Gravita-Protocol / Gravita-SmartContracts

GNU General Public License v3.0
48 stars 31 forks source link

[PFD-02C] Inefficient Data Transformation #379

Closed 0xfornax closed 1 year ago

0xfornax commented 1 year ago

PFD-02C: Inefficient Data Transformation

Type Severity Location
Gas Optimization PriceFeed.sol:L136

Description:

The timeoutMinutes data entry of an oracle is always converted to seconds within the PriceFeed contract.

Example:

    return block.timestamp - _priceTimestamp > _oracleTimeoutMinutes * 60;
}

Recommendation:

We advise it to be stored as seconds instead, eliminating the need for a multiplication in PriceFeed::_isStalePrice and thus optimizing its gas cost.

0xfornax commented 1 year ago

Fixed.