question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Verification of Proxy and ProxyAdmin failing using Hardhat

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
frangiocommented, Apr 20, 2021

The contracts are verified now. Sorry about the inconvenience. Should be automated very soon.

0reactions
frangiocommented, Feb 21, 2022

Please refer to our guide How to verify a contract on Etherscan/BscScan/PolygonScan, particularly the section about proxies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hardhat: failed to verify ProxyAdmin contract at <0x ...
In this case polygonscan itself found a similar source code and it appears was verified by similarity ...
Read more >
Cannot auto verify Proxy contract with implementation and ...
So I suppose its problem with verification of Proxy or ProxyAdmin contracts or even with hardhat-upgrades verify task.
Read more >
Upgrading Smart Contracts using OpenZeppelin ... - Medium
The script uses the deployProxy method which is from the plugin. Create a deploy-atm.js script const { ethers, upgrades } = require("hardhat");async ...
Read more >
OpenZeppelin Hardhat Upgrades
This will automatically check that the Box contract is upgrade-safe, set up a proxy admin (if needed), deploy an implementation contract for the...
Read more >
OpenZeppelin on Twitter: "Upgradeable proxies are contracts ...
Etherscan verification for proxies is now available in the latest release of the OpenZeppelin Upgrade Plugins! This feature extends hardhat-etherscan's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found