Steadefi

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

Missing error handling in lvTokenValue function

Summary

Missing error in lvTokenValue function can cause failure of contract execution

Vulnerability Details

The contract execution failure can cause the transaction to revert if totalSupply_ is zero, the division totalAsset_ * SAFE_MULTIPLIER / totalSupply_ could result in a runtime exception due to division by zero.

Impact

Any subsequent operations in the transaction would be rolled back thereby making the user or contract conducting the transaction to possibly lose gas fees

Tools Used

VS Code

Recommendations

An explicit else statement of this form below can be written to handle the error:
} else {
// Add a check for division by zero
require(totalSupply_ != 0, "Division by zero");
return totalAsset_ * SAFE_MULTIPLIER / totalSupply_;
}
}

Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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