diff --git a/yarn-project/noir-contracts/Nargo.toml b/yarn-project/noir-contracts/Nargo.toml new file mode 100644 index 00000000000..d3300102923 --- /dev/null +++ b/yarn-project/noir-contracts/Nargo.toml @@ -0,0 +1,27 @@ +[workspace] +members = [ + "src/contracts/card_game_contract", + "src/contracts/child_contract", + "src/contracts/docs_example_contract", + "src/contracts/easy_private_token_contract", + "src/contracts/ecdsa_account_contract", + "src/contracts/escrow_contract", + "src/contracts/import_test_contract", + "src/contracts/lending_contract", + "src/contracts/multi_transfer_contract", + "src/contracts/native_token_contract", + "src/contracts/non_native_token_contract", + "src/contracts/parent_contract", + "src/contracts/pending_commitments_contract", + "src/contracts/pokeable_token_contract", + "src/contracts/price_feed_contract", + "src/contracts/private_token_airdrop_contract", + "src/contracts/private_token_contract", + "src/contracts/public_token_contract", + "src/contracts/schnorr_account_contract", + "src/contracts/schnorr_auth_witness_account_contract", + "src/contracts/schnorr_hardcoded_account_contract", + "src/contracts/schnorr_single_key_account_contract", + "src/contracts/test_contract", + "src/contracts/uniswap_contract", +] diff --git a/yarn-project/noir-contracts/scripts/compile.sh b/yarn-project/noir-contracts/scripts/compile.sh index c867cc12526..07ba3cb40b1 100755 --- a/yarn-project/noir-contracts/scripts/compile.sh +++ b/yarn-project/noir-contracts/scripts/compile.sh @@ -34,11 +34,11 @@ build() { CONTRACT_NAME=$1 CONTRACT_FOLDER="${CONTRACT_NAME}_contract" echo "Compiling $CONTRACT_NAME..." - cd src/contracts/$CONTRACT_FOLDER - rm -f target/* + rm -f target/${CONTRACT_FOLDER}-* + rm -f target/debug_${CONTRACT_FOLDER}-* # If the compilation fails, rerun the compilation with 'nargo' and show the compiler output. - nargo compile --output-debug; + nargo compile --package $CONTRACT_FOLDER --output-debug; } echo "Using $(nargo --version)" diff --git a/yarn-project/noir-contracts/src/scripts/copy_output.ts b/yarn-project/noir-contracts/src/scripts/copy_output.ts index 1b6150fe58b..05da55f50be 100644 --- a/yarn-project/noir-contracts/src/scripts/copy_output.ts +++ b/yarn-project/noir-contracts/src/scripts/copy_output.ts @@ -50,19 +50,18 @@ const main = () => { if (!name) throw new Error(`Missing argument contract name`); const projectName = `${snakeCase(name)}_contract`; - const projectDirPath = `src/contracts/${projectName}`; const contractName = upperFirst(camelCase(name)); const artifactFile = `${projectName}-${contractName}.json`; - const buildJsonFilePath = `${projectDirPath}/target/${artifactFile}`; + const buildJsonFilePath = `./target/${artifactFile}`; const buildJson = JSON.parse(readFileSync(buildJsonFilePath).toString()); const debugArtifactFile = `debug_${artifactFile}`; let debug = undefined; try { - const debugJsonFilePath = `${projectDirPath}/target/${debugArtifactFile}`; + const debugJsonFilePath = `./target/${debugArtifactFile}`; const debugJson = JSON.parse(readFileSync(debugJsonFilePath).toString()); if (debugJson) { debug = debugJson; @@ -91,6 +90,7 @@ const main = () => { // Write a .nr contract interface, for consumption by other Noir Contracts if (INTERFACE_CONTRACTS.includes(name)) { + const projectDirPath = `src/contracts/${projectName}`; const noirInterfaceDestFilePath = `${projectDirPath}/src/interface.nr`; try { writeFileSync(noirInterfaceDestFilePath, generateNoirContractInterface(artifactJson)); diff --git a/yarn-project/yarn-project-base/Dockerfile b/yarn-project/yarn-project-base/Dockerfile index 29f29172995..abb55baad30 100644 --- a/yarn-project/yarn-project-base/Dockerfile +++ b/yarn-project/yarn-project-base/Dockerfile @@ -117,6 +117,7 @@ WORKDIR /usr/src/yarn-project FROM builder_ as noir_types COPY . . COPY --from=noir /usr/src/yarn-project/noir-contracts/src/contracts /usr/src/yarn-project/noir-contracts/src/contracts +COPY --from=noir /usr/src/yarn-project/noir-contracts/target /usr/src/yarn-project/noir-contracts/target WORKDIR /usr/src/yarn-project/noir-contracts # Run yarn build to have the json ABIs available for the types generator