Omniscia Mean Finance Audit
GetBalances Code Style Findings
GetBalances Code Style Findings
GBS-01C: Loop Iterator Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | GetBalances.sol:L22 |
Description:
The linked for
loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics(post - 0.8.X
).
Example:
solidity/contracts/extensions/GetBalances.sol
22for (uint256 i; i < _tokens.length; i++) {
Recommendation:
We advise the increment / decrement operation to be performed in an unchecked
code block as the last statement within the for
loop to optimize its execution cost.
Alleviation:
The linked for
loop has been appropriately optimized via the usage of an unchecked
code block for the iterator's increment.