Omniscia Boson Protocol Audit

ProtocolBase Code Style Findings

ProtocolBase Code Style Findings

PBS-01C: Repetitive Invocations of Getter Functions

TypeSeverityLocation
Gas OptimizationProtocolBase.sol:L297, L300, L339, L342, L488, L491

Description:

The linked statements repetitively invoke the same getter functions whilst their return values remain unchanged.

Example:

contracts/protocol/bases/ProtocolBase.sol
487// Get the dispute's slot
488dispute = protocolEntities().disputes[_exchangeId];
489
490// Get the disputeDates's slot
491disputeDates = protocolEntities().disputeDates[_exchangeId];

Recommendation:

We advise the getter functions to be invoked once and their results to be stored to local variables that are consequently utilized optimizing the gas cost of the statements significantly.

Alleviation (44009967e4f68092941d841e9e0f5dd2bb31bf0b):

The protocol entities are now correctly cached to local variable declarations thus optimizing the codebase's gas cost.