> ## Documentation Index
> Fetch the complete documentation index at: https://www.diadata.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Stellar

> dApps built on Stellar can leverage DIA oracles to access up-to-date asset price information.

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

## Oracle Details

| Chain   | Address                                                                                                                                                                 |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Testnet | [`CAEDPEZDRCEJCF73ASC5JGNKCIJDV2QJQSW6DJ6B74MYALBNKCJ5IFP4`](https://stellar.expert/explorer/testnet/contract/CAEDPEZDRCEJCF73ASC5JGNKCIJDV2QJQSW6DJ6B74MYALBNKCJ5IFP4) |

## Available Asset Feeds

| Asset Price Feed | Asset Markets                                                                                                |
| ---------------- | ------------------------------------------------------------------------------------------------------------ |
| BTC              | [BTC Markets](https://www.diadata.org/app/price/asset/Bitcoin/0x0000000000000000000000000000000000000000/)   |
| USDC             | [USDC Markets](https://www.diadata.org/app/price/asset/Ethereum/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/) |
| DIA              | [DIA Markets](https://www.diadata.org/app/price/asset/Ethereum/0x84cA8bc7997272c7CfB4D0Cd3D55cd942B3c9419)   |

## How to Access Data

Call the `read_oracle_value` 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.

Below is the oracle contract code in Soroban:

```rust theme={"system"}
use soroban_sdk::{Env, String};

use crate::storage_types::{DataKey, OracleValue, VALUE_BUMP_AMOUNT, VALUE_LIFETIME_THRESHOLD};

pub fn read_oracle_value(e: &Env, key: String) -> OracleValue {
    let store_key = DataKey::Value(key);

    if let Some(value) = e
        .storage()
        .temporary()
        .get::<DataKey, OracleValue>(&store_key)
    {
        e.storage()
            .temporary()
            .extend_ttl(&store_key, VALUE_LIFETIME_THRESHOLD, VALUE_BUMP_AMOUNT);
        value
    } else {
        OracleValue::default()
    }
}

pub fn write_oracle_value(e: &Env, key: String, value: &OracleValue) {
    let store_key = DataKey::Value(key);
    e.storage().temporary().set(&store_key, value);
    e.storage()
        .temporary()
        .extend_ttl(&store_key, VALUE_LIFETIME_THRESHOLD, VALUE_BUMP_AMOUNT);
}
```

## Request a Custom Oracle

DIA offers highly customizable oracles that are individually tailored to each dApp's needs. Each oracle can be customized in the following ways, including:

* Data Sources & Asset Feeds
* Pricing Methodologies
* Update Triggers (Frequency, Deviation, Heartbeat, ...etc)

Get a tailored oracle for your dApp, request one below:

<CardGroup>
  <Card title="Request Custom Oracle" href="/guides/how-to-guides/request-a-custom-oracle" icon="angle-right" iconType="solid" horizontal />
</CardGroup>

## Support

For developer assistance, connect with the DIA team directly on [Discord](https://discord.gg/ZvGjVY5uvs) or [Telegram](https://t.me/diadata_org).
