15,000 USDC
View results
Submission Details
Severity: gas
Valid

mintDsc()- boolean check not required

Summary

The boolean returned by i_dsc.mint() function is not required to be checked as it always returns True as per defined in DecentralisedStableCoin.sol

Vulnerability Details

In mintDsc() function of DscEngine.sol, the returned value of i_dsc.mint() function is stored in a memory variable and checked if it is false, and custom error DSCEngine__MintFailed() is reverted. This check is not required as the mint() function in DecentralisedStableCoin.sol will always return True or revert.

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L201
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DecentralizedStableCoin.sol#L65

Support

FAQs

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