gas

No amountCollateral > balance check

Reward

Total

17.35 USDC

3.21 USDC
Selected
4.50 USDC
3.21 USDC
3.21 USDC
3.21 USDC
Selected Submission

No amountCollateral > balance check

Severity

Low Risk

Relevant GitHub Links

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L135

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L149

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L169

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L183

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L282

Summary

No amountCollateral > balance check

Vulnerability Details

There is a moreThanZero modifier to unsure that the user won't input 0 as amountCollateral but there isn't any check to ensure that the user is inputting an amountCollateral <= to his balance.

Impact

The transaction will fail is the user inputs an amountCollateral > to his balance.

Tools Used

Manual review

Recommendations

Add a if or require check to unsure user is inputting amountCollateral <= to his balance.