v3-periphery
v3-periphery copied to clipboard
Loss of precision in the double division of `LiquidityAmounts#getLiquidityForAmount0`
https://github.com/Uniswap/uniswap-v3-periphery/blob/cd6b3775af80c745389fa5cd323ed6759b6926c3/contracts/libraries/LiquidityAmounts.sol#L28-L30
This method could be more precise by at least 32 bits by dividing by Q64 instead of Q96 in the intermediate step, and shifting the subtracted ratio left by 32 bits
As a result, this change was required in the v3-sdk to accommodate the less than complete precision of the calculation that is used in the NFT contract for adding liquidity https://github.com/Uniswap/uniswap-v3-sdk/commit/9ff7531842993d3493404fb622dae4a809957231
The desired fix here is to create an additional LiquidityAmountsPrecise
library that does not have this issue