Blockchain & Crypto Explained

How DeFi Liquidity Pools Make Swaps Without Order Books

An automated market maker swaps against token reserves, moves its quoted price as those reserves change, and pays fees to liquidity providers who bear real risks.

Visit Blockchain & Crypto Explained on YouTube

Short answer

The answer in plain English

A DeFi liquidity pool is a smart contract holding reserves of two or more tokens. Instead of matching a buyer with a seller, an automated market maker applies a formula to the reserves and calculates how much output a trader receives for an input. The swap changes the reserve ratio and therefore the next quoted price. Liquidity providers fund the reserves and may earn fees, but price divergence, contract failures, bad tokens, and concentrated-liquidity ranges can make the position lose value.

Why it matters

What to understand

In a constant-product pool, the reserve relationship is commonly written as x times y equals k. Buying one token removes it from the pool and adds the other, so each additional unit becomes more expensive. Larger trades cause more price impact in shallow pools. Arbitrage aligns the pool with outside markets. LP fees compensate capital providers, but they do not guarantee that providing liquidity will outperform simply holding the original assets.

Visual guide

How the pieces fit together

A traditional order book matches a buyer and seller while a DeFi market sends a trader directly to a smart-contract liquidity pool.
An order book coordinates counterparties; an AMM lets the trader interact with reserves held under a pricing rule.
A small token swap barely disturbs a liquidity pool while a large swap creates a much larger wave and price movement.
Price impact grows with the size of the trade relative to the liquidity available along its route.
Two charts compare a liquidity position after prices return with a withdrawal made after a large relative price move.
Impermanent loss is measured against holding the original assets; withdrawing after divergence realizes the position at its changed composition.

You trade with reserves, not a waiting seller

A swap on an automated market maker can finish even when no person accepts the other side at that moment. The counterparty is a smart contract holding token reserves. You send one asset into the contract, it calculates an output under its rules, and it sends another asset back.

That is the practical difference from an order book. An order book lists bids and offers and matches compatible instructions. A liquidity pool keeps assets available continuously and moves its price when a trade changes the reserves.

A traditional order book matches a buyer and seller while a DeFi market sends a trader directly to a smart-contract liquidity pool.

An order book coordinates counterparties; an AMM lets the trader interact with reserves held under a pricing rule.

The Uniswap v2 pool documentation describes each pool as a venue for a pair of ERC-20 tokens. Other AMMs use different assets and formulas, but reserves plus an on-chain rule are the shared idea.

A constant-product pool resists being emptied

The classic Uniswap model is written as x × y = k. Here, x and y are the two reserves and k is the invariant the swap calculation protects, adjusted in practice for fees.

Suppose a simplified pool contains 10 ETH and 30,000 units of a dollar stablecoin. The reserve ratio suggests 3,000 stablecoins per ETH before fees. If a trader adds stablecoins and removes ETH, the ETH reserve falls while the stablecoin reserve rises. The next unit of ETH costs more than the first because the pool is becoming more imbalanced.

The quoted price is therefore not a fixed label. It emerges from the state of the contract. The Uniswap v2 whitepaper specifies the core pair mechanics and explains how the contracts maintain the invariant.

Trade size creates price impact

A small trade against a deep pool changes the reserve ratio only slightly. A large trade against a shallow pool moves it substantially. The difference between the starting marginal price and the average execution price caused by your own order is price impact.

A small token swap barely disturbs a liquidity pool while a large swap creates a much larger wave and price movement.

Price impact grows with the size of the trade relative to the liquidity available along its route.

Slippage is often used more broadly for the difference between an expected quote and the eventual execution. Other pending transactions, routing, and block conditions can change the result before confirmation. A slippage-tolerance setting tells the transaction how much deterioration it may accept before reverting; it does not create more liquidity or guarantee a fair token.

Official Uniswap swap documentation notes that swaps execute against passive liquidity and pay a fee to providers rather than filling discrete first-in-first-out orders.

Arbitrage connects the pool to outside prices

The contract does not independently know the market price on another exchange. When its reserve ratio implies a meaningfully different price, arbitrage traders can buy the cheaper asset in one venue and sell it in the other. Their trades alter the pool reserves until the opportunity is too small after fees and transaction costs.

Arbitrage is what keeps a simple AMM useful as markets move, but it is not a free oracle. A thin pool can be pushed far by one trade. Systems that consume an AMM price need defenses against short-lived manipulation rather than assuming every on-chain quote is reliable.

Liquidity providers own a changing claim

The reserves come from liquidity providers. In a basic two-token pool, a provider deposits assets in the current pool ratio and receives tokens or a position record representing a proportional claim.

That claim is not a promise to return the original quantities. Trades constantly change the mix. If one asset appreciates relative to the other, arbitrage tends to remove some of the appreciating asset and add more of the other. When the provider withdraws, the position may contain a different combination than it began with.

Swap fees accrue under the pool’s rules and can increase the value of the position. But fees are compensation for capital and risk, not interest guaranteed by a borrower or bank.

Impermanent loss is a comparison with holding

Impermanent loss compares the value of the pool position with the value the provider would have had by simply keeping the deposited assets outside the pool. Relative price movement creates the difference because the AMM rebalances mechanically.

Two charts compare a liquidity position after prices return with a withdrawal made after a large relative price move.

Impermanent loss is measured against holding the original assets; withdrawing after divergence realizes the position at its changed composition.

The label can be misleading. If the relative price returns before withdrawal, the comparison can shrink. If the provider exits after divergence, the changed asset mix and its result are realized. Fees may outweigh that underperformance, but they may also be smaller. Volume, volatility, fee tier, active liquidity, incentives, contract behavior, and timing all matter.

Newer pools add choices rather than removing risk

Constant product across every possible price is only one design. Stable-asset curves try to offer lower slippage near a shared target. Weighted pools use unequal reserve weights. Concentrated liquidity lets providers allocate capital to selected price ranges.

Concentration can produce more liquidity near the current price with less capital. It also makes the position dependent on a chosen range. If the market leaves it, the position may stop earning fees and can become composed almost entirely of one asset. Active management, fee tiers, and position-specific results make the simple two-reserve picture an introduction, not a calculator for every protocol.

A pool’s existence proves very little

Permissionless creation lets communities establish markets without securing a centralized exchange listing. The same openness lets anyone create a pool for a worthless, misleading, or malicious token. Visible liquidity does not prove identity, solvency, safe code, or an honest issuer.

Traders should distinguish price impact from token and contract risk, review the actual token address, understand approvals, and set transaction limits intentionally. Providers need to assess both assets, the contract, the range or curve, fee rules, incentives, and the holding alternative.

An AMM’s innovation is coordination: code holds reserves, quotes trades, updates balances, and distributes value according to published rules. It removes the need for a traditional matching engine. It does not remove market risk, software risk, or the need to understand what the wallet is signing.

Check the facts

Sources

  1. Uniswap v2 CoreUniswap
  2. PoolsUniswap Developers
  3. Understanding Swaps on UniswapUniswap Developers