AMM V3 introduces concentrated liquidity, allowing LPs to allocate capital to specific price ranges rather than the full (0, infinity) range. A position providing liquidity between prices $p_a$ and $p_b$ achieves up to 4000x capital efficiency compared to V2 for the same depth at the current price. The pool uses a tick-based price discretization where each tick represents a 0.01% price increment.
Prices are discretized into ticks. Each tick i maps to price p(i) = 1.0001^i:
An LP position specifies a range [tickLower, tickUpper]:
struct Position {
uint128 liquidity; // concentrated liquidity units
int24 tickLower; // lower bound tick
int24 tickUpper; // upper bound tick
uint256 feeGrowthInside0; // accumulated fees, token0
uint256 feeGrowthInside1; // accumulated fees, token1
}
Liquidity is only active when the current tick is within the position's range.
A swap moves the price across ticks:
1. Compute how much of the input can be consumed at the current tick's liquidity
2. If the input is exhausted, return the output
3. If not, cross to the next initialized tick, update active liquidity, repeat
Each tick crossing adds/removes liquidity from positions whose boundaries align with that tick.
Fees accrue per-tick and are claimable by position owners proportional to their liquidity share within the tick range.
V3 pools store an array of (blockTimestamp, tickCumulative, liquidityCumulative) observations. Up to 65535 observations are stored, enabling TWAP queries over extended periods without external infrastructure.
Unlike V2 LP tokens (fungible ERC-20), V3 positions are non-fungible (ERC-721) because each position has unique tick bounds. The NonfungiblePositionManager wraps positions as NFTs.
1. Just-in-time liquidity: LPs can add liquidity for a single block to capture fees and withdraw. This is a feature, not a bug -- it increases competition among LPs.
2. Tick crossing gas: swaps crossing many ticks consume proportionally more gas. Pools with sparse liquidity may have expensive swaps.
3. Oracle manipulation: TWAP with sufficient observation window (30 minutes+) is resistant to single-block manipulation.
github.com/luxfi/standard/contracts/amm/v3/ |LuxPool.sol |NonfungiblePositionManager.sol |Copyright (C) 2024-2026, Lux Partners Limited. All rights reserved.
Licensed under the MIT License.