Closed petertdavies closed 3 years ago
You're probably right, I also suspect that this happens because abigen!
expects the abi
object as root of the json like contract_abi.json
this is not the case for builds like openzeppelin: https://npm.runkit.com/@openzeppelin/contracts/build/contracts/IERC20.json?t=1632833791195
So we probably need to account for that when decoding from npm.
Ugh I was sort of opinionated on not parsing the artifacts, but that seems inevitable given that OZ has published packages like that. We should add that.
Version
Platform
Linux 5.4.0-81-generic #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
The bug
The
abigen!
macro fails with the confusingerror: Illegal abi `{`
, when called on the output of the solidity compiler (rather than just the abi). Here is a minimal example.The reason
The output of the solidity compiler isn't just the abi in JSON format, it is a larger JSON object with an
abi
key containing the abi. When the abi parser attempts to parse this it fails, falling back to the human readable parser which then fails witherror: Illegal abi `{`
.It would be nice if we could support both formats.