Suitable Functions for Constant Function Market Makers (CFMMs)
CFMMs rely on deterministic trading functions to manage liquidity and price formation. Below are the primary mathematical models used, along with their applications and examples:
1. Constant Product Market Maker (CPMM)
Function: ( x \cdot y = k )
Description:
- Maintains a constant product of reserves for two assets.
- Widely used in decentralized exchanges (DEXs) like Uniswap and SushiSwap[[2]][[3]][[6]].
- Mechanism: When one asset is traded, the other’s quantity adjusts to preserve ( k ), creating a hyperbolic price curve[[2]][[4]].
2. Constant Sum Market Maker (CSMM)
Function: ( x + y = k )
Description:
- Maintains a constant sum of reserves for two assets.
- Use Case: Stablecoin pools where price stability is prioritized (e.g., mStable)[[2]][[8]].
- Limitation: Becomes non-functional if one asset is fully traded out[[2]].
3. Constant Mean Market Maker (CMMM)
Function: ( \left( R_1^{w_1} R_2^{w_2} \cdots R_n^{w_n} \right)^{1/\sum w_i} = k )
Description:
- Uses a weighted geometric mean for multi-asset pools.
- Example: Balancer employs this model with customizable weights for diverse token pairs[[5]][[8]].
- Advantage: Supports more than two assets with flexible weighting[[5]].
4. Hybrid Models
Function: ( \sum R_i - \alpha \left( \prod R_i^{w_i} \right)^{1/\sum w_i} = k )
Description:
- Combines linear (sum) and geometric mean components.
- Example: Curve Finance uses a modified version to optimize for low-slippage stablecoin swaps[[8]].
- Parameter: ( \alpha ) adjusts the balance between sum and geometric mean[[8]].
Comparison Table
| Model | Function | Assets Supported | Key Use Case | Example Protocols |
|---|
| CPMM | ( x \cdot y = k ) | 2 | General DEX trading | Uniswap, SushiSwap |
| CSMM | ( x + y = k ) | 2 | Stablecoin pools | mStable |
| CMMM | Weighted geometric mean | ≥2 | Multi-asset pools | Balancer |
| Hybrid (Curve) | Sum + geometric mean adjustment | 2–4 | Low-slippage swaps | Curve Finance |
Key Considerations
- CPMMs dominate for simplicity and broad applicability[[2]][[6]].
- CMMMs enable complex multi-asset strategies but require careful weight tuning[[5]][[8]].
- Hybrid models (e.g., Curve) optimize for specific asset classes like stablecoins[[8]].
For implementation, the choice depends on liquidity pool composition, asset volatility, and desired trading dynamics[[2]][[5]][[8]].