solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Include enums in the ABI

Open axic opened this issue 4 years ago • 1 comments

For a while internal types are exposed in the ABI, which can be used to do type checking stricter than the encoding allows.

Such an example when enums are used in an interface (see #595):

      {
        "indexed": false,
        "internalType": "enum I.MyEnum",
        "name": "b",
        "type": "uint8"
      }

The proposal is to include a new entry in the ABI for enums:

{
  "type": "enum",
  "name": "MyEnum",
  "min": 0,
  "max": max
}

The min is hardcoded at 0 as enums are encoded as uint8 currently, but leaving the field for future compatibility.

axic avatar Aug 31 '21 18:08 axic

I think we should use the type field only for things that also appear in the signature. If you want to look up additional information for the type, I think you should use the AST instead.

chriseth avatar Sep 08 '21 10:09 chriseth

This issue has been marked as stale due to inactivity for the last 90 days. It will be automatically closed in 7 days.

github-actions[bot] avatar Mar 21 '23 12:03 github-actions[bot]

Hi everyone! This issue has been automatically closed due to inactivity. If you think this issue is still relevant in the latest Solidity version and you have something to contribute, feel free to reopen. However, unless the issue is a concrete proposal that can be implemented, we recommend starting a language discussion on the forum instead.

github-actions[bot] avatar Mar 28 '23 12:03 github-actions[bot]