Constant Sum Market Maker (CSMM)
A constant sum market maker is an AMM where the sum of token reserves stays constant, providing zero-slippage trades but risking total depletion.
Key Takeaways
- A constant sum market maker uses the invariant x + y = k, producing a linear price curve that offers zero slippage regardless of trade size.
- Pure CSMMs are impractical for open markets because arbitrageurs can drain the entire pool when the external price diverges from the pool's fixed exchange rate.
- Hybrid designs like StableSwap blend constant-sum and constant-product curves to get low slippage near the peg while preventing total reserve depletion.
What Is a Constant Sum Market Maker?
A constant sum market maker (CSMM) is a type of constant function market maker that uses the formula x + y = k to determine token prices. In this equation, x and y represent the reserve quantities of two tokens in a liquidity pool, and k is a constant set when liquidity is first deposited. The constant k changes only when a liquidity provider adds or removes tokens from the pool.
Because the relationship between reserves is linear, the exchange rate between the two tokens is always 1:1. Swapping one unit of token X always yields exactly one unit of token Y, regardless of how large the trade is. This makes CSMMs conceptually the simplest type of automated market maker, but also the most fragile in practice.
The CSMM model is primarily studied as a theoretical building block and as a component within hybrid curve designs. No major decentralized exchange uses a pure CSMM for open trading due to the depletion risk described below.
How It Works
The constant sum invariant defines a straight line when plotted with token X reserves on one axis and token Y reserves on the other. Every valid pool state must lie somewhere on this line, from (0, k) at one extreme to (k, 0) at the other.
The Linear Price Curve
In a constant-product AMM (x · y = k), the price of each token changes with every trade because the curve is a hyperbola. Larger trades move the price more, creating slippage. In a CSMM, the curve is a straight line with a slope of -1:
// Constant Sum invariant
x + y = k
// For a swap of Δx tokens in:
// New reserves: (x + Δx) and (y - Δy)
// Invariant must hold: (x + Δx) + (y - Δy) = k
// Therefore: Δy = Δx
// The output always equals the input (before fees)
// Price = Δy / Δx = 1 (constant for any trade size)This means every unit of token X exchanged always returns exactly one unit of token Y. There is no price impact, no slippage, and no advantage to splitting a trade into smaller pieces.
Reserve Boundaries
The linear invariant imposes hard boundaries on the pool. Reserves for each token range from 0 to k:
- When x = 0 and y = k, the pool holds only token Y and cannot sell more Y
- When x = k and y = 0, the pool holds only token X and cannot sell more X
- When x = y = k/2, the pool is perfectly balanced
Unlike a constant-product curve, which asymptotically approaches zero without reaching it, the CSMM curve actually reaches zero. A single sufficiently large trade can completely drain one side of the pool.
Comparison to Other Invariants
| Property | Constant Sum (x + y = k) | Constant Product (x · y = k) |
|---|---|---|
| Curve shape | Straight line | Hyperbola |
| Price impact | Zero (fixed rate) | Increases with trade size |
| Slippage | None | Proportional to trade size vs. pool depth |
| Reserve depletion | Possible (one side can reach zero) | Impossible (asymptotic) |
| Arbitrage resistance | None (stale price is exploitable) | Self-correcting (price adjusts with trades) |
| Best suited for | Pegged assets at stable ratio | Volatile token pairs |
The Depletion Problem
The fundamental flaw of a pure CSMM is that it cannot adjust its price in response to market conditions. If the external market price of token X rises above the pool's fixed 1:1 rate, arbitrageurs will buy all of the underpriced token X from the pool, paying with the less valuable token Y. Because there is no price curve to push back, a single arbitrageur can drain the entire reserve of the more valuable token in one transaction.
Consider a pool with 1,000 USDC and 1,000 USDT (k = 2,000). If USDT trades at $0.98 on external markets while the CSMM still prices them 1:1, an arbitrageur can deposit 1,000 USDT (worth $980) and withdraw all 1,000 USDC (worth $1,000), capturing $20 in risk-free profit. After this trade, the pool holds 2,000 USDT and 0 USDC: it is completely depleted on one side and can no longer function as a two-sided market.
This is fundamentally different from a constant-product pool, where each successive unit of the scarce token costs exponentially more, making full depletion mathematically impossible.
Hybrid Approaches
Because pure CSMMs fail under real market conditions, protocol designers use them as one component within hybrid curves that blend constant-sum and constant-product behavior.
StableSwap (Curve Finance)
The most successful hybrid is StableSwap, introduced by Michael Egorov in November 2019 for Curve Finance. StableSwap uses an amplification coefficient (A) to blend the constant-sum and constant-product invariants into a single curve:
- When reserves are near balance (both tokens close to k/2), the curve behaves like a constant sum, giving near-zero slippage for pegged-asset swaps
- As reserves become imbalanced, the curve transitions toward constant-product behavior, increasing slippage and making full depletion prohibitively expensive
- The A parameter controls how wide the low-slippage zone is: higher A means more constant-sum-like behavior near the peg, lower A means more constant-product-like behavior
This hybrid design is what makes StableSwap pools so effective for trading between stablecoins and other pegged assets. Traders get minimal slippage under normal conditions, while liquidity providers are protected from total depletion during depeg events.
Other Hybrid Designs
Several other approaches incorporate constant-sum segments:
- Constant mean market makers generalize the formula to weighted geometric means, allowing pools with unequal token ratios
- Power-root curves use exponents between 0 and 1 to create curves that sit between constant sum and constant product, sharing the same depletion point as CSMM
- Concentrated liquidity positions in protocols like Uniswap v3 can approximate constant-sum behavior within narrow price ranges
Use Cases
Despite being impractical in pure form, the constant sum model has specific applications where the depletion risk is managed or irrelevant:
- Pegged asset pools: when two tokens are tightly pegged (USDC/USDT, stETH/ETH), the constant-sum segment of a hybrid curve provides near-zero-cost swaps under normal conditions
- Closed or permissioned systems: in environments where arbitrage is restricted or the price is guaranteed by an external mechanism, a pure CSMM can function safely
- Theoretical foundation: CSMMs serve as a baseline model in academic research for analyzing AMM properties such as capital efficiency, impermanent loss, and arbitrage dynamics
- Educational tools: the simplicity of x + y = k makes it an effective starting point for teaching how AMMs work before introducing more complex invariants
Why It Matters
Understanding the constant sum model is essential for grasping why different AMM designs exist. The CSMM represents one extreme of the design space: perfect execution quality (zero slippage) at the cost of zero resilience to price deviations. The constant-product model represents the other extreme: guaranteed liquidity at all prices, but with slippage that grows with trade size.
Every modern AMM design can be understood as a point on this spectrum. StableSwap pools sit close to the constant-sum end for pegged assets. Uniswap v3's concentrated liquidity lets providers choose their own position on the curve. For a deeper look at how these market structures compare, see the Uniswap v4 hooks and DeFi payments research article.
For builders integrating token swaps into Bitcoin-native applications, the tradeoffs between slippage, depletion risk, and capital efficiency directly influence which curve model to adopt. Protocols building on layers like Spark can evaluate whether pegged-asset swaps (favoring constant-sum behavior) or volatile-pair trading (favoring constant-product) better serves their users.
Risks and Considerations
Total Reserve Depletion
The defining risk of a pure CSMM is that the pool can be completely drained of one token. Unlike constant-product pools where depletion is asymptotically impossible, a CSMM has no price cushion. A single large trade can extract every unit of the more valuable token, leaving liquidity providers holding only the less valuable asset.
No Price Discovery
A CSMM does not perform price discovery. Its exchange rate is fixed at 1:1 regardless of supply, demand, or external market conditions. This means the pool cannot adapt to new information and will always trade at a stale price when the true market rate shifts.
Impermanent Loss Becomes Permanent
In a constant-product AMM, impermanent loss is bounded and partially reverses if prices return to their original ratio. In a CSMM, once arbitrageurs drain one side of the pool, liquidity providers have lost their entire position in the depleted token. There is no mechanism for recovery, making the loss permanent.
Dependence on External Price Stability
Any deployment of constant-sum logic assumes that the traded assets will maintain their pegged ratio. When this assumption breaks (as in a stablecoin depeg), even hybrid designs with constant-sum components can expose liquidity providers to significant losses as the pool absorbs the depegging asset.
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.