Omniscia Vendor Finance Audit

VendorLicenseEngine Code Style Findings

VendorLicenseEngine Code Style Findings

VLE-01C: Generic Typographic Mistake

Description:

The referenced line contains a typographical mistake or generic documentational error (i.e. copy-paste) that should be corrected.

Example:

contracts/VendorLicenseEngine.sol
31///@notice Error if not facotry is trying to increment the amount of pools deployed by license

Recommendation:

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

Description:

The LicenseInfo contains a redundant exists data point that can be deduced by identifying whether the value of maxPoolCount is non-zero.

Example:

contracts/VendorLicenseEngine.sol
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: true
74});

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

Description:

The linked value literal is repeated across the codebase multiple times.

Example:

contracts/VendorLicenseEngine.sol
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.