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

Initiating variables of type uint to 0

Summary

The two state variables balance and index of Staking.sol are initiated explicitly to zero

Vulnerability Details

Uint256's initial value is zero so there is no point in explicitly assigning zero value to it. The same goes for the index i in for loops. There is no need to initialize i = 0 .

Impact

Gas optimization

Tools Used

Manual review

Recommendations

Just leave these two state variables as uint256 public balance; and uint256 public index;

Support

FAQs

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