Incorrect handling of feeDataArray in UpliftOnlyExample::afterUpdate function, users can always lower the exitFee percentage to minWithdrawalFeeBps even if price increase by transfer lpNFT token to another wallet and then withdraw.
In afterUpdate function, before adding feeDataArray value to the new user, the lpTokenDepositValue are reset to lpTokenDepositValueNow. UpliftOnlyExample.sol#L609
This code leave a way for users to lower the withdrawal fee when price increase:
Before withdrawing, users transfer the lpNFT token to their another wallet and then withdraw.
By doing that, the lpTokenDepositValueChange = 0 and feePerLP = (uint256(minWithdrawalFeeBps) * 1e18) / 10000;
The exitFee will be the minimum.
Protocol lost a significant amount of exitFee.
Case 1: Bob does not avoid exitFee
Amount before: 1000e24
Amount add liquidity: 1000e24
Amount after: 980e24
exitFee amount: 20e24
Case 2: Bob transfer lpNFT token to avoid exitFee
Amount before: 1000e24
Amount add liquidity: 1000e24
Amount after: 999.5e24
exitFee amount: 0.5e24
Place these two test into UpliftExample.t.sol.
Then in /2024-12-quantamm/pkg/pool-hooks run forge test --mt test_BobRemoveLiquidityDoublePositivePriceChange -vv. Look into the terminal, the logs result is as above.
Manual review
Foundry
Do not update lpTokenDepositValue.
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.