This repository contains the smart contracts of Rush.Trading. The contracts are written in Solidity and are tested using Foundry.
Rush Trading utilizes a modular architecture, with each module being a separate contract. This allows for scalability and flexibility in the future.
You may notice that some test files are accompanied by .tree
files. This is called the Branching Tree Technique, and
the goal is to structure the tests systematically, making it easier to cover all possible test cases.
The Branching Tree Technique is explained in detail here:
This project was built using Foundry. Refer to installation instructions here.
git clone git@github.com:rush-trading/contracts.git rush-trading-contracts
cd rush-trading-contracts
bun install
To make it easier to perform some tasks within the repo, a few scripts are available via a package.json file.
Script | Action |
---|---|
bun run build |
Compile all contracts. |
bun run clean |
Remove all cached and compiled files. |
bun run lint |
Lint all files in the project. |
bun run lint:sol |
Lint all Solidity files in the project. |
bun run prettier:check |
Check formatting for all non-Solidity files in the project. |
bun run prettier:write |
Fix formatting for all non-Solidity files in the project. |
Make sure to create a local .env
file and add the necessary API_KEY_ALCHEMY
environment variable to be able to run
fork tests. You can use the provided .env.example
file as a template.
Script | Description |
---|---|
bun run gas:report |
Output gas report from all tests except those that revert. |
bun run gas:snapshot |
Generate gas snapshot file from all tests except those that revert. |
bun run test |
Run all Foundry tests. |
bun run test:coverage |
Run all Foundry tests and output coverage. |
bun run test:coverage:report |
Run all Foundry tests and generate coverage report. |
Specific tests can be run using forge test
conventions, specified in more detail in the Foundry
Book.
Deployment instructions can be found in the DEPLOYMENT.md file.