Automated Market Makers (AMMs) are a type of decentralized exchange (DEX) mechanism that enables trustless trading of digital assets without the need for traditional order books. Instead of relying on buyers and sellers to match orders, AMMs use mathematical formulas and liquidity pools to determine asset prices.

The flowchart above outlines the AMM process, which consists of two primary user actions: trading and providing liquidity.
1. User Interaction
- Users can either trade assets or provide liquidity to the pool.
2. Providing Liquidity
- If a user chooses to provide liquidity, they must deposit token pairs into a liquidity pool.
- These liquidity pools operate under a constant product formula, such as x*y=k , ensuring that the pool maintains balance.
3. Trading Process
- If a user wants to trade, they submit their tokens to the pool, triggering a smart contract that governs the exchange.
- The AMM applies the constant product formula to determine the trade price dynamically.
4. Trade Execution
- The trade type is identified as either a swap (exchange one token for another) or liquidity removal (withdrawal of tokens by liquidity providers).
If swapping:
- The output amount is calculated based on the AMM formula.
- The trade is executed, and pool balances are updated.
If removing liquidity:
- Tokens are returned to the provider, and the corresponding liquidity pool (LP) tokens are burned to adjust the total liquidity.
Here are some of the AMM Formulas used for the exchange purposes:
1. Constant Product Market Maker (CPMM)
Constant Product Market Maker is the most common AMM model used, popularized by Uniswap, is the Constant Product Market Maker. It follows a simple yet powerful mathematical principle:
x * y = k
Where:
- x: quantity of token X in the pool
- y: quantity of token Y in the pool
- k: constant product value

Example:
Let’s say we have a pool with:
- 100 ETH (x)
- 200,000 USDC (y)
- k = 100 * 200,000 = 20,000,000
If someone wants to buy 10 ETH, we can calculate the required USDC using:
- (100–10) * (200,000 + Δy) = 20,000,000
- 90 * (200,000 + Δy) = 20,000,000
- 200,000 + Δy = 20,000,000/90
- Δy = 22,222.22 USDC
This means they need to pay 22,222.22 USDC for 10 ETH, resulting in a price impact due to the size of the trade.
2. Constant Sum Market Maker (CSMM)
A simpler model that maintains a constant sum of assets:
x + y = k
While this appears simpler, it has a major limitation: it provides infinite liquidity at a constant price, which isn’t sustainable in practice. This is why it’s rarely used in isolation.

Example:
With a pool of:
- 100 ETH + 200,000 USDC = 200,100 (k)
- Price is fixed at 2,000 USDC per ETH
- No price impact regardless of trade size
3. Constant Mean Market Maker (CMMM)
Balancer introduced this generalized form that allows for multiple tokens with different weights:
(x₁^w₁) * (x₂^w₂) * … * (xₙ^wₙ) = k
Where:
- xᵢ: quantity of token i
- wᵢ: weight of token i
- Σwᵢ = 1

Example:
For a pool with:
- 80% USDC (w₁ = 0.8)
- 20% ETH (w₂ = 0.2)
- 200,000 USDC (x₁)
- 100 ETH (x₂)
The constant k would be: k = (200,0⁰⁰⁰·⁸) * (1⁰⁰⁰·²)
4. Hybrid Models
Curve’s StableSwap
Designed specifically for stable assets, it combines CPMM and CSMM:
χD^n + D = An^n Σxᵢ + (D^n)/n^n
Where:
- D: invariant representing total deposits
- n: number of coins
- A: amplification coefficient
- xᵢ: quantity of coin i
This model provides:
- Low slippage for trades between assets of similar value
- Higher slippage as prices diverge
- Adjustable amplification factor (A) to balance stability and profitability
Example:
For a DAI-USDC pool with A = 100:
- When both assets are at $1, trades have minimal slippage
- If DAI drops to $0.98, slippage increases to protect the pool
5. Dynamic Automated Market Maker (Dynamic-AMM)
A newer innovation that adjusts parameters based on market conditions:
P = f(x, y, v)
Where:
- P: price
- f: price function
- v: external price feed or other variables
Example:
A pool might:
- Use Chainlink price feeds as a base
- Adjust liquidity concentration around the current price
- Modify fee tiers based on volatility
Automated market makers represent a paradigm shift in decentralized trading, fundamentally reimagining how markets could function without traditional intermediaries. Though not the most capital-efficient venues, AMMs have democratized market making and allowed for 24/7 permissionless trading in a wide variety of tokens. The innovative constant product formula of an AMM, though simple in concept, has proven remarkably resilient as a means to maintaining the stability of markets and ensuring consistent liquidity. As DeFi evolves, AMMs are a perfect example of how mathematical principles can be used to create trustless, automated trading systems that everyone can use. While their lack of slippage and impermanent loss will remain their drawbacks, the contributions of these protocols have been fundamental in changing the landscape of decentralized finance and pave the way for future innovations in algorithmic trading mechanisms.
Understanding Automated Market Makers was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.