20,000 USDC
View results
Submission Details
Severity: low
Valid

Prevent division by 0

Summary

On several locations in the code precautions are not being taken for not dividing by 0, this will revert the code.

Vulnerability Details

These functions can be called with 0 value in the input, this value is not checked for being bigger than 0, that means in some scenarios this can potentially trigger a division by zero.

Code Snippet

File: Lender.sol
265: uint256 fees = (debt * borrowerFee) / 10000;
561: uint256 govFee = (borrowerFee * loan.collateral) / 10000;
650: uint256 fee = (borrowerFee * (debt - debtToPay)) / 10000;
725: fees = (lenderFee * interest) / 10000;

Impact

In certain cases, this could lead to a division by zero.

Tools Used

Manual

Recommendations

Recommend making sure division by 0 won’t occur by checking the variables beforehand and handling this edge case.

Support

FAQs

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