in UpliftOnlyExample::onAfterRemoveLiquidity There is a division before multiplication in lpTokenDepositValueChange usage logic, causing any change of deposit value below 100% truncates to 0, and any change that is not perfect % of lpTokenDepositValue will have the remainder truncated
in UpliftOnlyExample::onAfterRemoveLiquidity Hook, there is a calculation to check for lpTokenDepositValue during withdrawals to see if any uplift happened, according to that, its decided to use upliftFeeBps or minWithdrawalFeeBps
But as you see in Line 475, we get the ratio of change by dividing by the old lpTokenDepositValue before we multiply this ration by 1e18 in Line 482
Here is an example of what would happen
lpTokenDepositValueNow = 15e18
lpTokenDepositValue = 10e18
lpTokenDepositValueNow - lpTokenDepositValue = 15e18 - 10e18 = 5e18
5e18 / lpTokenDepositValue = 5e18 / 10e18 = 0
lpTokenDepositValueChange = 0
Then the logic in else block will be the one to be executed, since the line 480 if evaluate to false
Also, if the uplift happened was 350%, then the 50% will truncate (35e18 - 10e18 / 10e18 = 3e18)
Loss of fees (funds) for LP providers and Quant AMM admin
Manual Review
multiply during lpTokenDepositValueChange calculation first (as seen below)
Likelihood: High, every call to the function (withdraw) Impact: Low/Medium, uplift fees will be applied only when the price of one asset is doubled but fixed fees will still be collected.
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.