Trying to upgrade a already deployed proxy contact on etherscan

Hi, I am trying to verify my transparent proxy contract. I successfully verified the implementation contract. But having problems when trying to verify the proxy. I use create3factory to deploy the contracts. I am getting this error:


Failed to verify TransparentUpgradeableProxy contract at 0x4b17F5Ef7F6CcdD06105F0a260c0E39eC6376007: Bytecode does not match with the current version of TransparentUpgradeableProxy in the Hardhat Upgrades plugin.
Failed to verify directly using hardhat verify: The address provided as argument contains a contract, but its bytecode doesn't match any of your local contracts.

:1234: Code to reproduce

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

contract TransparentProxy is TransparentUpgradeableProxy, Ownable {
    constructor(
        address _logic,
        address _admin,
        bytes memory _data
    ) payable TransparentUpgradeableProxy(_logic, _admin, _data) {
        transferOwnership(msg.sender);
    }
}

:computer: Environment

hardhat

1 Like

Since your proxy is deployed as your custom TransparentProxy contract, you would need to verify it manually, because its bytecode is different from what the Hardhat plugin normally deploys. See How to verify a contract on Etherscan/BscScan/PolygonScan for general info on verification.

Note: your pattern to use Ownable within the proxy itself is not recommended, because that risks storage clash and possible function selector clashes with the implementation. See https://docs.openzeppelin.com/upgrades-plugins/1.x/proxies. Instead, consider using OwnableUpgradeable in your implementation instead.

1 Like

yes, I read this one but still having problems with verifying. I upload solc-input.json and I am getting this error :
Error! Invalid constructor arguments provided. Please verify that they are in ABI-encoded format

here is my abi encode data :
0x0000000000000000000000007ab7de8ef151a3fb56d3440022dcd5856ab1820100000000000000000000000043d730dcbec77b1d5581a77642812f28b2088d10000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a490482d7200000000000000000000000000000000000000000000000000000000000000600000000000000000000000009bcd5003715c936051abd41e00b175b1756c2d90000000000000000000000000982aec3767cd5c31a66db55614da5f52c7b893e50000000000000000000000000000000000000000000000000000000000000001000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000000000000000000000000000000000000

yes I am aware of selector clashes problem but its already deployed contract.

1 Like

From your contract creation tx, it looks like your ABI encoded data might be:

0x0000000000000000000000007ab7de8ef151a3fb56d3440022dcd5856ab1820100000000000000000000000043d730dcbec77b1d5581a77642812f28b2088d10000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a490482d7200000000000000000000000000000000000000000000000000000000000000600000000000000000000000009bcd5003715c936051abd41e00b175b1756c2d90000000000000000000000000982aec3767cd5c31a66db55614da5f52c7b893e50000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000
1 Like

this is my creation tx on bsc: https://bscscan.com/tx/0x6d3bf7766069934919cb9b8308b0778a06d0bb34e3ebae7be6612154c4593730
This didn't work because you get it from eth I guess. How did you get that ABI encoded data may I learn that?

1 Like

this also didn't work on etherscan

1 Like

Right, I got it from Ethereum. What you provided earlier looks right for your bsc deployment.

I don't think I can help further as this really depends on how you compiled and deployed it. Just ensure that your solc JSON input contains your proxy contract which you deployed, and that your compiler version for Etherscan verification matches what you used to compile the proxy contract.

2 Likes