Skip to content

defi-space/ds-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

defi.space contracts

Consists of four main components: Automated Market Maker (AMM), Yield Farming, Game, and Faucet smart contracts. These components are tested using integration tests to ensure their functionality and reliability.

Project Structure

.
├── src/                   # Core smart contract modules
│   ├── amm/               # Automated Market Maker contracts
│   ├── farms/             # Yield Farming contracts
│   ├── game/              # Game contracts
│   ├── faucet/            # Faucet contracts
│   └── lib.cairo          # Main entry point
├── integration-tests/     # Integration test suite
│   ├── tests/             # Test files
│   ├── env.example        # Environment variables template
│   └── package.json       # Test dependencies
├── Scarb.toml             # Project dependencies and configuration
└── README.md              # Project documentation

AMM (Automated Market Maker)

Modules

  • Factory: Manages the creation of trading pairs.
  • Router: Facilitates token swaps and liquidity management.
  • Pair: Represents a trading pair and handles liquidity and swaps based on the constant product formula.
  • MockERC20: A mock implementation of the ERC20 token standard for testing purposes.

Key Files

  • src/amm/lib.cairo: The main entry point for the AMM modules.

Yield Farming

Modules

  • Powerplant: Manages the creation and configuration of reactors.
  • Reactor: Handles reward distribution and user interactions.
  • Conduit: Facilitates user deposits and withdrawals.

Key Files

  • src/farms/lib.cairo: The main entry point for the Yield Farming modules.

Game

Modules

  • GameFactory: Manages the creation and configuration of game sessions.
  • GameRouter: Facilitates interactions with game sessions.
  • GameSession: Handles game logic and user interactions.

Key Files

  • src/game/lib.cairo: The main entry point for the Game modules.

Faucet

Modules

  • RegularFaucet: Standard token distribution system.
  • WhitelistedFaucet: Token distribution system with whitelist controls.

Key Files

  • src/faucet/lib.cairo: The main entry point for the Faucet modules.

Integration Tests

Overview

The integration-tests directory contains test scripts written using Mocha and Chai for assertions. These tests validate the functionality of all smart contracts.

Setup

  1. Copy integration-tests/env.example to integration-tests/.env and fill in the required environment variables.
  2. Install dependencies:
    cd integration-tests
    pnpm install

Running Tests

Use the following command to run all integration tests:

cd integration-tests
pnpm test

Project Dependencies

  • StarkNet framework version 2.7.0
  • OpenZeppelin contracts version 0.15.0
  • snforge_std version 0.30.0 for development and testing

For detailed dependency information, refer to:

  • Scarb.toml for Cairo dependencies
  • integration-tests/package.json for test dependencies

About

Cairo contracts of the defi.space protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •