Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Enum Types in ABI Generation #8

Merged
merged 2 commits into from
Jul 1, 2023
Merged

Conversation

0x19
Copy link
Contributor

@0x19 0x19 commented Jul 1, 2023

This pull request introduces the ability to recognize and handle enum types in our ABI generation process. This is a crucial addition as enums are a common feature in Solidity contracts, and their omission in our ABI generation process was a significant gap in our functionality.

The changes in this PR include:

  • Enum Type Recognition: We've added a new function isEnumType that checks if a given type is an enum. This function is used during the state variable injection process to correctly identify enum types.
  • Enum Definition Parsing: We've extended the AbiListener with a new method EnterEnumDefinition. This method is called when the parser encounters an enum definition in the Solidity code. It extracts the enum's name and its values, and stores them in the AbiParser's map of defined enums for future reference.
  • Enum Handling in State Variable Injection: The InjectStateVariable method has been extended to handle enum types. When an enum type is detected, the method now correctly generates the ABI for the enum.

This pull request references issue: #6

@0x19 0x19 added documentation Improvements or additions to documentation enhancement New feature or request abi Application Binary Interface labels Jul 1, 2023
@0x19 0x19 self-assigned this Jul 1, 2023
@coveralls
Copy link

coveralls commented Jul 1, 2023

Pull Request Test Coverage Report for Build 5430959025

  • 35 of 35 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.9%) to 65.196%

Totals Coverage Status
Change from base Build 5430775659: 1.9%
Covered Lines: 399
Relevant Lines: 612

💛 - Coveralls

@0x19 0x19 merged commit 984e52a into main Jul 1, 2023
@0x19 0x19 deleted the 6-enum-abi-support branch July 1, 2023 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abi Application Binary Interface documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants