[evm] Verifying shimmer_testnet and neon_devnet with hardhat (#703)

* Add shimmer testnet and neon_devnet

* zksync comment

* Add verify
This commit is contained in:
guibescos 2023-03-17 09:47:59 -05:00 committed by GitHub
parent ab779d058f
commit d06c10502d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 78 deletions

87
package-lock.json generated
View File

@ -9121,20 +9121,6 @@
"hardhat": "^2.12.6"
}
},
"node_modules/@matterlabs/hardhat-zksync-verify": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@matterlabs/hardhat-zksync-verify/-/hardhat-zksync-verify-0.1.3.tgz",
"integrity": "sha512-gZhJmsC529HaLiJ42qSfvT+lYpStqj9IsiEzkI/jxyKHH8FVQz5Uu1wWMeWIRd3Q4GkF0arIYIJWf14oO5AhqA==",
"dependencies": {
"@matterlabs/hardhat-zksync-solc": "0.3.14",
"axios": "^1.3.4",
"chalk": "4.1.2",
"dockerode": "^3.3.4"
},
"peerDependencies": {
"@nomiclabs/hardhat-etherscan": "3.1.2"
}
},
"node_modules/@metamask/eth-sig-util": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz",
@ -10292,20 +10278,20 @@
}
},
"node_modules/@nomiclabs/hardhat-etherscan": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.2.tgz",
"integrity": "sha512-IEikeOVq0C/7CY6aD74d8L4BpGoc/FNiN6ldiPVg0QIFIUSu4FSGA1dmtJZJKk1tjpwgrfTLQNWnigtEaN9REg==",
"version": "3.1.7",
"resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz",
"integrity": "sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ==",
"dependencies": {
"@ethersproject/abi": "^5.1.2",
"@ethersproject/address": "^5.0.2",
"cbor": "^5.0.2",
"cbor": "^8.1.0",
"chalk": "^2.4.2",
"debug": "^4.1.1",
"fs-extra": "^7.0.1",
"lodash": "^4.17.11",
"semver": "^6.3.0",
"table": "^6.8.0",
"undici": "^5.4.0"
"undici": "^5.14.0"
},
"peerDependencies": {
"hardhat": "^2.0.4"
@ -10322,18 +10308,6 @@
"node": ">=4"
}
},
"node_modules/@nomiclabs/hardhat-etherscan/node_modules/cbor": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/cbor/-/cbor-5.2.0.tgz",
"integrity": "sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A==",
"dependencies": {
"bignumber.js": "^9.0.1",
"nofilter": "^1.0.4"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@nomiclabs/hardhat-etherscan/node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@ -10389,14 +10363,6 @@
"graceful-fs": "^4.1.6"
}
},
"node_modules/@nomiclabs/hardhat-etherscan/node_modules/nofilter": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz",
"integrity": "sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA==",
"engines": {
"node": ">=8"
}
},
"node_modules/@nomiclabs/hardhat-etherscan/node_modules/semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@ -27911,6 +27877,7 @@
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz",
"integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
@ -28240,6 +28207,7 @@
"version": "5.0.7",
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz",
"integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
@ -49664,8 +49632,7 @@
"@certusone/wormhole-sdk": "^0.9.9",
"@matterlabs/hardhat-zksync-deploy": "^0.6.2",
"@matterlabs/hardhat-zksync-solc": "^0.3.14",
"@matterlabs/hardhat-zksync-verify": "^0.1.3",
"@nomiclabs/hardhat-etherscan": "^3.1.2",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/contracts-upgradeable": "^4.5.2",
"@openzeppelin/hardhat-upgrades": "^1.22.1",
@ -56234,17 +56201,6 @@
"dockerode": "^3.3.4"
}
},
"@matterlabs/hardhat-zksync-verify": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@matterlabs/hardhat-zksync-verify/-/hardhat-zksync-verify-0.1.3.tgz",
"integrity": "sha512-gZhJmsC529HaLiJ42qSfvT+lYpStqj9IsiEzkI/jxyKHH8FVQz5Uu1wWMeWIRd3Q4GkF0arIYIJWf14oO5AhqA==",
"requires": {
"@matterlabs/hardhat-zksync-solc": "0.3.14",
"axios": "^1.3.4",
"chalk": "4.1.2",
"dockerode": "^3.3.4"
}
},
"@metamask/eth-sig-util": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz",
@ -57122,20 +57078,20 @@
"requires": {}
},
"@nomiclabs/hardhat-etherscan": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.2.tgz",
"integrity": "sha512-IEikeOVq0C/7CY6aD74d8L4BpGoc/FNiN6ldiPVg0QIFIUSu4FSGA1dmtJZJKk1tjpwgrfTLQNWnigtEaN9REg==",
"version": "3.1.7",
"resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz",
"integrity": "sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ==",
"requires": {
"@ethersproject/abi": "^5.1.2",
"@ethersproject/address": "^5.0.2",
"cbor": "^5.0.2",
"cbor": "^8.1.0",
"chalk": "^2.4.2",
"debug": "^4.1.1",
"fs-extra": "^7.0.1",
"lodash": "^4.17.11",
"semver": "^6.3.0",
"table": "^6.8.0",
"undici": "^5.4.0"
"undici": "^5.14.0"
},
"dependencies": {
"ansi-styles": {
@ -57146,15 +57102,6 @@
"color-convert": "^1.9.0"
}
},
"cbor": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/cbor/-/cbor-5.2.0.tgz",
"integrity": "sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A==",
"requires": {
"bignumber.js": "^9.0.1",
"nofilter": "^1.0.4"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@ -57201,11 +57148,6 @@
"graceful-fs": "^4.1.6"
}
},
"nofilter": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz",
"integrity": "sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA=="
},
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@ -58091,8 +58033,7 @@
"@certusone/wormhole-sdk": "^0.9.9",
"@matterlabs/hardhat-zksync-deploy": "^0.6.2",
"@matterlabs/hardhat-zksync-solc": "^0.3.14",
"@matterlabs/hardhat-zksync-verify": "^0.1.3",
"@nomiclabs/hardhat-etherscan": "^3.1.2",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/contracts-upgradeable": "^4.5.2",
"@openzeppelin/hardhat-upgrades": "^1.22.1",

