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

Unnecessery check in Staking contract

Summary

Staking contract has update function to update global index of earned rewards

Vulnerability Details

This function has the following code:

if (_balance > balance) {
uint256 _diff = _balance - balance;
if (_diff > 0) {

Where if first clause (_balance > balance) is true, the second one (_diff) will always be true.

Impact

Extra gas usage for unnecessary check

Tools Used

Observation

Recommendations

Delete second if statement

Support

FAQs

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