FOLLOW THE MECHANISM

  1. 1Supply

    LPs contribute the two reserve assets.

  2. 2Swap

    The input increases one reserve while output reduces the other.

  3. 3Reprice

    The changed reserve ratio changes the next marginal price.

A conceptual sequence. Real implementations can add steps, intermediaries, and conditions.

Inventory becomes the market

An automated market maker holds assets in a pool and uses a rule to determine exchanges. The classic two-asset constant-product model begins with reserves x and y and the relation x × y = k. Buying one asset removes it from the pool while adding the other, changing the ratio and the next quoted price. This is the educational model used here, grounded in Uniswap v2’s historical design. Other AMMs use different curves, ranges, weights or additional mechanisms.

Work through the curve

Ignoring fees, a pool with 100 A and 10,000 B has k = 1,000,000. Adding 10 A leaves 110 A, so the remaining B reserve is 1,000,000 ÷ 110, approximately 9,090.91. The trader receives approximately 909.09 B. The initial marginal price was 100 B per A, while the average received was 90.91. The difference comes from walking along a curved price schedule. The pool never simply multiplies the entire input by its initial spot price.

Fees and arbitrage change the story

With a fee deducted from the trade input, only the effective input determines quoted output, while retained fees can increase reserves. A real protocol may share fees with another recipient. External trading then tends to bring pool prices toward other markets through arbitrage, subject to costs and risk. The pool itself does not know a universally correct market price. Arbitrage trades change LP inventory, connecting the mechanism’s usefulness for traders to the risks borne by inventory suppliers.

Why version and scope matter

Uniswap v3 and v4 allow liquidity over selected price ranges. The full-reserve v2 demonstration does not model their concentrated positions, range exits, hooks or routing. A result from the demo also excludes network fees, token transfer quirks, competing orders and failed execution. It is a balance-conserving model of a pricing mechanism, not a quote from a venue. Inspecting the curve is useful because it shows why small pools and large trades interact so sharply even when every contract behaves as intended.

MAKE IT CONCRETE

Finite reserves

In the no-fee formula, ever-larger inputs approach draining the output reserve but do not reach all of it with any finite input. This is a mathematical property, not evidence that every asset in the pool has value.

FAILURE PATHS & COMMON MISREADINGS

Where the model can break

  • A pool ratio is not an external price oracle by itself.
  • The v2 model does not describe every AMM or concentrated position.

TRY IT YOURSELF

Your wallet says $10,000. How much can you sell?

A fictional wallet shows 10,000 tokens at $1 each. Choose a deep pool, thin pool or shallow order book, decide how much to sell, and predict what the instruction can actually execute.

Open the scenario 3–5 min · Fictional balances · Replay your decisions

KEEP EXPLORING

Connect this idea

Make the distinction

Part of a bigger story

← Back to all topicsBack to top ↑