DeFi & AMM

Invariant Curve (StableSwap)

The pricing curve used by Curve Finance for stablecoin AMMs, maintaining near-peg prices with minimal slippage.

Invariant Curve (StableSwap) — An invariant curve is the mathematical formula that defines the pricing relationship between assets in an automated market maker (AMM) pool. The curve determines how token prices change with each trade and governs the pool's capital efficiency, slippage characteristics, and suitability for different asset types.

How It Works

Every AMM pool operates according to an invariant — a mathematical relationship between the pool's token reserves that must hold true before and after every trade. The simplest and most common is the constant product formula (x * y = k), used by Uniswap v2, where the product of the two token reserves must remain constant. When a trader buys token X, the pool's X reserve decreases and Y reserve increases, but their product stays the same.

Different invariant curves produce dramatically different trading characteristics. Curve Finance's StableSwap invariant combines constant product and constant sum formulas, creating near-zero slippage for trades between similarly-priced assets (like stablecoins). Concentrated liquidity in Uniswap v3 allows LPs to deploy capital along specific segments of the price curve, improving capital efficiency by up to 4,000x for narrow ranges.

More exotic invariants include Balancer's weighted constant product (supporting pools with custom weight ratios like 80/20), Solidly's x^3*y + x*y^3 = k for correlated pairs, and Meteora's DLMM which uses discrete price bins rather than a continuous curve.

Why It Matters in DeFi

The choice of invariant curve directly determines slippage, capital efficiency, and impermanent loss characteristics. A constant product AMM works universally but is capital-inefficient — most liquidity sits unused far from the current price. A StableSwap curve is highly efficient for pegged assets but would mispriced volatile pairs catastrophically.

Understanding invariant curves helps traders predict price impact before executing large trades and helps liquidity providers choose the right pool type for their risk profile. It is also the technical foundation for comparing AMM designs across the DeFi ecosystem.

Real-World Example

Swapping $100,000 USDC to USDT on a constant product AMM (Uniswap v2-style) with $10 million TVL would incur roughly 1% slippage. The same swap on Curve Finance's StableSwap pool with the same TVL would incur approximately 0.01% slippage — a 100x improvement — because the StableSwap invariant concentrates liquidity around the 1:1 price ratio where stablecoins naturally trade.

Common questions about Invariant Curve (StableSwap) in cryptocurrency and DeFi.

The constant product formula (x * y = k) is the most widely used invariant. Uniswap v2, SushiSwap, PancakeSwap, and most basic AMMs use this curve. It is simple, robust, and works for any token pair, but it is not capital-efficient for correlated assets.

Yes. Curve Finance's StableSwap is actually a hybrid that blends the constant product and constant sum formulas using an amplification parameter. Some newer AMMs dynamically adjust their invariant based on market conditions or oracle prices.

The curve shape determines how pool reserves shift with price changes. Constant product AMMs expose LPs to standard impermanent loss. Concentrated liquidity amplifies both fees and impermanent loss within the selected range. StableSwap curves minimize impermanent loss for pegged assets but amplify it if the peg breaks.

Ready to put your knowledge into practice?

Start Boosting