Skip to content

Commit 6eb97fb

Browse files
Wait for 5 confirmations before veryfing contracts
Without the change, the verification of contracts on Etherscan could sometimes fail with error like this: ``` Verifying contract 0x... on Etherscan... Nothing to compile NomicLabsHardhatPluginError: Failed to send contract verification request. Endpoint URL: https://api-goerli.etherscan.io/api Reason: The Etherscan API responded that the address 0x... does not have bytecode. This can happen if the contract was recently deployed and this fact hasn't propagated to the backend yet. Try waiting for a minute before verifying your contract. If you are invoking this from a script, try to wait for five confirmations of your contract depiloyment transaction before running the verification subtask. ```
1 parent 8ec6cc0 commit 6eb97fb

6 files changed

+30
-0
lines changed

deploy/01_deploy_t.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1111
})
1212

1313
if (hre.network.tags.etherscan) {
14+
await hre.ethers.provider.waitForTransaction(
15+
T.transactionHash,
16+
5,
17+
300000
18+
)
1419
await helpers.etherscan.verify(T)
1520
}
1621

deploy/03_deploy_vending_machine_keep.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
3030
})
3131

3232
if (hre.network.tags.etherscan) {
33+
await hre.ethers.provider.waitForTransaction(
34+
vendingMachine.transactionHash,
35+
5,
36+
300000
37+
)
3338
await helpers.etherscan.verify(vendingMachine)
3439
}
3540

deploy/04_deploy_vending_machine_nu.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2626
})
2727

2828
if (hre.network.tags.etherscan) {
29+
await hre.ethers.provider.waitForTransaction(
30+
vendingMachine.transactionHash,
31+
5,
32+
300000
33+
)
2934
await helpers.etherscan.verify(vendingMachine)
3035
}
3136

deploy/06_deploy_keep_stake.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1414
})
1515

1616
if (hre.network.tags.etherscan) {
17+
await hre.ethers.provider.waitForTransaction(
18+
KeepStake.transactionHash,
19+
5,
20+
300000
21+
)
1722
await helpers.etherscan.verify(KeepStake)
1823
}
1924

deploy/07_deploy_token_staking.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
7171
log("Initialized TokenStaking.")
7272

7373
if (hre.network.tags.etherscan) {
74+
await hre.ethers.provider.waitForTransaction(
75+
TokenStaking.transactionHash,
76+
5,
77+
300000
78+
)
7479
await helpers.etherscan.verify(TokenStaking)
7580
}
7681
}

deploy/30_deploy_tokenholder_timelock.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2222
})
2323

2424
if (hre.network.tags.etherscan) {
25+
await hre.ethers.provider.waitForTransaction(
26+
timelock.transactionHash,
27+
5,
28+
300000
29+
)
2530
await helpers.etherscan.verify(timelock)
2631
}
2732

0 commit comments

Comments
 (0)