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

Use scientific notation (e.g. `1e18`) rather than exponentiation (e.g. `10**18`)

Summary

Use scientific notation (e.g. 1e18) rather than exponentiation (e.g. 10**18)

Vulnerability Details

While the compiler knows to optimize away the exponentiation,
it's still better coding practice to use idioms that do not
require compiler optimization, if they exist.

File: src/Lender.sol
246: uint256 loanRatio = (debt * 10 ** 18) / collateral;
384: uint256 loanRatio = (totalDebt * 10 ** 18) / loan.collateral;
618: uint256 loanRatio = (debt * 10 ** 18) / collateral;

Link to code - https://github.com/Cyfrin/2023-07-beedle/tree/main/src/Lender.sol

Tools Used

Code Review

Recommendations

Use scientific notation (e.g. 1e18) rather than exponentiation (e.g. 10**18)

Auditor

NeoCrao

Support

FAQs

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