Skip to main content
DIA is a cross-chain, trustless oracle network delivering verifiable price feeds for Hemi. DIA sources raw trade data directly from primary markets and computes it onchain, ensuring complete transparency and data integrity.

Oracle Contracts

Oracle Configuration

Deviation (%)1%
Heartbeat1h

Available Asset Feeds

ChainPrice FeedTypeAdapter Address (AggregatorV3Interface)
Hemi MainnethemiBTCFundamental0x240B2470421f16c6eb1F41db39c6156fb719Cd94
EthereumhemiBTCFundamental0x798c4b91168f5c9a3b571722941756934135b059
Hemi MainnetsatUSDMarketN/A

How to Access Data

getValue Method

To consume price data, you’ll need to invoke the getValue method on the oracle contract which you can access through the DIA Oracle library or the interface. Below is an example of a contract consuming data from the oracle on Hemi Mainnet chain using the IDIAOracleV2 interface. If you pass fairValue:hemiBTC as the key, it will return the fair-value of hemiBTC with 8 decimal places (e.g. 100580335 is $1.00580335) along with the Unix timestamp of the last price update. You can also query the other values by passing the following keys to the getValue function:
  • usdValue:hemiBTC: the price of hemiBTC in USD
  • numerator:hemiBTC: the total BTC reserves
  • denominator:hemiBTC: the total hemiBTC supply
  • DEX:satUSD/USD: the price of satUSD in USD
pragma solidity ^0.8.13;

interface IDIAOracleV2 {
    function getValue(string memory) external view returns (uint128, uint128);
}

contract DIAOracleV2Consumer{

    address immutable ORACLE = 0xE609bFAF4449da0B97C0F7a54b1ea8Fb8D8FD7ED;

    function getPrice(string memory key)
    external
    view
    returns (
        uint128 latestPrice,
        uint128 timestampOfLatestPrice
    ) {
        (latestPrice, timestampOfLatestPrice) =
                 IDIAOracleV2(ORACLE).getValue(key);
    }
}
See the full example here.

Adapter contracts

To consume price data from our oracle, you can use the adapter smart contract located at the adapter address for each asset. This will allow you to access the same methods on the AggregatorV3Interface such as getRoundData & latestRoundData. You can learn more here. This is a sample contract for consuming the hemiBTC fundamental price feed:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface DiaAssetSpecificCallingConvention {
    function latestRoundData() external view returns (
        uint80 roundId,
        int256 answer,
        uint256 startedAt,
        uint256 updatedAt,
        uint80 answeredInRound
    );
}

contract DIAOracleSample {
    address hemiBTCAdapter = 0x240B2470421f16c6eb1F41db39c6156fb719Cd94;

    function getHemiBTCLatestPrice() external view returns (
        uint128 latestPrice,
        uint128 timestampOflatestPrice
    ) {
        // Call the Chainlink adapter's latestRoundData function
        (, int256 answer, , uint256 updatedAt, ) =
            DiaAssetSpecificCallingConvention(hemiBTCAdapter).latestRoundData();

        latestPrice = uint128(uint256(answer));
        timestampOflatestPrice = uint128(updatedAt);

        return (latestPrice, timestampOflatestPrice);
    }
}

Request a Custom Oracle

DIA offers highly customizable oracles that are individually tailored to each dApp’s needs. Each oracle can be customized in the following ways, including:
  • Data Sources & Asset Feeds
  • Pricing Methodologies
  • Update Triggers (Frequency, Deviation, Heartbeat, …etc)
Get a tailored oracle for your dApp, request one below:

Support

For developer assistance, connect with the DIA team directly on Discord or Telegram.