Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
Gemini 2.5 Pro
GPT-5
GPT-4o
DeepSeek R1 via Azure
2000 character limit reached

CFAMM: Constant-Function Automated Market Maker

Updated 6 August 2025
  • CFAMMs are decentralized trading protocols that maintain a deterministic invariant function of asset reserves to enable continuous liquidity and serve as on-chain price oracles.
  • They generalize classical models like constant-product and constant-mean AMMs, offering flexible designs that address trade slippage, impermanent loss, and dynamic fee optimization.
  • By leveraging duality and option-theoretic interpretations, CFAMMs connect liquidity provision with prediction market mechanisms, optimizing incentives for market participants.

A Constant-Function Automated Market Maker (CFAMM) is a class of decentralized trading protocol in which feasible trades are those that leave a specified deterministic function of the pool’s asset reserves invariant. This mechanism generalizes multiple classical AMM models including constant-product, constant-sum, and constant-mean invariants, underpinning prominent decentralized exchanges such as Uniswap and Balancer. CFAMMs serve as critical primitives in decentralized finance, providing continuous liquidity, implicit price discovery, and an on-chain price oracle via arbitrage incentives.

1. Formal Structure and Canonical Invariant

A CFAMM is structurally defined by a reserve vector RR+nR \in \mathbb{R}^n_+ (for nn assets) and a continuous, typically concave, homogeneous trading function or invariant φ:R+nR+\varphi: \mathbb{R}^n_+ \to \mathbb{R}_+. A valid trade—formalized via input vector Δ\Delta and output vector Λ\Lambda—transforms the reserves from RR to R=R+γΔΛR' = R + \gamma\Delta - \Lambda (with γ\gamma the fee-adjusted scaling), and must satisfy: φ(R,Δ,Λ)=φ(R,0,0)\varphi(R, \Delta, \Lambda) = \varphi(R, 0, 0) or, in level-set form for classical invariants,

