Verification of Proxy and ProxyAdmin failing using Hardhat

Opened up a new issue request

When using Solidity 0.8 in the contract and importing
import "@openzeppelin/contracts/proxy/utils/Initializable.sol"
The contracts do get compiled in Solidity v 0.8.

However, when attempting to verify the contracts using
npx hardhat verify --network <networkName> <address>

Getting the following error:

Error in plugin @nomiclabs/hardhat-etherscan: The bytecode retrieved could not have been generated by any of the selected compilers.
The expected version is 0.6.12.
The selected compiler version is: 0.8.0

Possible causes are:
  - Wrong compiler version selected in hardhat config.
  - The given address is wrong.
  - The selected network (kovan) is wrong.

While digging through the fx upgrades.deployProxy it is importing:

import AdminUpgradeabilityProxy from '@openzeppelin/upgrades-core/artifacts/contracts/proxy/AdminUpgradeabilityProxy.sol/AdminUpgradeabilityProxy.json';
import ProxyAdmin from '@openzeppelin/upgrades-core/artifacts/contracts/proxy/ProxyAdmin.sol/ProxyAdmin.json';

It appears that the Initializable contract at node_modules/@openzeppelin/upgrades-core/contracts/Initializable.sol is suited for pragma solidity >=0.4.24 <0.7.0;
Further, the contracts over here https://github.com/OpenZeppelin/openzeppelin-upgrades/tree/master/packages/core/contracts/proxy are also suited for pragma solidity ^0.6.0

I believe this is the reason why I am not able to verify the contracts.

Link to github repo: Sample Github Repo

2 Likes

I replied with the following on GitHub:

The proxy and ProxyAdmin are precompiled. They should be verified on most public networks.

Can you advise what version of Upgrades Plugins you are using, which network you have deployed to along with the address of your proxy and ProxyAdmin?