# DIA

## Overview

DIA is a cross-chain oracle platform for Web3. It serves as an ecosystem for transparent financial data within a smart contract environment dedicated to finance. DIA's mission is to foster a collaborative environment among data analysts, providers, and consumers. Essentially, DIA offers a trustworthy and verifiable conduit linking external data from diverse origins to on-chain smart contracts, facilitating the creation of a myriad of financial decentralized applications. DIA is architected as a hybrid framework, integrating off-chain mechanisms for the storage and manipulation of extensive datasets, with on-chain elements that supply data to financial smart contracts.

### DIA's API&#x20;

Display the most transparent data to your users using DIA's API. Whether you're developing a financial service, a portfolio management tool, a new media platform, or anything else, DIA provides the most advanced and up-to-date data for your product.&#x20;

### API Access&#x20;

The base URL for DIA is <https://api.diadata.org/v1>. All API paths are extensions of this base URL. Detailed documentation for our API endpoints can be found on the [API documentation site](https://docs.diadata.org/documentation/api-1/api-endpoints).

### DIA's Oracle

Here is an overview of the deployed oracle contracts on each supported chain.&#x20;

DIA Development Oracle contracts are smart contracts that offer a selected range of asset prices for live testing on our Mainnet and Testnet. These contracts are regularly updated and replaced, not maintained indefinitely.&#x20;

DIA Development Oracle contracts are not meant to be integrated into a dApp. DIA creates specific contracts for dApps. To request a dedicated oracle, please contact the team on their website[ Discord ](https://discord.gg/bHKuz3bzaA)or the [DIA DAO Forum](https://dao.diadata.org/).

### Deployed Contracts

{% tabs %}
{% tab title="BEVM Mainnet" %}

<table><thead><tr><th width="190">Parameter</th><th>Value</th></tr></thead><tbody><tr><td>Smart Contract</td><td><a href="https://scan-mainnet.bevm.io/address/0x9a9a5113b853b394E9BA5FdB7e72bC5797C85191?tab=contract">0x9a9a5113b853b394E9BA5FdB7e72bC5797C85191</a></td></tr><tr><td>Oracle Type</td><td><a href="https://docs.diadata.org/documentation/oracle-documentation/access-the-oracle#dia-key-value-oracle-contract-v2">Key/Value Oracle</a></td></tr><tr><td>Seeds</td><td><p>"BTC/USD"<br>"ORDI/USD"<br>"ETH/USD"</p><p>"SATS/USD"</p></td></tr></tbody></table>
{% endtab %}

{% tab title="BEVM Canary" %}

| Parameter      | Value                                                                                                                              |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Smart Contract | 0x719108DC653CC3a9055ab8d9018c5D7924912631                                                                                         |
| Oracle Type    | [Key/Value Oracle](https://docs.diadata.org/documentation/oracle-documentation/access-the-oracle#dia-key-value-oracle-contract-v2) |
| Seeds          | <p>"BTC/USD"<br>"ORDI/USD"</p>                                                                                                     |
| {% endtab %}   |                                                                                                                                    |
| {% endtabs %}  |                                                                                                                                    |

### Example (Solidity)

```solidity
pragma solidity ^0.8.13;

interface IDIAOracleV2{
    function getValue(string memory) external returns (uint128, uint128);
}

contract IntegrationSample{

    address immutable ORACLE = 0x719108DC653CC3a9055ab8d9018c5D7924912631;
    uint128 public latestPrice; 
    uint128 public timestampOflatestPrice; 
   
    function getPriceInfo(string memory key) external {
        (latestPrice, timestampOflatestPrice) = IDIAOracleV2(ORACLE).getValue(key); 
    }
   
    function checkPriceAge(uint128 maxTimePassed) external view returns (bool inTime){
         if((block.timestamp - timestampOflatestPrice) < maxTimePassed){
             inTime = true;
         } else {
             inTime = false;
         }
    }
}
```

#### Result

<figure><img src="https://727834651-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwN89eii3YaURreMjRaq%2Fuploads%2F4gipWssbe62KTG58MKGX%2Fimage.png?alt=media&#x26;token=4532cc49-675c-4184-969f-503ce16916f4" alt="" width="326"><figcaption></figcaption></figure>
