Skip to main content
DIA is a cross-chain oracle provider that sources granular market data from diverse exchanges, including CEXs and DEXs. Its data sourcing is thorough, enabling unparalleled transparency and customizability for resilient price feeds for 20,000+ assets. Its versatile data processing and delivery ensures adaptability and reliability for any decentralized application.

Oracle details

ChainAddress
Mainnet0xbA0E0750A56e995506CA458b2BdD752754CF39C4
Testnet0x9206296ea3aee3e6bdc07f7aaef14dfcf33d865d

Oracle configuration

Pricing MethodologyMAIR
Deviation (%) & Refresh Frequency0.5% and 120 seconds
Heartbeat24h

Asset feeds

Mainnet

Asset TickerAdapter addressAsset Markets
USDT0x936C4F07fD4d01485849ee0EE2Cdcea2373ba267USDT markets
USDC0x5D4266f4DD721c1cD8367FEb23E4940d17C83C93USDC markets
BTC0xb12e1d47b0022fA577c455E7df2Ca9943D0152bEBTC markets
ARB0x6a96a0232402c2BC027a12C73f763b604c9F77a6ARB markets
SOL0xa4a3a8B729939E2a79dCd9079cee7d84b0d96234SOL markets
SOMI0x1f5f46B0DABEf8806a1f33772522ED683Ba64E27SOMI markets

Testnet

Asset TickerAdapter addressAsset Markets
USDT0x67d2c2a87a17b7267a6dbb1a59575c0e9a1d1c3eUSDT markets
USDC0x235266D5ca6f19F134421C49834C108b32C2124eUSDC markets
BTC0x4803db1ca3A1DA49c3DB991e1c390321c20e1f21BTC markets
ARB0x74952812B6a9e4f826b2969C6D189c4425CBc19BARB markets
SOL0xD5Ea6C434582F827303423dA21729bEa4F87D519SOL markets
SOMI0xaEAa92c38939775d3be39fFA832A92611f7D6aDeSOMI markets

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 our oracle on Sepolia testnet. If you pass BTC/USD as the key, it will return the most recent price of BTC in USD with 8 decimal places (e.g. 9601458065403 is $96,014.58065403) along with the Unix timestamp of the last price update.
pragma solidity ^0.8.13;

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

contract DIAOracleV2Consumer{

    address immutable ORACLE = 0x9206296ea3aee3e6bdc07f7aaef14dfcf33d865d;

    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 $SOMI 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 somiAdapter =

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

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

        return (latestPrice, timestampOflatestPrice);
    } // SOMI:1.23125165
}

Lumina Stack Feeds

Demo oracles are available for testing the new fully verifiable & decentralized Lumina stack on Somnia testnet.

Oracle Details

ChainContractAddress
TestnetPush Oracle0xFb1462A649A92654482F8E048C754333ad85e5C0
TestnetPull Oracle0x4E0BD1602f2FeC717E751F24f4e8178bfb9f5dc6

Oracle Configuration

Pricing MethodologyMedian
Deviation (%) & Refresh Frequency1% and 120 seconds
Heartbeat24h

Asset Feeds

Asset Tickerupdates(key)Asset Markets
ETHETH/USDETH Markets
BTCBTC/USDBTC Markets
DIADIA/USDDIA Markets
USDCUSDC/USDUSDC Markets

Additional Details

You can find the contract addresses for the Somnia bridge’s components on testnet below:

How to Access Data

To consume price data, select the method required for your dapp. The updates method is available for Push-based oracles and request method for Pull-based oracles. The price updates are stored in both methods in an updates mapping. When accessing the updates mapping through the key BTC/USD, it will return the most recent price of BTC in USD with 8 decimal places (e.g. 9601458065403 is $96,014.58065403) along with the Unix timestamp of the last price update. Below are sample contracts that consume the BTC/USD price feed through both methods:

updates Method

pragma solidity ^0.8.13;

import { PushOracleReceiver } from "@dia-data/contracts-spectra/PushOracleReceiver.sol";

contract DIAOracleSample {

    PushOracleReceiver public diaOracle;
    string public key = "BTC/USD";

    constructor(address _oracle) {
        diaOracle = PushOracleReceiver(payable(_oracle));
    }

    function getPrice()
    external
    view
    returns (
        uint128 timestampOflatestPrice,
        uint128 latestPrice
    ) {
        (timestampOflatestPrice, latestPrice) =
                 diaOracle.updates(key);
    }
}

request Method

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

import { RequestOracle } from "@dia-data/contracts-spectra/RequestOracle.sol";

contract PullOracleSample {
    address public constant DIA_RECIPIENT = 0x9bb71344Ed950F9cFD85EE1C7258553B01d95FA0; // DIA testnet
    uint32 public constant DESTINATION_DOMAIN = 100640; // DIA testnet chain id

    RequestOracle public diaOracle;
    string public key = "BTC/USD";

    constructor(address _requestOracle) {
        diaOracle = RequestOracle(payable(_requestOracle));
    }

    /*
    * To calculate the request fee on each chain, you can check the script below:
    * https://github.com/diadata-org/Spectra-interoperability/blob/main/contracts/scripts/sendTestMessage.mjs#L111
    */
    function requestPrice(string memory key) external payable {
        diaOracle.request{value: msg.value}(
            DIA_RECIPIENT,
            DESTINATION_DOMAIN,
            abi.encode(key)
        );
    }

    function getPrice()
    external
    view
    returns (
        uint128 timestampOflatestPrice,
        uint128 latestPrice
    ) {
        (timestampOflatestPrice, latestPrice) =
                 diaOracle.updates(key);
    }
}

Oracle Grants Program

The DIA Oracle Grants Program provides zero-cost oracle access for up to 1 year, covering deployment and update costs to accelerate dApp development on Somnia. Learn more about the grant here:

DIA Oracle Grants Program | Apply Now

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.
I