The Standard

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

A user can get 0 amount after swapping

Summary

A user can get 0 amount after swapping.

Vulnerability Details

The calculateMinimumAmountOut function calcualtes the minimum amount a user using the swap function can get. Based on the private function which is called by the swap function, a user can either get 0 amount out of the swap or a certain amount.

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

This shouldn't be the case. A user shouldn't get 0 amount out of a swap. In fact, a user should be able to specifiy the minimum amount he should get and not the other way round.

Impact

A user can get 0 amount from a swap

Tools Used

Manual review

Recommendations

A minimum out parameter should be used where a user can specify the minimum amount he should get.

Updates

Lead Judging Commences

hrishibhat Lead Judge almost 2 years 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.