Omniscia BlazeSwap Audit
BlazeSwapBasePair Code Style Findings
BlazeSwapBasePair Code Style Findings
BSB-01C: Inefficient Loop Limit Evaluation
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | BlazeSwapBasePair.sol:L117 |
Description:
The linked for loop evaluates its limit inefficiently on each iteration.
Example:
contracts/core/BlazeSwapBasePair.sol
117for (uint256 i; i < pendingFeeAccount.length; i++) {Recommendation:
We advise the statement within the for loop limit to be relocated outside to a local variable declaration that is consequently utilized for the evaluation to significantly reduce the codebase's gas cost. We should note the same optimization is applicable for storage reads present in those limits as they are newly read on each iteration (i.e. length members of arrays in storage).
Alleviation:
The BlazeSwap team considered this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.
