From e80da0dc2e9861b362526efd3e6ac8472f4ef00e Mon Sep 17 00:00:00 2001 From: Axel Delamarre <1091900+delaaxe@users.noreply.github.com> Date: Wed, 16 Nov 2022 10:34:56 +0200 Subject: [PATCH 1/3] Update verification script --- DEPLOYMENT.md | 3 ++- scripts/execute_script.sh | 10 +++++++++- scripts/verify.js | 14 ++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) mode change 100644 => 100755 scripts/verify.js diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index b6f488f94..24c121c1f 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -10,13 +10,14 @@ If setting up a new environment `ENV_NAME` for the first time: - Add a new AWS configuration locally - Add it to `S3_BUCKET_SUFFIXES` in `.env` -## 2. Deploy the contracts: +## 2. Deploy and verify the contracts: ``` ./scripts/deploy.sh --no-compile ENV_NAME 1 ./scripts/deploy.sh --no-compile ENV_NAME 2 ./scripts/deploy.sh --no-compile ENV_NAME 3 ./scripts/deploy.sh --no-compile ENV_NAME 4 +./scripts/execute_script.sh --no-compile scripts/verify.js ENV_NAME ``` If you need to do some manual changes to the config file and reupload it to S3 you can do it like this: diff --git a/scripts/execute_script.sh b/scripts/execute_script.sh index 5881e2e1b..5fb3a8001 100755 --- a/scripts/execute_script.sh +++ b/scripts/execute_script.sh @@ -24,4 +24,12 @@ fi NETWORK=$1 shift -AWS_PROFILE=argent-$NETWORK AWS_SDK_LOAD_CONFIG=true npx truffle exec $FILE --network $NETWORK "$@" \ No newline at end of file +IS_AWS_VAULT_INSTALLED=$(command -v "aws-vault" || echo 0) +IS_PROFILE_AVAILABLE=$(aws-vault list | grep "argent-$NETWORK" || echo 0) + +if [ "$IS_AWS_VAULT_INSTALLED" == "0" ] || [ "$IS_PROFILE_AVAILABLE" == "0" ]; +then + AWS_PROFILE=argent-$NETWORK AWS_SDK_LOAD_CONFIG=true npx truffle exec $FILE --network $NETWORK "$@" +else + aws-vault exec argent-$NETWORK -- npx truffle exec $FILE --network $NETWORK "$@" +fi \ No newline at end of file diff --git a/scripts/verify.js b/scripts/verify.js old mode 100644 new mode 100755 index e7bfb4818..db98bc0ab --- a/scripts/verify.js +++ b/scripts/verify.js @@ -16,8 +16,12 @@ const ConfiguratorLoader = require("../utils/configurator-loader.js"); const Configurator = require("../utils/configurator.js"); async function execVerify(contractName, contractAddress, network) { - const res = await exec(`npx truffle run verify ${contractName}@${contractAddress} --network ${network}`).catch((e) => e); - console.log(res.stdout); + try { + const res = await exec(`npx truffle run verify ${contractName}@${contractAddress} --network ${network}`); + console.log(res.stdout || res); + } catch (error) { + console.error(`Error verifying: ${error}`); + } } async function main() { @@ -42,18 +46,20 @@ async function main() { const configuration = configurator.copyConfig(); for (const [contractName, contractAddress] of Object.entries(configuration.contracts)) { + console.log(`Verifying contract ${contractName} at ${contractAddress} ...`); await execVerify(contractName, contractAddress, network); } - for (const [contractName, value] of Object.entries(configuration.filters)) { + for (const [contractName, value] of Object.entries(configuration.filters || {})) { const contractAddresses = [].concat(...[value]); // value can be an address or array of addresses for (const addr of contractAddresses) { - console.log(`Verifying ${contractName} at ${addr} ...`); + console.log(`Verifying filter ${contractName} at ${addr} ...`); await execVerify(contractName, addr, network); } } for (const [moduleName, moduleAddress] of Object.entries(configuration.modules)) { + console.log(`Verifying module ${moduleName} at ${moduleAddress} ...`); await execVerify(moduleName, moduleAddress, network); } } From 6c7c2e6ffa0d0b8f7c270ce2dfcdf7e65224f9a5 Mon Sep 17 00:00:00 2001 From: Axel Delamarre <1091900+delaaxe@users.noreply.github.com> Date: Wed, 16 Nov 2022 12:58:45 +0200 Subject: [PATCH 2/3] Update DEPLOYMENT.md --- DEPLOYMENT.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 24c121c1f..ddfd3f2ce 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -12,6 +12,8 @@ If setting up a new environment `ENV_NAME` for the first time: ## 2. Deploy and verify the contracts: +Run the four deployments scripts in order (you can find them in the `deployment/` directory). + ``` ./scripts/deploy.sh --no-compile ENV_NAME 1 ./scripts/deploy.sh --no-compile ENV_NAME 2 From c37cc278c1caa26c3006090322f7067a0e72b6d6 Mon Sep 17 00:00:00 2001 From: Axel Delamarre <1091900+delaaxe@users.noreply.github.com> Date: Wed, 16 Nov 2022 12:59:40 +0200 Subject: [PATCH 3/3] Update .env.example --- .env.example | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.example b/.env.example index abffcb0a4..0e46e3bc5 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ INFURA_KEY= ALCHEMY_KEY= +ETHERSCAN_API_KEY= S3_BUCKET_PREFIX= S3_BUCKET_SUFFIXES= S3_CONFIG_KEY=