While making a swap on UniswapV3 the caller should use the slippage parameter amountOutMinimum parameter to avoid losing funds.
The function Fees.sellProfits submits a swap to UniswapV3 without providing slippage tolerance.
The amountOutMinimum is set to 0 which basically tells the Uniswap V3 router: "I am willing to get 0 tokens for this swap."
amountOutMinimum is used to specify the minimum amount of tokens the caller wants to be returned from a swap. Using amountOutMinimum = 0 tells the swap that the caller will accept a minimum amount of 0 output tokens from the swap, opening up the user to a catastrophic loss of funds via MEV bot sandwich attacks.
Loss of funds and not getting the correct amount of tokens in return.
VSCode
Use parameters amountOutMinimum correctly to avoid loss of funds
A potential logic might be to fetch the most recent price from the Uniswap contract and apply a slippage tolerance on it as you wish (could be between 0.5-2.5% for example).
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.