Skip to main content

Ecosystem Price Oracles, powered by DIA

Introduction to DIA

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.

Information on Usage of DIA Oracles on Alephium

The DIA oracle on Alephium is free of use. dApps built on Alephium can leverage the oracles to access up-to-date asset price information. This oracles are designed for production environments and comes with a predefined list of feeds and settings.

If dApps require a custom oracle with different assets and configurations, please contact DIA on Telegram.

Price Oracles

Deployed contracts

The main oracle contracts on Group 0 are deployed at the following addresses:

NetworkAddress
Mainnet285zrkZTPpUCpjKg9E3z238VmpUBQEAbESGsJT6yX7Rod
Testnet216wgM3Xi5uBFYwwiw2T7iZoCy9vozPJ4XjToW74nQjbV

(New groups will be added in the near future).

How to access DIA oracles?

Locate one of the deployed contracts (either testnet or mainnet) and call the get-value function. This function expects one parameter, which is the symbols of the asset you want to retrieve and a “/USD”, so for example for the Bitcoin price the parameter must be “BTC/USD”.

This will return two values:

  1. The price of the asset, with 8 decimals.
  2. The timestamp of the last update in Unix time format, in UTC timezone.

Included price feeds

The Alephium oracle includes the following price feeds. Use the Query Symbol as a parameter in the get-value function to receive the latest price information for any of these assets.

AssetQuery SymbolSources Overview
Bitcoin (BTC)BTC/USDBTC Sources
USD Coin (USDC)USDC/USDUSDC Sources
Ether (ETH)ETH/USDETH Sources
Wrapped Bitcoin (WBTC)WBTC/USDWBTC Sources
Tether USD (USDT)USDT/USDUSDT Sources
Alephium (ALPH)ALPH/USDALPH Sources
Ayin (AYIN)AYIN/USDAYIN Sources

Learn more about DIA’s data sourcing and data computation architecture.

Oracle configuration settings

Methodology: VWAPIR

The final price point for each asset is calculated by computing the assets' trade information across multiple DEXs and CEXs. This is done using a Volume Weighted Average Price with Interquartile Range (VWAPIR) methodology.

Update frequency: 0.2% deviation + 10 minutes heartbeat

Each asset is updated every two minutes if the new price deviates from the old one by more than 0.2%. Additionally, a heartbeat of 10 minutes is applied, which means that each price is updated at least once per day even if it moves by less than 0.2%.


Randomness Oracles

Deployed contracts

The Randomness oracle contracts on Group 0 are deployed at the following addresses:

NetworkAddress
Mainnetv1v4cBXP9L7M9ryZZCx7tuXuNb9pnDLGb3JJkPBpbR1Z
Testnet217k7FMPgahEQWCfSA1BN5TaxPsFovjPagpujkyxKDvS3

How the Randomness Oracle Works

DIA leverages drand’s distributed randomness beacon, enabling verifiable, unpredictable, and unbiased random numbers.

DIA xRandom Alephium

The drand network's nodes collaborate every 30 seconds to produce a verifiable random number, which DIA's oracle system then captures and publishes to its smart contract, making this randomness readily available for on-chain applications.

You can learn more about the full publishing process here.

How to Access Data

Accessing the oracle on-chain

To consume randomness data, you’ll need to use the IDIARandomOracle interface to

  1. Invoke the getLastRound method to get the round ID of the latest randomness data update.
  2. Use the round ID to invoke the getRandomValue method to get the randomness value, the round ID, and the BLS signature.

The RandomnessFetcher contract below is a simple example to fetch and store the randomness value from the randomness oracle:

struct DIARandomValue {
mut randomness: ByteVec,
mut signature: ByteVec,
mut round: U256
}

Interface IDIARandomOracle {
pub fn getLastRound() -> U256
pub fn getRandomValue(round: U256) -> DIARandomValue
}

Contract RandomnessFetcher(
oracle: IDIARandomOracle,
mut randomValue: DIARandomValue
) {
@using(updateFields = true, checkExternalCaller = false)
pub fn update() -> () {
let lastRound = oracle.getLastRound()
let value = oracle.getRandomValue(lastRound)
randomValue = value
}
}

When deploying the RandomnessFetcher contract, you'll need to pass in the address of the deployed oracle contract depending on the network.

Please note that round IDs are used round-robin and will repeat after 1000 iterations.

Example

You can find a deployment example here.

Support

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

Developers seeking other specialized, production-grade oracle with tailored price feeds and configurations can initiate the request by contacting the DIA BD Team via Telegram.