From 1bd6266692c40121063f0be91d7c3706a584d154 Mon Sep 17 00:00:00 2001 From: Ahmad Afuni Date: Wed, 25 Oct 2023 19:36:59 +0200 Subject: [PATCH] chore: Add portal contract option to deploy subcommand of aztec-cli (#3032) This PR adds a portal contract option to the 'deploy' subcommand' of `aztec-cli`. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [x] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [x] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist). Co-authored-by: Dan Lee <142251406+dan-aztec@users.noreply.github.com> --- yarn-project/cli/src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/yarn-project/cli/src/index.ts b/yarn-project/cli/src/index.ts index baed053ad039..3f0deea6ce12 100644 --- a/yarn-project/cli/src/index.ts +++ b/yarn-project/cli/src/index.ts @@ -223,6 +223,11 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { 'Optional encryption public key for this address. Set this value only if this contract is expected to receive private notes, which will be encrypted using this public key.', parsePublicKey, ) + .option( + '-p, --portal-address ', + 'Optional L1 portal address to link the contract to.', + parseEthereumAddress, + ) .option( '-s, --salt ', 'Optional deployment salt as a hex string for generating the deployment address.', @@ -231,7 +236,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { // `options.wait` is default true. Passing `--no-wait` will set it to false. // https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue .option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction') - .action(async (artifactPath, { rpcUrl, publicKey, args: rawArgs, salt, wait }) => { + .action(async (artifactPath, { rpcUrl, publicKey, args: rawArgs, portalAddress, salt, wait }) => { const contractArtifact = await getContractArtifact(artifactPath, log); const constructorArtifact = contractArtifact.functions.find(({ name }) => name === 'constructor'); @@ -247,8 +252,8 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { const deploy = deployer.deploy(...args); - await deploy.create({ contractAddressSalt: salt }); - const tx = deploy.send({ contractAddressSalt: salt }); + await deploy.create({ contractAddressSalt: salt, portalContract: portalAddress }); + const tx = deploy.send({ contractAddressSalt: salt, portalContract: portalAddress }); const txHash = await tx.getTxHash(); debugLogger(`Deploy tx sent with hash ${txHash}`); if (wait) {