feat: verify contracts deployed from infra (#3243)

pull/3294/head
Paul Balaji 8 months ago committed by GitHub
parent e6e7de87d0
commit c47ebdbf59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      solidity/flatten.sh
  2. 1
      solidity/package.json
  3. 6
      typescript/helloworld/hardhat.config.ts
  4. 44
      typescript/infra/config/environments/mainnet3/helloworld/hyperlane/verification.json
  5. 30
      typescript/infra/config/environments/mainnet3/helloworld/rc/verification.json
  6. 114
      typescript/infra/config/environments/testnet4/helloworld/hyperlane/verification.json
  7. 22
      typescript/infra/config/environments/testnet4/helloworld/rc/verification.json
  8. 55
      typescript/infra/scripts/verify.ts
  9. 3
      typescript/infra/src/config/agent/relayer.ts
  10. 2
      typescript/infra/src/config/agent/validator.ts
  11. 10
      typescript/sdk/src/consts/chainMetadata.ts
  12. 122
      typescript/sdk/src/deploy/verify/ContractVerifier.ts
  13. 21
      typescript/sdk/src/deploy/verify/types.ts
  14. 30
      typescript/sdk/src/metadata/ChainMetadataManager.ts
  15. 18
      typescript/sdk/src/metadata/blockExplorer.ts
  16. 1
      typescript/sdk/src/metadata/chainMetadataTypes.ts
  17. 2
      typescript/sdk/src/providers/MultiProvider.ts

@ -1,23 +0,0 @@
LICENSE="// SPDX-License-Identifier: MIT OR Apache-2.0"
rm -rf flattened
mkdir -p flattened
# flatten contracts
yarn hardhat flatten > flattened/flattened.sol
# remove duplicate licenses
grep -vE "// SPDX.*" flattened/flattened.sol > flattened/delicensed.sol
# add license
echo "$LICENSE" | cat - flattened/delicensed.sol > flattened/licensed.sol
# compile
solc flattened/licensed.sol
# TODO: automate this?
if [ $? -ne 0 ]; then
echo "Remove @openzeppelin/../ICrossDomainMessenger and replace Optimism_Bridge with ICrossDomainMessenger"
echo "Then try compiling again with solc flattened/licensed.sol"
exit 1
fi

@ -50,7 +50,6 @@
"clean": "hardhat clean && rm -rf ./dist ./cache ./types ./coverage",
"coverage": "./coverage.sh",
"docs": "forge doc",
"flatten": "./flatten.sh",
"storage": "./storage.sh",
"prettier": "prettier --write ./contracts ./test",
"test": "hardhat test && forge test -vvv",

@ -9,11 +9,7 @@ import 'solidity-coverage';
*/
module.exports = {
solidity: {
compilers: [
{
version: '0.8.19',
},
],
version: '0.8.19',
},
gasReporter: {
currency: 'USD',

@ -7,13 +7,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xB97d3bF2fC296c2cAC4056bBC8A783ff39408e20",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x22Fd11F93F0303346c9b9070cc67C4Bc7aB2dABB",
"constructorArguments": "0000000000000000000000002971b9aec44be4eb673df1b88cdb57b96eefe8a40000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -27,13 +27,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x2A925CD8a5d919c5c6599633090c37fe38A561b6",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xd54fF402ADf0a7CBad9626B1261bF4bEB26A437a",
"constructorArguments": "000000000000000000000000ff06afcaabaddd1fb08371f9cca15d73d51febd60000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -47,13 +47,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x6c0aC8cEA75232aa7BeD8cbe9C4f820E7a77a9C3",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x42ad84C5d2a90e574678958133B8a13CA9F44AAF",
"constructorArguments": "0000000000000000000000005d934f4e2f797775e53561bb72aca21ba36b96bb0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -67,13 +67,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x4151773Db70C0b2D4c43Ea44A5FB5803ff1d3e0B",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x10Add66Db9C837000A43F3601aa9c54c6744F4c8",
"constructorArguments": "00000000000000000000000050da3b3907a08a24fe4999f4dcf337e8dc7954bb0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -87,13 +87,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x96271cA0ab9eeFB3Ca481749c0Ca4c705fD4F523",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xb2BFFD0248C7a0029860A29fD4Efe762a22f93Af",
"constructorArguments": "000000000000000000000000979ca5202784112f4738403dbec5d0f3b9daabb90000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -107,13 +107,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xA6f0A37DFDe9C2c8F46F010989C47d9edB3a9FA8",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x3da5fDCcC661c84454f49dB0Cf519561BC7c2729",
"constructorArguments": "000000000000000000000000d4c1905bb1d26bc93dac913e13cacc278cdcc80d0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -127,13 +127,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x9311cEE522A7C122B843b66cC31C6a63e2F92641",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x7ff2bF58C38A41AD7C9CbC14e780e8a7EDBbd48D",
"constructorArguments": "000000000000000000000000c005dc82818d67af737725bd4bf75435d065d2390000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -147,13 +147,13 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xAe067C08703508230357025B38c35Cd12793628c",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xE25d0D46a42a106Cdf4943262644DD5E26fa7bfF",
"constructorArguments": "000000000000000000000000094d03e751f49908080eff000dd6fd177fd44cc30000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -167,19 +167,19 @@
"isProxy": false
},
{
"name": "router",
"name": "HelloWorld",
"address": "0x182E8d7c5F1B06201b102123FC7dF0EaeB445a7B",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x26f32245fCF5Ad53159E875d5Cae62aEcf19c2d4",
"constructorArguments": "00000000000000000000000035231d4c2d8b8adcb5617a638a0c4548684c7c7000000000000000000000000056f52c0a1ddcd557285f7cbc782d3d83096ce1cc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xA166219dF110BDA97b91e65D4BB4Aae4159978b9",
"constructorArguments": "000000000000000000000000ad09d78f4c6b9da2ae82b1d34107802d380bb74f0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -187,7 +187,7 @@
],
"base": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x811808Dd29ba8B0FC6C0ec0b5537035E59745162",
"constructorArguments": "000000000000000000000000ea87ae93fa0019a82a727bfd3ebd1cfca8f64f1d0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -195,7 +195,7 @@
],
"scroll": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x0be2Ae2f6D02a3e0e00ECB57D3E1fCbb7f8F38F4",
"constructorArguments": "0000000000000000000000002f2afae1139ce54fefc03593fee8ab2adf4a85a70000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -203,7 +203,7 @@
],
"polygonzkevm": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xaad207a0Fd7a4e3C927Ccc78ac8134baF586B852",
"constructorArguments": "0000000000000000000000003a464f746d23ab22155710f44db16dca53e0775e0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false

