Explain an LP-token mint to the Uniswap v2 protocol fee recipient
In the reference v2 pair the optional protocol fee is realized through LP-token issuance during a liquidity event. An indexer can mistake this transfer from zero for an ordinary provider deposit.
Rebuild the fee mint with pre-event state
Read the factory feeTo setting, prior kLast, pre-event reserves and LP total supply before the relevant mint or burn. When fee collection is on and the invariant has grown, use the pair’s integer square roots and formula.
totalSupply = 11000; sqrt(kLast) = 100; sqrt(k) = 110
fee LP = floor(11000 × (110 - 100) / (5 × 110 + 100)) = 169
In the simplified fixture, the calculation yields 169 LP base units after flooring. Associate this issuance with the configured fee recipient. The provider’s own mint or burn calculation uses the supply after the fee issuance.
Check whether fee collection was enabled
A zero feeTo, a zero prior kLast or absent growth can produce no fee mint. A swap can grow the invariant without immediately emitting this fee transfer. Forked pairs may change the coefficient or implement another mechanism. github.com UniswapV2Pair.sol