Due to current uplift fee scaling logic it's encouraged to withdraw and deposit before the first uplift fee boundary is hit.
By current logic users can avoid paying high uplift fees by withdrawing before their the first uplift fee boundary is hit.
The boundary being deposit price doubling.
If we look at lpTokenDepositValueChange
calculation we'll see that it will only be set to "1" and above if the new value is at least double the price at deposit time. Otherwise the division will round it back to zero and the "if" logic will apply the fixed fee instead.
At least in tests the values of minimal uplift fee and the fixed fee are 200 (2%) and 5 (0.05%), which is not an insignificant difference.
This means that if gas fees are ignored, the user could withdraw and deposit 40 times before the fees charged would get anywhere close the once charged uplift fee value.
Because uplift fees are charged on price increases, this would mean that when the market would be in a bull run the liquidity of the pool would fluctuate greatly as users withdraw and redeposit liquidity to reset the fees. Especially because the fee logic has a sharp cutoff where a 1.9999...x times price increase has 0.05% fee and as soon as it hits 2x time increase it becomes a 2% fee.
In smaller liquidity pools this would expose regular swappers to higher slippage and more arbitrage opportunities.
The fee calculation logic encourages unstable liquidity when market is in a bull run - may expose swappers to large slippage. Also reduces platform revenue by circumventing larger profit fees.
Manual review and foundry tests. Test case is a modified version from UpliftExample.t.sol (UpliftOnlyExampleTest)
The following below would gradually increase the fee percentage up to 2% maximum and stop increasing when profits hit 150% of the original deposit.
And after the calculation use, the below code to transition:
This would result in a much smoother transition from fixed to uplift fees. Now it still has some overlap and minWithdrawalFeeBps is going to be applied at the beggining of positive value increase, but the transition can futher be tuned to decrease that overlap.
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.