Omniscia Mantissa Finance Audit
PoolVolatile Code Style Findings
PoolVolatile Code Style Findings
PVE-01C: Loop Iterator Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | PoolVolatile.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/PoolVolatile.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.