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

Unnecessary `if (_diff > 0)` because of a previous `if (_balance > balance)` statement

Summary

Vulnerability Details

if (_balance > balance) {
uint256 _diff = _balance - balance;
if (_diff > 0) { // @audit remove to save gas
uint256 _ratio = _diff * 1e18 / totalSupply;
if (_ratio > 0) {
index = index + _ratio;
balance = _balance;
}
}
}

_diff always greater than 0 because of previous if-statement if (_balance > balance).

Impact

save gas

Tools Used

Recommendations

Remove if (_diff > 0) statement to save gas

Support

FAQs

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