Open code423n4 opened 3 years ago
Would like to see proof to this statement, why does it save gas?
I imagine gas savings could be generated on this one by limiting the number of comparisons the function makes. If an earlier branch is entered, subsequent branches are not executed and the function will instead return.
Handle
gzeon
Vulnerability details
Impact
Use else if for mutually exclusive conditions to save gas
Proof of Concept
https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L125 can be rewritten into