ππ½ How to Swap
Follow the Swap Tutorial

How does a swap work?
User selects two assets β one to sell and one to receive.- Input amount is defined β the app estimates the output based on current pool conditions.
- Router SDK scans available pools β if the Aggregator is enabled, it calculates the best distribution
DexDistribution. - User confirms the swap β the smart contract receives the input asset and performs the swap.
- User receives the new asset β if itβs the first time, a trustline must be signed to accept the asset.
π Constant Product Formula
Each AMM in Soroswap follows this formula:x= balance of asset Ay= balance of asset Bk= constant product (remains unchanged)
- A is deposited into the pool
- B is withdrawn
- The price updates to maintain the balance
π Previous: Liquidity Pools