Etherscan contract verification: invalid constructor arguments

I have a Proxy contract on rinkeby 0xA7Bb0CF8c00F26d1E7CbaF4020dFc9FCA2759495 and I am trying to verify and publish its source code. Normally Etherscan provides the constructor argument automatically, but this time the field Constructor arguments shows a warning

Note: Unable to determine contructor arguments, please check and replace with correct values (416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374000000000000000000000000cd4403b165c4bee155e4ab3694a199ed56c54e090000000000000000000000007e7551e2c94b31a494aee5c3f966794afb78c97a0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e4a4bc81b8000000000000000000000000e85d72d56f2811243a426470fba662260b40f9bd000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000cd4403b165c4bee155e4ab3694a199ed56c54e09000000000000000000000000cd4403b165c4bee155e4ab3694a199ed56c54e09000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000005af3107a400000000000000000000000000000000000000000000000000000000000)

eventhough the bytes string in the parenthesis should already be the correct constructor arguments (difference in the end between raw bytecode and deployed bytecode). I tried to remove the warning and leave just the bytes string and got Error! Invalid constructor arguments provided. Please verify that they are in ABI-encoded format. This is how the constructor looks like:

constructor (address _proxyOwner, address _implementation, bytes memory initializationData, bool forceCall) {
        _setProxyOwner(_proxyOwner);
        _setImplementation(_implementation);
        if (initializationData.length > 0 || forceCall) {
            Address.functionDelegateCall(implementation(), initializationData);
        }
    }

the initializationData should call the function initialize() in the implementation contract.

1 Like

My best advice is to try to use the plugin for verifying depending on your dev environment.

I use Hardhat so I use "@nomiclabs/hardhat-etherscan" https://www.npmjs.com/package/hardhat-etherscan

It is absolutely worth it to figure out how to get it working. It makes verification so much easier.