20,000 USDC
View results
Submission Details
Severity: high

The `borrow` function operates with the logic that all ERC20 tokens are 18 decimals, this is incorrect

Summary

The borrow function operates on the logic that all ERC20 tokens are 18 decimals, whereas many tokens have different decimals,

Vulnerability Details

src/Lender.sol:
231 /// @param borrows a struct of all desired debt positions to be opened
232: function borrow(Borrow[] calldata borrows) public {
// Codes...
245: // make sure the user isn't borrowing too much
246: uint256 loanRatio = (debt * 10 ** 18) / collateral;
// Codes...
287: }

Impact

Tools Used

Manual Code Review

Recommendations

Check to decimal with loanRatio calculate

uint256 loanRatio = (debt * 10 ** (IERC20.decimals()) / collateral;

Support

FAQs

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