Skip to content

[study] (2h) Fee growth tracking — global vs inside-position, feeGrowthInside #77

@ozpool

Description

@ozpool

Goal

Understand how V3/V4 track LP fees efficiently.

Time estimate

2h (single focused session)

Prerequisites

Study plan (in order)

  1. [25 min] V3 whitepaper §6.3 'Fee Growth'
  2. [25 min] uniswap/v3-core: contracts/libraries/Tick.solgetFeeGrowthInside
  3. [25 min] uniswap/v3-core: contracts/libraries/Position.sol — fee crediting on update
  4. [20 min] Hands-on: walk through fee accrual for a swap crossing one tick
  5. [25 min] Write outcomes from memory

Total: 120 min

After studying, you can

  • Distinguish feeGrowthGlobal from feeGrowthInside
  • Describe per-unit-liquidity fee accrual semantics
  • Trace how a position claims accrued fees on the next modifyPosition
  • Explain the gas savings vs per-position update on every swap

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

Metadata

Metadata

Assignees

Labels

priority:p2-polishNice-to-have / polishstatus:readyScoped and ready to pick uptype:studyArchitecture study / research issue

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions