calculate BlockNumber.get() before the loop in line 289 and save it in a variable to prevent calculating it (and calling the get function) in every iteration.
code before:
for (uint256 i; i < ids.length; i++) {
...
require(due.startBlock != BlockNumber.get(), 'E207');
...
}
code after:
uint32 startblock = BlockNumber.get();
for (uint256 i; i < ids.length; i++) {
...
require(due.startBlock != startblock , 'E207');
...
}
Handle
OriDabush
Vulnerability details
TimeswapPair.sol - Gas Optimization
calculate BlockNumber.get() before the loop in line 289 and save it in a variable to prevent calculating it (and calling the get function) in every iteration.
code before:
code after: