Omniscia Moby Audit
FeeDistributor Code Style Findings
FeeDistributor Code Style Findings
FDR-01C: Loop Iterator Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | FeeDistributor.sol:L84 |
Description:
The linked for
loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X
).
Example:
84for (uint256 i = 0; i < _tokens.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 (a8720219a6a97e10b8d9c6a70c6345747f0fdcb3):
The referenced loop iterator's increment statement has been relocated at the end of the for
loop's body and has been unwrapped in an unchecked
code block, optimizing its gas cost.
FDR-02C: Repetitive Value Literal
Type | Severity | Location |
---|---|---|
Code Style | FeeDistributor.sol:L110, L114, L174 |
Description:
The linked value literal is repeated across the codebase multiple times.
Example:
110uint256 treasuryAmount = rewardTotal * treasuryRate / 100;
Recommendation:
We advise it to be set to a constant
variable instead optimizing the legibility of the codebase.
Alleviation (a8720219a6a97e10b8d9c6a70c6345747f0fdcb3):
The Moby team stated that it is not possible to define the rewardTotal
and treasuryRate
evaluation as a constant, however, the exhibit was referencing the 100
value literal to achieve this.
As such, we consider the exhibit to remain acknowledged.