I want to verify a contract code on Etherscan, but don't know how to get the arguments in ABI-encoded format. I have the source code and the interface in JSON. Is there some tool I can use, or some easy way of getting the JSON to the ABI format?
Note: I used just the "Deploy Contract" from Ethereum Wallet (Mist), no fancy compiler or anything.
The source code: https://gist.github.com/crutor0x/45cd845349345190458df7f7412654e8
JSON ABI: https://gist.github.com/crutor0x/dd97e9593ffb696bfb583481dccb86d9
Contract address: 0x3c75226555fc496168d48b88df83b95f16771f37
Best Answer
The page "Verify Contract" ask for "Constructor Arguments ABI-encoded".
In your case the constructor has no parameters, so you can leave such field empty.
In the general case when your constrctor has parameters you can proceed as follow:
You can use ethereumjs-abi to encode/decode the parameters for transaction calls.
Let's suppose your constructor is
MyToken(address _to, uint256 _value, bool _enabled)
. The parameters types are ["address", "uint256", "bool"].If you have created the contract MyToken("0x1234567812345678", 0x314159268, true). Then the parameters values are ["0x1234567812345678", "0x314159268", true].
Then you can encode the values with
rawEncode(parameterTypes, parameterValues)
.On execution it will output