Skip to content
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

Use @nomiclabs/hardhat-etherscan for Etherscan verification #125

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
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.
```
michalinacienciala committed Oct 7, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
charlyx Charles-Henri GUERIN
commit 6eb97fbaaf21ca16e0b4be926808c28fdee9fb91
5 changes: 5 additions & 0 deletions deploy/01_deploy_t.ts
Original file line number Diff line number Diff line change
@@ -11,6 +11,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
})

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
T.transactionHash,
5,
300000
)
await helpers.etherscan.verify(T)
}

5 changes: 5 additions & 0 deletions deploy/03_deploy_vending_machine_keep.ts
Original file line number Diff line number Diff line change
@@ -30,6 +30,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
})

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
vendingMachine.transactionHash,
5,
300000
)
await helpers.etherscan.verify(vendingMachine)
}

5 changes: 5 additions & 0 deletions deploy/04_deploy_vending_machine_nu.ts
Original file line number Diff line number Diff line change
@@ -26,6 +26,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
})

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
vendingMachine.transactionHash,
5,
300000
)
await helpers.etherscan.verify(vendingMachine)
}

5 changes: 5 additions & 0 deletions deploy/06_deploy_keep_stake.ts
Original file line number Diff line number Diff line change
@@ -14,6 +14,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
})

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
KeepStake.transactionHash,
5,
300000
)
await helpers.etherscan.verify(KeepStake)
}

5 changes: 5 additions & 0 deletions deploy/07_deploy_token_staking.ts
Original file line number Diff line number Diff line change
@@ -71,6 +71,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
log("Initialized TokenStaking.")

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
TokenStaking.transactionHash,
5,
300000
)
await helpers.etherscan.verify(TokenStaking)
}
}
5 changes: 5 additions & 0 deletions deploy/30_deploy_tokenholder_timelock.ts
Original file line number Diff line number Diff line change
@@ -22,6 +22,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
})

if (hre.network.tags.etherscan) {
await hre.ethers.provider.waitForTransaction(
timelock.transactionHash,
5,
300000
)
await helpers.etherscan.verify(timelock)
}