The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Zero slippage can result bad trades.

Vulnerability Details

swap function in SmartVaultV3.sol used calculateMinimumAmountOut to calculate slippage parameter.

uint256 minimumAmountOut = calculateMinimumAmountOut(_inToken, _outToken, _amount);

https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultV3.sol#L217

However calculateMinimumAmountOut function can return zero value.

return collateralValueMinusSwapValue >= requiredCollateralValue ?
0 : calculator.eurToToken(getToken(_outTokenSymbol), requiredCollateralValue - collateralValueMinusSwapValue);
}

https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultV3.sol#L210-L211

It means that user can get 0 tokens when swapping.

Impact

It's possible to swap tokens for nothing.

Tools Used

Manual review.

Recommendations

Consider to revert if slippage is zero.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Slippage-issue

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

Slippage-issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.