UpliftOnlyExample:nAfterRemoveLiquidity
function contains an issue in the calculation logic for applying fees when the LP token deposit value increases. Specifically, the uplift fee (upliftFeeBps
) is not applied in scenarios where the value increase is less than 2x the deposit value, resulting in users being undercharged. This can cause a loss of potential fee revenue for the pool.
When users remove liquidity if their deposit value increases they should have pay fee to pool calculated with upliftFeeBps
ratio. However because of rounding down issue users can pay less fee.
The calculation of lpTokenDepositValueChange
determines the proportional change in LP token value by dividing the difference between the current value (lpTokenDepositValueNow
) and the deposit value (lpTokenDepositValue
). However, this division can result in the value rounding down to zero when the increase is less than 2x the deposit value. As a result:
When lpTokenDepositValueNow
is greater than the deposit value but not sufficiently large, the change rounds to zero.
The function defaults to applying the minWithdrawalFeeBps
instead of the uplift fee (upliftFeeBps
).
This prevents the pool from collecting the appropriate fee, leading to revenue loss.
Test:
The current logic allows users to avoid paying the uplift fee unless the value increase is substantial (2x or more of the deposit value)
Manual
Update the lpTokenDepositValueChange
calculation to prevent rounding down by increasing precision
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.