Fees Calculation
Fees earned by the protocol position of any pair are accumulated in fees0 and fees1 variables of the LiquidityPosition struct in the smart contract. Liquidity position also stores totalLiquidity that represents the total shares of this pool.
When any user removes their liquidity, the fee variables are updated from the Uniswap position. Then users earned fees according to their share of the pool, are transferred to their wallet and the accumulated fee variables are updated.
Copy link