Skip to content
This repository has been archived by the owner on Feb 27, 2025. It is now read-only.
/ contracts Public archive

⚡⚡⚡ Smart contracts of the rush.trading protocol

License

Notifications You must be signed in to change notification settings

rush-trading/contracts

Repository files navigation

Rush Trading

Foundry CI Foundry License: MIT

Overview

This repository contains the smart contracts of Rush.Trading. The contracts are written in Solidity and are tested using Foundry.

Architecture

Rush Trading utilizes a modular architecture, with each module being a separate contract. This allows for scalability and flexibility in the future.

Branching Tree Technique

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:

Setup

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

Scripts

To make it easier to perform some tasks within the repo, a few scripts are available via a package.json file.

Build Scripts

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.

Test Scripts

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

Deployment instructions can be found in the DEPLOYMENT.md file.

About

⚡⚡⚡ Smart contracts of the rush.trading protocol

Resources

License

Stars

Watchers

Forks