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

246 uint256 loanRatio = (debt * 10 ** 18) / collateral;
384 uint256 loanRatio = (totalDebt * 10 ** 18) / loan.collateral;
618 uint256 loanRatio = (debt * 10 ** 18) / collateral;

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

Impact

Informational

Tools Used

Manual review

Recommendations

Use scientific notation

Support

FAQs

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