Goal
Understand how V3/V4 track LP fees efficiently.
Time estimate
2h (single focused session)
Prerequisites
Study plan (in order)
- [25 min] V3 whitepaper §6.3 'Fee Growth'
- [25 min]
uniswap/v3-core: contracts/libraries/Tick.sol — getFeeGrowthInside
- [25 min]
uniswap/v3-core: contracts/libraries/Position.sol — fee crediting on update
- [20 min] Hands-on: walk through fee accrual for a swap crossing one tick
- [25 min] Write outcomes from memory
Total: 120 min
After studying, you can
Tradeoff prompt for the architectural review
Why doesn't fee tracking require per-position state updates on every swap?
References
- uniswap/v3-core Tick.sol + Position.sol
- Uniswap V3 whitepaper §6.3
Goal
Understand how V3/V4 track LP fees efficiently.
Time estimate
2h (single focused session)
Prerequisites
Study plan (in order)
uniswap/v3-core: contracts/libraries/Tick.sol—getFeeGrowthInsideuniswap/v3-core: contracts/libraries/Position.sol— fee crediting on updateTotal: 120 min
After studying, you can
feeGrowthGlobalfromfeeGrowthInsidemodifyPositionTradeoff prompt for the architectural review
Why doesn't fee tracking require per-position state updates on every swap?
References