LibraryMarkets2020Design paperCorpus record
Uniswap v2 Core
Uniswap. Hayden Adams, Noah Zinsmeister, Dan Robinson.
The 2020 core paper for Uniswap v2: a constant-product automated market maker, with arbitrary ERC-20 pairs, price accumulators, and a flash-swap callback. It is the clearest short specification of the pool that much of later DeFi either forked or assumed.
Uniswap v2 prices a pair with a constant product: the pool multiplies its two reserves and refuses any trade that would shrink that product, before the fee.
The five-minute read
Anyone can pool two tokens
There is no order book and no listing committee. Liquidity providers deposit both assets and receive a claim on the pool.
The price is the ratio of reserves
A trader sends one asset in and receives the other out, leaving the product of the reserves no smaller than before, plus a fee that stays in the pool.
The fee is how liquidity is paid
The paper's 0.30 percent is not a toll to a company. It accrues to the reserves, so the liquidity token becomes a claim on a slightly larger pool.
Flash swaps appear here
A caller may withdraw and repay inside one transaction, or fail the whole transaction. The paper makes the pool a primitive other contracts can compose, which is also how it can be attacked.
Price oracles are a side effect
The paper adds a time-weighted price accumulator so other contracts can read a manipulated-resistant average. A spot price at the end of one block is not that oracle.
One action, walked through
- A liquidity provider deposits both tokens in the current ratio and receives pool tokens.
- A trader sends token A. The contract computes how much token B leaves so that the product of reserves does not fall, ignoring the fee that is kept.
- Reserves update. The implicit price, A per B, moves.
- If the trader is using a flash swap, they must pay the pool back before the transaction ends, or the call reverts.
- When the provider withdraws, they burn pool tokens and receive their share of both reserves, fees included, and losses included.
The argument, unpacked
The invariant is the whole market maker
Constant product means large trades move the price a lot, and the pool never runs out of either asset in theory: the price goes to an extreme instead. That is a design for long-tail pairs, not a design that mimics a deep order book at one price.
Liquidity providers are short volatility
If the outside price moves and arbitrageurs rebalance the pool, the provider ends with more of the falling asset. The fee is the compensation the paper offers. It does not promise the fee will be enough. Impermanent loss is this arithmetic, not a moral failure of the provider.
Composability includes the attacker
A flash swap that must repay inside the transaction is safe for the pool's accounting and unsafe for any other contract that trusts a spot price the swap just moved. The paper's oracle section exists because the spot price is a toy.
What has to be true
- Both tokens are standard and do not take a fee on transfer or rebase balances. Weird tokens break the reserve accounting.
- Arbitrageurs can trade when the pool price drifts from other markets. Without them the invariant does not track a fair price.
- Users set a minimum output. The contract will happily trade at a ruined price if the caller does not constrain it.
- The time-weighted oracle is used by anyone who needs a price. The spot reserves are not a price feed.
What happened after the paper
Uniswap v2 became the reference pool on Ethereum and was followed by v3's concentrated liquidity, which changes the invariant from 'the whole price range' to 'a chosen interval'. Read v2 for the constant product and the oracle accumulator. Do not describe a v3 position as if it were this paper.
What to check before you use the idea
- Does the quoted price cover the whole curve or a concentrated range?
- Who receives the fee, and is it the paper's 0.30 percent or a later setting?
- Is any other contract reading the spot reserves as an oracle?
- What happens if one of the tokens charges a transfer fee?
Terms
- Constant product
- The rule that the two reserves, multiplied, do not fall when someone trades.
- Pool token
- A claim on a share of both reserves, including fees and including any inventory loss.
- Flash swap
- A withdrawal that must be repaid before the transaction ends, or the transaction reverts.
- Time-weighted price
- An average of the pool's price over time, harder to push inside a single block than the spot ratio.
The problem the paper names
Order books need makers who stay online. Uniswap's design lets a pool of two tokens quote a price from its own reserves, so a trader can swap against the contract without a counterparty sitting in the book.
What the design proposes
- The invariant is the product of the two reserves, up to the fee. A trade moves the reserves along that curve.
- Anyone may add liquidity in proportion to the reserves and receive a claim on the pool.
- A cumulative price is stored so other contracts can read a time-weighted average without trusting the spot price.
How the mechanism is specified
- The fee stays in the pool. Liquidity providers earn it only by being in the pool while volume happens, and they eat divergence loss when the price moves.
- Flash swaps let a user receive tokens and pay inside the same transaction, or revert.
- The core contracts are not the router, the interface, or the later v3 concentrated-liquidity paper.
What this page does not treat as proven
- The invariant is not a promise of a good price. It is a function of reserves.
- Divergence loss is not a bug in the paper. It is the cost of the curve.
- This page does not describe governance, the UNI token, or v3. Those are separate.
Why a venture studio still reads it
Any venture that says 'AMM' should be able to write its invariant on one line and say who loses when the external price moves. Uniswap v2 is that line.
This is Blockchain Lab's reading of a public design paper. It is not the paper, not a copy of it, and not an offer of tokens, equity, custody or a partnership. Later network behaviour can diverge from the text. Nothing here is investment, legal or technical advice.
Research status: Design paper. Last reviewed: 1 October 2026. This is a reading of a public paper, not investment, legal or security advice.