@ -1,7 +1,7 @@
{
"polygon": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xd5D06f8Ee9cfab362e5758A0A925db7470E7D22f",
"constructorArguments": "0000000000000000000000005d934f4e2f797775e53561bb72aca21ba36b96bb0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -9,7 +9,7 @@
],
"bsc": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xC728F24AA2442d6230c9785635b81fF73C1a16Db",
"constructorArguments": "0000000000000000000000002971b9aec44be4eb673df1b88cdb57b96eefe8a40000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -17,7 +17,7 @@
],
"arbitrum": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x4D172025D810DDD770e7464A41673ca8e75539b0",
"constructorArguments": "000000000000000000000000979ca5202784112f4738403dbec5d0f3b9daabb90000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -25,7 +25,7 @@
],
"optimism": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x8Fc3AdBF87c74dF6142f6D65aE0f8BFe042BBDd0",
"constructorArguments": "000000000000000000000000d4c1905bb1d26bc93dac913e13cacc278cdcc80d0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -33,7 +33,7 @@
],
"moonbeam": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x1dA36d5c79Ae8Bc43eC080FeD9B4Dbb91b509834",
"constructorArguments": "000000000000000000000000094d03e751f49908080eff000dd6fd177fd44cc30000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -41,7 +41,7 @@
],
"gnosis": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x9B0C41777A0fC5dd040BC8B043991Eb168f3bD9C",
"constructorArguments": "000000000000000000000000ad09d78f4c6b9da2ae82b1d34107802d380bb74f0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -49,7 +49,7 @@
],
"base": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x6756189BDE3a29bb56466DECb50BBA76543D8752",
"constructorArguments": "000000000000000000000000ea87ae93fa0019a82a727bfd3ebd1cfca8f64f1d0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -57,7 +57,7 @@
],
"scroll": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x5366362c41e34869BDa231061603E4356D66079D",
"constructorArguments": "0000000000000000000000002f2afae1139ce54fefc03593fee8ab2adf4a85a70000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -65,7 +65,7 @@
],
"polygonzkevm": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x03cF708E42C89623bd83B281A56935cB562b9258",
"constructorArguments": "0000000000000000000000003a464f746d23ab22155710f44db16dca53e0775e0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -73,7 +73,7 @@
],
"celo": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xcfacC141f090E5441D8F274659D43ec20F748b19",
"constructorArguments": "00000000000000000000000050da3b3907a08a24fe4999f4dcf337e8dc7954bb0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -81,7 +81,7 @@
],
"ethereum": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xC6B1e375550343cDA762d2efD4EbdB3B8609a7a4",
"constructorArguments": "000000000000000000000000c005dc82818d67af737725bd4bf75435d065d2390000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -89,7 +89,7 @@
],
"avalanche": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x24fb6e8E7F8298696BaeE10B15bB57295a1f1e35",
"constructorArguments": "000000000000000000000000ff06afcaabaddd1fb08371f9cca15d73d51febd60000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -97,7 +97,7 @@
],
"mantapacific": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xDa7cECb05C4aeB02c1aFDE277d4306a2da7Bd762",
"constructorArguments": "0000000000000000000000003a464f746d23ab22155710f44db16dca53e0775e0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -105,7 +105,7 @@
],
"viction": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x83c2DB237e93Ce52565AB110124f78fdf159E3f4",
"constructorArguments": "0000000000000000000000002f2afae1139ce54fefc03593fee8ab2adf4a85a70000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -113,7 +113,7 @@
],
"inevm": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x0BD07E3934D1C4cc8Db0eA2a5cDAc8C8d8eb9824",
"constructorArguments": "0000000000000000000000002f2afae1139ce54fefc03593fee8ab2adf4a85a70000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false

