Omniscia Boson Protocol Audit
ProtocolLib Code Style Findings
ProtocolLib Code Style Findings
PLB-01C: Generic Typographic Mistake
Type | Severity | Location |
---|---|---|
Code Style | ![]() | ProtocolLib.sol:L57 |
Description:
The referenced line contains a typographical mistake or generic documentational error (i.e. copy-paste) that should be corrected.
Example:
57// limit the sum of (Protocol Fee percentage + Agent Fee perpercentagecent) of an offer fee
Recommendation:
We advise this to be done so to enhance the legibility of the codebase.
Alleviation (44009967e4f68092941d841e9e0f5dd2bb31bf0b):
The typographic mistake has been appropriately corrected.
PLB-02C: Inefficient Data Types
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | ProtocolLib.sol:L66, L156 |
Description:
The uint16
data type utilized in the linked instances is redundant as it does not take advantage of Solidity's tight-packing mechanism and represents a sub-256 bit data type that is more expensive to operate on.
Example:
63// Protocol fees storage64struct ProtocolFees {65 // Percentage that will be taken as a fee from the net of a Boson Protocol exchange66 uint16 percentage; // 1.75% = 175, 100% = 1000067 // Flat fee taken for exchanges in $BOSON68 uint256 flatBoson;69}
Recommendation:
We advise a full uint256
variable and storage slot to be utilized by the referenced data entries as the EVM is natively more performant when operating on 256-bit data types than when operating on sub-256 data types as on the latter it has to perform low-level padding and unpadding operations on the operated members.
Alleviation (44009967e4f68092941d841e9e0f5dd2bb31bf0b):
The first data type has been up-scaled to a uint256
properly whilst the latter data type is no longer present in the codebase thus addressing this exhibit in full.