๐กeOracle Adapter
This guide shows you how to read and use eOracle Feeds using Solidity, adapted to the Chainlink oracle interface.
This interface can be used to integrate eOracle into existing infrastructure relying on any oracle interface, eg; a ChainLink compatible interface.
Reading eOracle Feeds on any EVM-compatible blockchains is consistent across chains. The query and response format are uniform.
Prerequisites
You have a basic understanding of smart contract development.
You have been using ChainLink interface in your existing project.
Edit/Deploy using Remix by clicking here.
The code has the following elements:
An interface named
IEOFeedAdapter
defines several functions for accessing data from an external source.These functions include retrieving the pair symbol, decimals, description, and version of the data feed, as well as fetching round data and the latest round data.
The constructor initializes a public variable named
_feedAdapter
, which is of typeIEOFeedAdapter
. It sets_feedAdapter
to connect to a specificEOFeedAdapter
contract deployed on the Holesky network at address0xDD8387185C9e0a173702fc4a3285FA576141A9cd
. This adapter is designated for theBTC
feed.The
getPrice()
function retrieves the latest price data from the_feedAdapter
by calling thelatestRoundData()
function. It returns the answer, which represents the latest price of theBTC
feed.The
usePrice()
function internally callsgetPrice()
to fetch the latest price , illustrating how the price could be parsed and used.
Contact support@eoracle.io for more details on deployments and usage.
Last updated