Feature req: Output contract metadata in build artifacts
See original GitHub issueOverview
Recently I got my hands on a project that compiles contracts with brownie and wants to verify their contracts with Sourcify. Sourcify does full/perfect verification which leverages Solidity’s contract metadata and the hash of it appended at the end of the bytecode.
To be able to perfectly verify contracts, the contract metadata is needed and brownie doesn’t seem to output this information in the contract’s compilation artifacts.
Specification
To be able to verify, users need to provide the contract metadata alongside the source files. In brownie, I noticed the metadata is not output in the build/contracts/*.json
files by default. In contrast, metadata is output by default in Truffle, and since v2.6.8 in Hardhat.
I also couldn’t find an option to modify the Standard JSON Input-Output of the compiler where it would be possible to output the metadata as such:
version: ...,
optimizer: {...},
outputSelection: {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"metadata", // <-- add this
...
]
},
},
Including a Truffle output file as a reference. Notice the metadata field: Resolver.json.txt
Also if the metadata file becomes available, it would be possible to develop a Sourcify verification plugin to easily verify contracts following the deployment of the contract.
cc: @fredo
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
@istankovic No. I am starting as a open source contributor and started working on porting Lens Protocol from Hardhat-TypeScript to Brownie-Python and was facing some issue with verification for few contracts.
Try using your compile contract’s
get_verification_info
to getstandard json input
.For example:
There is this open PR: https://github.com/eth-brownie/brownie/pull/1280