Skip to content
Lattice

IPriceOracleReader

Git Source

Title: IPriceOracleReader

Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)

The provider-agnostic READ surface for a Lattice price-oracle adapter: a single latestAnswer(bytes32 key) returning a WAD-normalized (1e18) price. A consumer can depend on this interface to read any adapter that exposes a matching latestAnswer, without coupling to a specific provider.

This interface unifies only the normalized READ — each adapter keeps its own provider-specific surface (registration, write semantics, etc.) entirely separate. An adapter that wishes to be read through this interface declares a latestAnswer(bytes32)->int256 with the SAME selector DIRECTLY (not by inheriting this interface): Solidity excludes inherited functions from type(I).interfaceId, so inheriting would shift the adapter's ERC-165 id.

No adapter checks an L2 sequencer-uptime feed or bounds its answer. The opt-in IOracleGuard (OracleGuard facet) adds both checks over any adapter that implements this read.

Functions

latestAnswer

Returns the latest price for key, normalized to 18 decimals (WAD).

function latestAnswer(bytes32 key) external view returns (int256 answerWad);

Parameters

NameTypeDescription
keybytes32The feed identifier (chosen by the administrator).

Returns

NameTypeDescription
answerWadint256The latest price scaled to 1e18.