|
2 | 2 | sidebar_position: 3 |
3 | 3 | --- |
4 | 4 |
|
5 | | -# DIA Oracle |
6 | | - |
7 | | -[DIA]: https://www.diadata.org/ |
8 | | - |
9 | | -## Overview |
10 | | - |
11 | | -DIA is a cross-chain, end-to-end, open-source data and oracle platform for Web3. DIA is an ecosystem for open financial data in a financial smart contract ecosystem. The goal of DIA is to bring together data analysts, data providers, and data users. In general, DIA provides a reliable and verifiable bridge between off-chain data from various sources and on-chain smart contracts that can be used to build a variety of financial dApps. DIA is setup as a hybrid system with off-chain components for storing and processing large amounts of data and on-chain components providing data sources for financial smart contracts. |
12 | | - |
13 | | -## DIA's API |
14 | | - |
15 | | -Show your users the most transparent data on the market with DIA's API. Whether you're building a financial service, a portfolio management tool, a new media offering, or more, DIA has the most advanced and updated data on the market for your product. |
16 | | - |
17 | | -### API Access |
18 | | - |
19 | | -The DIA base URL is `https://api.diadata.org/v1`. All API paths are sub-paths of this base URL. You can find specific documentation for the endpoints of our API on the [API documentation site](https://docs.diadata.org/documentation/api-1/api-endpoints). |
20 | | - |
21 | | -## DIA's Oracle |
22 | | - |
23 | | -Here, we provide an overview of the deployed oracle contracts on each supported chain. |
24 | | - |
25 | | -DIA Development Oracle contracts are smart contracts that provide a selected range of asset prices for live testing on our Mainnet and Testnet. The contracts are upgraded and exchanged on a rolling basis and are not maintained indefinitely. |
26 | | - |
27 | | -DIA Development Oracle contracts are not intended to be integrated into a dApp. DIA deploys dedicated contracts for dApps. Please request a dedicated oracle by contacting the team on their [Discord](https://discord.com/invite/zFmXtPFgQj) or the [DIA DAO Forum](https://dao.diadata.org/). |
28 | | - |
29 | | -## Deployed Contracts |
30 | | - |
31 | | -[Key/Value Oracle]: https://docs.diadata.org/documentation/oracle-documentation/access-the-oracle#dia-key-value-oracle-contract-v2 |
32 | | - |
33 | | -### Astar |
34 | | - |
35 | | -**Smart Contract**: [0xd79357ebb0cd724e391f2b49a8De0E31688fEc75](https://blockscout.com/astar/address/0xd79357ebb0cd724e391f2b49a8De0E31688fEc75/contracts) |
36 | | - |
37 | | -**Oracle Type**: [Key/Value Oracle] |
38 | | - |
39 | | -### Shiden |
40 | | - |
41 | | -**Smart Contract**: [0xCe784F99f87dBa11E0906e2fE954b08a8cc9815d](https://blockscout.com/shiden/address/0xCe784F99f87dBa11E0906e2fE954b08a8cc9815d/contracts) |
42 | | - |
43 | | -**Oracle Type**: [Key/Value Oracle] |
44 | | - |
45 | | -### Shibuya |
46 | | - |
47 | | -**Smart Contract**: 0x1232AcD632Dd75f874E357c77295Da3f5Cd7733E |
48 | | - |
49 | | -**Oracle Type**: [Key/Value Oracle] |
50 | | - |
51 | | -## Price feeds |
52 | | - |
53 | | -The oracle contains information about crypto assets. You can access a price quotation (see [sources](https://docs.diadata.org/documentation/methodology/digital-assets/cryptocurrency-trading-data) and [methodology](https://docs.diadata.org/documentation/methodology/digital-assets/exchangeprices)) and the current circulating supply as well as the timestamp of the last update. |
54 | | - |
55 | | -1. Access the corresponding oracle smart contract (see table above). |
56 | | -2. Call `getValue(symbol)` with `symbol` being the asset symbol such as `BTC/USD`. You can use the "Read" section on Etherscan to execute this call. |
57 | | -3. The response of the call contains two values: |
58 | | - 1. The current asset price in USD with a fix-comma notation of eight decimals. |
59 | | - 2. The [UNIX timestamp](https://www.unixtimestamp.com/) of the last oracle update. |
60 | | - |
61 | | -The development oracle supports price quotations for, at the very least, the following assets: |
62 | | - |
63 | | -- BTC |
64 | | -- DIA |
65 | | -- USDC |
| 5 | +# DIA |
| 6 | + |
| 7 | +[DIA](https://www.diadata.org/) is a cross-chain, trustless oracle network delivering verifiable price feeds for Astar. DIA sources raw trade data directly from primary markets and computes it onchain, ensuring complete transparency and data integrity. |
| 8 | + |
| 9 | +## Key features |
| 10 | + |
| 11 | +- Complete verifiability from source to destination smart contract. |
| 12 | +- Direct data sourcing from 100+ primary markets eliminating intermediary risk. |
| 13 | +- Support for 20,000+ assets across all major asset classes. |
| 14 | +- Custom oracle configuration with tailored sources and methodologies. |
| 15 | + |
| 16 | +## Data products |
| 17 | + |
| 18 | +- **Token Price Feeds**: Real-time market prices for assets across CEXs and DEXs. |
| 19 | +- **Fundamental Feeds**: Fair value pricing and backing data (NAV, Proof of Reserve, and more). |
| 20 | +- **Real-World Asset (RWA) Feeds**: Traditional financial data including Equities, FX rates, |
| 21 | + commodities, and ETFs. |
| 22 | +- **Randomness**: Verifiable random number generation for gaming, lotteries, and more. |
| 23 | + |
| 24 | +## Querying DIA price feeds |
| 25 | + |
| 26 | +Call the `getValue(string memory key)` function on the oracle contract with the |
| 27 | +Query Symbol (e.g., "BTC/USD"). The function returns the asset price with 8 decimal precision and the timestamp of the last update. We'll use this address |
| 28 | +on Astar: |
| 29 | +[`0xd79357ebb0cd724e391f2b49a8De0E31688fEc75`](https://blockscout.com/astar/address/0xd79357ebb0cd724e391f2b49a8De0E31688fEc75/contracts) |
| 30 | + |
| 31 | +```solidity |
| 32 | +pragma solidity ^0.8.13; |
| 33 | +interface IDIAOracleV2 { |
| 34 | + function getValue(string memory) external view returns (uint128, |
| 35 | + uint128); |
| 36 | +} |
| 37 | +contract DIAOracleSample { |
| 38 | + /** |
| 39 | + * @notice The DIA oracle to read from. |
| 40 | + * Oracle Address: 0xd79357ebb0cd724e391f2b49a8De0E31688fEc75 |
| 41 | + * Network: Astar Network |
| 42 | + */ |
| 43 | + address constant diaOracle = 0xd79357ebb0cd724e391f2b49a8De0E31688fEc75; |
| 44 | + function getPrice(string memory key) |
| 45 | + external |
| 46 | + view |
| 47 | + returns ( |
| 48 | + uint128 latestPrice, |
| 49 | + uint128 timestampOfLatestPrice |
| 50 | + ) { |
| 51 | + (latestPrice, timestampOfLatestPrice) = |
| 52 | + IDIAOracleV2(diaOracle).getValue(key); |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +View the complete integration guide for Astar [here](https://www.diadata.org/docs/guides/chain-specific-guide/astar). |
| 58 | + |
| 59 | +## Request a custom oracle |
| 60 | + |
| 61 | +For dapps requiring specific configurations, DIA deploys production-grade custom |
| 62 | +oracles tailored to your requirements with configurable data sources, pricing |
| 63 | +methodologies, update triggers, and coverage for any of 20,000+ supported |
| 64 | +assets. |
| 65 | + |
| 66 | +→ [Request a custom oracle](https://www.diadata.org/docs/guides/how-to-guides/request-a-custom-oracle) |
| 67 | + |
| 68 | +## Resources |
| 69 | + |
| 70 | +- Developer support: [Discord](https://discord.com/invite/ZvGjVY5uvs) | |
| 71 | + [Telegram](https://t.me/diadata_org) |
| 72 | +- [Astar integration guide](https://www.diadata.org/docs/guides/chain-specific-guide/astar) |
| 73 | +- [DIA documentation](https://www.diadata.org/docs) |
0 commit comments