Skip to content

Commit

Permalink
fix(etherscan-verify): workaround a bug when using distinct keys per …
Browse files Browse the repository at this point in the history
…network

Turns out that if the ETHERSCAN_API_KEY is set, hardhat-deploy ignores any apiKey setting
in hardhat.config.ts. As a workaround, we rename ETHERSCAN_API_KEY to ETHERSCAN_API_KEY_FIX.
  • Loading branch information
jaybuidl committed Feb 9, 2022
1 parent 37d8d60 commit 4b57748
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions contracts/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
REPORT_GAS=true
INFURA_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1

# There seems to be a bug with hardhat-deploy's implementation of etherscan-verify
# If ETHERSCAN_API_KEY is set, it overrides any hardhat configuration.
ETHERSCAN_API_KEY_FIX=ABC123ABC123ABC123ABC123ABC123ABC1
ARBISCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
REPORT_GAS=true
7 changes: 5 additions & 2 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const config: HardhatUserConfig = {
verify: {
etherscan: {
apiKey: process.env.ARBISCAN_API_KEY,
apiUrl: "https://api-testnet.arbiscan.io/api",
},
},
},
Expand All @@ -83,7 +82,6 @@ const config: HardhatUserConfig = {
verify: {
etherscan: {
apiKey: process.env.ARBISCAN_API_KEY,
apiUrl: "https://api.arbiscan.io/api",
},
},
},
Expand Down Expand Up @@ -128,6 +126,11 @@ const config: HardhatUserConfig = {
enabled: process.env.REPORT_GAS !== undefined,
currency: "USD",
},
verify: {
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY_FIX,
},
},
watcher: {
compilation: {
tasks: ["compile"],
Expand Down

0 comments on commit 4b57748

Please sign in to comment.