Defender Timelock contract verification failing

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

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

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?