DEX essentials

AMM reserves and price feeds have different jobs

Separate the state that prices an AMM swap from an oracle or chart that reports a reference value.

A reserve-based pool uses its balances and invariant to determine executable amounts. A price feed reports information about value. These functions can interact, but a pool does not necessarily copy an external oracle price before every swap.

Pricing from internal state

For a hypothetical constant-product pool, changing the reserve ratio changes the local exchange relationship. A trade obtains output according to that state and the pricing rule, even if an external chart displays a slightly different reference.

Uniswap's v2 pricing guide describes this reserve-based mechanism. The reference used to assess whether a proposed trade is acceptable is a separate input to the user's or integration's decision.

A pool can also produce oracle information

The direction can run the other way: an application can observe pool prices over time and use them as a reference. Uniswap's oracle documentation explains cumulative observations that support time-weighted average calculations.

A historical average is not the same as the current finite-size swap quote. It describes prices over an interval, while the quote describes an amount exchanged against a current state.

Do not generalize one architecture to every pool

Some AMM designs or attached logic can use external rates or oracle information. The correct question is which variables the specific pool's pricing function consumes. “All DEX prices come from oracles” and “no AMM ever uses an oracle” are both overly broad.

For understanding a route, separate three quantities: the pool state used to calculate output, the reference used to value that output, and the user's enforceable execution bound.

These can disagree without being interchangeable. A reference can be stale; a pool can have limited depth; a boundary can be deliberately permissive. Inspecting which role each number plays is the first step toward explaining the difference.

The presence of a dollar price beside a quote does not, by itself, establish that the settlement contract consults that dollar feed. Often it is an interface valuation rather than an execution condition.

Sources & verification (3)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. Uniswap v2 Pricing

    Reserve pricing, invariant enforcement and exact swap modes.

    https://developers.uniswap.org/docs/protocols/v2/concepts/pricing
  2. Uniswap v2 Oracles

    Pool observations can supply cumulative price data and external TWAP consumers.

    https://developers.uniswap.org/docs/protocols/v2/concepts/oracles
  3. Understanding Swaps on Uniswap

    AMM execution, minimum output, maximum input, deadlines and impact.

    https://developers.uniswap.org/docs/get-started/concepts/traders/swaps

Continue reading

How constant-product pools price a swap How stable-swap pools handle correlated assets How unequal pool weights affect swap prices