InitBip0 Code Style Findings

InitBip0 Code Style Findings

IB0-01C: Inefficient Loop Data Type

Type Severity Location
Gas Optimization InitBip0.sol:L58

Description:

The EVM is built to operate on 32 byte data types and any type less than that requires extra padding and un-padding operations to utilise it.

Example:

protocol/contracts/farm/init/InitBip0.sol
58for (uint32 i = 0; i < sOld.g.bipIndex; i++) {

Recommendation:

We advise the linked loop iterator to be adjusted from uint32 to uint256 to optimise the gas cost of the contract.

Alleviation:

The loop data type was updated to a uint256 and internally within the loop it is casted to a uint32 and consequently utilized for all intents and purposes thereby optimizing the codebase.

View Fix on GitHub
Navigated to InitBip0 Code Style Findings