Omniscia Boson Protocol Audit
SellerBase Code Style Findings
SellerBase Code Style Findings
SBE-01C: Multiple Top-Level Type Declarations
Type | Severity | Location |
---|---|---|
Code Style | ![]() | SellerBase.sol:L15, L170 |
Description:
The SellerBase
file contains two top-level declarations (SellerBase
and IInitializableClone
).
Example:
168}169
170interface IInitializableClone {
Recommendation:
We advise the latter of the two to be split to its dedicated file to aid in the codebase's maintainability.
Alleviation (44009967e4f68092941d841e9e0f5dd2bb31bf0b):
The IInitializableClone
interface declaration has been renamed and relocated to its dedicated file that is imported to the codebase thus alleviating this exhibit.
SBE-02C: Repetitive Invocations of Getter Functions
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | SellerBase.sol:L49-L54, L62, L68-L70, L82, L124, L128, L132-L133 |
Description:
The linked statements repetitively invoke the same getter functions whilst their return values remain unchanged.
Example:
48require(49 protocolLookups().sellerIdByOperator[_seller.operator] == 0 &&50 protocolLookups().sellerIdByOperator[_seller.clerk] == 0 &&51 protocolLookups().sellerIdByAdmin[_seller.operator] == 0 &&52 protocolLookups().sellerIdByAdmin[_seller.clerk] == 0 &&53 protocolLookups().sellerIdByClerk[_seller.operator] == 0 &&54 protocolLookups().sellerIdByClerk[_seller.clerk] == 0,55 SELLER_ADDRESS_MUST_BE_UNIQUE56);
Recommendation:
We advise the getter functions to be invoked once and their results to be stored to local variables that are consequently utilized optimizing the gas cost of the statements significantly.
Alleviation (44009967e4f68092941d841e9e0f5dd2bb31bf0b):
The protocol lookups are now correctly cached to local variable declarations thus optimizing the codebase's gas cost.