For each contract whose address appears in migration.json (and therefore is a "migrated contract") we send the contract's solidity code to etherscan.io which will attempt to "verify" that the given code corresponds to the bytecodes deployed at the address given in migration.json.
Note Contract validation via this script currently does not work on Windows (truffle-flattener generates invalid flattened .sol files). The fix for that is at this writing in PR at truffle-flattener.
- In the project root, create an ".env" file (or use the existing one) that contains:
APIKEY=[API key from https://etherscan.io/myapikey]
Alternately you can supply this as an OS environment variable when you run build.verify
.
- initialize just one time, required by
build.verify
:
npm run verify.initialize
- build just one time or whenever you modify verify.ts, required by
verify
:
npm run verify.build
npm run verify -- -p [provider url] -n kovan
npm run verify -- -p [provider url] -n kovan -v 0.0.1-rc.18
The default Arc version is the last version listed in the migration.json file for the given network.
npm run verify -- -c UpgradeScheme -p [provider url] -n kovan
Outputs a GUID that you can use with npm run verify -- -g
.
npm run verify -- -c UpgradeScheme -a 0x12345... -p [provider url] -n kovan
Output the flattened script to a file named "flattened.[contractName].sol", by supplying the absolute path to a folder in which to write the file(s):
npm run verify -- -f [absolute folder path] [...] -p [provider url] -n kovan
Given the GUID that is output by npm run verify
:
npm run verify -- -g [GUID] -n kovan
npm run verify.help
npm run verify.lint
And fix:
npm run verify.lint.andFix