Open code423n4 opened 2 years ago
for
Caching the array length in a for-loop saves gas as the length does not need to be read on every iteration.
The following loops could be refactored:
++i
i++
return
_multicall()
https://github.com/pooltogether/v4-twab-delegator/blob/master/contracts/PermitAndMulticall.sol#L36 _multicall() has named returns we can remove return results;
return results;
Duplicate of https://github.com/code-423n4/2022-02-pooltogether-findings/issues/9, https://github.com/code-423n4/2022-02-pooltogether-findings/issues/14
Gas Optimizations
Cache array length in
for
loops:Caching the array length in a for-loop saves gas as the length does not need to be read on every iteration.
The following loops could be refactored:
++i
is more gas efficient thani++
:The following loops could be refactored:
remove
return
from_multicall()
:https://github.com/pooltogether/v4-twab-delegator/blob/master/contracts/PermitAndMulticall.sol#L36
_multicall()
has named returns we can removereturn results;