Source Adapters

Standardization contract to unify incoming interfaces.

This adapter wraps an oracle interface for ingestion into the Oval contract, allowing the Oval to handle any custom middleware or interaction patterns that a protocol uses for talking to Chainlink contracts. The common example is the standard Chainlink Source Adapter that interacts with a standard Chainlink interface in the case that there is no middleware between the protocol and a standard Chainlink feed.

  1. Access Chainlink prices via any interface.

  2. Standardize decimals across different feeds. All internal logic assumes 18 decimals.

In internal Oval calls (between source adapter, Oval contract, and destination adapters) we pass around “sourceData” which is a tuple of the latest price and latest timestamp as (int256, uint256).

The minimal interface for a source adapter looks as follows:

interface IXSourceOracleAdapter { // Returns the latest price data from the source and the update timestamp. function getLatestSourceData() view returns (int256, uint256);

// Tries getting latest data as of requested timestamp. 
// If this is not available returns the earliest data available past the
// requested timestamp bounded by maxTraversal.
function tryLatestDataAt(uint256 timestamp, uint256 maxTraversal) view returns (int256, uint256);

// If the source requires snapshotting, this executes the snapshot.
function snapshotData() external;
}

Oval offers multiple source adapters. The directory containing the source adapters can be found here.

The following table summarizes the Source Adapters supported by Oval and their compatibilities with Source Oracles. A single adapter can be compatible with multiple Oracles (e.g., ChainlinkSourceAdapter can be used for both Chainlink and Redstone Classic, as they implement the same interfaces). In the resources column, you will find tools and documentation to deploy your Oval instance with your required configuration.

Last updated