Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions docs/infrastructure/Oracles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
sidebar_position: 30
sidebar_label: Oracles
title: Oracles
---

# Ecosystem Price Oracles, powered by DIA


## Introduction to DIA

**[DIA](https://diadata.org/)** 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](https://t.me/diabdteam).**


## Price Oracles


### Deployed contracts

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



* **Testnet**: vKdWgyqtQZzAV7eoMXxQCkyiNtceViGZheXC1iHbKFDZ
* **Mainnet:** 285zrkZTPpUCpjKg9E3z238VmpUBQEAbESGsJT6yX7Rod

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


<table>
<tr>
<td><strong><code>Asset</code></strong>
</td>
<td><strong><code>Query Symbol</code></strong>
</td>
<td><strong><code>Sources Overview</code></strong>
</td>
</tr>
<tr>
<td><code>Bitcoin (BTC)</code>
</td>
<td><code>BTC/USD</code>
</td>
<td><code><a href="https://www.diadata.org/app/price/asset/Bitcoin/0x0000000000000000000000000000000000000000/">BTC Sources</a></code>
</td>
</tr>
<tr>
<td><code>USD Coin (USDC)</code>
</td>
<td><code>USDC/USD</code>
</td>
<td><code><a href="https://www.diadata.org/app/price/asset/Ethereum/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/">USDC Sources</a></code>
</td>
</tr>
<tr>
<td><code>Ether (ETH)</code>
</td>
<td><code>ETH/USD</code>
</td>
<td><code><a href="https://www.diadata.org/app/price/asset/Ethereum/0x0000000000000000000000000000000000000000/">ETH Sources</a></code>
</td>
</tr>
<tr>
<td><code>Wrapped Bitcoin (WBTC)</code>
</td>
<td><code>WBTC/USD</code>
</td>
<td><code><a href="https://www.diadata.org/app/price/asset/Ethereum/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/">WBTC Sources</a></code>
</td>
</tr>
<tr>
<td><code>Tether USD (USDT)</code>
</td>
<td><code>USDT/USD</code>
</td>
<td><code><a href="https://www.diadata.org/app/price/asset/Ethereum/0xdAC17F958D2ee523a2206206994597C13D831ec7/">USDT Sources</a></code>
</td>
</tr>
<tr>
<td><code>Alephium (ALPH)</code>
</td>
<td><code>ALPH/USD</code>
</td>
<td><code><a href="https://www.diadata.org/app/price/asset/Alephium/tgx7VNFoP9DJiFMFgXXtafQZkUvyEdDHT9ryamHJYrjq/">ALPH Sources</a></code>
</td>
</tr>
</table>


Learn more about DIA’s [data sourcing](https://docs.diadata.org/introduction/dia-technical-structure/data-sourcing) and [data computation](https://docs.diadata.org/introduction/dia-technical-structure/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](https://docs.diadata.org/products/token-price-feeds/exchangeprices/vwapir-volume-weighted-average-price-with-interquartile-range-filter).


#### Update frequency: 0.5% deviation + 1-hour heartbeat

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


## Example

You can find a deployment example [here](https://github.com/alephium/ralph-example/tree/master/call-oracle/contracts).

## Support

For developer assistance, connect with the DIA team directly on[ Discord](https://chat.openai.com/c/d2ca764b-00d6-4de7-8555-0cc30ac416b1#) or [Telegram](https://t.me/diadata_org).

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](https://t.me/diabdteam).
Loading