diff --git a/docs/build/integrations/oracles/dia.md b/docs/build/integrations/oracles/dia.md index 036273c88fe..19f949f8160 100644 --- a/docs/build/integrations/oracles/dia.md +++ b/docs/build/integrations/oracles/dia.md @@ -2,64 +2,72 @@ sidebar_position: 3 --- -# DIA Oracle - -[DIA]: https://www.diadata.org/ - -## Overview - -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. - -## DIA's API - -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. - -### API Access - -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). - -## DIA's Oracle - -Here, we provide an overview of the deployed oracle contracts on each supported chain. - -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. - -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/). - -## Deployed Contracts - -[Key/Value Oracle]: https://docs.diadata.org/documentation/oracle-documentation/access-the-oracle#dia-key-value-oracle-contract-v2 - -### Astar - -**Smart Contract**: [0xd79357ebb0cd724e391f2b49a8De0E31688fEc75](https://blockscout.com/astar/address/0xd79357ebb0cd724e391f2b49a8De0E31688fEc75/contracts) - -**Oracle Type**: [Key/Value Oracle] - -### Shiden - -**Smart Contract**: [0xCe784F99f87dBa11E0906e2fE954b08a8cc9815d](https://blockscout.com/shiden/address/0xCe784F99f87dBa11E0906e2fE954b08a8cc9815d/contracts) - -**Oracle Type**: [Key/Value Oracle] - -### Shibuya - -**Smart Contract**: 0x1232AcD632Dd75f874E357c77295Da3f5Cd7733E - -**Oracle Type**: [Key/Value Oracle] - -## Price feeds - -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. - -1. Access the corresponding oracle smart contract (see table above). -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. -3. The response of the call contains two values: - 1. The current asset price in USD with a fix-comma notation of eight decimals. - 2. The [UNIX timestamp](https://www.unixtimestamp.com/) of the last oracle update. - -The development oracle supports price quotations for, at the very least, the following assets: - -- BTC -- DIA -- USDC +# DIA + +[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. + +## Key features + +- Complete verifiability from source to destination smart contract. +- Direct data sourcing from 100+ primary markets eliminating intermediary risk. +- Support for 20,000+ assets across all major asset classes. +- Custom oracle configuration with tailored sources and methodologies. + +## Data products + +- **Token Price Feeds**: Real-time market prices for assets across CEXs and DEXs. +- **Fundamental Feeds**: Fair value pricing and backing data (NAV, Proof of Reserve, and more). +- **Real-World Asset (RWA) Feeds**: Traditional financial data including Equities, FX rates, + commodities, and ETFs. +- **Randomness**: Verifiable random number generation for gaming, lotteries, and more. + +## Querying DIA price feeds + +Call the `getValue(string memory key)` function on the oracle contract with the +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 +on Astar: +[`0xd79357ebb0cd724e391f2b49a8De0E31688fEc75`](https://blockscout.com/astar/address/0xd79357ebb0cd724e391f2b49a8De0E31688fEc75/contracts) + +```solidity +pragma solidity ^0.8.13; +interface IDIAOracleV2 { + function getValue(string memory) external view returns (uint128, + uint128); +} +contract DIAOracleSample { + /** + * @notice The DIA oracle to read from. + * Oracle Address: 0xd79357ebb0cd724e391f2b49a8De0E31688fEc75 + * Network: Astar Network + */ + address constant diaOracle = 0xd79357ebb0cd724e391f2b49a8De0E31688fEc75; + function getPrice(string memory key) + external + view + returns ( + uint128 latestPrice, + uint128 timestampOfLatestPrice + ) { + (latestPrice, timestampOfLatestPrice) = + IDIAOracleV2(diaOracle).getValue(key); + } +} +``` + +View the complete integration guide for Astar [here](https://www.diadata.org/docs/guides/chain-specific-guide/astar). + +## Request a custom oracle + +For dapps requiring specific configurations, DIA deploys production-grade custom +oracles tailored to your requirements with configurable data sources, pricing +methodologies, update triggers, and coverage for any of 20,000+ supported +assets. + +→ [Request a custom oracle](https://www.diadata.org/docs/guides/how-to-guides/request-a-custom-oracle) + +## Resources + +- Developer support: [Discord](https://discord.com/invite/ZvGjVY5uvs) | + [Telegram](https://t.me/diadata_org) +- [Astar integration guide](https://www.diadata.org/docs/guides/chain-specific-guide/astar) +- [DIA documentation](https://www.diadata.org/docs)