Decimal Code Style Findings

Decimal Code Style Findings

DEC-01C: Return Value Optimization

Type Severity Location
Gas Optimization Decimal.sol:L136

Description:

The linked code re-creates the value of 1 in its D256 form instead of yielding one() directly.

Example:

protocol/contracts/libraries/Decimal.sol
135if (b == 0) {
136 return from(1);
137}

Recommendation:

We advise the from(1) statement to be replaced by one() to optimize the code.

Alleviation:

The value of one() is optimally returned as advised.

View Fix on GitHub