The vault executes swaps without slippage protection. That will cause a loss of funds because of sandwich attacks.
https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/SmartVaultV3.sol#L217-L227
https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/SmartVaultV3.sol#L210-L211
It can happen that the calculateMinimumAmountOut results 0 when the collateralValueMinusSwapValue is larger or equal as the requiredCollateralValue, this can happen when the PriceCalculator returns a wrong result. This leads to a swap without slippage protection.
Swaps will be sandwiched causing a loss of funds for the users.
we are setting to zero, but this is a significant risk in production.
For a real deployment, this value should be calculated using our SDK or an onchain price oracle -
this helps protect against getting an unusually bad price for a trade due to a front running sandwich or another type of price manipulation
Validate the return value of the minimumAmountOut. When 0 is returned the vault doesn't have the balance to perform the swap and it should revert. This will also protect the user from sandwich attacks.
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.