---
title: Constant-Function Market Makers (CFMMs)
url: https://www.emergentmind.com/topics/constant-function-market-makers-cfmms
type: topic
---

# Constant-Function Market Makers (CFMMs)

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 $\mathbf{R} = (R_A)_{A \in \mathcal{A}} \in \mathbb{R}_+^\mathcal{A}$ over a set $\mathcal{A}$ of assets. Trades are permitted if the reserves move along a predefined invariant, $\phi: \mathbb{R}_+^\mathcal{A} \to \mathbb{R}$:

\[
\phi(\mathbf{R}') = \phi(\mathbf{R})
\]

for every post-trade $\mathbf{R}'$. The function $\phi$ is typically nondecreasing, concave, homogeneous of degree one, and continuous; these properties enforce no-arbitrage, path independence, and well-behaved price curves [2003.10001][2308.08066][2302.00196].

Common CFMM invariants include:

| Invariant Type    | Functional Form                                          | Example           |
|-------------------|---------------------------------------------------------|-------------------|
| Constant-product  | $\prod_{i} R_i^{w_i}$, $\sum_i w_i = 1$                 | Uniswap/Balancer  |
| Power mean        | $\left( \sum_i w_i R_i^\gamma \right)^{1/\gamma}$       | Generalized Mean  |
| Constant-sum      | $\sum_i R_i$                                            | Stablecoin pools  |
| Log-score (LMSR)  | $\sum_i w_i \ln R_i$                                    | Prediction Mkts   |

The instantaneous marginal price $P_{i \to j}(\mathbf{R})$ is given by

\[
P_{i \to j}(\mathbf{R}) = \frac{\frac{\partial\phi}{\partial R_i}}{\frac{\partial\phi}{\partial R_j}}
\]

## 2. Key Axioms: Separability, Scale and Translation Invariance

CFMMs are characterized axiomatically by:

- **Separability (Independence):** Trading a subset $\mathcal{B} \subseteq \mathcal{A}$ leaves exchange ratios unaffected by nontraded assets. Formally, $\phi(\mathbf{R}_{\mathcal{B}}, \mathbf{S}_{-\mathcal{B}}) = \phi(\mathbf{S}) \Leftrightarrow \phi(\mathbf{S}_{\mathcal{B}}, \mathbf{R}_{-\mathcal{B}}) = \phi(\mathbf{R})$.

- **Scale invariance (DeFi):** $\phi(\mathbf{R}) = \phi(\mathbf{S}) \Rightarrow \phi(\lambda \mathbf{R}) = \phi(\lambda \mathbf{S})$ for all $\lambda > 0$. LP positions are fungible and liquidity curves scale naturally.

- **Translation invariance (Prediction markets):** $\phi(\mathbf{R}) = \phi(\mathbf{S}) \Rightarrow \phi(\mathbf{R} + \alpha\mathbf{1}) = \phi(\mathbf{S} + \alpha\mathbf{1})$ for $\alpha \in \mathbb{R}$; fundamental for cost-function-based prediction markets such as LMSR [2210.00048][2302.00196].

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 $p$-power mean:

\[
\phi_p(\mathbf{x}; \mathbf{w}) =
\begin{cases}
\left( \sum_{i=1}^n w_i x_i^p \right)^{1/p} & p \neq 0 \\
\prod_{i=1}^n x_i^{w_i} & p = 0
\end{cases}
\]
with weights $\sum_i w_i = 1$.

Canonical cases:

- $p=1$: weighted arithmetic mean — zero slippage, but trade size bounded by reserves.
- $p \to 0$: 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 [2208.07305].

The extension to Generalized $f$-Mean Market Makers (Gf3Ms) employs quasi-arithmetic means:

\[
M_{f,w}(\mathbf{x}) = f^{-1}\left( \sum_{i=1}^n w_i f(x_i) \right)
\]
for $f$ continuous and strictly monotonic. When $M_{f,w}$ 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 $\gamma$ to balance LP compensation against accurate price reporting and competitive trading volume. In multi-pool competitive settings, each pool sets $\gamma_i$ to maximize its fee-revenue against the trader’s liquidity allocation, subject to a Nash equilibrium constraint:

\[
u_i(\gamma) = \gamma_i x_i(\gamma_1,\ldots,\gamma_n)
\]

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 [2105.13510]. In G3Ms, fee minimization recovers the ideal constant-mix LP payoff in the zero-fee limit [2104.00446].

## 5. Slippage, Liquidity, and Curvature

The price impact of large trades, or slippage, is determined by the curvature of the invariant $\phi$. For geometric mean CFMMs (Uniswap):

- Slippage for trade size $\varepsilon$ is bounded by $\mu$-stability, with $\mu$ the maximum derivative of marginal price. Effective liquidity is thus $\Lambda = 1/\mu$.
- For constant-sum models, $\mu = 0$ (no slippage until exhaustion).
- High-curvature CFMMs mitigate adverse selection from informed traders but impose greater slippage on uninformed flows [2012.08040].
- In G3Ms, slippage can be interpolated by choice of $p$ [2208.07305].

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 [2204.05238][2107.12484][2210.04929].

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 [2601.19950][2207.11835].

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 [2210.04929].

## 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 $V(c)$ of asset prices can be realized as the minimal mark-to-market portfolio value constrained by CFMM invariants:

\[
V(c) = \inf\left\{ c^T R \mid \phi(R) \ge 0 \right\}
\]

Fenchel conjugacy provides a canonical construction mapping desired payoffs to CFMM trading functions [2103.14769]. Derivative-like market makers (e.g., RMM-01) can create LP tokens tracking Black-Scholes covered calls or other contracts [2310.14320].

## 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 $\phi$ as an optimal curve; conversely, observed trading curves enable reverse inference of the maker’s implicit beliefs [2212.03340].

This approach unifies the construction, analysis, and reverse engineering of CFMMs as belief-based convex programs.

## References

- [2208.07305]: G3Ms: Generalized Mean Market Makers
- [2210.00048]: Axioms for Constant Function Market Makers
- [2003.10001]: Improved Price Oracles: Constant Function Market Makers
- [2105.13510]: A Note on Optimal Fees for Constant Function Market Makers
- [2601.19950]: Defensive Rebalancing for Automated Market Makers
- [2103.14769]: Replicating Market Makers
- [2012.08040]: When does the tail wag the dog? Curvature and market making
- [2310.14320]: Analysis of the RMM-01 Market Maker
- [2302.00196]: An Axiomatic Characterization of CFMMs and Equivalence to Prediction Markets
- [2210.04929]: Augmenting Batch Exchanges with Constant Function Market Makers
- [2104.00446]: Optimal Fees for Geometric Mean Market Makers
- [2207.11835]: Towards a Theory of Maximal Extractable Value I: Constant Function Market Makers
- [2308.08066]: The Geometry of Constant Function Market Makers
- [2407.16885]: Automated Market Making and Decentralized Finance
- [2212.03340]: Finding the Right Curve: Optimal Design of Constant Function Market Makers
- [2306.11580]: The Pricing and Hedging of Constant Function Market Makers
- [2204.05238]: Optimal Routing for Constant Function Market Makers
- [2107.12484]: 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.

Source: https://www.emergentmind.com/topics/constant-function-market-makers-cfmms