Omniscia Mean Finance Audit
TakeRunSwapsAndTransferMany Code Style Findings
TakeRunSwapsAndTransferMany Code Style Findings
TRA-01C: Loop Iterator Optimizations
Type | Severity | Location |
---|---|---|
Gas Optimization | TakeRunSwapsAndTransferMany.sol:L41, L46, L52, L58 |
Description:
The linked for
loops increment / decrement their iterator "safely" due to Solidity's built - in safe arithmetics(post - 0.8.X
).
Example:
solidity/contracts/extensions/TakeRunSwapsAndTransferMany.sol
41for (uint256 i; i < _parameters.swappers.length; i++) {
Recommendation:
We advise the increment / decrement operations to be performed in an unchecked
code block as the last statement within each for
loop to optimize their execution cost.
Alleviation:
All for
loops have been appropriately optimized via the usage of the unchecked
code block for each iterator's increment.