Skip to content

Hardhat Verify contract issue #5773

Discussion options

You must be logged in to vote

Solution:

Better to have a function to wait for sometime before calling the verify method

updated code:

async function sleep(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}


// update the if condition in deploy()
  if(hre.network.config.chainId === 80001 && ETHERSCAN_API_KEY ){
    console.log("waiting for confirmation")
    await sleep(30 * 1000);  // wait for sometime to update the backend of the Network
    await verify(await simpleStorageFactory.getAddress(),[])
  }

This will work, and your contract will be verified and published on the network

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by KarthickSakthi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants