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

Staking.sol - updateFor() - Cache `index`

Summary

State variable index is used multiple times and can be cached

Vulnerability Details

Impact

Tools Used

Recommendations

Change

supplyIndex[recipient] = index;
uint256 _delta = index - _supplyIndex;

To

uint256 _index = index;
supplyIndex[recipient] = _index;
uint256 _delta = _index - _supplyIndex;

Support

FAQs

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