Markets
Liquidity pools and LP shares
Short answer A liquidity pool holds the reserves a swap trades against. The LP share is the claim on those reserves and on fees. Uniswap v2 uses a fungible token, v3 and v4 use position NFTs from different contracts, and Curve NG uses the pool contract itself.
The pool is the inventory. The LP share is the receipt. Confusing them causes two integration bugs: treating the receipt as if it were the original deposit, and treating every receipt as an ERC-20.
Inventory changes underneath the receipt
A swap sells one reserve for the other. Fees, depending on the design, either stay in the reserves or accrue to the position. After enough trading, a provider who deposited equal value can withdraw mostly one asset. The receipt did not malfunction. It is a claim on the current inventory, including fees and excluding what traders took out.
That inventory risk has a name in constant-product markets, divergence or impermanent loss, but the accounting fact is simpler than the name. The LP is short the move. Fees are the compensation. If fees do not cover the inventory change, the position lost value relative to holding the deposited tokens. No invariant promises otherwise.
Four receipts
Uniswap’s overview separates v2’s fungible pool tokens from the ranged positions of v3 and v4. On v4 it says PositionManager uses ERC-6909 for internal accounting, while the contract source mints an ERC-721. This page follows the source for the position token.
v2 mints a fungible ERC-20. Balance is proportional share. Fees increase reserve value per token, less the protocol’s share where governance has turned that fee on. Two holders can be pooled, transferred, and composed like any other token. The cost of that simplicity is that nobody chooses a price range.
v3 mints an ERC-721 through NonfungiblePositionManager because a range is part of the position. The NFT is not a share of the whole pool. It is a share of liquidity between two ticks. Two NFTs in one pool can be in different ranges and earn different fees. They should not be added together as if they were v2 LP tokens.
v4’s PositionManager mints another ERC-721, named “Uniswap v4 Positions NFT” in the contract. The range is still the position. The contract address is not v3’s NonfungiblePositionManager, so an indexer that only watches that v3 contract misses v4 liquidity. ERC-6909 on PoolManager is a claim on tokens left in the singleton. It can sit beside a position when a manager opts to settle that way. It is not a substitute token id for the NFT.
Curve Stableswap-NG collapses pool and LP token into one contract. The integration guide says so. Transfers of the pool’s own token are transfers of LP claims. A metapool then treats some other pool’s LP token as one of its coins. That is composition of receipts: the metapool’s inventory includes a claim on a second inventory. Withdrawing one coin from the metapool can require the base pool to unwind.
Shares are not deposits
Lido also uses the word share, for a different pool. An stETH share is a claim on pooled ether, not on an AMM’s two reserves. Aave’s scaled aToken balance is a claim on a lending reserve. The accounting article lines those up. The word “LP token” should stay with AMM receipts.
When a protocol lists an LP token as collateral, it is pricing this receipt. The price has to understand the inventory underneath, including a range that might be out of the money or a StableSwap pool that is holding a depegged coin. The ERC-20 interface will not say which of those is true.
Sources
Check the claims yourself: each group below is a different kind of evidence. Code and specifications show what the contracts do. Documentation shows what the protocol says they do.
Source code
- PositionManager.sol Uniswap
Documentation
- How Uniswap works Uniswap
- Concentrated liquidity Uniswap
- Integrating Stableswap-NG Curve
- Uniswap v4 architecture Uniswap
- ERC-6909 in Uniswap v4 Uniswap
Governance
- UNIfication proposal Uniswap Labs
Changes
- : Noted that Uniswap’s overview and contract source disagree about v4 position accounting, and cited the protocol-fee source.
- : Noted that Uniswap v2 token holders receive fees net of any protocol share.
Every change to the publication is listed on What changed.
Keep reading
How on-chain exchanges price trades Step 3 of 13
Previous: Constant-product pricing · Next: Concentrated liquidity
See something wrong or missing?
Propose a change via pull request (src/content/concepts/liquidity-pools.md) or report a correction. See how to contribute.