Omniscia Vendor Finance Audit
VendorFeesManager Code Style Findings
VendorFeesManager Code Style Findings
VFM-01C: Inefficient mapping
Lookups
Type | Severity | Location |
---|---|---|
Gas Optimization | VendorFeesManager.sol:L55 |
Description:
The linked statements perform key-based lookup operations on mapping
declarations from storage multiple times for the same key redundantly.
Example:
55if (rateFunction[_pool] != 0 && rateFunction[_pool] != _type) revert InvalidType();
Recommendation:
As the lookups internally perform an expensive keccak256
operation, we advise the lookups to be cached wherever possible to a single local declaration that either holds the value of the mapping
in case of primitive types or holds a storage
pointer to the struct
contained.
Alleviation:
The lookup has been optimized by storing it to a local variable (rateType
) once and consequently utilizing it twice, optimizing the codebase as advised.
VFM-02C: Repetitive Value Literal
Type | Severity | Location |
---|---|---|
Code Style | VendorFeesManager.sol:L77, L80 |
Description:
The linked value literal is repeated across the codebase multiple times.
Example:
77return (_rawPayoutAmount * getCurrentRate(address(_pool))) / 1000000;
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.