Hardhat Etherscan plugin: "Error occurs while verifying contract .."

I am trying to verifying contract through Etherscan plugin and i am using Hardhat plugin.
but i am getting errors as

Error in plugin @nomiclabs/hardhat-etherscan: The address provided as argument contains a contract, but its bytecode doesn't match any of your local contracts.

Possible causes are:
  - Contract code changed after the deployment was executed. This includes code for seemingly unrelated contracts.
  - A solidity file was added, moved, deleted or renamed after the deployment was executed. This includes files for seemingly unrelated contracts.
  - Solidity compiler settings were modified after the deployment was executed (like the optimizer, target EVM, etc.).
  - The given address is wrong.
  - The selected network (rinkeby) is wrong.


and I followed this steps to verify using etherscan plugin:

1 Like

Hi @Prabhakaran,

Sorry for the delay in replying. I only just came across this post.
Verification is still not as easy as it should be.

Are you able to share your contract, address on the public network, any parameters and whether optimization was used?

It looks like you have cloned OpenZeppelin Contracts rather than importing from npm. (see: https://docs.openzeppelin.com/contracts/3.x/#overview)

For upgradeable contracts we need to use the OpenZeppelin Contracts upgrade variant. (see: OpenZeppelin Contracts 3.3)

1 Like

Hi @abcoathup sir ,thanks and this is the contract address 0xc2ADC511f7a78e687e302DD86D58365b20515360. and i will check it out the docs you suggested.

1 Like

It seems like this contract has been verified on the Rinkeby.
Yeah, try to use npm to install the package and import.

2 Likes

yes @Skyge now the contract is verified ,thanks.

1 Like