Papers
Topics
Authors
Recent
Search
2000 character limit reached

Constant Function Market Makers (CFMMs)

Updated 19 February 2026
  • CFMMs are automated mechanisms that maintain a deterministic invariant over multi-asset reserves to enable trustless, on-chain trading.
  • Their design leverages convex optimization and duality principles to facilitate efficient trade routing, robust price discovery, and optimal liquidity distribution.
  • Various implementations — including constant-product, weighted geometric mean, and option-replicating models — impact trading slippage, fee design, and risk management.

Constant Function Market Makers (CFMMs) are a class of automated market making mechanisms fundamental to decentralized exchanges (DEXs) operating on blockchains such as Ethereum. A CFMM is defined by a deterministic, continuously maintained trading function (also called an invariant or potential) over the reserves of multiple assets. Trades are executable if, and only if, the proposed post-trade reserves satisfy the invariant, which is typically a concave, increasing function for multi-asset pools. This framework generalizes the constant-product rule (Uniswap), the weighted geometric mean (Balancer), constant-sum forms, and more exotic functions such as those used in Curve and option-replicating AMMs. The CFMM framework enables trustless, on-chain liquidity provision, transparent price discovery, and algorithmic equilibrium subject to rigorous convexity, separability, and scaling axioms.

1. Foundational Structure and Core Properties

A CFMM holds reserves RR+nR \in \mathbb{R}^n_+ of nn assets. Its dynamics are encoded by an invariant function Φ:R+nR\Phi: \mathbb{R}_+^n \rightarrow \mathbb{R}, required to be concave, increasing, and typically differentiable. Given a fee parameter γ(0,1]\gamma \in (0,1], a trade proposing to deposit ΔR+n\Delta \in \mathbb{R}^n_+ and withdraw ΛR+n\Lambda \in \mathbb{R}^n_+ is accepted if

Φ(R+γΔΛ)Φ(R),\Phi(R + \gamma \Delta - \Lambda) \geq \Phi(R),

with equality typically enforced by maximizing Λ\Lambda for the provided Δ\Delta (Angeris et al., 2021).