View File

@ -39,3 +39,17 @@ dependencies, so it fails to parse the `HDWallet` arguments in our
`truffle-config.json`. As a quick workaround, we backport the patch to `0.5.11`
by applying the `truffle-verify-constants.patch` file, which the `npm run verify` script does transparently. Once the toolchain has been upgraded and the
errors fixed, this patch can be removed.
## Verifying with hardhat
Some chains might require users to verify with hardhat. Here are the additional steps :
- Add the chain to `networks` in `hardhat.config.ts` (equivalent of `truffle-config.js`)
- Add the explorer parameters to `etherscan` in `hardhat.config.ts`
- Run :
```
MNEMONIC=... npx hardhat verify 0x354bF866A4B006C9AF9d9e06d9364217A8616E12 --network shimmer_testnet
```
This process is somehow flaky. After running it, check the explorer as sometimes it will work even when it says it failed.

View File

@ -1,8 +1,8 @@
import "@matterlabs/hardhat-zksync-deploy";
import "@matterlabs/hardhat-zksync-solc";
import "@nomiclabs/hardhat-etherscan";
import "@openzeppelin/hardhat-upgrades";
import "@matterlabs/hardhat-zksync-verify";
import "@matterlabs/hardhat-zksync-deploy";
import "@matterlabs/hardhat-zksync-solc";
// import "@matterlabs/hardhat-zksync-verify"; UNCOMMENT THIS AND INSTALL THIS PACKAGE TO VERIFY ZKSYNC
module.exports = {
zksolc: {
@ -36,6 +36,44 @@ module.exports = {
verifyURL:
"https://zksync2-mainnet-explorer.zksync.io/contract_verification",
},
neon_devnet: {
url: "https://devnet.neonevm.org",
chainId: 245022926,
accounts: {
mnemonic: process.env.MNEMONIC,
},
},
shimmer_testnet: {
url: "https://json-rpc.evm.testnet.shimmer.network",
chainId: 1070,
accounts: {
mnemonic: process.env.MNEMONIC,
},
},
},
etherscan: {
apiKey: {
neon_devnet: "there_should_be_a_dummy_value_here_to_avoid_error",
shimmer_testnet: "there_should_be_a_dummy_value_here_to_avoid_error",
},
customChains: [
{
network: "neon_devnet",
chainId: 245022926,
urls: {
apiURL: "https://devnet-api.neonscan.org/hardhat/verify",
browserURL: "https://devnet.neonscan.org",
},
},
{
network: "shimmer_testnet",
chainId: 1070,
urls: {
apiURL: "https://explorer.evm.testnet.shimmer.network/api",
browserURL: "https://explorer.evm.testnet.shimmer.network",
},
},
],
},
solidity: {
version: "0.8.4",

View File

@ -27,8 +27,7 @@
"@certusone/wormhole-sdk": "^0.9.9",
"@matterlabs/hardhat-zksync-deploy": "^0.6.2",
"@matterlabs/hardhat-zksync-solc": "^0.3.14",
"@matterlabs/hardhat-zksync-verify": "^0.1.3",
"@nomiclabs/hardhat-etherscan": "^3.1.2",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/contracts-upgradeable": "^4.5.2",
"@openzeppelin/hardhat-upgrades": "^1.22.1",