3 releases (stable)

1.1.0 Oct 25, 2024
1.0.0 Sep 8, 2024
0.1.0 Sep 8, 2024

#56 in #swap

Download history 189/week @ 2024-09-03 80/week @ 2024-09-10 24/week @ 2024-09-17 21/week @ 2024-09-24 41/week @ 2024-10-01 116/week @ 2024-10-22 10/week @ 2024-10-29

126 downloads per month

MIT license

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:

  1. Token Swapping: Allows users to swap between two tokens (e.g., USDT and wBTC).
  2. Add Liquidity: Liquidity providers can add tokens to the pool.
  3. Remove Liquidity: Providers can remove their liquidity from the pool.
  4. 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:

  1. Install Solana CLI: https://docs.solana.com/cli/install-solana-cli-tools
  2. Install Anchor: https://book.anchor-lang.com/getting_started/installation.html
  3. Configure Solana for Devnet: solana config set --url https://api.devnet.solana.com

DEPLOYMENT:

  1. Update Anchor.toml with correct Program ID and cluster.
  2. Deploy the program to Devnet:
anchor build
anchor deploy
  1. Verify deployment:
solana program show <ProgramID>

USAGES:

  1. Create the necessary token accounts for two tokens (Token A and Token B), pool accounts, and admin account using the Solana CLI.
  2. Use the program to: a. Add Liquidity b. Remove Liquidity c. Swap Tokens

Dependencies

~19–27MB
~476K SLoC