The marginal price vector at any reserve state RR is given by the gradient Φ(R)\nabla \Phi(R), with individual asset prices defined as pi=Φ(R)iΦ(R)np_i = \frac{\nabla \Phi(R)_i}{\nabla \Phi(R)_n}, using asset nn as numéraire (Angeris et al., 2021, Angeris et al., 2020). For two-asset CFMMs, the swap curve F(δ)F(\delta) relating the input and maximum output can often be given in closed form (e.g., for Uniswap's Φ(x,y)=xy\Phi(x, y) = xy, F(δ)=yxyx+γδF(\delta) = y - \frac{xy}{x + \gamma \delta}) (Angeris et al., 2021).

Axiomatic Characterization: Essential properties are concavity, monotonicity, and (often) 1-homogeneity (scale invariance) of Φ\Phi, enforced by the requirements of no-arbitrage, path-independence, dominated trade exclusion, demand responsiveness, and liquidation admissibility (Schlegel et al., 2022, Frongillo et al., 2023). Separability (pairwise independence) ensures that the marginal price of exchanging ii for jj is functionally independent of the other reserves (Schlegel et al., 2022).

2. Convexity, Optimization, and Trade Feasibility

The fundamental consequence of concavity is that the trade acceptance region, as well as the set of all attainable reserve states post-trade, is convex (Angeris et al., 2021, Angeris et al., 2023). The selection of optimal trades (including the utility-maximizing trade for a rational agent) reduces to solving the convex program:

maxΔ,ΛU(ΛΔ) s.t.Φ(R+γΔΛ)Φ(R),    Δ0,    Λ0,\begin{aligned} \max_{\Delta, \Lambda} \quad & U(\Lambda - \Delta) \ \text{s.t.} \quad & \Phi(R + \gamma \Delta - \Lambda) \geq \Phi(R), \;\; \Delta \geq 0, \;\; \Lambda \geq 0, \end{aligned}

where UU is a concave, increasing utility function (Angeris et al., 2021).

Dual variables in the Lagrangian formulation correspond to the marginal prices reported by the CFMM at the post-trade reserve state, providing the canonical on-chain spot price and, in equilibrium with external prices, serving as a robust, incentive-compatible price oracle (Angeris et al., 2021, Angeris et al., 2020). Interior-point, operator-splitting, and first-order methods, leveraging domain-specific solvers (CVXPY, JuMP, ECOS, SCS), efficiently handle CFMMs even with hundreds of assets (Angeris et al., 2021).

Routing problems across a network of CFMMs—splitting multi-token trades for optimal price or slippage—likewise reduce to convex optimization, or mixed-integer convex programming if fixed costs per pool are included. Dual-based decomposition and Fenchel conjugacy further yield efficient parallel algorithms for large networks and aggregation (Angeris et al., 2022, Diamandis et al., 2023).

3. Geometric and Axiomatic Formulations

CFMMs are geometrically characterized by the convex, upward-closed set of reachable reserve vectors SR+nS \subseteq \mathbb{R}_+^n, with the canonical trading function ϕ(R)=sup{λ:R/λS}\phi(R) = \sup\{\lambda : R/\lambda \in S\}, guaranteed to be concave, homogeneous, and nondecreasing (Angeris et al., 2023). This construction via convex cones yields an explicit duality between the trading function and the portfolio value function:

V(c)=infRScTR,ϕ(R)=infc>0cTRV(c),V(c) = \inf_{R \in S} c^T R, \quad \phi(R) = \inf_{c > 0} \frac{c^T R}{V(c)},

and enables composition by scaling, Minkowski addition, and intersection of reachable sets (Angeris et al., 2023).

Axiomatic approaches distinguish classes of CFMMs through invariance criteria: scale invariance (1-homogeneity) leads to the constant-product (CPMM) and CES family, while translation invariance leads to logarithmic scoring rule CFMMs (LMSR) used in prediction markets. The CPMM emerges as the extreme, trader-optimal point for a set of convex, symmetric, scale-invariant market makers (Schlegel et al., 2022). Equivalence to cost-function prediction markets is established via convex duality: every concave, increasing CFMM can be associated with a convex cost-function market, and vice versa (Frongillo et al., 2023).

4. Parameter Choices, Curvature, and Fee Design

Curvature of the trading function determines sensitivity to trade size (“slippage”) and liquidity. For a two-asset CFMM, the price impact is governed by the local and global curvature of the invariant. High curvature (large second derivatives) increases slippage and liquidity-provider protection; low curvature reduces slippage but exposes LPs to adverse selection (Angeris et al., 2020). Quantitatively, price sensitivity μ=g(0)\mu = g'(0) and liquidity κ=(g(0)g(L))/L\kappa = (g(0) - g(-L))/L characterize these effects and prescribe yield-farming subsidies to compensate for impermanent loss (Angeris et al., 2020).

Fee Optimization: Trading fees γ\gamma provide compensation to LPs for arbitrage-induced loss but also widen the “no-arbitrage band,” reducing price accuracy. For geometric mean market makers (G³Ms), mean-variance analysis shows that, in continuous-diffusion settings, optimal fees approach zero, with competitive dynamics in multi-pool settings driving fees toward the smallest nonzero values justified by fixed costs (Evans et al., 2021, Fritsch et al., 2021). Calibration to actual DEX data reveals smaller pools extract higher returns on capital at equilibrium, guiding optimal liquidity distribution among pools (Fritsch et al., 2021).

5. Privacy, Attacks, and Implementation Challenges

Commodity CFMMs provide no transaction privacy; under standard adversarial models, knowledge of pre- and post-trade reserves and marginal prices allows an observer to reconstruct individual trade sizes exactly whenever the invariant has nonzero curvature and is 1-homogeneous (Angeris et al., 2021). All practical attempts at privacy—randomized oracle noise, batching, private timing, or trusted hardware—face either efficacy, utility, or trust challenges.

Extensions to privacy-aware CFMMs add randomness (“noise trades”) to the asset reserves. The expected arbitrage loss from noise can be exactly offset by a “privacy fee” only if the noise is zero-mean in asset coordinates; the requisite fee is inversely proportional to pool liquidity (Goyal et al., 2023). This achieves priceability and truthfulness but necessarily exposes users to higher costs or loss of privacy when liquidity is concentrated.

Game-theoretic attacks: CFMMs are structurally susceptible to maximal extractable value (MEV), including sandwich attacks and transaction reordering. Analyses show that the marginal profit for MEV searchers is controlled by the slippage and the curvature of the CFMM. Systematic design of the invariant (curvature tuning, fee scaling) and careful setting of slippage tolerances by users can mitigate the worst-case impact (Kulkarni et al., 2022).

6. Design Generalizations and Option-like CFMMs

The convex-analytic machinery underlying CFMMs supports arbitrarily general concave, 1-homogeneous, nondecreasing invariants, allowing for the engineering of payoff-matching AMMs (“replicating market makers”). There is a one-to-one correspondence between such “consistent” payoff functions and CFMM invariants via Fenchel conjugacy; for example, LP-tokens can be engineered to replicate option payoffs such as covered calls (Angeris et al., 2021, Jepsen et al., 2023).

Generalizations such as Generalized Mean Market Makers (G3Ms) and their further extensions (Gf3Ms) interpolate between constant-sum (arithmetic mean), constant-product (geometric mean), and more general mean functions, with tunable curvature and slippage characteristics (Zanger, 2022). Optimal design frameworks (e.g., maximizing the fraction of failed trades or minimizing failure risk for a given liquidity distribution) can be formulated as convex programs, calibrating the CFMM curve shape to the market-maker’s beliefs, fee targets, and loss aversion (Goyal et al., 2022).

Concentrated liquidity (CL)—as in Uniswap v3—enables LPs to focus liquidity over selected price intervals, increasing capital efficiency and providing strategies for optimal liquidity provision under stochastic asset dynamics or via reinforcement learning with function approximation (e.g., LSTMs for state features) (Monga, 2024).

7. Applications and Extensions

CFMMs now underpin the majority of decentralized, on-chain exchange, liquidity, and yield strategies, with central roles in:

Ongoing research continues to expand the scope of CFMMs with robust geometric, analytic, and computational frameworks, connecting DeFi mechanisms, prediction markets, convex analysis, and market microstructure. The convexity and duality structure of CFMMs enables modular, scalable design for both market participants and system architects.


Principal references:

Definition Search Book Streamline Icon: https://streamlinehq.com
References (20)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Constant Function Market Makers (CFMMs).