A decentralized token swap system built on Solana, enabling direct peer-to-peer token exchanges without intermediaries or fees.
- Direct P2P token swaps
- No intermediaries or fees
- Secure escrow mechanism
- Support for any SPL tokens
- Alice creates an offer to swap Token A for Token B
- Bob accepts the offer, exchanging his Token B for Alice's Token A
- The smart contract ensures a secure, atomic swap
lib.rs
: Main module and instruction handlersinstructions/
: Offer creation and execution logicstate/
: Offer state managementerror.rs
: Custom error typesconstants.rs
: Program constants
- Alice initiates a swap offer
- Contract creates an escrow vault
- Alice's tokens are locked in the vault
- Offer details are saved on-chain
- Bob accepts an existing offer
- Bob's tokens are sent to Alice
- Alice's tokens are released to Bob
- Offer is closed and vault is emptied
- Trustless: No third-party involvement
- Efficient: Direct swaps
- Cost-effective: No fees (only network costs)
- Flexible: Compatible with all SPL tokens
- Anchor framework
- Solana Program Library (SPL)
- Program Derived Addresses (PDAs) for secure vaults
Swap tokens securely and efficiently on Solana! 🎉