[G-09] Multiple addresses mapping can be combined into a single mapping of an address to a struct, where appropriate
Saves a storage slot for the mapping. Depending on the circumstances and sizes of types, can avoid a Gsset (20000 gas) per mapping combined. Reads and subsequent writes can also be cheaper when a function requires both values and they both fit in the same storage slot. Finally, if both fields are accessed in the same function, can save ~42 gas per access due to not having to recalculate the key’s keccak256 hash (Gkeccak256 - 30 gas) and that calculation’s associated stack operations.
[G-01] != 0 costs less gas compared to > 0 for unsigned integers in require statements with the optimizer enabled (6 gas)
There are 1 instances of this issue ::
File: => https://github.com/jbx-protocol/juice-nft-rewards/blob/f9893b1497098241dd3a664956d8016ff0d0efd0/contracts/abstract/JB721Delegate.sol#L116
Remediation
Try to use !=0 instaed of >0 in case of uints
[G-02] >= COSTS LESS GAS THAN >
The compiler uses opcodes GT and ISZERO for solidity code that uses >, but only requires LT for >=, which saves 3 gas
There are 3 instances of this issue ::
File: => https://github.com/jbx-protocol/juice-nft-rewards/blob/f9893b1497098241dd3a664956d8016ff0d0efd0/contracts/abstract/JB721Delegate.sol#L120
Remediation
Try to use >= instead of > whenever possible may be function logic should model on this during contract writing.
[G-03] Loop can be more optimizable
There are 5 instances of this issue:
Recommended Mitigation
. Should not initialize uint with default value i.e uint i=0 TO uint i; . Should use ++i instead i++ . Should uncheck i++
[G-04] += costs more gas than = + for state variables
There are 6 instances of this issue:
[G-05] Divide by 2 should be bit-shift. If possible try to use bit-shift in replace of multiplication and division
There is 1 instance of this issue::
[G-06] Unchecking Arithmetic operations that can't Under/Overflow
There is 3 instance of this issue::
[G-07] Memory should cached inside function and then used further
There is 3 instance of this issue::
[G-08] Variables that could be immutable
There is 3 instance of this issue::
[G-09] Multiple addresses mapping can be combined into a single mapping of an address to a struct, where appropriate
Saves a storage slot for the mapping. Depending on the circumstances and sizes of types, can avoid a Gsset (20000 gas) per mapping combined. Reads and subsequent writes can also be cheaper when a function requires both values and they both fit in the same storage slot. Finally, if both fields are accessed in the same function, can save ~42 gas per access due to not having to recalculate the key’s keccak256 hash (Gkeccak256 - 30 gas) and that calculation’s associated stack operations.
There are 1 instances of this issue: