Solidity allows you to parse Solidity contract files, extract detailed information from their Abstract Syntax Trees (AST), and interactively explore the contracts' structure and components via a terminal-based user interface.
This project is still a WIP.
- AST Parsing: Parse Solidity contract JSON files containing ASTs to extract comprehensive information.
- Detailed Extraction: Extract contracts' variables, functions, constructors, events, modifiers, structs, enums, and inheritance information.
- Interactive Terminal UI: Navigate through contracts and their components using an intuitive terminal-based interface.
- Supports Multiple Contracts: Parse and explore multiple contracts within a specified directory.
- Go (version 1.20 or later)
- Git
- Solidity compiler to generate AST JSON files (optional if you already have AST files) -- prefered
foundry
.
git clone [email protected]:Simon-Busch/solidity-ast-parser.git
cd solidity-ast-parser
- Prepare Contract AST Files: Place your Solidity contract JSON files (containing the AST) into the data/ directory. These JSON files can be generated using the Solidity compiler with the appropriate flags.
Can be done with:
forge build --ast
for a whole project.
-
Create a
data
folder and paste all desired build folder or all the json inside. -
Build && run the Application:
make run
Contracts List: Upon running the application, you'll see a list of contracts parsed from the data/ directory on the left panel.
- Use the Up (↑) and Down (↓) arrow keys to navigate through the list.
- Press Right (→) to select a contract and view its details.
Details Panel: The middle panel displays the selected contract's components, such as constructor, functions, variables, events, structs, and enums.
- Navigate using the Up (↑) and Down (↓) arrow keys.
- Press Right (→) to view detailed information about a selected item in the right panel.
- Press Left (←) to go back to the contracts list or previous panel.
Information Panel: The right panel shows detailed information about the selected component, including parameters, modifiers, visibility, and state mutability.
Exit: Press q or Ctrl+C to exit the application at any time.
Contributions are welcome! If you'd like to improve this project.
This project is licensed under the MIT License.