Exchange is an AMM based on constant product curve. Inspired from Balancer and Solana Token Swap Program.
-
Constant product:
(A+A') * (B-B') = Invariant
-
Balancer WhitePaper: https://balancer.fi/whitepaper.pdf
-
Solana Token Swap: https://spl.solana.com/token-swap
- Initialize Swap Pool with tokens
- Deposit tokens to get pool tokens representing the share in the pool
- Withdraw tokens in exchange for pool tokens
- Swap token A with token B and vice versa after some fee
** CODE IS NOT AUDITED AND STILL WIP **