Skip to content

Clarification on Fee Tracking in Positions Management #36

Discussion options

You must be logged in to vote

Are feeGrowthGlobal1X128 and feeGrowthGlobal1X128 always non-decreasing for a given pool?

Yes. This is so because swap fees only grow up: trades are made, swap fees are taken. These variables are updated during swapping:
https://github.com/Uniswap/v3-core/blob/main/contracts/UniswapV3Pool.sol#L760-L766
When swapping tokens, swap fees are subtracted from input amounts and counted. After a swap is done, the global fees are increased by the total swap fees accumulated during the swap.

is it possible to calculate how much fees a position would have received per liquidity till this time by directly using feeGrowthInside0X128 * position.liquidity

If I understand the question correctly, it's…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by allenzhao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants