Replies: 4 comments
-
I don’t know it’s even possible to extract this from an ABI fragment. Can you include the generated ABI in this issue? |
Beta Was this translation helpful? Give feedback.
-
Sure. Here's what I get from [
{
"inputs": [
{
"internalType": "enum L.BOOL",
"name": "b",
"type": "L.BOOL"
}
],
"name": "f",
"outputs": [
{
"internalType": "enum L.BOOL",
"name": "",
"type": "L.BOOL"
}
],
"stateMutability": "pure",
"type": "function"
}
] |
Beta Was this translation helpful? Give feedback.
-
Yeah. That is literally not enough data to process. :) |
Beta Was this translation helpful? Give feedback.
-
Yeah. This will probably have to be fixed in the compiler. Still I wanted to make you aware of this issue since it won't disappear in older compiler versions and knowing about it might save you some needless debugging down the line. And it likely affects more than just enums. You might also want to detect it and at least handle the error gracefully. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What was wrong?
Abicoder
fails to properly parse/use the ABI generated bysolc
for a library. One example of this is that for contracts thetype
of an enum is reported as an integer type (uint8
if enum has 256 of less entries) while for libraries it'senum L.E
(whereL
is a library name andE
is some enum).An attempt to use such an
enum
results in an error:Code that produced the error
This assumes that you have
solc
,npm
andnode
in yourPATH
.Just run these commands in a shell in an empty directory:
Full error output
Environment
ethers@5.0.19
npm 6.14.7
node.js v10.22.1
solc 0.7.4
How can it be fixed?
The inconsistent ABI for libraries is actually a problem in the compiler and is likely to be fixed in the near future (feedback welcome in ethereum/solidity#9278). It affects other tools too: dethcrypto/TypeChain#216, ethereum/eth-abi#146.
In the meantime (and for older versions when it's fixed), tools need to handle it differently than in contracts.
Beta Was this translation helpful? Give feedback.
All reactions