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

Incorrect calculation of loanRatio value.

Summary

Any token with a non-18 decimal precision will result in the miscalculation of the loanRatio.

Vulnerability Details

According to the project team's information, the contract supports any ERC-20 token.The contract calculates the loanRatio considering the token's decimal precision as 18. If the token's decimal precision is not 18, this will result in miscalculations, leading to issues in the contract's execution.Some tokens have low decimals (e.g. USDC has 6). Even more extreme, some tokens like Gemini USD only have 2 decimals.Some tokens have more than 18 decimals (e.g. YAM-V2 has 24).This will result in the loanRatio value being much larger or much smaller than expected, a situation the contract is not designed to encounter.
uint256 loanRatio = (debt * 10 ** 18) / collateral;

Impact

This will lead to a series of issues with the contract.

Tools Used

vscode

Recommendations

It is recommended to consider tokens with different precisions.

Support

FAQs

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

Give us feedback!