diff --git a/cosmwasm/README.md b/cosmwasm/README.md index 5f088281..c9eac21f 100644 --- a/cosmwasm/README.md +++ b/cosmwasm/README.md @@ -112,35 +112,22 @@ This folder contains deployment scripts for cosmwasm contracts needed for amplif Deploy each contract. Chain name should match the key of an object in the `chains` section of the config. Chain name should be omitted for contracts that are not chain specific. - `node deploy-contract.js [subcommand] -m [mnemonic] -a [path to contract artifacts] -c [contract name] -e [environment] -n ` + `node deploy-contract.js [upload|instantiate|upload-instantiate] -m [mnemonic] -a [path to contract artifacts] -c [contract name] -e [environment] -n ` Some of the contracts depend on each other and need to be deployed in a specific order. Note the connection router and axelarnet gateway each need to know the other's address, so you need to pass `--instantiate2`, and upload both contract before instatiating them. -Upload: - 1. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "AxelarnetGateway" --instantiate2 -e devnet` 2. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "Router" --instantiate2 -e devnet` -3. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "ServiceRegistry" -e devnet` -4. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "Rewards" -e devnet` -5. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "Coordinator" -e devnet` -6. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "Multisig" -e devnet` -7. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "InterchainTokenService" -e devnet` -8. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "VotingVerifier" -e devnet -n "avalanche"` -9. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "Gateway" -e devnet -n "avalanche"` -10. `node deploy-contract.js upload -m [mnemonic] -a [path to artifacts] -c "MultisigProver" -e devnet -n "avalanche"` - -Instantiate: - -1. `node deploy-contract.js instantiate -m [mnemonic] -c "AxelarnetGateway" --instantiate2 -e devnet` -2. `node deploy-contract.js instantiate -m [mnemonic] -c "Router" --instantiate2 -e devnet` -3. `node deploy-contract.js instantiate -m [mnemonic] -c "ServiceRegistry" -e devnet` -4. `node deploy-contract.js instantiate -m [mnemonic] -c "Rewards" -e devnet` -5. `node deploy-contract.js instantiate -m [mnemonic] -c "Coordinator" -e devnet` -6. `node deploy-contract.js instantiate -m [mnemonic] -c "Multisig" -e devnet` -7. `node deploy-contract.js instantiate -m [mnemonic] -c "InterchainTokenService" -e devnet` -8. `node deploy-contract.js instantiate -m [mnemonic] -c "VotingVerifier" -e devnet -n "avalanche"` -9. `node deploy-contract.js instantiate -m [mnemonic] -c "Gateway" -e devnet -n "avalanche"` -10. `node deploy-contract.js instantiate -m [mnemonic] -c "MultisigProver" -e devnet -n "avalanche"` +3. `node deploy-contract.js instantiate -m [mnemonic] -c "AxelarnetGateway" --instantiate2 -e devnet` +4. `node deploy-contract.js instantiate -m [mnemonic] -c "Router" --instantiate2 -e devnet` +5. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "ServiceRegistry" -e devnet` +6. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "Rewards" -e devnet` +7. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "Coordinator" -e devnet` +8. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "Multisig" -e devnet` +9. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "InterchainTokenService" -e devnet` +10. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "VotingVerifier" -e devnet -n "avalanche"` +11. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "Gateway" -e devnet -n "avalanche"` +12. `node deploy-contract.js upload-instantiate -m [mnemonic] -a [path to artifacts] -c "MultisigProver" -e devnet -n "avalanche"` ### Constant Address Deployment diff --git a/cosmwasm/deploy-contract.js b/cosmwasm/deploy-contract.js index 43edddb4..0d4de1a0 100644 --- a/cosmwasm/deploy-contract.js +++ b/cosmwasm/deploy-contract.js @@ -64,6 +64,11 @@ const instantiate = async (client, wallet, config, options) => { printInfo(`Instantiated ${chainName ? chainName.concat(' ') : ''}${contractName}. Address`, contractAddress); }; +const uploadInstantiate = async (client, wallet, config, options) => { + await upload(client, wallet, config, options); + await instantiate(client, wallet, config, options); +}; + const mainProcessor = async (processor, options) => { const { env } = options; const config = loadConfig(env); @@ -109,6 +114,19 @@ const programHandler = () => { fetchCodeId: true, }); + const uploadInstantiateCmd = program + .command('upload-instantiate') + .description('Upload wasm binary and instantiate contract') + .action((options) => { + mainProcessor(uploadInstantiate, options); + }); + addAmplifierOptions(uploadInstantiateCmd, { + contractOptions: true, + storeOptions: true, + instantiateOptions: true, + instantiate2Options: true, + }); + program.parse(); };