Glossary

Stable Swap

A stable swap is a DEX mechanism optimized for trading assets of similar value, using a specialized curve to minimize slippage.

Key Takeaways

  • A stable swap is a DEX mechanism that uses a hybrid bonding curve to minimize slippage when trading assets that should hold the same value, such as stablecoins pegged to the U.S. dollar.
  • The StableSwap invariant, introduced by Curve Finance in 2019, combines the constant-product formula with a constant-sum formula, controlled by an amplification factor (A) that determines how flat the curve is around the peg.
  • Compared to standard AMM designs, stable swap pools achieve roughly 100x better execution for same-peg assets, making them the backbone of stablecoin swap infrastructure across DeFi.

What Is a Stable Swap?

A stable swap is a decentralized exchange mechanism specifically designed for trading assets that are expected to maintain a similar price. Standard AMMs like Uniswap V2 spread liquidity uniformly across all possible prices from zero to infinity. For assets that should trade at 1:1 (like USDC and USDT), this design wastes the vast majority of capital: most liquidity sits at price ranges that will never be used.

The StableSwap invariant, published by Michael Egorov in his November 2019 whitepaper for Curve Finance, solves this by concentrating liquidity around the expected peg price. The result is near-zero slippage for balanced trades while still protecting against complete pool drainage if one asset loses its peg.

Stable swap pools now underpin much of DeFi's stablecoin plumbing. DEX aggregators consistently route stablecoin trades through Curve and similar protocols, and protocol treasuries rely on these pools for large, low-impact conversions between dollar-denominated assets.

How It Works

The StableSwap invariant is a hybrid of two primitive AMM formulas:

  • Constant-sum: x + y = D. This gives zero slippage but allows the pool to be fully drained of one asset, making it unsafe on its own.
  • Constant-product: x × y = k (the Uniswap V2 formula). This prevents drainage but produces high slippage, especially for large trades.

The StableSwap invariant blends these two formulas using a dynamic leverage factor (chi) that shifts based on how balanced the pool is. When the pool is balanced, the curve behaves like a constant-sum (flat, low slippage). As the pool becomes imbalanced, the curve transitions toward constant-product behavior (steep, preventing drainage).

The StableSwap Invariant

The full invariant for a pool of n tokens with balances x_i and amplification coefficient A is:

A * n^n * sum(x_i) + D = A * D * n^n + D^(n+1) / (n^n * prod(x_i))

Where:
  A    = amplification coefficient (controls curve shape)
  n    = number of tokens in the pool
  x_i  = balance of token i
  D    = invariant (total "virtual balance" when perfectly balanced)

The equation cannot be solved analytically, so implementations use Newton's method to iteratively converge on the correct output amount for each swap.

The Amplification Factor (A)

The amplification coefficient A is the single most important parameter in a stable swap pool. It controls the width of the low-slippage zone around the peg:

  • High A (100 to 2000): the curve is flatter across a wider range of reserve ratios, approximating constant-sum behavior. Best for tightly pegged assets like USDC/USDT/DAI. Curve's 3pool uses A = 2000.
  • Low A (1 to 10): the curve behaves more like a constant-product AMM. Better for loosely correlated assets like stETH/ETH, where small deviations from 1:1 are expected.
  • A = 0: pure constant-product (equivalent to Uniswap V2).

The trade-off is straightforward: higher A means less slippage when the pool is balanced, but if a depeg occurs, LPs absorb more of the depegging asset at near-par prices before the curve steepens. This concentrates losses during depeg events.

Slippage Comparison

The difference in execution quality between StableSwap and constant-product AMMs is dramatic for same-peg assets:

MetricUniswap V2 (x × y = k)Curve StableSwap
Average slippage~0.30%~0.004%
$10M trade on $50M pool~11.05% total cost~0.043% total cost
Capital utilization~1.3% (spread across all prices)Near 100% (concentrated at peg)

For large stablecoin swaps, StableSwap achieves roughly two orders of magnitude better execution. The advantage narrows for small trades and widens dramatically for larger ones.

Use Cases

Stablecoin-to-Stablecoin Swaps

The flagship use case. Curve's 3pool (USDC/USDT/DAI) is one of the deepest liquidity pools in DeFi. Arbitrageurs, protocol treasuries, and aggregators route through it for large stablecoin conversions with minimal price impact. Metapools pair new stablecoins against 3pool LP tokens, enabling routing from any stablecoin to any other via a two-hop path.

Liquid Staking Derivative Swaps

Assets like stETH (Lido's staked ETH derivative) trade at a soft peg to ETH. Before Ethereum's Shapella upgrade enabled direct withdrawals, Curve's stETH/ETH pool was the primary exit liquidity for staked ETH positions. These pools typically use lower A values (50 to 100) since liquid staking derivatives can deviate further from their peg than stablecoins.

Cross-Stablecoin Routing

DeFi protocols that need to convert between stablecoins (for yield strategies, treasury management, or on-chain forex operations) rely on stable swap pools as core infrastructure. DEX aggregators like 1inch and CoW Swap consistently route stablecoin trades through Curve when it offers the best execution.

Wrapped and Synthetic Asset Swaps

Any pair of assets expected to hold the same value benefits from StableSwap mechanics: wBTC/renBTC, FRAX/USDC, and other pegged pairs all use this design to reduce trading costs for their holders.

Why It Matters

Stable swap pools are critical infrastructure for the stablecoin economy. As stablecoin supply has grown past $160 billion, efficient conversion between different dollar-denominated tokens has become essential for everything from peg maintenance to cross-protocol composability.

For payment infrastructure built on stablecoins, stable swap pools serve as the connective tissue between different issuers. A payment platform that accepts USDC but needs to settle in USDT can route through a stable swap pool with minimal friction. This interoperability is what allows the stablecoin swap market to function as a unified liquidity layer rather than a set of isolated token silos.

The StableSwap design has been widely adopted beyond Curve. PancakeSwap added StableSwap pools on BNB Chain, Ellipsis Finance launched as an authorized Curve fork, and Saddle Finance reimplemented the invariant in Solidity (becoming one of the most-forked DeFi projects). Curve itself released StableSwapNG in late 2023, supporting up to 8 tokens per pool, dynamic fees, and yield-bearing rebasable tokens.

Risks and Considerations

Depeg Amplification

The same property that makes StableSwap efficient (a flat curve around the peg) becomes a liability during depeg events. With a high A value, the pool absorbs large quantities of the depegging asset at near-1:1 prices before the curve steepens. LPs end up concentrated in the failing token.

The May 2022 UST collapse illustrated this risk. After Terraform Labs withdrew 150 million UST from Curve's 3pool, a large sell order triggered an imbalance that cascaded into UST's full depeg. The pool's efficiency became a single point of failure for a fragile peg.

Impermanent Loss on Permanent Depeg

Standard impermanent loss in AMMs is temporary if prices revert. In stable swap pools, if one asset permanently depegs, LPs suffer concentrated losses: the pool rebalances heavily toward the worthless token, and the "impermanent" loss becomes permanent.

Smart Contract Risk

In July 2023, several Curve pools were drained of approximately $50 to $70 million due to a reentrancy bug in the Vyper compiler (versions 0.2.15, 0.2.16, and 0.3.0). The vulnerability was not in the StableSwap math itself but in the compiler that generated the smart contract bytecode. The incident demonstrated that mathematical soundness does not guarantee implementation safety.

Liquidity Concentration Risk

Because stable swap pools offer the best execution for pegged assets, they attract deep dependencies from aggregators, protocols, and treasuries. If a major pool drains or is exploited, downstream protocols that depend on it for routing or peg maintenance can suffer cascading failures.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.