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

Parameterization of 1e18 in Staking.sol and parameterization of 10000 in Lender.sol

Summary

The constant 1e18 appears two times in the middle of both functions update and updateFor in Staking.sol.
Using the this number directly throughout the contract can make it harder to understand the code's intention and may lead to potential errors if the value needs to be changed in the future. It is generally considered good practice to parameterize such constants to make the code more readable, maintainable, and flexible. The same thing happens in case of the constant 10000 within Lender.sol.

Tools Used

Manual review

Recommendations

Define the two variables in their respective contract and replace the hardcoded values.

Staking.sol:

+ uint256 private constant SCALE_FACTOR = 1e18;

Lender.sol

+ uint256 private constant BASIS_POINTS = 10 ** 4;

Support

FAQs

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

Give us feedback!