Omniscia Teahouse Finance Audit
AaveATokenOracle Code Style Findings
AaveATokenOracle Code Style Findings
AAT-01C: Loop Iterator Optimizations
Type | Severity | Location |
---|---|---|
Gas Optimization | AaveATokenOracle.sol:L60, L81, L96 |
Description:
The linked for
loops increment / decrement their iterator "safely" due to Solidity's built - in safe arithmetics (post-0.8.X
).
Example:
contracts/oracle/AaveATokenOracle.sol
60for (uint256 i; i < _assets.length; i = i + 1) {
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 (302b96f324a88038a0872015466cd43783c14543):
The referenced loop iterator increment statements have been relocated at the end of each respective for
loop's body and have been unwrapped in an unchecked
code block, optimizing their gas cost.