Constant Product Pools
Constant Product Pools are generally used for token pairs with higher volatility as they facilitate trading at all possible prices. This applies also to large and sudden market moves. Constant Product Pools work by keeping their reserves balanced according to the following equation:
Where Rx and Ry are the reserves of token X and token Y respectively, and k is a constant. Any trades that occur will change the values of Rx and Ry, but only in ways that satisfy this equation. That is also the reason for the name of this particular pool type.
If a trader wishes to sell a quantity ∆x of token X, they will receive a quantity ∆y of token Y such that:
To add liquidity, liquidity providers deposit token X and token Y in a ratio that matches the current price (Rx / Ry). The added liquidity increases the value of k. Intuitively, with more liquidity present in the reserves, traders will receive a larger output (∆y) for a given input (∆x). This way, increased liquidity reduces trade slippage.
Diffusion takes a 0.30% fee per trade for constant product pools. As a result, each trade actually increases the constant k. As mentioned earlier, this functions as a payout to LPs, which is partly realized when they burn their pool tokens to withdraw their LP position.