Instead of doing if (X == true) or if (X == false), it is more gas efficient to do if (X) or if (!X).
Instances
Manager.sweep()
// Sends any remaining ETH to the receiver address (as long as receiver address is payable)
(bool success, ) = _receiver.call{ value: address(this).balance }('');
if (success == false) revert InvalidConditions();
SherClaim.claim()
// Only allow claim calls if claim period is active
if (!active()) revert InvalidState();
SherlockClaimManager.cleanUp()
if (_isCleanupState(_oldState) == false) revert InvalidState();
SherlockClaimManager.escalate()
// Can this claim be updated (based on its current state)? If no, revert
if (_isEscalateState(_oldState, updated) == false) revert InvalidState();
Recommended Mitigation Steps
Manager.sweep()
// Sends any remaining ETH to the receiver address (as long as receiver address is payable)
(bool success, ) = _receiver.call{ value: address(this).balance }('');
if (!success) revert InvalidConditions();
SherClaim.claim()
// Only allow claim calls if claim period is active
if (!active()) revert InvalidState();
SherlockClaimManager.cleanUp()
if (!_isCleanupState(_oldState)) revert InvalidState();
SherlockClaimManager.escalate()
// Can this claim be updated (based on its current state)? If no, revert
if (!_isEscalateState(_oldState, updated)) revert InvalidState();
Handle
GreyArt
Vulnerability details
Impact
Instead of doing
if (X == true)
orif (X == false)
, it is more gas efficient to doif (X)
orif (!X)
.Instances
Manager.sweep()
SherClaim.claim()
SherlockClaimManager.cleanUp()
SherlockClaimManager.escalate()
Recommended Mitigation Steps
Manager.sweep()
SherClaim.claim()
SherlockClaimManager.cleanUp()
SherlockClaimManager.escalate()