The current fee calculation logic in the removeLiquidityProportional function can be exploited by transferring the liquidity pool (LP) token between accounts before withdrawing. This resets the lpTokenDepositValue to the current pool value, significantly reducing the uplift fee applied during withdrawal. This manipulation undermines the expected fee structure, allowing users to avoid paying fair fees for uplift in pool value.
Fees during liquidity removal are calculated based on the change in value (lpTokenDepositValueChange) of the LP token since its deposit.
When an LP token is transferred, the lpTokenDepositValue is updated to the current pool value, effectively resetting the deposit value to the pool's current value.
By transferring the LP token back and forth between accounts, users can manipulate the recorded deposit value and avoid paying fees for the actual uplift in pool value.
User deposits liquidity, minting an LP token with an initial lpTokenDepositValue.
The pool value increases, raising the fee due on withdrawal.
Before withdrawing, the user transfers the LP token to another account and then back, resetting the lpTokenDepositValue to the pool's current value.
The lpTokenDepositValueChange is now zero or minimal, and the fee is calculated using minWithdrawalFeeBps, bypassing the intended uplift fee.
The user withdraws liquidity, paying minimal fees.
Fee Avoidance: Users pay significantly reduced fees (e.g., 0.5e18 instead of 20e18) by resetting the deposit value through token transfers.
Manual Audit
Modify the afterUpdate function in the UpliftOnlyExample contract to prevent resetting the lpTokenDepositValue during transfers.
Likelihood: High, any transfer will trigger the bug. Impact: High, will update lpTokenDepositValue to the new current value without taking fees on profit.
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.