Replies: 3 comments 2 replies
-
@sammanadh Yes, etherscan did not index the contract before our verify function was triggered. So now you can comment out the rest of the code and only run the verify function with deployed contract address and args. |
Beta Was this translation helpful? Give feedback.
-
I have the same problem with Sepolia network. As @sammanadh mentioned, I wanted to simultaneously verify the contract without any manual process in between. Let me know if you find a solution for this. I raised a discussion for the same: #5735 |
Beta Was this translation helpful? Give feedback.
-
I actually have a working code, but I can't spot where do you meet an error. I will place my code here, hope it helps const { verifyMessage } = require("ethers")
const { ethers, run, network } = require("hardhat")
async function main() {
const SimpleStorageFactory = await ethers.getContractFactory(
"SimpleStorage"
)
console.log("Deploying, please wait....")
const SimpleStorage = await SimpleStorageFactory.deploy()
await SimpleStorage.deploymentTransaction().wait(1)
// waitConfirmations: network.config.blockConfirmations || 1
const SimpleStorageAdress = await SimpleStorage.getAddress()
console.log(`Deployment contract address: ${SimpleStorageAdress}`)
// 4 == 4 - true
// 4 == "4" - true
// 4 === "4" - false
if (network.config.chainId != 31337 && process.env.ETHERSCAN_API_KEY) {
await SimpleStorage.deploymentTransaction().wait(6)
await verify(SimpleStorageAdress, [])
}
// console.log(network.config)
}
async function verify(contractAddress, args){
console.log("Verifying contract...")
try {
await run("verify:verify", {
address: contractAddress,
constructorArguments: args,
})
} catch (error) {
// if (error.messsage.toLowerCase().include("verified")){
// console.log("Already verified!")
// } else {
// console.log(error)
// }
console.log(error)
}
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am at chapter 6 of the course, where I am learning to verify deployed contracts using hardhat. The entire code for deploy script looks like this:
But when I run this code using hardhat run command and passing goerli in network flag, I get the following error:
My understanding is that the reason that we have for certain number of block confirmation for contract deployment, before running the verify task, is so that these types of error wont occur. But I am still facing this issue no matter how many block confirmation I await.
Please help.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions