Issue: Should use != 0 instead of > 0 in a require statement if the variable is an unsigned integer (uint)
Explanation: != 0 should be used where possible since > 0 costs more gas.
Issue: Variables should not be initialized to their default values
Explanation: Initializing uint256 variables to their default value of zero is unnecessary and costs gas.
Issue: Should use
!= 0
instead of> 0
in arequire
statement if the variable is an unsigned integer (uint
) Explanation:!= 0
should be used where possible since> 0
costs more gas.https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/inception/InceptionVaultsCore.sol#L121-L126
Change
_amount > 0
to_amount != 0
https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/oracles/GUniLPOracle.sol#L112
Change
rA > 0 || rB > 0
torA != 0 || rB != 0
Issue: Use of '&&' within a
require
function Explanation: Dividing therequire
into separaterequire
messages instead of using '&&' will save gasThe two lines below contain identical code: https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/liquidityMining/v2/GenericMinerV2.sol#L58
https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/liquidityMining/v2/PARMinerV2.sol#L52
Change to:
The two lines below contain identical code: https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/liquidityMining/v2/GenericMinerV2.sol#L70
https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/liquidityMining/v2/PARMinerV2.sol#L71
Change to:
The two lines below contain identical code: https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/liquidityMining/v2/GenericMinerV2.sol#L331
https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/liquidityMining/v2/PARMinerV2.sol#L426
Change to:
Issue: Variables should not be initialized to their default values Explanation: Initializing
uint256
variables to their default value of zero is unnecessary and costs gas.https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/contracts/inception/InceptionVaultsCore.sol#L218
Change
uint256 insuranceAmount = 0;
touint256 insuranceAmount;