Can’t verify Timelock Contract from Defender in BSCScan

Hey guys,

I am trying to verify TimeLock contract I deployed on BSCScan using Defender. TimeLock contract address is 0xF95b43E052404c0456994355B7AC981DD892F49d

I am using TimelockController contract v4.8.1 as indicated by the docs:

Compiler setting is 0.8.4 too. But I keep getting " Error! Unable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode])

Then I tried to use Solidity Standard-Json Input from @frangio in this thread: Defender Timelock - Contract Verification

Changed the compiler version to 0.8.13 too. But I get " Error! Unable to generate Contract ByteCode and ABI”

Can someone please help? :frowning:

This link says:

Compiler settings are meaningless when it comes to contract deployment (so this description probably needs to be fixed in that OpenZeppelin webpage).

Compiler settings are meaningful when it comes to:

  1. Contract compilation
  2. Contract verification

You should find out exactly what compiler settings you have used for your contract compilation, and then use the exact same compiler settings for your contract verification.

The TimelockController contract v4.8.1 provided by the OpenZeppelin Contracts library relies on:

pragma solidity ^0.8.0;

So you may have compiled your contract with any compiler version equal to or higher than 0.8.0.


Thanks for your suggestion.

The issue is that I didn’t manually deploy the contract. It was done automatically by OpenZeppelin Defender UI. So no compilation whatsoever done from me using Hardhat or Remix or anything.

Another problem is that, TimelockController code seems to have newer version after 4.8.1 too

Are you suggesting that I do trial and error approach for this?

Yeah, and I would start from the latest (0.8.19), then go backward one version at a time.

I suppose I also need to flatten the contract too?

Hi there,

I used the contract 4.8.1, flattened it in Remix and tried from 0.8.19 until 0.8.0. No go.

It keeps saying Unable to generate Contract ByteCode and ABI


I also used the latest TimelockController.sol from (Master Branch), flattened the contract in Remix and went through compiler version 0.8.19 to 0.8.0. No go. I tried with Optimization on and off each time. Still no go.

Soemone helppp :frowning:

Hi @cilmion -

Sorry for the issues with verification - can you please confirm your settings are consistent with this post (Defender Timelock - Contract Verification) including License for instance? We've been able to successfully verify with those settings.

Hi @cilmion, I was able to verify your contract following my recommendations from the thread you linked:

Hi @frangio, I am so so sorry for my late reply.

Thank you very much!