Omniscia Vendor Finance Audit
VendorLicenseEngine Code Style Findings
VendorLicenseEngine Code Style Findings
VLE-01C: Generic Typographic Mistake
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | VendorLicenseEngine.sol:L31 |
Description:
The referenced line contains a typographical mistake or generic documentational error (i.e. copy-paste) that should be corrected.
Example:
31///@notice Error if not facotry is trying to increment the amount of pools deployed by licenseRecommendation:
We advise this to be done so to enhance the legibility of the codebase.
Alleviation:
The error declaration has been relocated to a dedicated IErrors file and all typographic mistakes have been corrected.
VLE-02C: Redundant Existence Data Point
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | VendorLicenseEngine.sol:L73, L83, L89, L95, L104, L112, L120 |
Description:
The LicenseInfo contains a redundant exists data point that can be deduced by identifying whether the value of maxPoolCount is non-zero.
Example:
60if (_discount < 0 || _discount > 1000000) revert InvalidDiscount();61if (_colDiscount < 0 || _colDiscount > 1000000) revert InvalidDiscount();62if (_expiry <= block.timestamp) revert InvalidDiscount();63if (_maxPoolCount == 0) revert InvalidDiscount();64uint256 tokenId = _tokenIdCounter.current();65_tokenIdCounter.increment();66_safeMint(to, tokenId);67LicenseInfo memory lic = LicenseInfo({68 maxPoolCount: _maxPoolCount,69 currentPoolCount: 0,70 discount: _discount,71 colDiscount: _colDiscount,72 expiry: _expiry,73 exists: true74});Recommendation:
We advise the variable to be omitted and the maxPoolCount to be validated instead optimizing the codebase's gas cost.
Alleviation:
The exists data point has been omitted from the codebase and now maxPoolCount is utilized in its place to ensure validation of a particular license thereby alleviating this exhibit.
VLE-03C: Repetitive Value Literal
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | VendorLicenseEngine.sol:L60, L61, L84, L90 |
Description:
The linked value literal is repeated across the codebase multiple times.
Example:
60if (_discount < 0 || _discount > 1000000) revert InvalidDiscount();Recommendation:
We advise it to be set to a constant variable instead optimizing the legibility of the codebase.
Alleviation:
A contract-level constant has been declared as HUNDRED_PERCENT replacing all instances of the literal and optimizing the legibility of the codebase.
