Constant-Function Market Makers (CFMMs)
- CFMMs are decentralized protocols that enforce a constant invariant on liquidity pool reserves to ensure no-arbitrage and coherent price curves.
- They leverage techniques like convex optimization, differential geometry, and axiomatic principles to model trading functions and fee optimization.
- CFMMs enable advanced features including derivative replication, defensive rebalancing, and optimal curve design, enhancing liquidity and capital efficiency.
Constant-Function Market Makers (CFMMs) are decentralized exchange protocols that accept or reject asset trades by enforcing a deterministic invariant—a “constant function”—of the reserve holdings in a liquidity pool. Their trading rules, mathematical structure, and economic properties underpin almost all major Automated Market Makers (AMMs) in DeFi, including Uniswap, Balancer, and Curve. Modern CFMM designs are analyzed through convex optimization, axiomatic characterization, and differential geometry. This article provides a comprehensive technical account of CFMMs for researchers and professionals familiar with arXiv literature.
1. Mathematical Structure and Trading Functions
A CFMM maintains a reserve vector over a set of assets. Trades are permitted if the reserves move along a predefined invariant, :
for every post-trade . The function is typically nondecreasing, concave, homogeneous of degree one, and continuous; these properties enforce no-arbitrage, path independence, and well-behaved price curves (Angeris et al., 2020, Angeris et al., 2023, Frongillo et al., 2023).
Common CFMM invariants include:
| Invariant Type | Functional Form | Example |
|---|---|---|
| Constant-product | , | Uniswap/Balancer |
| Power mean | Generalized Mean | |
| Constant-sum | Stablecoin pools | |
| Log-score (LMSR) | Prediction Mkts |
The instantaneous marginal price is given by
2. Key Axioms: Separability, Scale and Translation Invariance
CFMMs are characterized axiomatically by:
- Separability (Independence): Trading a subset leaves exchange ratios unaffected by nontraded assets. Formally, .
- Scale invariance (DeFi): for all . LP positions are fungible and liquidity curves scale naturally.
- Translation invariance (Prediction markets): for ; fundamental for cost-function-based prediction markets such as LMSR (Schlegel et al., 2022, Frongillo et al., 2023).
These principles classify CFMMs as generalized mean mechanisms or log-score mechanisms according to the target application.
3. Generalized Mean Market Makers (G3Ms) and Gf3Ms
The family of Generalized Mean Market Makers (G3Ms) parametrizes CFMM invariants using the -power mean:
with weights .
Canonical cases:
- : weighted arithmetic mean — zero slippage, but trade size bounded by reserves.
- : weighted geometric mean (Uniswap/Balancer) — unbounded trade size, slippage grows rapidly.
- $0 < p < 1$: strictly interpolates between the two, offering unbounded trade size and parametrically lower slippage (Zanger, 2022).
The extension to Generalized -Mean Market Makers (Gf3Ms) employs quasi-arithmetic means:
for continuous and strictly monotonic. When satisfies nondecreasing, concave, differentiable, and homogeneous properties, it produces a valid CFMM invariant.
4. Game-Theoretic Fee Selection and Capital Allocation
CFMM protocols must choose optimal fee rates to balance LP compensation against accurate price reporting and competitive trading volume. In multi-pool competitive settings, each pool sets to maximize its fee-revenue against the trader’s liquidity allocation, subject to a Nash equilibrium constraint:
Fee adjustment equilibria are proven to exist, and, typically, equilibrium fees are significantly below prevailing market standards. LP ROI is higher in smaller pools, incentivizing capital migration until equilibrium (Fritsch et al., 2021). In G3Ms, fee minimization recovers the ideal constant-mix LP payoff in the zero-fee limit (Evans et al., 2021).
5. Slippage, Liquidity, and Curvature
The price impact of large trades, or slippage, is determined by the curvature of the invariant . For geometric mean CFMMs (Uniswap):
- Slippage for trade size is bounded by -stability, with the maximum derivative of marginal price. Effective liquidity is thus .
- For constant-sum models, (no slippage until exhaustion).
- High-curvature CFMMs mitigate adverse selection from informed traders but impose greater slippage on uninformed flows (Angeris et al., 2020).
- In G3Ms, slippage can be interpolated by choice of (Zanger, 2022).
Yield-farming and liquidity incentives are mathematically linked to curvature: higher curvature demands greater subsidies to maintain LP profitability.
6. Routing, Batch Integration, and Defensive Rebalancing
Optimal trade execution across CFMM networks or within batch auctions is formulated as a convex program subject to invariant constraints. Routing splits trades to maximize output, accounting for slippage, fees, and fixed costs; arbitrage detection is a special case (Angeris et al., 2022, Angeris et al., 2021, Ramseyer et al., 2022).
When CFMM configurations are arbitrage-prone, defensive rebalancing allows direct pool-to-pool asset transfers to a Pareto-efficient, arbitrage-free state while maximizing global liquidity. The optimization procedure is convex and efficiently solved; active/passive pool distinctions permit flexible protocol integration and MEV mitigation (Devorsetz et al., 26 Jan 2026, Kulkarni et al., 2022).
In batch auctions, CFMMs can be combined with limit orders; path independence, joint price discovery, Pareto-optimality, and price coherence are formalized, but not all properties can coexist (Ramseyer et al., 2022).
7. Portfolio-Valued CFMMs and Derivative Replication
CFMMs can be engineered to replicate specific payoff profiles, including option payoffs and covered calls. Any concave, nonnegative, homogeneous function of asset prices can be realized as the minimal mark-to-market portfolio value constrained by CFMM invariants:
Fenchel conjugacy provides a canonical construction mapping desired payoffs to CFMM trading functions (Angeris et al., 2021). Derivative-like market makers (e.g., RMM-01) can create LP tokens tracking Black-Scholes covered calls or other contracts (Jepsen et al., 2023).
8. Optimal Curve Design and Inference of Market Beliefs
CFMM trading functions can be optimally tailored to the market-maker’s beliefs about future asset prices via infinite-dimensional convex programming, maximizing capital efficiency and minimizing unserved trade fraction. The liquidity allocated at each price directly encodes LP beliefs, solving for as an optimal curve; conversely, observed trading curves enable reverse inference of the maker’s implicit beliefs (Goyal et al., 2022).
This approach unifies the construction, analysis, and reverse engineering of CFMMs as belief-based convex programs.
References
- (Zanger, 2022): G3Ms: Generalized Mean Market Makers
- (Schlegel et al., 2022): Axioms for Constant Function Market Makers
- (Angeris et al., 2020): Improved Price Oracles: Constant Function Market Makers
- (Fritsch et al., 2021): A Note on Optimal Fees for Constant Function Market Makers
- (Devorsetz et al., 26 Jan 2026): Defensive Rebalancing for Automated Market Makers
- (Angeris et al., 2021): Replicating Market Makers
- (Angeris et al., 2020): When does the tail wag the dog? Curvature and market making
- (Jepsen et al., 2023): Analysis of the RMM-01 Market Maker
- (Frongillo et al., 2023): An Axiomatic Characterization of CFMMs and Equivalence to Prediction Markets
- (Ramseyer et al., 2022): Augmenting Batch Exchanges with Constant Function Market Makers
- (Evans et al., 2021): Optimal Fees for Geometric Mean Market Makers
- (Kulkarni et al., 2022): Towards a Theory of Maximal Extractable Value I: Constant Function Market Makers
- (Angeris et al., 2023): The Geometry of Constant Function Market Makers
- (Monga, 2024): Automated Market Making and Decentralized Finance
- (Goyal et al., 2022): Finding the Right Curve: Optimal Design of Constant Function Market Makers
- (Dewey et al., 2023): The Pricing and Hedging of Constant Function Market Makers
- (Angeris et al., 2022): Optimal Routing for Constant Function Market Makers
- (Angeris et al., 2021): Constant Function Market Makers: Multi-Asset Trades via Convex Optimization
Constant-Function Market Makers are mathematically tractable, axiomatizable, and convex-optimization-based exchange mechanisms that subsume all major AMM designs and their information-theoretic or economic counterparts in prediction markets. Modern innovations in curve design, defensive mechanisms, fee competition, and derivative replication stem from their rigorous mathematical foundation and modular composition rules.