20,000 USDC
View results
Submission Details
Severity: medium

Lack of collateral check can make loanRatio equals to 0.

Summary

During the calculation of loanRatio their is no check on the collateral , which makes the LoanRatio equals to 0, and makes the function reverts everytime..

Vulnerability Details

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L618

uint256 loanRatio = (debt * 10 ** 18) / collateral;
if (loanRatio > pool.maxLoanRatio) revert RatioTooHigh();

Impact

function will get revert everytime on collateral = o .

Tools Used

Recommendations

Make a check for collateral , like under borrow function
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L244

Support

FAQs

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