3 releases (stable)
1.1.0 | Oct 25, 2024 |
---|---|
1.0.0 | Sep 8, 2024 |
0.1.0 | Sep 8, 2024 |
#57 in #swap
19KB
379 lines
SOLANA TOKEN SWAP PROGRAM
This project implements a decentralized token swap program on the Solana blockchain. Users can swap tokens, add and remove liquidity, and an admin receives fees from swaps.
FEATURES:
- Token Swapping: Allows users to swap between two tokens (e.g., USDT and wBTC).
- Add Liquidity: Liquidity providers can add tokens to the pool.
- Remove Liquidity: Providers can remove their liquidity from the pool.
- Fee Mechanism: A fee is applied to swaps and transferred to an admin account.
REQUIREMENTS:
- Rust & Cargo (for Solana program development)
- Solana CLI tools
- Anchor framework
- Phantom wallet for interaction
SETUP:
- Install Solana CLI: https://docs.solana.com/cli/install-solana-cli-tools
- Install Anchor: https://book.anchor-lang.com/getting_started/installation.html
- Configure Solana for Devnet: solana config set --url https://api.devnet.solana.com
DEPLOYMENT:
- Update Anchor.toml with correct Program ID and cluster.
- Deploy the program to Devnet:
anchor build
anchor deploy
- Verify deployment:
solana program show <ProgramID>
USAGES:
- Create the necessary token accounts for two tokens (Token A and Token B), pool accounts, and admin account using the Solana CLI.
- Use the program to: a. Add Liquidity b. Remove Liquidity c. Swap Tokens
Dependencies
~19–27MB
~474K SLoC