Omniscia Mantissa Finance Audit
Pool Code Style Findings
Pool Code Style Findings
PLO-01C: Loop Iterator Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | Pool.sol:L254 |
Description:
The linked for
loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X
).
Example:
contracts/Pool.sol
254for (uint i = 0; i < lpList.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 (418ee413ad8e26f7eea383764c19953ff31b2bf3):
The referenced loop iterator increment statement has been optimized by relocating it to the end of the for
loop's body and performing it within an unchecked
code block.