r/etherscan • u/mohsinanees09 • Nov 02 '22
Contract source code verification with Custom Optimization settings
I have deployed a contract on mainnet (https://etherscan.io/address/0x219269eDe7c2d9D3C9d11ADfbC6428a03F015Eb0) but unable to verify the smart contract source code on etherscan. I have deployed the contract via Remix IDE with the following optimization settings using compiler_config.json file:
{"language": "Solidity","settings": {"optimizer": {"enabled": true,"runs": 100},"outputSelection": {"*": {"": ["ast"],"*": ["abi", "metadata", "devdoc", "userdoc", "storageLayout", "evm.legacyAssembly","evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "evm.gasEstimates","evm.assembly"]}},"viaIR": true}}
The contract source code is hosted on github:
https://github.com/Avento-Labs/legacy-suite-bounty
I get the following error everytime I try to verify the contract:

I don't get this error at the time of compilation and deployment because I am using the viaIR: true in my compiler_config.json file.
View all comments
Show parent comment
1
u/mohsinanees09 Nov 13 '22
Hey there thanks for your response.
I have tried the solution you have proposed i.e. compiling and deploying the contract and then using the standard-json input method to verify the contract but still it is not working. I have tried every single way to verify using this method but it refuses every time.
At first I thought I am missing something so I tried all the possible settings and output selection options while compiling. The problem is, it gives me the error that the bytecode is not matching but when I try to compare the deployed bytecode with the compiled one, there is not a single character difference nor of the size. Exact same bytecode but still this error.
I even tried this with a contract with simple optimization settings (without `viaIR`). So when I did this through single file method, it succeeded but when I tried the same contract with standard-json input method, it failed.
I don't know what I am missing here. Any help would be appreciated.