G03 - unchecked block can be used for gas efficiency of the expression that can't overflow/underflow
Check comments
protocol/contracts/utils/CvxMintAmount.sol:21 uint256 currentCliff = cvxTotalSupply / _CLIFF_SIZE; // Could be unchecked since _CLIFF_SIZE is non-zero constant
protocol/contracts/zaps/PoolMigrationZap.sol:22 for (uint256 i; i < newPools_.length; ++i) { // Increment in for loop can be unchecked, it would never overflow with type uint256
protocol/contracts/tokenomics/VestedEscrow.sol:155 uint256 elapsed = _time - startTime; // Could be unchecked due to check on L152
protocol/contracts/BkdLocker.sol:140 i = i - 1; // Could be unchecked due to check on L139
protocol/contracts/BkdLocker.sol:144 stashedWithdraws[i] = stashedWithdraws[stashedWithdraws.length - 1]; //
Could be unchecked since length of stashedWithdraws decrease in sync with counter "i" and loop will end after length 1
G04 - Caching storage values in memory
Variables that are read multiple times in a code block can be cached and re-used instead of reading from storage to save gas.
G01 - Comparison
> 0
is less gas efficient than!= 0
withuint256
inrequire
statement with optimizerG02 - Too long revert string
Shortening revert strings to fit in 32 bytes will decrease deployment time gas and will decrease runtime gas when the revert condition has been met.
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/tokenomics/Minter.sol#L152
G03 -
unchecked
block can be used for gas efficiency of the expression that can't overflow/underflowCheck comments
G04 - Caching storage values in memory
Variables that are read multiple times in a code block can be cached and re-used instead of reading from storage to save gas.
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/StakerVault.sol#L322-L349
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/StakerVault.sol#L359-L398
G05 - Redundant code
The following lines don't change the value of the variable since it's uint256:
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/tokenomics/InflationManager.sol#L575