Verifying default hardhat-upgrades proxy on new chain (polygon zkevm)

I have deployed upgradeable contracts on polygon zkevm and their implementation have been verified. However the proxy itself is not verified. I am using the default hardhat-upgrades-1.17.0 proxy implementation (targets compiler 0.8.2)

Any help on how to verify the proxy? Or someone can verify it on this chain? I tried to use the same code as on polygonscan but the bytecode doesn't match (probably due to constructor arguments?)

That would give you a 'similar match' I believe.

So if anything, I'd aim for the compiler settings.

In other words, make sure that all of your compiler parameters are configured for your unsuccessful verification attempt in the same way that they were configured for your successful compilation attempt.

For example:

    version: '0.8.2',
    viaIR: false,
    settings: {
        optimizer: {
            enabled: true,
            runs: 200

This is obviously impossible without:

  1. The contract's source code
  2. The contract's deployment address
  3. The contract's construction arguments
  4. The compiler's configuration parameters
1 Like

I added the compiler settings for 0.8.2 (my contracts are compiled at 0.8.9) and on verify I get the error - 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.

By verifying on this chain I meant someone (openzeppelin) could deploy any dummy upgradeable contract and then verify the proxy. By similar match my proxy would also get verified automatically

Why don't you simply provide all the required details (listed in my answer above), and thus make it easier for anyone reading your request to address it?

Contract code

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {OwnableUpgradeable as Ownable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import {ERC20Upgradeable as ERC20} from '@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol';
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';

contract DummyVeMnt is Initializable, ERC20, Ownable {

    function initialize() public initializer {
        __ERC20_init('Dummy veMNT', 'dveMNT');

Deployment address: 0x714023acef728603686Dd5b186aD1c7052dBC896

No initializer arguments


solidity: {
    compilers: [{
      version: '0.8.9',
      settings: {
        optimizer: {
          enabled: true,
          runs: 200

Ok I managed to get it to work after reading how hardhat-upgrades constructs the data parameter and then manually verifying on zkevm polygonscan. All proxies of this type should now be automatically verified on zkevm

With newer versions of the hardhat-upgrades plugin (since version 1.18.0), you can also use the verify task to verify proxies.