Omniscia Boson Protocol Audit
ProtocolBase Code Style Findings
ProtocolBase Code Style Findings
PBS-01C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | ProtocolBase.sol: • I-1: L724 • I-2: L731 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.
Example:
contracts/protocol/bases/ProtocolBase.sol
723if (priceRangesLength > 0) {724 for (uint256 i; i < priceRangesLength - 1; ++i) {725 if (_price <= priceRanges[i]) {726 // Return the fee percentage for the matching price range727 return feePercentages[i];728 }729 }730 // If price exceeds all ranges, use the highest fee percentage731 return feePercentages[priceRangesLength - 1];732}Recommendation:
Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.
Alleviation:
The first arithmetic operation has been wrapped in an unchecked code block whereas the second arithmetic operation has been removed.
As such, we consider this exhibit fully addressed.