ψ(R)=ψ(R)\psi(R') = \psi(R)

Exemplars include:

  • Constant product AMM (Uniswap): φ(R,Δ,Λ)=(R1+γΔ1Λ1)(R2+γΔ2Λ2)\varphi(R, \Delta, \Lambda) = (R_1 + \gamma\Delta_1 - \Lambda_1)(R_2 + \gamma\Delta_2 - \Lambda_2),
  • Constant mean/balancer: φ(R,Δ,Λ)=i=1n(Ri+γΔiΛi)wi\varphi(R, \Delta, \Lambda) = \prod_{i=1}^n (R_i + \gamma\Delta_i - \Lambda_i)^{w_i}, wi=1\sum w_i = 1,
  • Elliptic/circle invariants: C(q)=i=1n(qia)2+bijqiqjC(q) = \sum_{i=1}^n (q_i - a)^2 + b\sum_{i \neq j} q_i q_j.

The trading set T(R)T(R) and reachable set S(R)S(R) encode all possible trades and resultant reserves, forming the basis for geometric, dual, and optimization-based analyses (Angeris et al., 2020, Angeris et al., 2023).

2. Price Discovery and Oracle Property

The invariant function implicitly defines the marginal (no-arbitrage) prices. Formally, for differentiable ψ\psi: priceψ(R)\text{price} \propto \nabla \psi(R) Choosing a numéraire (e.g., asset kk), the relative price between assets jj and kk is: Pj/k=wj/Rjwk/RkP_{j/k} = \frac{w_j/R_j}{w_k/R_k} for a constant-mean invariant. Arbitrage ensures that whenever the CFAMM’s internal prices deviate from external references, profit-seeking traders rebalance reserves until the supporting hyperplane (gradient of the constraint surface) matches the external vector of asset prices (Angeris et al., 2020).

Under path deficiency or its strict variant, the reserves' value (measured in any strictly positive price vector) is non-decreasing over feasible trade sequences, precluding “drain” exploits and rendering the CFAMM a robust oracle (Angeris et al., 2020).

3. Axiomatic Foundations and Equivalence to Prediction Markets

Axiomatic analyses reveal that CFAMMs emerge naturally from simple principles:

  • Separability (independence) ensures the exchange rates between assets depend only on the relevant pair’s inventories, not on others.
  • Scale invariance (for DeFi) leads to functional forms such as constant-product and constant-mean (“constant inventory elasticity” class), while translation invariance (for prediction markets) uniquely determines the LMSR cost function (Schlegel et al., 2022, Frongillo et al., 2023).

Consequently, every "good" (i.e., liquid, path-independent, responsive, and non-dominated) market maker is necessarily a CFAMM with a concave invariant, and vice versa. There exists a duality: every CFAMM defines a proper scoring rule, and every scoring-rule-based prediction market can be recast as a CFAMM with an invariant ϕ(q)=C(q)\phi(q) = -C(-q), where CC is the cost function (Frongillo et al., 2023).

4. Replication, Duality, and Portfolio Interpretation

The space of convex, homogeneous, nonnegative, nondecreasing “portfolio value” functions V()V(\cdot) is equivalent to the space of CFAMMs via Fenchel conjugacy: ψV(R)=infcRn(cTRV(c))\psi_V(R) = \inf_{c \in \mathbb{R}^n} (c^T R - V(c)) Conversely, the set of feasible reserves is S={R0:cRV(c) c}S = \{R \geq 0 : c^\top R \geq V(c)\ \forall\,c\} (Angeris et al., 2021). This duality, sometimes encoded as ψV(R)=(V)(R)\psi_V(R) = -(-V)^*(-R), statically replicates nonlinear payoff profiles—including those of European options and exotic derivatives—within the canonical CFAMM framework.

Geometric perspectives further demonstrate that the canonical trading function and the minimal-cost portfolio function are dually associated through the liquidity cone KK via conic duality: ϕ(R)=sup{λ>0:R/λS},V(c)=infR>0cTRϕ(R)\phi(R) = \sup\{\lambda > 0: R/\lambda \in S\},\quad V(c) = \inf_{R > 0} \frac{c^T R}{\phi(R)} This equivalence persists with minimal assumptions: convexity and monotonicity suffice (Angeris et al., 2023).

5. Liquidity Microstructure, Slippage, and Impermanent Loss

CFAMMs enforce nonlinear price responses to order size due to their invariant curve geometry. For the constant-product model, marginal price sensitivity is yx-\frac{y}{x}, resulting in nonlinear “slippage.” Larger trades against shallow pools incur superlinear price impact, quantified explicitly by [(1/(1f)2)1]×100%[(1/(1-f)^2)-1]\times 100\% for a trade of fraction ff of a token reserve (Jensen et al., 2021).

For liquidity providers (LPs), providing capital to a CFAMM results in “impermanent loss” (IL): the difference between holding assets directly and keeping them in the pool. This is a deterministic, convex function of the spot price ratio and market volatility—losses increase in shallow or highly volatile conditions: IL=(VE+11)×100%\text{IL} = (\sqrt{V_E+1} - 1)\times 100\% Design flexibility is encoded in generalized invariants. The power root family

Vpow(a,b;p)=(ap+bp)1/pV_{\operatorname{pow}}(a, b; p) = (a^p + b^p)^{1/p}

with q=p/(p1)q = p/(p-1) interpolates sum, product, harmonic mean, and reserve invariants, tuning the trade-off between slippage (for traders) and impermanent loss (for LPs) (Wu et al., 2022).

6. Optimal Design, Fee Dynamics, and Practical Implementations

Recent frameworks treat CFAMM design as a convex optimization over the space of liquidity allocation functions L(p)L(p), parameterized by beliefs (density ψ\psi) on future asset prices. Constraints on total reserves and optimality (maximizing the fraction of settled trades or net profit) yield trading functions that minimize expected trade failure, with dual formulas for inferring LP beliefs from observed invariants (Goyal et al., 2022).

Dynamic fee optimization is analyzed as a stochastic control problem, leading to (i) two regimes: high fees to deter arbitrage when inventory drifts from balanced, and low or negative fees to attract noise traders and increase volume; and (ii) explicit, nearly linear fee formulas in inventory misalignment and external price deviation: p(t,y)=g(t,y,s)g(t,y+Δ+)Δ++1kΔ+p^*(t, y) = \frac{g(t, y, s) - g(t, y+\Delta^+)}{\Delta^+} + \frac{1}{k \Delta^+} where gg arises from the HJB equation solved for the AMM’s value function (Baggiani et al., 3 Jun 2025).

Concentrated liquidity protocols allow LPs to allocate over intervals ("ticks"), supporting strategic positioning based on profitability, volatility, and predicted price drift—analytic solutions exist in single-pool settings, whereas multi-pool provision leverages deep learning approaches such as LSTM networks for high-dimensional allocation (Monga, 23 Jul 2024).

7. Option-Theoretic Interpretation and LVR Analysis

A rigorous option-theoretic model represents a CFAMM liquidity position as a static portfolio of perpetual American continuous-instaLLMent (CI) options. Each option, funded at a constant rate qq per unit time, statically replicates the AMM’s delta exposure: SΠ(S)=V(S)\partial_S \Pi(S) = V'(S) where VV is the CFAMM value function and Π\Pi the replicated portfolio. The loss-versus-rebalancing (LVR)—the adverse-selection cost incurred by non-instantaneous rebalancing relative to continuous hedging—is proven analytically equal to the continuous funding theta of the at-the-money CI option: dLVRt=12σ2St2V(St)dtd\text{LVR}_t = \frac{1}{2} \sigma^2 S_t^2 V''(S_t)\, dt Calibration procedures allow mapping the perpetual volatility to term-structure-implied market values; the framework supports liquidity band selection that renders LVR nearly constant and predictable over arbitrary horizons (Singh et al., 5 Aug 2025).

Table: Core Invariant and Pricing Formulas

CFAMM Family Invariant ψ()\psi(\cdot) Marginal Price Formula
Constant Product xy=kx y = k y/xy/x
Constant-Mean i=1nxiwi\prod_{i=1}^n x_i^{w_i}, wi=1\sum w_i=1 (wj/xj)/(wk/xk)(w_j/x_j)/(w_k/x_k) (numéraire kk)
Power Root (xq+yq)1/q=k(x^q + y^q)^{1/q} = k xq1y1qx^{q-1} y^{1-q}
Constant Ellipse (qia)2+bijqiqj=k\sum (q_i - a)^2 + b \sum_{i \neq j} q_i q_j = k 2(qia)+bjiqj2(q_i - a) + b \sum_{j \ne i} q_j

References


The CFAMM framework systematically underpins the microstructure and economic incentives of decentralized markets, generalizing myriad mechanisms for liquidity aggregation, price discovery, and incentive-compatible fee structures. Through geometric, dual, and axiomatic analyses, it demonstrates robust market properties—such as manipulability resistance, arbitrage protection, and capital-efficient liquidity allocation—while also exposing tractable trade-offs between trader experience, LP risk, and protocol design. The option-theoretic interpretation and optimization-based design offer rigorous paths for further innovation and empirical performance tuning in automated market infrastructure.