Skip to main content

How Does a Constant Product Market Maker (CPMM) Work?

A CPMM, like Uniswap v2, maintains a constant product for the reserves of two assets in a liquidity pool, defined by the formula x y = k. When a user trades, the ratio of x and y changes to maintain k, which determines the new price.

The larger the trade, the more the price shifts (slippage), which is the mechanism exploited by sandwich attacks.

How Does the Concept of Slippage Relate to the Size of the Constant Product (K) in an AMM Pool?
What Is the Economic Incentive for Miners to Participate in a High-Difficulty Network?
How Does the Constant Product Formula Work in a Basic AMM?
How Does the Shift from PoW to PoS Affect the Issuance Rate of a Cryptocurrency?