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

No need to explicitly set storage variable value to 0

Summary

Staking contract has balance and index variables stored in storage.

Vulnerability Details

During deployment these variable values set to 0. That is not necessary as default uint256 variable value is already 0.
While explicitly setting these variables to 0 we use additional gas.

Impact

Extra gas is used

Tools Used

Observation

Recommendations

Change code to

/// @notice the balance of reward tokens
uint256 public balance;
/// @notice the index of the last update
uint256 public index;

Support

FAQs

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