Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Constant Sum Market Maker (CSMM)

An Automated Market Maker (AMM) model that maintains a constant price between two assets using the invariant x + y = k, but risks complete liquidity loss for one asset.
Chainscore © 2026
definition
DEFINITION

What is Constant Sum Market Maker (CSMM)?

A Constant Sum Market Maker (CSMM) is a type of automated market maker (AMM) algorithm that maintains a constant sum of the reserves of two assets in a liquidity pool, ensuring a fixed, stable exchange rate between them.

A Constant Sum Market Maker (CSMM) is an automated market maker (AMM) algorithm designed for trading pairs where a stable, 1:1 exchange rate must be maintained. Unlike other AMM models like the Constant Product Market Maker (CPMM), which uses the formula x * y = k, a CSMM operates on the principle x + y = k, where x and y represent the reserves of two assets and k is a constant. This linear bonding curve ensures zero price slippage for trades as long as both assets remain in the pool, making it theoretically ideal for trading stablecoin pairs like USDC/DAI.

The primary mechanism of a CSMM is its ability to offer perfect price stability within its liquidity bounds. Because the sum of the reserves is constant, a trader can swap one asset for the other at a fixed rate of 1:1 without affecting the price for subsequent trades. However, this model carries a critical vulnerability: depletion risk. If arbitrageurs do not correct price deviations from the external market, the pool can be completely drained of one asset, rendering it insolvent and unable to honor the fixed exchange rate. This makes pure CSMMs rare in practice for decentralized finance (DeFi).

In real-world DeFi applications, the pure CSMM model is often combined with other mechanisms to mitigate its risks. For example, Curve Finance employs a hybrid StableSwap invariant that blends characteristics of both the constant sum (x + y) and constant product (x * y) formulas. This creates a mostly flat curve near the peg for efficient stablecoin trading with minimal slippage, while the product component introduces curvature at the edges of the liquidity range to prevent total reserve depletion and provide infinite liquidity depth.

The CSMM concept is foundational for understanding automated liquidity provision and the design space of AMMs. Its key differentiators are its zero-slippage property within a range and its specific bonding curve shape. While its pure form is fragile, its principles are essential in specialized AMMs optimized for correlated assets, where maintaining a tight peg to an external price (like between two stablecoins or wrapped versions of the same asset) is the primary goal.

how-it-works
MECHANISM

How a Constant Sum Market Maker Works

A technical breakdown of the automated market maker (AMM) model that maintains a constant sum of asset reserves, enabling stable price trading.

A Constant Sum Market Maker (CSMM) is an automated market maker (AMM) model where the smart contract enforces that the sum of the reserves of two assets in its liquidity pool remains constant, expressed as x + y = k. This formula creates a zero-slippage trading environment, as the price of one asset in terms of the other is fixed at a 1:1 ratio, typically used for trading stablecoin pairs like USDC/DAI. Unlike the curved bonding functions of other AMMs, the CSMM's linear invariant means trades can be executed at a predictable, constant price until one of the reserves is completely depleted, leading to a state of pool imbalance.

The core mechanism relies on the invariant k. When a trader swaps asset x for asset y, the smart contract deducts the requested amount of y from the pool and adds a mathematically equivalent amount of x to ensure the sum x + y still equals the constant k. This results in a flat price curve, which is ideal for assets intended to hold equal value. However, this design introduces a critical vulnerability: if the external market price of the paired assets diverges, arbitrageurs are not incentivized to correct the imbalance, as there is no price gradient to exploit. Instead, liquidity providers (LPs) face divergent loss as one reserve is drained entirely.

Due to this fragility, pure CSMMs are rarely used in practice for general trading. Their primary application is in specialized stablecoin swaps and as a component within more complex, multi-function AMMs like Curve Finance, which combines a constant sum invariant with a constant product invariant (x * y = k) to create a "stable swap" with low slippage near the peg but protection against complete drainage. This hybrid model allows for efficient trading of pegged assets while mitigating the risk of a depleted liquidity pool that plagues the pure constant sum design.

key-features
MECHANICAL PROPERTIES

Key Features of CSMMs

Constant Sum Market Makers (CSMMs) are defined by a bonding curve that maintains a fixed sum of asset reserves, creating unique trading properties distinct from other AMM types.

01

Constant Price Invariance

