DIA Nexus Documentation
  • Nexus Overview
  • Intro to Nexus
    • How it works
    • Nexus vs. Lumina
    • Integrated Chains
  • Data products
    • Token Price Feeds
    • RWA Price Feeds
    • Randomness
    • Fair-value Feeds
  • How-to Guides
    • Fetch Price Data
      • Solidity
      • Vyper
      • Demo Oracles
      • Chain-specific Guide
        • Aleph Zero
        • Alephium
        • Edu Chain
        • Hydration
        • Kadena
        • LUKSO
        • Somnia
        • Stacks
        • Superseed
        • XRP Ledger (XRPL)
    • Generate Randomness
      • Solidity
      • WASM
      • Demo Oracles
      • Chain-specific Guide
        • Alephium
    • Migrate to DIA
    • Fund the Oracle
    • Build a Scraper
      • Development Cluster Stack
      • DIA Test‐Space with Docker Compose
      • DIA Test‐Space with Minikube
      • Add a new exchange scraper
      • Add a new foreign scraper
      • Add a new liquidity scraper
      • Additional notes
  • Request a Custom Oracle
  • Reference
    • Architecture
      • Data sourcing
      • Data computation
      • Data delivery
    • APIs
      • Token prices
        • RestAPI
          • Request Samples
        • GraphQL
          • Request Samples
      • RWA prices
    • Pricing Methodologies
      • IR: Interquartile Range Filter
      • MAIR: Moving Average with Interquartile Range Filter
      • VWAP: Volume Weighted Average Price
      • VWAPIR: Volume Weighted Average Price with Interquartile Range Filter
      • LST fair price
    • Data Sources
      • CEXes Data
      • DEXes Data
    • Smart Contracts
      • DIAOracleV2.sol
      • DIARandomOracle.sol
    • Randomness Protocol
  • Resources
    • Audits
    • Community & Support
    • Security Bounty Program
    • Research
      • Return Rates in Crypto Farming
      • Crypto Volatility Index
      • Compounded Rates
      • Polkadot Medianizer
    • T&C
      • Licence Agreement
      • Contributor Covenant Code of Conduct
      • Disclaimer
Powered by GitBook
On this page
  • Oracle details
  • Oracle configuration
  • Asset feeds
  • How to access data
  • Accessing the oracle on-chain (Solidity)
  • Adapter contracts
  • Support
Export as PDF
  1. How-to Guides
  2. Fetch Price Data
  3. Chain-specific Guide

Somnia

dApps built on Somnia can leverage DIA oracles to access up-to-date asset price information.

PreviousLUKSONextStacks

Last updated 1 month ago

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

Chain
Address

Somnia Testnet

Oracle configuration

Pricing Methodology

Deviation (%) & Refresh Frequency

0.5% and 120 seconds

Heartbeat

24h

Asset feeds

Asset Ticker
Adapter address
Asset Markets

USDT

USDC

BTC

ARB

SOL

How to access data

Accessing the oracle on-chain (Solidity)

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); 
    }
}

Adapter contracts

Support

To consume price data, you’ll need to invoke the getValue method on the oracle contract which you can access through the or the . 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.

See the full example .

To consume price data from our oracle, you can use the adapter smart contract located at the for each asset. This will allow you to access the same methods on the AggregatorV3Interface such as getRoundData & latestRoundData. You can learn more .

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

Developers seeking other specialized, production-grade oracle with tailored price feeds and configurations can initiate the request by .

DIA
here
Discord
Telegram
contacting the DIA BD Team via Telegram
here
adapter address
0x9206296ea3aee3e6bdc07f7aaef14dfcf33d865d
MAIR
0x67d2c2a87a17b7267a6dbb1a59575c0e9a1d1c3e
USDT markets
0x235266D5ca6f19F134421C49834C108b32C2124e
USDC markets
0x4803db1ca3A1DA49c3DB991e1c390321c20e1f21
BTC markets
0x74952812B6a9e4f826b2969C6D189c4425CBc19B
ARB markets
0xD5Ea6C434582F827303423dA21729bEa4F87D519
SOL markets
DIA Oracle library
interface