From 6b649274ee39dbdad6986973484aeba8998425d8 Mon Sep 17 00:00:00 2001 From: scnale Date: Thu, 22 Jun 2023 12:51:03 -0300 Subject: [PATCH] Evm/arbitrum mainnet deployment (#37) * evm: Adds addresses for Arbitrum's `CircleIntegration` deployment. * evm: Simplifies verification scripts. --- evm/env/mainnet/arbitrum-mainnet.env | 9 +++++++++ evm/forge-scripts/deploy_contracts.sol | 13 +++++++----- evm/shell-scripts/deploy_contracts.sh | 0 .../deploy_implementation_only.sh | 0 evm/shell-scripts/make_ethers_types.sh | 0 evm/shell-scripts/run_integration_tests.sh | 0 .../submit_testnet_registration.sh | 0 evm/shell-scripts/upgrade_proxy.sh | 0 evm/shell-scripts/verify_implementation.sh | 13 ++++-------- evm/shell-scripts/verify_proxy.sh | 20 +++++++++---------- evm/shell-scripts/verify_setup.sh | 8 ++++++++ 11 files changed, 38 insertions(+), 25 deletions(-) mode change 100644 => 100755 evm/shell-scripts/deploy_contracts.sh mode change 100644 => 100755 evm/shell-scripts/deploy_implementation_only.sh mode change 100644 => 100755 evm/shell-scripts/make_ethers_types.sh mode change 100644 => 100755 evm/shell-scripts/run_integration_tests.sh mode change 100644 => 100755 evm/shell-scripts/submit_testnet_registration.sh mode change 100644 => 100755 evm/shell-scripts/upgrade_proxy.sh mode change 100644 => 100755 evm/shell-scripts/verify_implementation.sh mode change 100644 => 100755 evm/shell-scripts/verify_proxy.sh create mode 100755 evm/shell-scripts/verify_setup.sh diff --git a/evm/env/mainnet/arbitrum-mainnet.env b/evm/env/mainnet/arbitrum-mainnet.env index 9897969..aa1b0f6 100644 --- a/evm/env/mainnet/arbitrum-mainnet.env +++ b/evm/env/mainnet/arbitrum-mainnet.env @@ -4,3 +4,12 @@ export RPC="" export RELEASE_WORMHOLE_ADDRESS=0xa5f208e072434bC67592E4C49C1B991BA79BCA46 export RELEASE_CIRCLE_BRIDGE_ADDRESS=0x19330d10D9Cc8751218eaf51E8885D058642E08A export RELEASE_WORMHOLE_FINALITY=1 + + +### Deployed Circle Integration addresses +export CIRCLE_INTEGRATION_IMPLEMENTATION=0xD73aFD826D6bDD4D2fEF326DF5091451A5d8130a +export CIRCLE_INTEGRATION_SETUP=0xC5180b274Ead8aC34131B6dDa0323e403d671De7 +export CIRCLE_INTEGRATION_PROXY=0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c + +# Used in verification scripts +export RELEASE_EVM_CHAIN_ID=42161 \ No newline at end of file diff --git a/evm/forge-scripts/deploy_contracts.sol b/evm/forge-scripts/deploy_contracts.sol index 72b70eb..1b5a1b4 100644 --- a/evm/forge-scripts/deploy_contracts.sol +++ b/evm/forge-scripts/deploy_contracts.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.19; import "forge-std/Script.sol"; -import "forge-std/console.sol"; +import "forge-std/console2.sol"; import {IWormhole} from "wormhole/interfaces/IWormhole.sol"; @@ -38,25 +38,28 @@ contract ContractScript is Script { function deployCircleIntegration() public { // first Setup setup = new CircleIntegrationSetup(); + console2.log("CircleIntegrationSetup address: %s", address(setup)); // next Implementation implementation = new CircleIntegrationImplementation(); + console2.log("CircleIntegrationImplementation address: %s", address(implementation)); - console.log("Wormhole address: %s, chainId: %s", address(wormhole), wormhole.chainId()); + + console2.log("Wormhole address: %s, chainId: %s", address(wormhole), wormhole.chainId()); // setup Proxy using Implementation proxy = new CircleIntegrationProxy( address(setup), - abi.encodeWithSelector( - bytes4(keccak256("setup(address,address,uint8,address,uint16,bytes32)")), + abi.encodeCall(CircleIntegrationSetup.setup, ( address(implementation), address(wormhole), uint8(vm.envUint("RELEASE_WORMHOLE_FINALITY")), address(circleBridge), wormhole.governanceChainId(), wormhole.governanceContract() - ) + )) ); + console2.log("CircleIntegrationProxy address: %s", address(proxy)); } function run() public { diff --git a/evm/shell-scripts/deploy_contracts.sh b/evm/shell-scripts/deploy_contracts.sh old mode 100644 new mode 100755 diff --git a/evm/shell-scripts/deploy_implementation_only.sh b/evm/shell-scripts/deploy_implementation_only.sh old mode 100644 new mode 100755 diff --git a/evm/shell-scripts/make_ethers_types.sh b/evm/shell-scripts/make_ethers_types.sh old mode 100644 new mode 100755 diff --git a/evm/shell-scripts/run_integration_tests.sh b/evm/shell-scripts/run_integration_tests.sh old mode 100644 new mode 100755 diff --git a/evm/shell-scripts/submit_testnet_registration.sh b/evm/shell-scripts/submit_testnet_registration.sh old mode 100644 new mode 100755 diff --git a/evm/shell-scripts/upgrade_proxy.sh b/evm/shell-scripts/upgrade_proxy.sh old mode 100644 new mode 100755 diff --git a/evm/shell-scripts/verify_implementation.sh b/evm/shell-scripts/verify_implementation.sh old mode 100644 new mode 100755 index af48905..1f39eb7 --- a/evm/shell-scripts/verify_implementation.sh +++ b/evm/shell-scripts/verify_implementation.sh @@ -1,13 +1,8 @@ -#/bin/bash +#/usr/bin/env bash -chain_id=$1 -deployed_addr=$2 -optimizer_runs=$3 -etherscan_key=$4 +etherscan_key=$1 -echo $chain_id $deployed_addr $optimizer_runs $etherscan_key - -forge verify-contract --chain-id $chain_id --num-of-optimizations $optimizer_runs --watch \ - --compiler-version v0.8.19 $deployed_addr \ +forge verify-contract --chain-id $RELEASE_EVM_CHAIN_ID --watch \ + --compiler-version v0.8.19 $CIRCLE_INTEGRATION_IMPLEMENTATION \ src/circle_integration/CircleIntegrationImplementation.sol:CircleIntegrationImplementation \ --etherscan-api-key $etherscan_key diff --git a/evm/shell-scripts/verify_proxy.sh b/evm/shell-scripts/verify_proxy.sh old mode 100644 new mode 100755 index a18d14d..4c1bbad --- a/evm/shell-scripts/verify_proxy.sh +++ b/evm/shell-scripts/verify_proxy.sh @@ -1,16 +1,14 @@ -#/bin/bash +#/usr/bin/env bash -chain_id=$1 -deployed_addr=$2 -optimizer_runs=$3 -etherscan_key=$4 -setup_addr=$5 -setup_bytes=$6 +etherscan_key=$1 -echo $chain_id $deployed_addr $optimizer_runs $etherscan_key +governance_chain_id=1 +governance_contract=0x0000000000000000000000000000000000000000000000000000000000000004 -forge verify-contract --chain-id $chain_id --num-of-optimizations $optimizer_runs --watch \ - --constructor-args $(cast abi-encode "constructor(address,bytes)" $setup_addr $setup_bytes) \ - --compiler-version v0.8.19 $deployed_addr \ +setup_bytes=$(cast calldata "function setup(address,address,uint8,address,uint16,bytes32)" $CIRCLE_INTEGRATION_IMPLEMENTATION $RELEASE_WORMHOLE_ADDRESS $RELEASE_WORMHOLE_FINALITY $RELEASE_CIRCLE_BRIDGE_ADDRESS $governance_chain_id $governance_contract) + +forge verify-contract --chain-id $RELEASE_EVM_CHAIN_ID --watch \ + --constructor-args $(cast abi-encode "constructor(address,bytes)" $CIRCLE_INTEGRATION_SETUP $setup_bytes) \ + --compiler-version v0.8.19 $CIRCLE_INTEGRATION_PROXY \ src/circle_integration/CircleIntegrationProxy.sol:CircleIntegrationProxy \ --etherscan-api-key $etherscan_key diff --git a/evm/shell-scripts/verify_setup.sh b/evm/shell-scripts/verify_setup.sh new file mode 100755 index 0000000..8c70696 --- /dev/null +++ b/evm/shell-scripts/verify_setup.sh @@ -0,0 +1,8 @@ +#/usr/bin/env bash + +etherscan_key=$1 + +forge verify-contract --chain-id $RELEASE_EVM_CHAIN_ID --watch \ + --compiler-version v0.8.19 $CIRCLE_INTEGRATION_SETUP \ + src/circle_integration/CircleIntegrationSetup.sol:CircleIntegrationSetup \ + --etherscan-api-key $etherscan_key