I have created Timelock in defender but the contract is not verified. I am trying to verify it using the v4.3.1 Timecontroller.sol but the byte code is not matching and it fails. Can someone help me with getting the contract verified on goerli?
Timelock contract
0xB0c1500b1Da0873e5a4c28F28aaDdB350080C175
bjmrq
August 26, 2022, 2:19pm
2
Hi @Prash_Cha , thanks for reaching out.
We have some documentation that might help you in the process of verifying the contract here .
This includes the specific version of the timelock controller we're using (v4.3.1), as well as the compiler options:
solidity: {
version: "0.8.4",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
Let me know if that helps?
I followed that documentation but it still says byte code does not match
nami
August 26, 2022, 3:03pm
4
Hi @Prash_Cha
I've gone ahead and verified the contract for you: https://goerli.etherscan.io/address/0xB0c1500b1Da0873e5a4c28F28aaDdB350080C175#code
I was able to do this through the hardhat-etherscan plugin as such:
I defined this as TimelockController.sol
in the contracts folder of my Hardhat project:
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/governance/TimelockController.sol";
Then, I defined this as arguments.js
module.exports = [
180,
[
"0x309fe87adafb481199862eadf2ac6abd1fc446bc"
],
[
"0x0000000000000000000000000000000000000000",
]
];
and ran the following command:
npx hardhat verify --constructor-args arguments.js --network goerli 0xB0c1500b1Da0873e5a4c28F28aaDdB350080C175
Make sure you install the right version of openzeppelin's contract library. In package.json
:
"dependencies": {
"@openzeppelin/contracts": "4.3.1",
...
}
Defender is currently deploying version 4.3.1 of the Timelock Controller contract.
Hope that helps!
Thanks a lot. One question. Any reason we are not using the latest version which is 4.7.1?
dan_oz
February 8, 2023, 5:25pm
6
Hey. Thanks for helping me with this one. Actually I have another issue if you would be able to help me figure out what I am doing wrong.
I have been trying to verify NFT contract that was deployed on June 28th 2022. The developer who deployed the contract is no longer in contact but I have the source code for it. I tried to verify it using Remix, Hardhat and manually through etherscan but it is failing. I think the openzeppelin contracts that were used during deployment were old version as the contract was deployed an year back almost. I do not know exactly what version of OpenZeppelin contracts were used but I know the compiler …