NOTE: Please read the instructions given below, which helps to make underdstanding of the protocol. If any issues or collabrating with projects please contact through Email or LinkedIn. This exchange only works on `devnet`.
A liquidity pool contains: Token-A: 100 units Token-B: 200 units The pool follows a constant ratio (1:2 ratio) between Token-A and Token-B.
A liquidity provider (LP) wants to add liquidity but provides tokens in a different ratio: Token-A: 50 units Token-B: 300 units(1:6 ratio).
The protocol uses Raydium DEX to swap the excess Token-B into Token-A.
At initial we take Token-A: 50 units and Token-B: 100 units with respective to pool balance ratios.
With the excess Token-B amount of 200 units we divide with 3 units(1+2), with that we swap Token-A with the 1 ratio amount of exceed 200 Units.
i.e, 66.6 Token-B units are swapped to Token-A in Raydium DEX by calculating fees.
After swapping the total Amount-A: 116.6 and Amount-B: 233.4(1:2 ration) tokens of liquidity is added