Verify hardhat upgradeable proxy on blockscout

Hi,

I'm running Blockscout locally with a local POA chain and try to verify a Transparent Proxy with an ERC20 implementation contract.

I try to find which contract i need to submit to Blockscout in order to verify the proxy contract.

From what i get from here , I'm supposed to find my way in https://github.com/OpenZeppelin/openzeppelin-upgrades yet it's unclear for me what i need to publish.

I'm using hardhat with

@openzeppelin/contracts-upgradeable": "^4.3.1"
@openzeppelin/hardhat-upgrades": "^1.10.0",

The contract i deploy is a wizard generated Transparent Upgradeable Erc20 with a basic deployement script

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

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract Token is Initializable, ERC20Upgradeable {
    function initialize() initializer public {
        __ERC20_init("MyToken", "MTK");
    }
}
const { ethers, upgrades } = require("hardhat");
async function main() {


  const Token = await ethers.getContractFactory("Token");
  const token = await upgrades.deployProxy(Token)

  await token.deployed();

  console.log("Token deployed to:", token.address);
}

Any hint is appreciated even an etherscan verified version that i could submit locally :innocent: or some pointers on where to dig depper.

Regards

1 Like

Does Blockscout have any kind of native support for proxies?

Transparent proxies deployed by our Hardhat plugin are using the contract TransparentUpgradeableProxy from @openzeppelin/contracts@4.1.0, compiled with Solidity 0.8.2, using these compiler settings:

You should also verify the implementation contract that you deployed. You can currently retrieve the address of the implementation contract using the function upgrades.erc1967.getImplementationAddress(proxyAddress).

I have a similar question. I'm able to verify my implementation contract without a problem, but I'm not able to source verify the proxy contract--i need the flattened source (the source verify complains about imports in the source using just the contract source mentioned above). For the older AdminUpgradeabilityProxy contracts blockscout recognized the contract byte code as a proxy and displayed the special proxy contract UI. However, it looks like for the TransparentUpgradeableProxy byte code is not recognized by blockscout.