-
Notifications
You must be signed in to change notification settings - Fork 1
[RTU-02C] Redundant Conditional Clause #16
Copy link
Copy link
Open
Description
RTU-02C: Redundant Conditional Clause
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() |
RebaseTokenUpgradeable.sol:L78 |
Description:
The RebaseTokenUpgradeable::_disableRebase function is solely invoked within USTB::disableRebase whereby the new disable state of the account is guaranteed to be different.
Example:
function _disableRebase(address account, bool disable) internal {
RebaseTokenStorage storage $ = _getRebaseTokenStorage();
if ($.optOut[account] != disable) {
uint256 balance = balanceOf(account);
$.optOut[account] = disable;
if (balance != 0) {
if (disable) {
RebaseTokenUpgradeable._update(account, address(0), balance);
ERC20Upgradeable._update(address(0), account, balance);
} else {
ERC20Upgradeable._update(account, address(0), balance);
RebaseTokenUpgradeable._update(address(0), account, balance);
}
}
if (disable) emit RebaseDisabled(account);
else emit RebaseEnabled(account);
}
}Recommendation:
We advise the referenced conditional to be omitted from the codebase, optimizing the gas cost of the function.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