@ -7,37 +7,37 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x477D860f8F41bC69dDD32821F2Bf2C2Af0243F16",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x76bDE8069b3467A459262192509Ad5c00AcbdaF0",
"constructorArguments": "000000000000000000000000ef9f292fcebc3848bf4bb92a96a04f9ecbb78e590000000000000000000000001246529eddca523afe5c6b9414299633d2e16697",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x39e08602570237433673B1340Da17105cA098EE7",
"constructorArguments": "000000000000000000000000ef9f292fcebc3848bf4bb92a96a04f9ecbb78e590000000000000000000000001246529eddca523afe5c6b9414299633d2e16697",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x0231C1A2CfDbC2d2FA8363c3eC60c85a458088aE",
"constructorArguments": "000000000000000000000000ef9f292fcebc3848bf4bb92a96a04f9ecbb78e590000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xb58F3D0CA2B26803eA6a64696989102cE301Fd23",
"constructorArguments": "000000000000000000000000ef9f292fcebc3848bf4bb92a96a04f9ecbb78e590000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xD0Ef694E96Bb695DC829f71956227eD141e3089F",
"constructorArguments": "000000000000000000000000ef9f292fcebc3848bf4bb92a96a04f9ecbb78e590000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -51,25 +51,25 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x5da3b8d6F73dF6003A490072106730218c475AAd",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xE04b1D70d487eFCa454EEBf3821E42Dd41e66609",
"constructorArguments": "0000000000000000000000005b6cff85442b851a8e6eabd2a4e4507b5135b3b00000000000000000000000006895d3916b94b386faa6ec9276756e16dae7480e",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x6F7A1B7868f14a2f4c36cc561d910aE7958bc8D8",
"constructorArguments": "0000000000000000000000005b6cff85442b851a8e6eabd2a4e4507b5135b3b00000000000000000000000006895d3916b94b386faa6ec9276756e16dae7480e",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x0B1C1B54f45e02552331D3106e71f5e0b573D5D4",
"constructorArguments": "0000000000000000000000005b6cff85442b851a8e6eabd2a4e4507b5135b3b00000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -83,25 +83,25 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x1A4d8a5eD6C93Af828655e15C44eeE2c2851F0D6",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x79B6151129780f5A80DFEF7c1E967b21A9674A7D",
"constructorArguments": "0000000000000000000000002d1889fe5b092cd988972261434f7e5f260411150000000000000000000000008ab67caf605c6ee83cbfefb0d8d67fdd3bf7b591",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xBEadC848cAB77875d066466b9F3509f069a0a4F5",
"constructorArguments": "0000000000000000000000002d1889fe5b092cd988972261434f7e5f260411150000000000000000000000008ab67caf605c6ee83cbfefb0d8d67fdd3bf7b591",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x04980C17e2CE26578C82f81207e706e4505FaE3B",
"constructorArguments": "0000000000000000000000002d1889fe5b092cd988972261434f7e5f260411150000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -115,31 +115,31 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xE09BF59dCA6e622efC33f6fbd8EF85dE45233388",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x5b297d6BBE080B66E6acece8d378F70F02c0Bc41",
"constructorArguments": "00000000000000000000000089280d0b68a246b276a910a518531e2a861ceb650000000000000000000000000dd20e410bdb95404f71c5a4e7fa67b892a5f949",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x90230E8cf53f4F9aFC2A9777eB0093C0B1C81b59",
"constructorArguments": "00000000000000000000000089280d0b68a246b276a910a518531e2a861ceb650000000000000000000000000dd20e410bdb95404f71c5a4e7fa67b892a5f949",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xd0e07a58BC91a686235E542350E63211C7A34c17",
"constructorArguments": "00000000000000000000000089280d0b68a246b276a910a518531e2a861ceb650000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xEF6DE81100B9314B45A1bdfA5C9148aFC4DdbDeE",
"constructorArguments": "000000000000000000000000f9f6f5646f478d5ab4e20b0f910c92f1ccc9cc6d0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -153,31 +153,31 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x405BFdEcB33230b4Ad93C29ba4499b776CfBa189",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xBF5b89eBdF86560F872603e2063f17b78dFbae02",
"constructorArguments": "000000000000000000000000c4796aabce2a9d774ce4603f5db5fb1605791dbd0000000000000000000000000cd26594ea6c6526927c0f5225ac09f6288e7140",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xA5F234545270cea8f31A8760b8b7ABcaA3654951",
"constructorArguments": "000000000000000000000000c4796aabce2a9d774ce4603f5db5fb1605791dbd0000000000000000000000000cd26594ea6c6526927c0f5225ac09f6288e7140",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x33AA9cFBC7E222B3eC231EcAa58dd846cC393C28",
"constructorArguments": "000000000000000000000000c4796aabce2a9d774ce4603f5db5fb1605791dbd0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x31b6a75ef30C8612738CC55eA3CB2d5DD3694DC7",
"constructorArguments": "00000000000000000000000049cfd6ef774acab14814d699e3f7ee36fdfba9320000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -191,25 +191,25 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x89e02C3C7b97bCBa63279E10E2a44e6cEF69E6B2",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x36a53DDa7626e5eb62e59a0192Af07b67AF434D8",
"constructorArguments": "00000000000000000000000076189acfa212298d7022624a4633411ee0d2f26f00000000000000000000000092f05669a354a032a84fcfabfd13bee1abc5bfd0",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x893b57DE7E3dd885F827c74E74F3099C1c250c52",
"constructorArguments": "00000000000000000000000076189acfa212298d7022624a4633411ee0d2f26f00000000000000000000000092f05669a354a032a84fcfabfd13bee1abc5bfd0",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x3Ce607F6FcE5Dfb9821f33504d86E04A4CD0C75f",
"constructorArguments": "00000000000000000000000076189acfa212298d7022624a4633411ee0d2f26f0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -223,37 +223,37 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x3582d1238cBC812165981E4fFaB0E8D9a4518910",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x050500E43Fa7F245f3012527DE29d22176c594c7",
"constructorArguments": "000000000000000000000000b5f021728ea6223e3948db2da61d612307945ea200000000000000000000000002a7661273528eff3d78cbe7cbd1a717b28b89fc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x7Dc5cE596995af8e5D568563038109B9bCA7F7c6",
"constructorArguments": "000000000000000000000000b5f021728ea6223e3948db2da61d612307945ea200000000000000000000000002a7661273528eff3d78cbe7cbd1a717b28b89fc",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xe7B2e23A9A77556736DBB040A8a5159a80Db73D5",
"constructorArguments": "000000000000000000000000b5f021728ea6223e3948db2da61d612307945ea20000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x138e726C327E9dd0779104B8d42331757CAeeB9F",
"constructorArguments": "000000000000000000000000b5f021728ea6223e3948db2da61d612307945ea20000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x372Cf98E673C235C1abD78DEAA61480e6fe55e46",
"constructorArguments": "000000000000000000000000b5f021728ea6223e3948db2da61d612307945ea20000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -267,37 +267,37 @@
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x339B46496D60b1b6B42e9715DeD8B3D2154dA0Bb",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f90cb82a76492614d07b82a7658917f3ac811ac1",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xB8D70C9352AA59f5EB138e045117841910c107a3",
"constructorArguments": "00000000000000000000000013dabc0351407d5aaa0a50003a166a73b4febfdc00000000000000000000000076189acfa212298d7022624a4633411ee0d2f26f",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xA3bAaC7d60d10abA54cC2Ffb4b63469810C5aDc0",
"constructorArguments": "00000000000000000000000013dabc0351407d5aaa0a50003a166a73b4febfdc00000000000000000000000076189acfa212298d7022624a4633411ee0d2f26f",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x9C63cE44d595cfd97215fcb97d58CFD07a9D6BD7",
"constructorArguments": "00000000000000000000000013dabc0351407d5aaa0a50003a166a73b4febfdc0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x22C7d91A4533536FE6006EFA46074E2Df8f82e82",
"constructorArguments": "00000000000000000000000013dabc0351407d5aaa0a50003a166a73b4febfdc0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xFd1e3710347659703962934d2381970ae0022227",
"constructorArguments": "00000000000000000000000013dabc0351407d5aaa0a50003a166a73b4febfdc0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -305,31 +305,31 @@
],
"sepolia": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x5d56B8a669F50193b54319442c6EEE5edD662381",
"constructorArguments": "000000000000000000000000cc737a94fecaec165abcf12ded095bb13f037685000000000000000000000000f987d7edcb5890cb321437d8145e3d51131298b6",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x8FF62Cd16C689C6541A284c0e2389D4371255Bc2",
"constructorArguments": "00000000000000000000000033abaf6708be03bdf0595da0745a7111b01db8c70000000000000000000000006f2756380fd49228ae25aa7f2817993cb74ecc56",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x73A7bDa325Ad8E5F591179C4ccA61b0CeF70d05C",
"constructorArguments": "00000000000000000000000033abaf6708be03bdf0595da0745a7111b01db8c70000000000000000000000006f2756380fd49228ae25aa7f2817993cb74ecc56",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xE14FE2a74Ba1E1bD0EE14B780e58fCcc3c95C013",
"constructorArguments": "00000000000000000000000033abaf6708be03bdf0595da0745a7111b01db8c70000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x37590302D4E60fbCAdF708E8Fc1DCd903a5880F8",
"constructorArguments": "000000000000000000000000ffaef09b3cd11d9b20d1a19becca54eec28847660000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -337,37 +337,37 @@
],
"scrollsepolia": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x433f7d6d0cB9eb8FF2902Ad01C1BEd6C09934a33",
"constructorArguments": "0000000000000000000000003c5154a193d6e2955650f9305c8d80c18c814a6800000000000000000000000086fb9f1c124fb20ff130c41a79a432f770f67afd",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xEe421285728284000ec6c6C55C6F9161faeFfa99",
"constructorArguments": "0000000000000000000000003c5154a193d6e2955650f9305c8d80c18c814a6800000000000000000000000086fb9f1c124fb20ff130c41a79a432f770f67afd",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x6c13643B3927C57DB92c790E4E3E7Ee81e13f78C",
"constructorArguments": "0000000000000000000000003c5154a193d6e2955650f9305c8d80c18c814a6800000000000000000000000086fb9f1c124fb20ff130c41a79a432f770f67afd",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x783c4a0bB6663359281aD4a637D5af68F83ae213",
"constructorArguments": "0000000000000000000000003c5154a193d6e2955650f9305c8d80c18c814a680000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xeAEfB1458b032e75de3e9A3a480d005c426FB1c5",
"constructorArguments": "0000000000000000000000003c5154a193d6e2955650f9305c8d80c18c814a680000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x66b71A4e18FbE09a6977A6520B47fEDdffA82a1c",
"constructorArguments": "0000000000000000000000003c5154a193d6e2955650f9305c8d80c18c814a680000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -375,37 +375,37 @@
],
"polygonzkevmtestnet": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xD0680F80F4f947968206806C2598Cbc5b6FE5b03",
"constructorArguments": "000000000000000000000000598face78a4302f11e3de0bee1894da0b2cb71f8000000000000000000000000ad34a66bf6db18e858f6b686557075568c6e031c",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x433f7d6d0cB9eb8FF2902Ad01C1BEd6C09934a33",
"constructorArguments": "000000000000000000000000598face78a4302f11e3de0bee1894da0b2cb71f8000000000000000000000000ad34a66bf6db18e858f6b686557075568c6e031c",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0xEe421285728284000ec6c6C55C6F9161faeFfa99",
"constructorArguments": "000000000000000000000000598face78a4302f11e3de0bee1894da0b2cb71f8000000000000000000000000ad34a66bf6db18e858f6b686557075568c6e031c",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x6c13643B3927C57DB92c790E4E3E7Ee81e13f78C",
"constructorArguments": "000000000000000000000000598face78a4302f11e3de0bee1894da0b2cb71f80000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x20c44b1E3BeaDA1e9826CFd48BeEDABeE9871cE9",
"constructorArguments": "000000000000000000000000598face78a4302f11e3de0bee1894da0b2cb71f80000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
},
{
"name": "Router",
"name": "HelloWorld",
"address": "0x783c4a0bB6663359281aD4a637D5af68F83ae213",
"constructorArguments": "000000000000000000000000598face78a4302f11e3de0bee1894da0b2cb71f80000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false

@ -1,7 +1,7 @@
{
"arbitrumgoerli": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xEAb4d0A8ba9F1d3a3A665b3F1DE05890A72135D3",
"constructorArguments": "00000000000000000000000013dabc0351407d5aaa0a50003a166a73b4febfdc0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -9,7 +9,7 @@
],
"optimismgoerli": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x7A4A358bF134a55920B4E2cdEbB62961C7a48D19",
"constructorArguments": "000000000000000000000000b5f021728ea6223e3948db2da61d612307945ea20000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -17,7 +17,7 @@
],
"scrollsepolia": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xA9425D5cBcD2c83EB2a5BF453EAA18968db3ef77",
"constructorArguments": "0000000000000000000000003c5154a193d6e2955650f9305c8d80c18c814a680000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -25,7 +25,7 @@
],
"alfajores": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x4D1d8394cBb445A75aE63fDd24421A353B73FF25",
"constructorArguments": "000000000000000000000000ef9f292fcebc3848bf4bb92a96a04f9ecbb78e590000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -33,7 +33,7 @@
],
"polygonzkevmtestnet": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xb3D796584fDeBE2321894eeF31e0C3ec52169C61",
"constructorArguments": "000000000000000000000000598face78a4302f11e3de0bee1894da0b2cb71f80000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -41,7 +41,7 @@
],
"sepolia": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xEB25e6e42B743a815E5C0409007993a828a0565f",
"constructorArguments": "000000000000000000000000ffaef09b3cd11d9b20d1a19becca54eec28847660000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -49,7 +49,7 @@
],
"fuji": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x29d70a6753D3F3E756502dE6dCd393fE85a97b73",
"constructorArguments": "0000000000000000000000005b6cff85442b851a8e6eabd2a4e4507b5135b3b00000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -57,7 +57,7 @@
],
"bsctestnet": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x643C7A37FB191A8a63BAB40264B251714F527AED",
"constructorArguments": "000000000000000000000000f9f6f5646f478d5ab4e20b0f910c92f1ccc9cc6d0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -65,7 +65,7 @@
],
"goerli": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x916e550aF85E0Ee7A28FAf54b3E1d87f8f4c0Cdd",
"constructorArguments": "00000000000000000000000049cfd6ef774acab14814d699e3f7ee36fdfba9320000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -73,7 +73,7 @@
],
"moonbasealpha": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0xabB6e0A30acEB8327EcC6D25bABf409081fDF2DA",
"constructorArguments": "00000000000000000000000076189acfa212298d7022624a4633411ee0d2f26f0000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false
@ -81,7 +81,7 @@
],
"mumbai": [
{
"name": "Router",
"name": "HelloWorld",
"address": "0x4d8323Bb5cD72148e826fCAb9B4A9dd09f77C905",
"constructorArguments": "0000000000000000000000002d1889fe5b092cd988972261434f7e5f260411150000000000000000000000000000000000000000000000000000000000000000",
"isProxy": false

@ -2,22 +2,22 @@ import {
ChainMap,
CompilerOptions,
ContractVerifier,
VerificationInput,
} from '@hyperlane-xyz/sdk';
import { fetchGCPSecret } from '../src/utils/gcloud';
import { execCmd, readFileAtPath, readJSONAtPath } from '../src/utils/utils';
import { readJSONAtPath } from '../src/utils/utils';
import { assertEnvironment, getArgs } from './agent-utils';
import { getEnvironmentConfig } from './core-utils';
// Requires https://github.com/crytic/solc-select to be installed and
// present in your $PATH. The current solc compiler version should
// already be installed via `solc-select install $VERSION`
async function main() {
const argv = await getArgs()
// This file can be generated by running `$ yarn workspace @hyperlane-xyz/core flatten`,
.string('source')
.describe('source', 'flattened solidity source file')
.describe(
'source',
'Path to hardhat build artifact containing standard input JSON',
)
.demandOption('source')
.string('artifacts')
.describe('artifacts', 'verification artifacts JSON file')
@ -29,17 +29,26 @@ async function main() {
const config = getEnvironmentConfig(environment);
const multiProvider = await config.getMultiProvider();
const verification = readJSONAtPath(argv.artifacts!);
const verification: ChainMap<VerificationInput> = readJSONAtPath(
argv.artifacts!,
);
const sourcePath = argv.source!;
const flattenedSource = readFileAtPath(sourcePath);
if (!sourcePath.endsWith('.json')) {
throw new Error('Source must be a JSON file.');
}
// from solidity/core/hardhat.config.ts
const buildArtifactJson = readJSONAtPath(sourcePath);
const source = buildArtifactJson.input;
const solcLongVersion = buildArtifactJson.solcLongVersion;
// codeformat always json
// compiler version inferred from build artifact
// always use MIT license
const compilerOptions: CompilerOptions = {
codeformat: 'solidity-single-file',
compilerversion: 'v0.8.19+commit.7dd6d404',
optimizationUsed: '1',
runs: '999999',
codeformat: 'solidity-standard-json-input',
compilerversion: `v${solcLongVersion}`,
licenseType: '3',
};
const versionRegex = /v(\d.\d.\d+)\+commit.\w+/;
@ -50,10 +59,6 @@ async function main() {
);
}
// ensures flattened source is compilable
await execCmd(`solc-select use ${matches[1]}`);
await execCmd(`solc ${sourcePath}`);
const apiKeys: ChainMap<string> = (await fetchGCPSecret(
'explorer-api-keys',
true,
@ -63,11 +68,23 @@ async function main() {
verification,
multiProvider,
apiKeys,
flattenedSource,
source,
compilerOptions,
);
return verifier.verify(argv.network ? [argv.network] : undefined);
const failedResults = (
await verifier.verify(argv.network ? [argv.network] : undefined)
).filter((result) => result.status === 'rejected');
if (failedResults.length > 0) {
console.error(
'Verification failed for the following contracts:',
failedResults.map((result) => result),
);
process.exit(1);
}
process.exit(0);
}
main().then(console.log).catch(console.error);

@ -2,7 +2,6 @@ import { BigNumberish } from 'ethers';
import {
AgentConfig,
AgentSignerKeyType,
ChainMap,
GasPaymentEnforcement,
MatchingList,
@ -100,7 +99,7 @@ export class RelayerConfigHelper extends AgentConfigHelper<RelayerConfig> {
// Get the signer configuration for each chain by the chain name.
async signers(): Promise<ChainMap<KeyConfig>> {
let chainSigners: ChainMap<KeyConfig> = {};
const chainSigners: ChainMap<KeyConfig> = {};
if (this.aws) {
const awsUser = new AgentAwsUser(

@ -8,7 +8,7 @@ import {
} from '@hyperlane-xyz/sdk';
import { ProtocolType } from '@hyperlane-xyz/utils';
import { AgentAwsUser, ValidatorAgentAwsUser } from '../../agents/aws';
import { ValidatorAgentAwsUser } from '../../agents/aws';
import { Role } from '../../roles';
import { HelmStatefulSetValues } from '../infrastructure';

@ -93,8 +93,9 @@ export const arbitrumgoerli: ChainMetadata = {
export const avalanche: ChainMetadata = {
blockExplorers: [
{
apiUrl: 'https://api.snowtrace.io/api',
family: ExplorerFamily.Other,
apiUrl:
'https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan/api',
family: ExplorerFamily.Routescan,
name: 'SnowTrace',
url: 'https://snowtrace.io',
},
@ -277,7 +278,7 @@ export const ethereum: ChainMetadata = {
url: 'https://etherscan.io',
},
{
apiUrl: 'https://blockscout.com/eth/mainnet/api',
apiUrl: 'https://eth.blockscout.com/api',
family: ExplorerFamily.Blockscout,
name: 'Blockscout',
url: 'https://blockscout.com/eth/mainnet',
@ -305,7 +306,8 @@ export const ethereum: ChainMetadata = {
export const fuji: ChainMetadata = {
blockExplorers: [
{
apiUrl: 'https://api-testnet.snowtrace.io/api',
apiUrl:
'https://api.routescan.io/v2/network/testnet/evm/43113/etherscan/api',
family: ExplorerFamily.Etherscan,
name: 'SnowTrace',
url: 'https://testnet.snowtrace.io',

@ -4,6 +4,7 @@ import { ethers } from 'ethers';
import { sleep, strip0x } from '@hyperlane-xyz/utils';
import { ExplorerFamily } from '../../metadata/chainMetadataTypes';
import { MultiProvider } from '../../providers/MultiProvider';
import { ChainMap, ChainName } from '../../types';
import { MultiGeneric } from '../../utils/MultiGeneric';
@ -37,7 +38,7 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
verificationInputs: ChainMap<VerificationInput>,
protected readonly multiProvider: MultiProvider,
protected readonly apiKeys: ChainMap<string>,
protected readonly flattenedSource: string, // flattened source code from eg `hardhat flatten`
protected readonly source: string, // solidity standard input json
protected readonly compilerOptions: CompilerOptions,
) {
super(verificationInputs);
@ -46,7 +47,16 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
verify(targets = this.chains()): Promise<PromiseSettledResult<void>[]> {
return Promise.allSettled(
targets.map((chain) => this.verifyChain(chain, this.get(chain))),
targets.map((chain) => {
const { family } = this.multiProvider.getExplorerApi(chain);
if (family === ExplorerFamily.Other) {
this.logger(
`Skipping verification for ${chain} due to unsupported explorer family.`,
);
return Promise.resolve();
}
return this.verifyChain(chain, this.get(chain));
}),
);
}
@ -65,13 +75,13 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
action: ExplorerApiActions,
options?: Record<string, string>,
): Promise<any> {
const apiUrl = new URL(this.multiProvider.getExplorerApiUrl(chain));
const { apiUrl, family } = this.multiProvider.getExplorerApi(chain);
const isGetRequest =
action === ExplorerApiActions.CHECK_STATUS ||
action === ExplorerApiActions.CHECK_PROXY_STATUS ||
action === ExplorerApiActions.GETSOURCECODE;
const params = new URLSearchParams({
apikey: this.apiKeys[chain],
...(this.apiKeys[chain] ? { apikey: this.apiKeys[chain] } : {}),
module: 'contract',
action,
...options,
@ -81,13 +91,43 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
if (isGetRequest) {
response = await fetch(`${apiUrl}?${params}`);
} else {
response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: params,
});
// For Blockscout explorers, we need to ensure module and action are always query params
if (family === ExplorerFamily.Blockscout) {
const formData = new URLSearchParams();
const urlWithParams = new URL(apiUrl);
urlWithParams.searchParams.append('module', 'contract');
urlWithParams.searchParams.append('action', action);
// remove any extraneous keys from body
for (const [key, value] of params) {
switch (key) {
case 'module':
case 'action':
case 'licenseType':
case 'apikey':
break;
default:
formData.append(key, value);
break;
}
}
response = await fetch(urlWithParams.toString(), {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: formData,
});
} else {
response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: params,
});
}
}
let result;
@ -96,9 +136,15 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
responseText = await response.text();
result = JSON.parse(responseText);
} catch (e) {
this.logger(`Failed to parse response from ${responseText}`, e);
this.logger(
`[${chain}] Failed to parse response from ${responseText}`,
e,
);
}
if (result.message === 'NOTOK') {
if (result.message !== 'OK') {
const errorMessageBase = `[${chain}]`;
let errorMessage;
switch (result.result) {
case ExplorerApiErrors.VERIFICATION_PENDING:
await sleep(5000); // wait 5 seconds
@ -107,19 +153,21 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
case ExplorerApiErrors.ALREADY_VERIFIED_ALT:
return;
case ExplorerApiErrors.PROXY_FAILED:
this.logger(`Proxy verification failed for, try manually?`);
return;
errorMessage = `${errorMessageBase} Proxy verification failed, try manually?`;
break;
case ExplorerApiErrors.BYTECODE_MISMATCH:
this.logger(
`Compiled bytecode does not match deployed bytecode, check constructor arguments?`,
);
return;
errorMessage = `${errorMessageBase} Compiled bytecode does not match deployed bytecode, check constructor arguments?`;
break;
default:
this.logger(
`Verification failed for some unknown reason on ${chain}`,
result,
);
throw new Error(`Verification failed: ${result.result}`);
errorMessage = `${errorMessageBase} Verification failed. ${
result.result ?? response.statusText
}`;
break;
}
if (errorMessage) {
this.logger(errorMessage);
throw new Error(errorMessage);
}
}
@ -139,9 +187,11 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
address: input.address,
},
);
return result[0].SourceCode !== '';
return !!result[0]?.SourceCode;
} catch (error) {
this.logger(`Error checking if contract is already verified: ${error}`);
this.logger(
`[${chain}] [${input.name}] Error checking if contract is already verified: ${error}`,
);
return false;
}
}
@ -171,12 +221,12 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
guid: proxyGuid,
});
this.logger(
`Successfully verified proxy ${addressUrl}#readProxyContract`,
`[${chain}] [${input.name}] Successfully verified proxy ${addressUrl}#readProxyContract`,
);
}
} catch (error) {
console.error(
`Verification of proxy at ${input.address} failed on ${chain}`,
`[${chain}] [${input.name}] Verification of proxy at ${input.address} failed`,
);
throw error;
}
@ -188,11 +238,11 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
input: ContractVerificationInput,
): Promise<void> {
this.logger(
`Verifying ${input.name} implementation at ${input.address} on ${chain}`,
`[${chain}] [${input.name}] Verifying implementation at ${input.address}`,
);
const data = {
sourceCode: this.flattenedSource,
sourceCode: this.source,
contractname: input.name,
contractaddress: input.address,
// TYPO IS ENFORCED BY API
@ -215,10 +265,12 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
if (guid) {
try {
await this.submitForm(chain, ExplorerApiActions.CHECK_STATUS, { guid });
this.logger(`Successfully verified ${addressUrl}#code`);
this.logger(
`[${chain}] [${input.name}] Successfully verified ${addressUrl}#code`,
);
} catch (error) {
console.error(
`Verifying implementation at ${input.address} failed on ${chain}`,
`[${chain}] [${input.name}] Verifying implementation at ${input.address} failed`,
);
throw error;
}
@ -234,7 +286,9 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
}
if (Array.isArray(input.constructorArguments)) {
this.logger('Constructor arguments in legacy format, skipping');
this.logger(
`[${chain}] [${input.name}] Constructor arguments in legacy format, skipping`,
);
return;
}
@ -244,7 +298,7 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
input.address,
);
this.logger(
`Contract ${input.name} already verified on ${chain} at ${addressUrl}#code`,
`[${chain}] [${input.name}] Contract already verified at ${addressUrl}#code`,
);
// There is a rate limit of 5 requests per second
await sleep(200);

@ -8,8 +8,21 @@ export type ContractVerificationInput = {
export type VerificationInput = ContractVerificationInput[];
export type CompilerOptions = {
codeformat: 'solidity-single-file' | 'solidity-standard-json-input'; //solidity-single-file (default) or solidity-standard-json-input (for std-input-json-format support
compilerversion: string; // see https://etherscan.io/solcversions for list of support versions
optimizationUsed: '0' | '1'; //0 = No Optimization, 1 = Optimization used (applicable when codeformat=solidity-single-file)
runs: string; //set to 200 as default unless otherwise (applicable when codeformat=solidity-single-file)
codeformat: 'solidity-standard-json-input';
compilerversion: string; // see https://etherscan.io/solcversions for list of support versions, inferred from build artifact
licenseType:
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
| '8'
| '9'
| '10'
| '11'
| '12'
| '13'
| '14'; // integer from 1-14, see https://etherscan.io/contract-license-types
};

@ -7,12 +7,14 @@ import { ChainMap, ChainName } from '../types';
import {
getExplorerAddressUrl,
getExplorerApi,
getExplorerApiUrl,
getExplorerBaseUrl,
getExplorerTxUrl,
} from './blockExplorer';
import {
ChainMetadata,
ExplorerFamily,
getDomainId,
safeParseChainMetadata,
} from './chainMetadataTypes';
@ -251,6 +253,34 @@ export class ChainMetadataManager<MetaExt = {}> {
return url;
}
/**
* Get a block explorer's API for a given chain name, chain id, or domain id
*/
tryGetExplorerApi(chainNameOrId: ChainName | number): {
apiUrl: string;
apiKey?: string;
family?: ExplorerFamily;
} | null {
const metadata = this.tryGetChainMetadata(chainNameOrId);
if (!metadata) return null;
return getExplorerApi(metadata);
}
/**
* Get a block explorer API for a given chain name, chain id, or domain id
* @throws if chain's metadata or block explorer data has no been set
*/
getExplorerApi(chainNameOrId: ChainName | number): {
apiUrl: string;
apiKey?: string;
family?: ExplorerFamily;
} {
const url = this.tryGetExplorerApi(chainNameOrId);
if (!url)
throw new Error(`No supported explorer api set for ${chainNameOrId}`);
return url;
}
/**
* Get a block explorer's API URL for a given chain name, chain id, or domain id
*/

@ -2,7 +2,7 @@ import { ProtocolType } from '@hyperlane-xyz/utils';
import { solanaChainToClusterName } from '../consts/chainMetadata';
import { ChainMetadata } from './chainMetadataTypes';
import { ChainMetadata, ExplorerFamily } from './chainMetadataTypes';
export function getExplorerBaseUrl(metadata: ChainMetadata): string | null {
if (!metadata?.blockExplorers?.length) return null;
@ -17,6 +17,22 @@ export function getExplorerBaseUrl(metadata: ChainMetadata): string | null {
return url.toString();
}
export function getExplorerApi(metadata: ChainMetadata): {
apiUrl: string;
apiKey?: string | undefined;
family?: ExplorerFamily | undefined;
} | null {
const { protocol, blockExplorers } = metadata;
// TODO solana + cosmos support here as needed
if (protocol !== ProtocolType.Ethereum) return null;
if (!blockExplorers?.length || !blockExplorers[0].apiUrl) return null;
return {
apiUrl: blockExplorers[0].apiUrl,
apiKey: blockExplorers[0].apiKey,
family: blockExplorers[0].family,
};
}
export function getExplorerApiUrl(metadata: ChainMetadata): string | null {
const { protocol, blockExplorers } = metadata;
// TODO solana + cosmos support here as needed

@ -11,6 +11,7 @@ import { ZNzUint, ZUint } from './customZodTypes';
export enum ExplorerFamily {
Etherscan = 'etherscan',
Blockscout = 'blockscout',
Routescan = 'routescan',
Other = 'other',
}

@ -306,6 +306,8 @@ export class MultiProvider<MetaExt = {}> extends ChainMetadataManager<MetaExt> {
// wait for deploy tx to be confirmed
await this.handleTx(chainNameOrId, contract.deployTransaction);
// return deployed contract
return contract as Awaited<ReturnType<F['deploy']>>;
}

Loading…
Cancel
Save