The exit fee calculation in onAfterRemoveLiquidity https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-hooks/contracts/hooks-quantamm/UpliftOnlyExample.sol#L474-L476 suffers from precision loss due to division operations being performed before multiplication, potentially leading to incorrect fee calculations and loss of funds for LPs.
The issue occurs in the fee calculation logic:
feePerLP will always be 0 when localData.lpTokenDepositValueChange > 0
Manual, Foundry
Reorder calculations to perform multiplications before division
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.