Skip to content

Commit

Permalink
chore: Add portal contract option to deploy subcommand of aztec-cli (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
2 people authored and Maddiaa0 committed Oct 25, 2023
1 parent 1f56cd4 commit 1bd6266
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions yarn-project/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <hex string>',
'Optional L1 portal address to link the contract to.',
parseEthereumAddress,
)
.option(
'-s, --salt <hex string>',
'Optional deployment salt as a hex string for generating the deployment address.',
Expand All @@ -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');

Expand All @@ -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) {
Expand Down

0 comments on commit 1bd6266

Please sign in to comment.