JPEGLock: pack owner + unlockAt saving ~21k gas. Could use up to 96 bits and still pack into 1 slot, 96 bits is way more than you need for a date.
JPEGStaking: This contract upgradeable but the JPEG token is not. It's not common, but with an upgradeable contract you can use immutable variables to save gas. Using a constructor and switching to IERC20Upgradeable public immutable jpeg saves ~2.1k per stake/unstake call since there is no SLOAD required for immutable variables (they have the gas efficiency of a constant, except for the constructor cost itself).
CryptoPunksHelper / EtherRocksHelper: These are the only use cases for NFTEscrow, suggesting that the nftAddress could be made immutable (similar to the point above), saving ~2.1k per call.
NFTEscrow: Separate getSalt from precompute to avoid unnecessary calculations anytime _executeTransfer is called.
JPEGStaking: line 46 _amount <= balanceOf(msg.sender) is redundant, the internal _burn call will validate that as well. Saving ~500 gas.
Consistency / small gas savings: Cache loop length consistently. e.g. in LPFarming, _massUpdatePools caches but claimAll does not.
owner
+unlockAt
saving ~21k gas. Could use up to 96 bits and still pack into 1 slot, 96 bits is way more than you need for a date.immutable
variables to save gas. Using a constructor and switching toIERC20Upgradeable public immutable jpeg
saves ~2.1k per stake/unstake call since there is no SLOAD required for immutable variables (they have the gas efficiency of a constant, except for the constructor cost itself).nftAddress
could be made immutable (similar to the point above), saving ~2.1k per call.precompute
to avoid unnecessary calculations anytime_executeTransfer
is called._amount <= balanceOf(msg.sender)
is redundant, the internal_burn
call will validate that as well. Saving ~500 gas._massUpdatePools
caches butclaimAll
does not.