Omniscia Vendor Finance Audit

VendorFeesManager Code Style Findings

VendorFeesManager Code Style Findings

VFM-01C: Inefficient mapping Lookups

Description:

The linked statements perform key-based lookup operations on mapping declarations from storage multiple times for the same key redundantly.

Example:

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

Description:

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

Example:

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