๐Ÿ“ก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.


// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

interface IEOFeedAdapter {
    function getPairSymbol() external view returns (uint16);
    function decimals() external view returns (uint8);
    function description() external view returns (string memory);
    function version() external view returns (uint256);
    function getRoundData(uint80 _roundId)
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

    function latestRoundData()
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

contract EOCLConsumerExample {
    IEOFeedAdapter public _feedAdapter;
     * Network: Holesky
     * EOFeedAdapter: 0xDD8387185C9e0a173702fc4a3285FA576141A9cd
     * Feed Symbol: BTC

    constructor() {
        _feedAdapter = IEOFeedAdapter(0xDD8387185C9e0a173702fc4a3285FA576141A9cd);

    function getPrice() external view returns (int256 answer) {
        (, answer,,,) = _feedAdapter.latestRoundData();

    function usePrice() external {
        int256 answer = this.getPrice();
        // Do something
        // .............

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 type IEOFeedAdapter. It sets _feedAdapter to connect to a specific EOFeedAdapter contract deployed on the Holesky network at address 0xDD8387185C9e0a173702fc4a3285FA576141A9cd. This adapter is designated for the BTC feed.

  • The getPrice() function retrieves the latest price data from the _feedAdapter by calling the latestRoundData() function. It returns the answer, which represents the latest price of the BTC feed.

  • The usePrice() function internally calls getPrice() 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