In InfinityStaker.sol:L25, marking INFINITY_TOKEN as immutable (as it never change outside the constructor) would avoid it taking space in the storage:
- address public INFINITY_TOKEN;
+ address public immutable INFINITY_TOKEN;
[G-02] Unnecesary checks on if
Since the conditions are order from lower to high you dont have to double check the lower bounds.
on InfinityStaker.sol#L69 there is no need to check if contract has enough balance, because safeTransferFrom will fail if contract doesnt have enough balance.
Gas Report
[G-01] USE
immutable
In InfinityStaker.sol:L25, marking
INFINITY_TOKEN
as immutable (as it never change outside the constructor) would avoid it taking space in the storage:[G-02] Unnecesary checks on if
Since the conditions are order from lower to high you dont have to double check the lower bounds.
[G-03] Avoid caching array length for calldata variables
You could save 5 gas if you avoid caching array length of calldata variables on:
InfinityExchange.sol
InfinityExchange.sol#L137 InfinityExchange.sol#L191 InfinityExchange.sol#L262 InfinityExchange.sol#L301 InfinityExchange.sol#L341 InfinityExchange.sol#L391 InfinityExchange.sol#L1047 InfinityExchange.sol#L1085 InfinityExchange.sol#L1106 InfinityExchange.sol#L1188 InfinityExchange.sol#L1204
InfinityOrderBookComplication.sol
InfinityOrderBookComplication.sol#L75 InfinityOrderBookComplication.sol#L81 InfinityOrderBookComplication.sol#L198 InfinityOrderBookComplication.sol#L215 InfinityOrderBookComplication.sol#L237-L238 InfinityOrderBookComplication.sol#L283-L284 InfinityOrderBookComplication.sol#L319
[G-04] Unnecesary require
on InfinityStaker.sol#L69 there is no need to check if contract has enough balance, because
safeTransferFrom
will fail if contract doesnt have enough balance.