Platform: Code4rena
Start Date: 21/12/2023
Pot Size: $90,500 USDC
Total HM: 10
Participants: 39
Period: 18 days
Judge: LSDan
Total Solo HM: 5
Id: 315
League: ETH
Rank: 17/39
Findings: 1
Award: $358.73
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: erebus
Also found by: adeolu, oakcobalt, thank_you, windowhan001
358.7303 USDC - $358.73
When a user wants to withdraw their tokens form the LiquidityLockbox, users will call the withdraw() function. In turn, when withdraw() is called, the LiquidityLockbox calls Whirlpool's decreaseLiquidity function to decrease the liquidity in a given position. When this function is called, LP tokens are burned in exchange for asset tokens. The Orca function supports passing in slippage checks, i.e. tokenMinA and tokenMinB. Unfortunately, the LiquidityLockbox passes in 0 values for both arguments:
whirlpool.decreaseLiquidity{accounts: metasDecreaseLiquidity, seeds: [[pdaProgramSeed, pdaBump]]}(amount, 0, 0);
This can lead to the user withdrawing far less tokens than expected if a sudden market shift occurs.
Imagine a scenario where a user wants to withdraw a large portion of tokens. The user calls LiquidityLockbox#withdraw. The following scenario occurs:
Users withdrawing liquidity will not be able to control how much at minimum they would like to receive.
Manual Review
Allow users to pass in two additional arguments in the withdraw() function to allow them to manually set the slippage values:
function withdraw(uint64 amount, uint64 minTokenA, uint64 minTokenB) external { ..... // Audit: adding in the minTokenA and minTokenB values will ensure we have proper slippage checks in place. whirlpool.decreaseLiquidity{accounts: metasDecreaseLiquidity, seeds: [[pdaProgramSeed, pdaBump]]}(amount, minTokenA, minTokenB);
Timing
#0 - c4-pre-sort
2024-01-10T15:19:51Z
alex-ppg marked the issue as duplicate of #339
#1 - c4-pre-sort
2024-01-10T15:19:57Z
alex-ppg marked the issue as sufficient quality report
#2 - c4-judge
2024-01-19T20:47:16Z
dmvt marked the issue as satisfactory