Skip to content

Commit d06c105

Browse files
authored
[evm] Verifying shimmer_testnet and neon_devnet with hardhat (#703)
* Add shimmer testnet and neon_devnet * zksync comment * Add verify
1 parent ab779d0 commit d06c105

File tree

4 files changed

+70
-78
lines changed

4 files changed

+70
-78
lines changed

package-lock.json

Lines changed: 14 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/ethereum/contracts/VERIFY.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,17 @@ dependencies, so it fails to parse the `HDWallet` arguments in our
3939
`truffle-config.json`. As a quick workaround, we backport the patch to `0.5.11`
4040
by applying the `truffle-verify-constants.patch` file, which the `npm run verify` script does transparently. Once the toolchain has been upgraded and the
4141
errors fixed, this patch can be removed.
42+
43+
## Verifying with hardhat
44+
45+
Some chains might require users to verify with hardhat. Here are the additional steps :
46+
47+
- Add the chain to `networks` in `hardhat.config.ts` (equivalent of `truffle-config.js`)
48+
- Add the explorer parameters to `etherscan` in `hardhat.config.ts`
49+
- Run :
50+
51+
```
52+
MNEMONIC=... npx hardhat verify 0x354bF866A4B006C9AF9d9e06d9364217A8616E12 --network shimmer_testnet
53+
```
54+
55+
This process is somehow flaky. After running it, check the explorer as sometimes it will work even when it says it failed.

target_chains/ethereum/contracts/hardhat.config.ts

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import "@matterlabs/hardhat-zksync-deploy";
2-
import "@matterlabs/hardhat-zksync-solc";
31
import "@nomiclabs/hardhat-etherscan";
42
import "@openzeppelin/hardhat-upgrades";
5-
import "@matterlabs/hardhat-zksync-verify";
3+
import "@matterlabs/hardhat-zksync-deploy";
4+
import "@matterlabs/hardhat-zksync-solc";
5+
// import "@matterlabs/hardhat-zksync-verify"; UNCOMMENT THIS AND INSTALL THIS PACKAGE TO VERIFY ZKSYNC
66

77
module.exports = {
88
zksolc: {
@@ -36,6 +36,44 @@ module.exports = {
3636
verifyURL:
3737
"https://zksync2-mainnet-explorer.zksync.io/contract_verification",
3838
},
39+
neon_devnet: {
40+
url: "https://devnet.neonevm.org",
41+
chainId: 245022926,
42+
accounts: {
43+
mnemonic: process.env.MNEMONIC,
44+
},
45+
},
46+
shimmer_testnet: {
47+
url: "https://json-rpc.evm.testnet.shimmer.network",
48+
chainId: 1070,
49+
accounts: {
50+
mnemonic: process.env.MNEMONIC,
51+
},
52+
},
53+
},
54+
etherscan: {
55+
apiKey: {
56+
neon_devnet: "there_should_be_a_dummy_value_here_to_avoid_error",
57+
shimmer_testnet: "there_should_be_a_dummy_value_here_to_avoid_error",
58+
},
59+
customChains: [
60+
{
61+
network: "neon_devnet",
62+
chainId: 245022926,
63+
urls: {
64+
apiURL: "https://devnet-api.neonscan.org/hardhat/verify",
65+
browserURL: "https://devnet.neonscan.org",
66+
},
67+
},
68+
{
69+
network: "shimmer_testnet",
70+
chainId: 1070,
71+
urls: {
72+
apiURL: "https://explorer.evm.testnet.shimmer.network/api",
73+
browserURL: "https://explorer.evm.testnet.shimmer.network",
74+
},
75+
},
76+
],
3977
},
4078
solidity: {
4179
version: "0.8.4",

target_chains/ethereum/contracts/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"@certusone/wormhole-sdk": "^0.9.9",
2828
"@matterlabs/hardhat-zksync-deploy": "^0.6.2",
2929
"@matterlabs/hardhat-zksync-solc": "^0.3.14",
30-
"@matterlabs/hardhat-zksync-verify": "^0.1.3",
31-
"@nomiclabs/hardhat-etherscan": "^3.1.2",
30+
"@nomiclabs/hardhat-etherscan": "^3.1.7",
3231
"@openzeppelin/contracts": "^4.5.0",
3332
"@openzeppelin/contracts-upgradeable": "^4.5.2",
3433
"@openzeppelin/hardhat-upgrades": "^1.22.1",

0 commit comments

Comments
 (0)