When a user deposits or adds liquidity using the addLiquidityProportional function, they receive an lpNFT, and corresponding data is stored in the poolsFeeData mapping. This data includes the token ID, amount, lpTokenDepositValue, blockTimestampDeposit, and upliftFeeBps.
However, the calculation of lpTokenDepositValue is incorrect. The value is currently calculated after liquidity is added, which can lead to inaccuracies in edge cases. Even though the liquidity is added proportionally, due to the muldown operation, the token values may differ before and after adding liquidity.
The following test case demonstrates the issue:
The output demonstrates a mismatch in the values:
Output = 4889 != 4990
This discrepancy highlights that the price of lpToken changes before and after liquidity addition.
The calculation of lpTokenDepositValue after adding liquidity leads to incorrect values being stored in the poolsFeeData mapping.
Users are assigned incorrect lpTokenDepositValue, which may result in inaccurate fee calculations or discrepancies in system behavior.
Foundry Fuzzer
Calculate the value of the lpToken before adding the liquidity.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.