rkalis / truffle-plugin-verify

✅ Verify your smart contracts on Etherscan from the Truffle CLI
https://kalis.me/verify-truffle-smart-contracts-etherscan/
MIT License
467 stars 130 forks source link

Couldn't verify Contracts on Etherscan using truffle-plugin-verify #191

Closed metadimensions closed 1 year ago

metadimensions commented 1 year ago

Hello,

I can’t verify the Smart contracts on the Etherscan mainnet. First I tried verifying directly on Etherscan but got import errors then I flattened the contract but it says the Bytecode was not matching.

Screenshot 2022-12-30 at 2 53 17 PM

Using Truffle the error says fail - unable to verify failed to verify 1 contract(s):

Screenshot 2022-12-30 at 2 43 38 PM
rkalis commented 1 year ago

Hey, thanks for the report. Do you have a repository that I can use to reproduce the issue?

rkalis commented 1 year ago

Also are you by any chance using viaIR? That is currently a known bug (see #181)

metadimensions commented 1 year ago

Not using ViaIR - actually the contract is already deployed on mainnet by a different dev person I couldn't find exact solidity code tried to debug this on the etherscan compiler but getting Bytecode error so trying this using Truffle verify.

rkalis commented 1 year ago

Oof yeah in that case it's going to be very hard to debug this because it needs to have the exact right source code to match. And the API response that we get from Etherscan doesn't really give you enough details to work with.

You could try using this Truffle plugin to generate the Input JSON and then upload that into the Etherscan verification form. That might give you slightly better error messages. But still if you don't know exactly which code + compiler settings were used to deploy the contract it'll be very difficult to verify the source code.

Sorry I can't be of more assistance here. Best of luck!