The core mechanism of a CSMM is the bonding curve defined by the equation x + y = k, where x and y are the reserves of two assets and k is a constant. This enforces a fixed 1:1 exchange rate between the assets, regardless of trade size or pool composition. The price is always the slope of the curve, which is -1.

02

Zero Slippage

Because the exchange rate is fixed, trades on a CSMM experience zero price slippage. A user can swap any amount of one asset for an exactly proportional amount of the other, as long as the pool has sufficient reserves. This is a critical feature for stablecoin pairs (e.g., USDC/DAI) where assets are intended to maintain parity.

03

Reserve Depletion Risk

The primary drawback of the constant-sum model is the risk of complete reserve depletion. If the fixed price diverges from the external market price, arbitrageurs will drain the cheaper asset from the pool until its reserve hits zero, rendering the pool insolvent and unable to fulfill trades. This makes "pure" CSMMs impractical for most volatile asset pairs.

04

StableSwap Hybrids

To mitigate depletion risk, real-world implementations like Curve Finance use a hybrid Constant Product / Constant Sum invariant. This creates a "flatter" curve near parity (low slippage like a CSMM) that smoothly transitions to a constant product curve (like Uniswap's x * y = k) as trades move away from the peg, protecting liquidity.

05

Ideal Use Case: Pegged Assets

CSMM mechanics are optimally designed for trading assets with a fixed price relationship. Primary examples include:

  • Stablecoin pairs (USDT/USDC, DAI/USDC)
  • Wrapped asset pairs (wBTC/renBTC, stETH/ETH)
  • Tokenized versions of the same asset across different chains
06

Impermanent Loss Dynamics

In a pure CSMM, impermanent loss does not exist for assets maintaining their peg, as the pool's value remains constant (k). However, if the external price diverges, LPs face a certain loss as arbitrageurs drain the undervalued asset. In hybrid models like StableSwap, impermanent loss is minimized but not eliminated when the peg holds.

examples
CONSTANT SUM MARKET MAKER

Examples and Use Cases

While less common than other AMM models, Constant Sum Market Makers (CSMMs) are the optimal mechanism for specific, price-stable trading pairs. Their unique properties enable precise use cases where maintaining a fixed exchange ratio is paramount.

01

Stablecoin-to-Stablecoin Pools

The primary application for a CSMM is trading between pegged assets like stablecoins (e.g., USDC, DAI, USDT). The constant sum invariant (x + y = k) ensures the price remains exactly 1:1, allowing for zero-slippage swaps of equal value. This is critical for:

  • Arbitrage: Efficiently balancing stablecoin liquidity across protocols.
  • Portfolio Rebalancing: Swapping between stable assets without price impact.
02

Wrapped Asset Bridges

CSMMs facilitate the minting and redeeming of wrapped tokens (e.g., wBTC, wETH) that represent assets from another blockchain. The pool holds the native asset (like BTC in custody) and the wrapped version. The 1:1 pricing ensures:

  • Trustless 1:1 Peg: Users can mint or burn the wrapped token at the exact underlying asset's value.
  • Bridge Liquidity: Provides immediate, slippage-free liquidity for the bridge's core mint/redeem function.
03

Rebalancing Index Funds / Baskets

CSMMs can model a tokenized basket of assets designed to maintain a specific weight. For example, a pool representing a 50/50 ETH/BTC index. The invariant ensures the total value of the basket (k) is constant, so minting a basket token deposits the correct proportional amounts, and redeeming it returns them. This enables:

  • Precise Creation/Redemption: For index tokens or ETF-like products.
  • Automated Portfolio Management: Maintaining fixed asset allocations.
04

The Impermanent Loss & Depletion Problem

This card highlights the critical limitation of CSMMs. Because price is fixed, any external market price deviation creates a risk-free arbitrage opportunity. Arbitrageurs will drain the pool of the undervalued asset until it is completely depleted, leaving only the overvalued asset. This makes CSMMs unsuitable for most volatile trading pairs. It demonstrates why Constant Product Market Makers (CPMMs) like Uniswap are dominant for general trading.

05

Comparison: CSMM vs. CPMM (Uniswap)

Contrasting the two core AMM models clarifies their design trade-offs.

  • CSMM (x + y = k): Price = 1. Zero slippage at pegged price. Vulnerable to depletion if peg breaks. Ideal for stable/pegged pairs.
  • CPMM (x * y = k): Price = y/x. Slippage increases with trade size. Provides infinite liquidity (asymptotic curves). Ideal for volatile/exploratory price discovery. This shows that CSMMs are a specialized tool, not a general-purpose AMM.
COMPARISON

CSMM vs. Other AMM Models

A feature and mechanism comparison of the Constant Sum Market Maker (CSMM) against the Constant Product (CPMM) and Hybrid AMM models.

Feature / MechanismConstant Sum (CSMM)Constant Product (CPMM)Hybrid (e.g., Curve, StableSwap)

Core Pricing Formula

x + y = k

x * y = k

A * (x + y) + D = A * D * n^n + D^(n+1) / (Π x_i)

Primary Use Case

Stablecoin/pegged asset pairs

Volatile/uncorrelated asset pairs

Stable/pegged or correlated asset pairs

Price Stability

Absolute (zero slippage within reserves)

Variable (price impacts reserve changes)

Targeted (low slippage near peg)

Impermanent Loss Risk

None (for perfectly pegged assets)

High (for volatile pairs)

Low (for assets near peg)

Liquidity Provider Fee

Typically 0% (or minimal)

Typically 0.3%

Typically 0.04%

Capital Efficiency

Low (reserves can be fully depleted)

Medium

High (amplified virtual reserves)

Oracle Dependency

Often required for rebalancing

Not required

Not required for core function

Example Implementation

mStable (mUSD), early DEX designs

Uniswap V2, SushiSwap

Curve Finance, Balancer Stable Pools

security-considerations
CONSTANT SUM MARKET MAKER (CSMM)

Security Considerations and Vulnerabilities

While CSMMs provide perfect price stability for pegged assets, their rigid mathematical model introduces distinct security and operational risks that differ from other AMM types.

01

Complete Reserve Draining (Divergence Loss)

The primary vulnerability of a CSMM is the risk of a complete reserve drain. Unlike Constant Product Market Makers (CPMMs) which have infinite liquidity depth, a CSMM's price remains fixed until one of its token reserves is fully depleted. An arbitrageur can execute a single, large trade to extract all of one asset, leaving the pool insolvent and unable to honor the peg for subsequent trades. This is an extreme form of impermanent loss (more accurately termed divergence loss) that results in a total loss for liquidity providers in the depleted asset.

02

Oracle Dependency & Manipulation

To maintain its peg in a volatile market, a CSMM must frequently rebalance its reserves by adding or removing liquidity. This rebalancing is typically triggered by an external price oracle. This creates a critical dependency:

  • Oracle Failure: A stale or incorrect price feed will cause the CSMM to rebalance incorrectly, either locking in losses or failing to defend the peg.
  • Oracle Manipulation: An attacker may manipulate the oracle price (e.g., via a flash loan attack on the reference market) to trigger a favorable but economically unjustified rebalance, profiting at the expense of the pool.
03

Liquidity Provider (LP) Risks

Providing liquidity to a CSMM carries asymmetric risks:

  • Capital Inefficiency: LPs must deposit large amounts of both assets to defend the peg against arbitrage, often for minimal fee revenue due to low volatility near the peg.
  • Asymmetric Loss Exposure: In a depeg scenario, LPs are exposed to 100% loss on the side of the pool that is drained. The promised "zero impermanent loss" only holds if the peg is perfectly maintained.
  • Rebalancing Slippage: When the protocol automatically rebalances, LPs may incur transaction costs and slippage, eroding their capital.
04

Smart Contract & Economic Attacks

CSMM implementations are susceptible to standard DeFi attack vectors, amplified by their mechanics:

  • Flash Loan Exploits: Attackers can borrow vast sums to drain a reserve in one transaction before the oracle can update or rebalancing can occur.
  • Governance Attacks: If the pool parameters (like the peg ratio or oracle address) are governed by a token, an attacker could seize control and alter them to drain funds.
  • Front-Running: Bots can front-run rebalancing transactions or large arbitrage trades to extract value from LPs and regular users.
05

Comparison to CPMM (Uniswap v2)

Contrasting CSMM security with the ubiquitous Constant Product Market Maker (x*y=k) highlights their trade-offs:

  • Liquidity Depth: CPMMs have theoretically infinite liquidity, preventing total drain but exposing LPs to continuous divergence loss. CSMMs have finite, drainable liquidity but target zero divergence loss.
  • Attack Surface: CPMMs are vulnerable to sandwich attacks and MEV on every trade. CSMMs are more vulnerable to oracle attacks and single-transaction reserve depletion.
  • Stability: CPMMs are self-balancing for any asset pair. CSMMs require active oracle-driven management to maintain stability for pegged assets.
06

Mitigation Strategies & Hybrid Models

Protocols implement several designs to mitigate CSMM risks:

  • Dynamic Fees: Increasing fees as reserves deplete to slow down a bank run.
  • Circuit Breakers: Halting trades if a reserve falls below a critical threshold.
  • Hybrid AMMs (Stableswap): Models like Curve's Stableswap combine CSMM and CPMM curves, acting as a CSMM near the peg (for low slippage) and transitioning to a CPMM near the edges (to prevent total drain).
  • Over-Collateralization & Insurance: Requiring reserves above 100% or using insurance funds to cover minor depeg events.
evolution
FROM THEORY TO PRACTICE

Evolution and Modern Relevance

While foundational, the Constant Sum Market Maker (CSMM) model's strict price stability is both its core strength and its primary limitation in the volatile world of decentralized finance.

The Constant Sum Market Maker (CSMM) is an automated market maker (AMM) model where the sum of the reserves of two assets in a liquidity pool remains constant, enforcing a fixed, 1:1 exchange rate. This model, derived from the bonding curve formula x + y = k, is designed for perfect price stability between pegged assets like different stablecoins (e.g., USDC and DAI) or wrapped versions of the same asset (e.g., wBTC and renBTC). Its primary historical application was in early decentralized exchanges seeking to minimize slippage for correlated assets, but its rigidity led to significant vulnerabilities.

The model's critical flaw is its susceptibility to depletion attacks or pool draining. Because the price is fixed regardless of external market conditions, if the external market price deviates even slightly from the pool's 1:1 peg, arbitrageurs can profitably drain the entire reserve of one asset from the pool, leaving it with only the less valuable asset and rendering it insolvent. This impermanent loss scenario is permanent and catastrophic for CSMMs, unlike the bounded, temporary impermanent loss experienced in Constant Product Market Makers (CPMMs) like Uniswap v2.

Consequently, pure CSMMs are rarely used as standalone AMMs in modern DeFi. Their evolution has been toward hybrid models that incorporate their stability benefits while mitigating risks. For example, Curve Finance's StableSwap invariant combines the constant sum and constant product formulas, creating a "levered" curve that approximates a CSMM within a narrow price range (e.g., around the $1 peg for stablecoins) but smoothly transitions to a CPMM at the boundaries to protect liquidity and prevent pool depletion. This hybrid approach provides extremely low slippage for correlated trades while maintaining economic security.

The modern relevance of the CSMM concept lies in its foundational role in structured liquidity and concentrated liquidity products. It serves as the theoretical ideal for zero-slippage swaps, which advanced AMMs now approximate within specific, user-defined price ranges. Understanding the CSMM is essential for developers designing new AMM mechanisms and for liquidity providers to comprehend the fundamental trade-offs between price stability, capital efficiency, and risk exposure in different market-making models.

CONSTANT SUM MARKET MAKER

Frequently Asked Questions (FAQ)

A Constant Sum Market Maker (CSMM) is a type of automated market maker (AMM) that uses a simple sum formula to maintain a fixed price between two assets. This section answers common technical and practical questions about its design, use cases, and limitations.

A Constant Sum Market Maker (CSMM) is an automated market maker (AMM) model where the sum of the reserves of two tokens in a liquidity pool is held constant, resulting in a fixed, stable exchange rate between them. The core formula is x + y = k, where x and y are the reserve amounts of the two tokens, and k is a constant. Unlike the more common Constant Product Market Maker (CPMM) used by Uniswap (x * y = k), this model eliminates price slippage for trades within the pool's liquidity bounds, as the price is always 1:1. This makes CSMMs ideal for trading pegged assets like different stablecoins (e.g., USDC and DAI) or wrapped versions of the same asset (e.g., WETH and stETH). However, this design is highly susceptible to liquidity depletion if the external market price deviates, as arbitrageurs can drain one asset entirely.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team