Verifying contract failing

deploying contracts on testnet like rinkeby or bsctestnet

and trying to verify them with @nomiclabs/hardhat-etherscan

is giving me an interesting error:

`Error in plugin @nomiclabs/hardhat-etherscan: The contract you want to verify was compiled with solidity 0.8.2, but your configured compiler version is: 0.8.4

the contracts have all pragma solidity ^0.8.4; so this is weird

npm show solc version

:1234: Code to reproduce

yarn hardhat verify --network rinkeby 0xBEBbbFe2846e6A17937e18bd3D45F4553fC4A033

hardhat verify --network bsctestnet 0x13A2Dc561D33565DED1f87F0554D52BBB2A68820

"hardhat": "^2.3.3"

:computer: Environment

@frangio any idea why this could be happening?

I don’t have anywhere pragma 0.8.2 defined…

I haven’t seen this error before. Can you ask in Hardhat’s Discord server?

1 Like

Will do, thanks for the discord info

Getting the same error as @Skyge and @abcoathup from this thread

Did not fully understand by reading his comments how he solved it.
(already using contracts-upgradeable": "^4.1.0, so that should not be it I think):

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 (bsctestnet) is wrong.

:computer: Environment

@ethereum-waffle/provider”: “^3.3.2”,
@nomiclabs/hardhat-ethers”: “^2.0.2”,
@nomiclabs/hardhat-etherscan”: “^2.1.3”,
@nomiclabs/hardhat-ganache”: “^2.0.0”,
@nomiclabs/hardhat-web3”: “^2.0.0”,
@openzeppelin/contracts-upgradeable”: “^4.1.0”,
@openzeppelin/hardhat-upgrades”: “^1.8.2”,
@openzeppelin/test-helpers”: “^0.5.11”,
“chai”: “^4.3.4”,
“eth-sig-util”: “^3.0.1”,
“hardhat”: “^2.3.3”,
“hardhat-ganache”: “^1.0.1”,
“mocha”: “^9.0.0”
“devDependencies”: {
“hardhat-abi-exporter”: “^2.2.1”

Forget to write in the post above, the error changed to that of Skyge and abcoathup after downgrading contracts to 8.2

Hi, have you solved this error?

It seems like in your hardhat.config.js, you set the compiler version is 0.8.2, so maybe you can change this line to version: "0.8.4",

Hello @Skyge unfortunately could not solve it,
I tried with hardhat config and contracts versions 0.8.0, 0.8.2, 0.8.4
without any luck:

I think the solution is somewhere here in this thread, but can’t figure out what Andrew did to solve it:

This one is the proxy, it has been verified, I think you need to verify the implementation contract, so what is the address of it?

1 Like

ParserError: Source "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol" not found: File import callback not supported
--> myc:8:1:
8 | import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
below is the error i am getting when trying to verfify my contract i am new to this so i am not sure whats going on
ParserError: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
--> myc:9:1:
9 | import "@openzeppelin/contracts/access/Ownable.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Please see our megathread on verification. There is a new section about "File import callback not supported".