Users will pay minWithdrawalFee instead of upliftFee even if there is an increase in their deposit value in most cases. They will only pay upliftFeewhen their deposit value doubles.
Look at the following in onAfterRemoveLiquidity:
The vulnerable part here is this calculation:
This ratio will always likely be 0.
Let's say that lpTokenDepositValueNowfor a token is 700, lpTokenDepositValue was 500 when the deposit was first made. Then,
lpTokenDepositValueChange = (700 - 500) / 500 = 200 / 500 = 0 (in solidity)
If lpTokenDepositValueChangeis 0, then the user will always pay a minimal withdrawal fee, instead of the uplift fee, even when the deposit has increased in value.
They will only pay an uplift fee if the lpTokenDepositValuehas doubled or more than doubled in value.
The protocol loses revenue that it earns through fees.
Manual review
Use div from the Math library as it multiplies with 1e18 before dividing:
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.