Skip to content

[evm] Verifying shimmer_testnet and neon_devnet with hardhat #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 16 additions & 75 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions target_chains/ethereum/contracts/VERIFY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
44 changes: 41 additions & 3 deletions target_chains/ethereum/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down Expand Up @@ -32,6 +32,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",
Expand Down
3 changes: 1 addition & 2 deletions target_chains/ethereum/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down