diff --git a/README.md b/README.md index a4527316..60f88d20 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,126 @@ -Raydium-Amm-v3 is an open-sourced concentrated liquidity market maker (CLMM) program built for the Solana ecosystem. +# Solana Automated Market Maker (AMM) -**Concentrated Liquidity Market Maker (CLMM)** pools allow liquidity providers to select a specific price range at which liquidity is active for trades within a pool. This is in contrast to constant product Automated Market Maker (AMM) pools, where all liquidity is spread out on a price curve from 0 to ∞. For LPs, CLMM design enables capital to be deployed with higher efficiency and earn increased yield from trading fees. For traders, CLMMs improve liquidity depth around the current price which translates to better prices and lower price impact on swaps. CLMM pools can be configured for pairs with different volatility. +## Project Overview -## Environment Setup -1. Install `Rust` +This is a comprehensive Solana-based Automated Market Maker (AMM) implementation designed to provide decentralized liquidity and token swapping functionality on the Solana blockchain. The project offers a robust, flexible, and secure solution for creating and managing liquidity pools, swapping tokens, and managing rewards. - ```shell - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - rustup default 1.79.0 +Key features include: +- Advanced liquidity management +- Flexible pool creation and configuration +- Support for multiple token types (including Token22) +- Reward mechanisms for liquidity providers +- Sophisticated swap routing and calculation mechanisms + +## Technologies Used + +- **Language**: Rust +- **Blockchain**: Solana +- **Build Tools**: + - Cargo + - Anchor Framework +- **Key Libraries**: + - Solana Program Library (SPL) + - Custom mathematical libraries for precise calculations + +## Project Structure + +``` +. +├── client/ # Client-side application and RPC interactions +├── programs/ # Core Solana program implementation +│ └── amm/ +│ ├── src/ +│ │ ├── instructions/ # Program instructions (swap, liquidity, etc.) +│ │ ├── libraries/ # Mathematical and utility libraries +│ │ ├── states/ # Data structures and account definitions +│ │ └── util/ # Utility functions +└── Cargo.toml # Workspace configuration +``` + +## Getting Started + +### Prerequisites + +- Rust (latest stable version) +- Solana CLI +- Anchor Framework + +### Installation + +1. Clone the repository: + ```bash + git clone https://github.com/your-org/solana-amm.git + cd solana-amm ``` -2. Install `Solana ` +2. Install dependencies: + ```bash + cargo build + ``` - ```shell - sh -c "$(curl -sSfL https://release.solana.com/v1.17.0/install)" +3. Build the Solana program: + ```bash + anchor build ``` - then run `solana-keygen new` to create a keypair at the default location. +## Core Features -3. install `Anchor` +### Liquidity Management +- Create and manage liquidity pools +- Increase/decrease liquidity with advanced mathematical calculations +- Support for concentrated liquidity positions - ```shell - # Installing using Anchor version manager (avm) - cargo install --git https://github.com/coral-xyz/anchor avm --locked --force - # Install anchor - avm install 0.29.0 - ``` +### Token Swapping +- Flexible swap mechanisms +- Support for multiple token types +- Efficient routing and price calculation -## Quickstart +### Reward System +- Initialize and set reward parameters +- Collect and distribute rewards to liquidity providers +- Flexible reward configuration -Clone the repository and enter the source code directory. -``` -git clone https://github.com/raydium-io/raydium-amm-v3 -cd raydium-amm-v3 -``` +## Usage Examples -Build +### Creating a Pool +```rust +// Example of creating an AMM pool (pseudo-code) +create_pool( + token_a, + token_b, + fee_tier, + initial_price +) ``` -anchor build -``` -After building, the smart contract files are all located in the target directory. -Deploy -``` -anchor deploy +### Swapping Tokens +```rust +// Example of performing a token swap +swap( + input_token, + output_token, + amount_in, + minimum_amount_out +) ``` -Attention, check your configuration and confirm the environment you want to deploy. -# CPI +## Security + +This project follows best practices for blockchain security: +- Comprehensive error handling +- Access control mechanisms +- Rigorous mathematical libraries to prevent overflow/underflow + +See `SECURITY.md` for more details. + +## Contributing + +Contributions are welcome! Please read the contributing guidelines before submitting pull requests. + +## License + +This project is licensed under the Apache License 2.0. See the `LICENSE` file for details. -An example of calling clmm can be found [here](https://github.com/raydium-io/raydium-cpi-example/tree/master/clmm-cpi) +## Disclaimer -# License -The source code is [licensed](https://github.com/raydium-io/raydium-clmm/blob/master/LICENSE) under Apache 2.0. \ No newline at end of file +This software is provided as-is with no guarantees. Use at your own risk, and always perform thorough testing before deploying to mainnet. \ No newline at end of file