π¦ Stableswap
Last updated
Last updated
A Standard AMM and a StableSwap AMM differ primarily in their design and purpose. Standard AMMs, like those used in Uniswap, rely on the constant product formula (x * y = k), making them suitable for trading volatile assets. However, this approach results in high slippage for large trades and inefficient liquidity distribution, especially for assets with similar prices.
The StableSwap formula is designed to facilitate efficient trading between assets with similar or pegged values (e.g., stablecoins or synthetic assets). It optimizes liquidity distribution to minimize slippage while maintaining flexibility for larger trades.
Below is a comparison of Stable Swap pool and classic AMM pool behavior with identical liquidity reserves.
Benefits:
1. Low Slippage: Perfect for assets with tightly correlated prices (e.g., stablecoins like USDC and DAI).
2. High Capital Efficiency: Concentrates liquidity near the equilibrium price for maximum utilization.
3. Minimal Impermanent Loss: As assets are pegged, price divergence risks are significantly reduced.
How It Works:
1. For small trades, the formula approximates constant sum (x + y = k), minimizing slippage.
2. For larger trades, it transitions to constant product (x * y = k), ensuring the pool doesnβt run out of liquidity.
It allows the curve to be flat around the middle, but also to adjust quickly to be more like a Constant Product Market Maker (CPMM, red line on the graph). Concentrated liquidity with 1:1 trade in the middle, but as soon as you deviate high, it will act more like a CPMM. This offers good liquidity with guardrails around a depeg.
The Constant Sum Market Maker (CSMM, dashed line on the graph) invariant has the benefit of keeping a constant price regardless of how many of each of the underlying tokens are in the liquidity pool (the pool can be unbalanced and still keep a constant price). The downside of CSMM is it can literally run out of liquidity and be left with only 1 token in the pool. The CPMM invariant has the opposite problem. It will never run out of tokens as it is forced to keep a 50/50 value split between the tokens. However, the CPMM always has a volatile price and can have very high slippage for traders.
The Stableswap Invariant combines both the CSMM and CPMM into 1 invariant.