As the title suggests, users will pay a fee lower than intended or only the minimal fees, by transferring their LPNFT before withdrawing their liquidity.
In onAfterRemoveLiquidity in UpliftOnlyExample, look at this section:
lpTokenDepositValueChangeis dependent on the difference of the current value of LP (lpTokenDepositValueNow) and the previous value of LP (lpTokenDepositValue) when the deposit was initially made or when the LPNFT associated with a deposit was transferred.
It affects how feePerLPis calculated:
If lpTokenDepositValueChangeis small, then feePerLPwill also be small and hence the fee amount that the user pays will also be small. Users can abuse this and pay small fees by transferring the LPNFT associated with a deposit to another address and then withdrawing their liquidity. Whenever an LPNFT is transferred, the afterUpdate function updates the feeDataArray :
On NFT transfer, the lpTokenDepositValueis updated to the latest value. A user can easily abuse this:
A user makes a deposit (adds liquidity) at time T1. He has an LPNFT corresponding to that deposit.
A year passes by, his position has significantly gained in value.
The user wants to remove his deposits now. However, he observes that feePerLPhe will be charged significantly more.
So, he transfers his LPNFT to another address he owns. This would update the lpTokenDepositValueto the latest value.
Now, using the other address, he withdraws the liquidity associated with that LPNFT.
On removal of liquidity, lpTokenDepositValueChange will be small because the difference between the lpTokenDepositValueNowand lpTokenDepositValuewill be very small, because of the latest update made when NFT was transferred.
The user ends up paying minimal uplift fees or if the lpTokenDepositValueChange == 0, then only the minimum fees.
User pays much less fees than intended, leading to a loss for the protocol.
Manual review
On transfer of LPNFTs, charge the from address "transfer" fees associated with that LPNFT.
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.