StableSwap — Efficient mechanism for Stablecoin Liquidity

Authors Egorov, Michael
Year 2019
Project Curve Finance
License Proprietary
Official Source https://curve.fi/files/stableswap-paper.pdf

This page is an educational summary and analysis of an official whitepaper or technical paper, written for reference purposes. It is not a verbatim reproduction. CryptoGloss does not claim authorship of the original work. All intellectual property rights remain with the original author(s). The official document is linked above.

“StableSwap — Efficient mechanism for Stablecoin Liquidity” is a paper by Michael Egorov (founder of Curve Finance), published in November 2019. It introduces the StableSwap invariant — a mathematical function that dramatically reduces slippage for trading between assets that should trade at approximately equal value (stablecoins, ETH/stETH, WBTC/renBTC).

Curve Finance launched in January 2020 and became the largest decentralized exchange by TVL, handling the vast majority of all stablecoin-to-stablecoin exchange volume in DeFi. The Curve Wars — the competition to control Curve’s gauge voting and CRV emissions — became one of DeFi’s defining political dynamics in 2021–2022.

> PDF hosting: The StableSwap paper is at curve.fi/files/stableswap-paper.pdf.


Publication and Context

Egorov has a physics PhD from Moscow Institute of Physics and Technology and was previously CEO of NuCypher (a cryptographic access control network). He published the StableSwap paper independently, then launched Curve in January 2020.

The key motivation: Uniswap’s x·y=k constant product formula was effective for volatile asset pairs but extremely inefficient for stablecoins. When trading DAI for USDC (both worth $1.00), Uniswap’s curve would price in substantial slippage even for moderate trades. Egorov’s insight was that a different mathematical curve — one that behaves like a constant-sum formula near the equilibrium price but falls back to constant-product away from it — would dramatically improve stablecoin liquidity.


The StableSwap Invariant

The constant-sum formula (x + y = C) has zero slippage at equal prices but fails when reserves deplete (one asset could go to zero). The constant-product formula (x·y = k) always maintains positive reserves but has high slippage near equal prices.

StableSwap combines them:

$$A cdot n^n cdot sum x_i + D = A cdot D cdot n^n + frac{D^{n+1}}{n^n cdot prod x_i}$$

Where:

  • $x_i$ are the balances of each asset in the pool
  • $D$ is the total liquidity (sum of balances when all assets are at 1:1 parity)
  • $A$ is the amplification coefficient — a parameter controlling how “flat” the curve is near equilibrium
  • $n$ is the number of assets in the pool

When balances are near equal ($x_i approx D/n$), the formula behaves close to constant-sum (very low slippage). When balances diverge significantly, it falls back toward constant-product behavior (preserving liquidity).

The amplification coefficient A:

  • High A → curves flatter near peg → lower slippage for balanced pools, but dangerous if peg breaks (little resistance to reserve depletion)
  • Low A → closer to constant-product → more slippage but more resilient
  • A is set by Curve governance per pool based on the stability characteristics of the assets

Multi-Asset Pools

The StableSwap formula generalizes to N assets. This enabled:

  • 3pool (TriPool): DAI + USDC + USDT — the most liquid stablecoin pool in DeFi
  • stETH pool: ETH + stETH (essentially a peg between liquid ETH and Lido’s staked ETH)
  • tricrypto: A generalization (Curve v2) for volatile assets

The 3pool became the standard stablecoin benchmark — its composition and CRV yield levels influenced stablecoin issuers directly.


Curve v2: CryptoSwap

In 2021, Egorov published a companion paper for Curve v2 (CryptoSwap) — extending StableSwap to volatile asset pairs. CryptoSwap uses an adaptive invariant that moves its “equilibrium price” (the price around which liquidity is concentrated) to track market prices. This provides concentrated liquidity similar to Uniswap v3 but with automatic rebalancing.


veCRV and The Curve Wars

Curve launched the CRV token in August 2020. veCRV (vote-escrowed CRV) is earned by locking CRV for up to 4 years:

  • veCRV holders vote on which liquidity pools receive CRV emissions (gauge weights)
  • Protocols that want cheap liquidity on Curve must accumulate veCRV to boost their pool’s emissions
  • This spawned the Curve Wars: Convex Finance, Yearn Finance, StakeDAO, and others competed to accumulate veCRV on behalf of their token holders

The veCRV model became a widely copied governance mechanism (Balancer’s veBAL, Velodrome, Frax, etc.).


Reality Check

In summer 2023, the Curve ecosystem suffered a serious crisis:

  • Reentrancy vulnerabilities in Curve’s Vyper compiler affected several pools; ~$70M was drained
  • Michael Egorov had borrowed ~$108M in stablecoins from multiple protocols (Aave, Frax, Abracadabra) using CRV as collateral — creating systemic risk across DeFi
  • A coordinated OTC CRV sale at below-market prices rescued Egorov’s positions

Despite the crisis, Curve’s core contracts (deployed before the Vyper bug) were unaffected, and the protocol continues operating.


Legacy

The StableSwap invariant is one of the most significant mathematical contributions in DeFi. Balancer adapted it; pools on virtually every AMM protocol have incorporated elements of the StableSwap curve for correlated assets. The veCRV governance model pioneered a new category of “veToken wars” that defined DeFi governance dynamics.


Related Terms


Research

  • Egorov, M. (2019). StableSwap — Efficient mechanism for Stablecoin Liquidity. curve.fi.

— Primary source. Section 2 derives the StableSwap invariant from first principles.

  • Angeris, G., et al. (2021). Improved Price Oracles: Constant Function Market Makers. ACM AFT 2020.

— Theoretical analysis of AMM invariants; places StableSwap in the broader CFMM taxonomy.

  • Egorov, M. (2021). Automatic Market Making with Dynamic Peg. curve.fi.

— The Curve v2 (CryptoSwap) paper; describes the volatile asset extension to StableSwap.