Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

missing checks and error handling for potential division by zero

Summary

missing checks and error handling for potential division by zero

Vulnerability Details

Potential division by zero in assetAmt * totalSupply() / (totalAsset() - assetAmt)

Impact

If (totalAsset() - assetAmt) is zero, this is undefined in mathematics and would lead to runtime exception error

Tools Used

VS Code

Recommendations

Error handling statements of this form can resolve the issue:

  1. if ((totalAsset() - assetAmt) == 0) revert Errors.DivisionByZeronotAllowed()

  2. require(totalAsset() > assetAmt, "Division by zero: totalAsset must be greater than assetAmt");

Updates

Lead Judging Commences

hans Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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