Library Development
This guide covers setting up your environment and workflow for contributing to Compose's Solidity library.
Prerequisites
Setup Steps
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/Compose.gitcd Compose
- Install dependencies:
forge install
- Build the project:
forge build
- Run tests:
forge test
Development Workflow
Once you are assigned to an issue:
- Fork the repository.
- Create a new branch for your work.
- Implement your changes.
- Make sure your changes follow the design of Compose.
- Format your code:
forge fmt. - Run tests to ensure everything works.
- Submit a pull request.
- We will review it and merge it and/or give you feedback on the work.
You can also make new issues to suggest new functionality or work.
Pre-PR Checklist
Before submitting a pull request:
- Format your code:
forge fmt. - Run all tests:
forge test. - Update gas snapshots:
forge snapshot. - Ensure your code follows the design of Compose.
- Ensure your code doesn't use any banned Solidity features.
- Ensure your code follows the coding style in the existing codebase.
Technical Considerations
- Make sure that you understand all code that you use or write.
- Gas efficiency is important but how easy the code is to read is more important.
- Write secure and bug free code.
- Consider edge cases and potential attack vectors.
Code Style Guide
Follow the Code Style Guide when contributing code.
Testing
Follow the Testing Guidelines when writing tests.
Changing lib/forge-std by Accident
If your pull request will by accident make any changes to the files in lib/forge-std, the way to fix this is to run forge install and commit the change.