-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: script optimizations * feat: address comments * feat: address comments * feat: add to gh action test * feat: test different deployment methods in gh action * feat: address comments --------- Co-authored-by: Dean Amiel <[email protected]>
- Loading branch information
Showing
25 changed files
with
557 additions
and
548 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
'use strict'; | ||
|
||
const { Option } = require('commander'); | ||
|
||
const addBaseOptions = (program, options = {}) => { | ||
program.addOption( | ||
new Option('-e, --env <env>', 'environment') | ||
.choices(['local', 'devnet', 'stagenet', 'testnet', 'mainnet']) | ||
.default('testnet') | ||
.makeOptionMandatory(true) | ||
.env('ENV'), | ||
); | ||
program.addOption(new Option('-y, --yes', 'skip deployment prompt confirmation').env('YES')); | ||
|
||
if (!options.ignoreChainNames) { | ||
program.addOption( | ||
new Option('-n, --chainNames <chainNames>', 'chains to run the script over').makeOptionMandatory(true).env('CHAINS'), | ||
); | ||
program.addOption(new Option('--skipChains <skipChains>', 'chains to skip over')); | ||
} | ||
|
||
if (!options.ignorePrivateKey) { | ||
program.addOption(new Option('-p, --privateKey <privateKey>', 'private key').makeOptionMandatory(true).env('PRIVATE_KEY')); | ||
} | ||
|
||
if (options.address) { | ||
program.addOption(new Option('-a, --address <address>', 'override address')); | ||
} | ||
|
||
return program; | ||
}; | ||
|
||
const addExtendedOptions = (program, options = {}) => { | ||
addBaseOptions(program, options); | ||
|
||
program.addOption(new Option('-v, --verify', 'verify the deployed contract on the explorer').env('VERIFY')); | ||
|
||
if (options.artifactPath) { | ||
program.addOption(new Option('-a, --artifactPath <artifactPath>', 'artifact path')); | ||
} | ||
|
||
if (options.contractName) { | ||
program.addOption(new Option('-c, --contractName <contractName>', 'contract name').makeOptionMandatory(true)); | ||
} | ||
|
||
if (options.salt) { | ||
program.addOption(new Option('-s, --salt <salt>', 'salt to use for create2 deployment').env('SALT')); | ||
} | ||
|
||
if (options.skipExisting) { | ||
program.addOption(new Option('-x, --skipExisting', 'skip existing if contract was already deployed on chain').env('SKIP_EXISTING')); | ||
} | ||
|
||
if (options.upgrade) { | ||
program.addOption(new Option('-u, --upgrade', 'upgrade a deployed contract').env('UPGRADE')); | ||
} | ||
|
||
return program; | ||
}; | ||
|
||
module.exports = { | ||
addBaseOptions, | ||
addExtendedOptions, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.