Use Custom Errors instead of requires with reason strings
The contracts use a number of require() calls with error reason strings. In total there are 57 calls including 34 in InfinityExchange and 9 in InfinityStaker.
Gas can be saved by changing these to use Custom Errors. In particular deployment gas is saved as the strings are replaced by just 4 bytes for the error signature.
As described in the Solidity blog:
require(condition, "error message") should be translated to if (!condition) revert CustomError().
Duplicated function _getCurrentPrice
This function is defined in InfinityOrderBookComplication AND InfinityExchange.
It could be moved to a deployed library and linked into each of these contracts to save on deployment gas.
It would also improve code quality to write some tests against this function directly. Currently it is indirectly tested through other functions.
Unused function InfinityToken._burn can be removed
Removing this will save deployment gas. It's internal and not called.
Use Custom Errors instead of requires with reason strings
The contracts use a number of require() calls with error reason strings. In total there are 57 calls including 34 in InfinityExchange and 9 in InfinityStaker.
Gas can be saved by changing these to use Custom Errors. In particular deployment gas is saved as the strings are replaced by just 4 bytes for the error signature.
As described in the Solidity blog:
require(condition, "error message")
should be translated toif (!condition) revert CustomError()
.Duplicated function _getCurrentPrice
This function is defined in InfinityOrderBookComplication AND InfinityExchange.
It could be moved to a deployed library and linked into each of these contracts to save on deployment gas.
It would also improve code quality to write some tests against this function directly. Currently it is indirectly tested through other functions.
Unused function InfinityToken._burn can be removed
Removing this will save deployment gas. It's internal and not called.