Require statements including conditions with the && operator can be broken down in multiple require statements to save gas.
PROOF OF CONCEPT
Instances include:
MyStrategy.sol(line 182-187)
function _withdrawAll() internal override {
require(
balanceOfPool() == 0 && LOCKER.balanceOf(address(this)) == 0,
"You have to wait for unlock or have to manually rebalance out of it"
);
MITIGATION
Breakdown each condition in a separate require statement (though require statements should be replaced with custom errors
Mitigated Code
function _withdrawAll() internal override {
require(balanceOfPool() == 0);
require(LOCKER.balanceOf(address(this) == 0,
Error.WAIT)
// Use CUSTOM ERROR instead "You have to wait for unlock or have to manually rebalance out of it"
);
Require instead of &&
IMPACT
Require statements including conditions with the && operator can be broken down in multiple require statements to save gas.
PROOF OF CONCEPT
Instances include:
MyStrategy.sol(line 182-187)
MITIGATION
Breakdown each condition in a separate require statement (though require statements should be replaced with custom errors
Mitigated Code