Omniscia DAFI Protocol Audit

DAFI Code Style Findings

DAFI Code Style Findings

DAF-01C: Redundant Usage of Storage

TypeSeverityLocation
Gas OptimizationInformationalDAFI.sol:L161

Description:

The dTokenDetails[_type].currentPrice variable used in the linked calculation is equivalent to the in-memory newPrice variable also evaluated by the surrounding if clause.

Example:

contracts/DAFI.sol
157if (newPrice > dTokenDetails[_type].baseLinePrice){
158 demandFactor = 1 ether;
159}
160else {
161 demandFactor = ((dTokenDetails[_type].currentPrice).mul(1 ether)).div(dTokenDetails[_type].baseLinePrice);
162}

Recommendation:

We advise the newPrice variable to be used directly reducing the gas cost of the function as well as increasing its legibility.The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.

Alleviation:

The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.