There is situation, when user will do swap without slippage protection
Function calculateMinimumAmountOut() uses for calculate minimal required amount of collateral tokens on contract balance after users's swap.
But, this function could return zero value, so when user will make swap, amountOutMinimum value will be specified as 0, which provides an opportunity to carry out a MEV attack.
As we can see, if collateralValueMinusSwapValue value will be greater on equal to requiredCollateralValue, function return zero value.
An attack could make MEV attack, and decrease price of token TokenIN in exchange pool, and the user will exchange his tokens unprofitably and the vault will become undercollateralised.
Manual review
In all cases, always specify amountOutMinimum value > 0. Function calculateMinimumAmountOut() always should return
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.