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

No Need to Initialize Varibales with Default Values

Summary

context: Lending.sol

When a variable is not set or initialized explicitly, the default value is assumed based on its data type (e.g., 0 for
numbers, false for booleans, 0x0 for addresses). By avoiding unnecessary initialization, it is possible to save 8 gas
per instance, leading to reduced gas fees for users.

Vulnerability Details

There is no vulnerability in the code; instead, it is a gas optimization recommendation.

Location of Affected Code:

In all contracts where there is a for loop like this.

-- for (uint256 i = 0; .....

++ for (uint256 i; .......

Impact

The current implementation of the code consumes more gas, resulting in higher gas fees for users.

Tools Used

Manual Insepection

Recommendations

Avoid initializing variables with their default values to save gas costs.

Support

FAQs

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