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

# CrossFi

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

# Token Price Feeds

## Oracle Details

| Chain   | Address                                                                                                                   |
| ------- | ------------------------------------------------------------------------------------------------------------------------- |
| Mainnet | [0x859e221ada7cebdf5d4040bf6a2b8959c05a4233](https://xfiscan.com/address/0x859e221ada7cebdf5d4040bf6a2b8959c05a4233)      |
| Testnet | [0x33df80cdf0c9ff686261b11263d9f4a3ccc3d07f](https://test.xfiscan.com/address/0x33df80cdf0c9ff686261b11263d9f4a3ccc3d07f) |

## Oracle Configuration

|                                       |                                                                                                                            |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Pricing Methodology**               | [VWAPIR](/docs/guides/methodologies/pricing-methodologies/vwapir-volume-weighted-average-price-with-interquartile-range-filter) |
| **Deviation (%) & Refresh Frequency** | 0.5% and 120 seconds                                                                                                       |
| **Heartbeat**                         | 24h                                                                                                                        |

## Available Asset Feeds

### Mainnet

| Asset Ticker | getValue(key) | Asset Markets                                                                                                |
| ------------ | ------------- | ------------------------------------------------------------------------------------------------------------ |
| USDT         | USDT/USD      | [USDT markets](https://www.diadata.org/app/price/asset/Ethereum/0xdAC17F958D2ee523a2206206994597C13D831ec7/) |
| USDC         | USDC/USD      | [USDC Markets](https://www.diadata.org/app/price/asset/Ethereum/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/) |
| XFI          | XFI/USD       | [XFI Markets](https://www.diadata.org/app/price/asset/Ethereum/0xC8CeED65E236F7d6fB378b8715f9e6912e486A54/)  |

### Testnet

| Asset Ticker | getValue(key) | Asset Markets                                                                                                         |
| :----------- | :------------ | :-------------------------------------------------------------------------------------------------------------------- |
| WETH         | WETH/USD      | [WETH Markets](https://www.diadata.org/app/price/asset/Ethereum/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/)          |
| WBTC         | WBTC/USD      | [WBTC Markets](https://www.diadata.org/app/price/asset/Ethereum/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/)          |
| USDT         | USDT/USD      | [USDT markets](https://www.diadata.org/app/price/asset/Ethereum/0xdAC17F958D2ee523a2206206994597C13D831ec7/)          |
| DAI          | DAI/USD       | [DAI Markets](https://www.diadata.org/app/price/asset/Ethereum/0x6B175474E89094C44Da98b954EedeAC495271d0F/)           |
| USDC         | USDC/USD      | [USDC Markets](https://www.diadata.org/app/price/asset/Ethereum/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/)          |
| FRAX         | FRAX/USD      | [FRAX Markets](https://www.diadata.org/app/price/asset/Ethereum/0x853d955aCEf822Db058eb8505911ED77F175b99e/)          |
| LINK         | LINK/USD      | [LINK Markets](https://www.diadata.org/app/price/asset/Ethereum/0x514910771AF9Ca656af840dff83E8264EcF986CA/)          |
| WBNB         | WBNB/USD      | [WBNB Markets](https://www.diadata.org/app/price/asset/BinanceSmartChain/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/) |
| EUR          | EUR/USD       | [EUR Markets](https://www.diadata.org/app/price/asset/Fiat/978/)                                                      |
| XFI          | XFI/USD       | [XFI Markets](https://www.diadata.org/app/price/asset/Ethereum/0xC8CeED65E236F7d6fB378b8715f9e6912e486A54/)           |

## How to Access Data

### getValue Method

To consume price data, you’ll need to invoke the [`getValue` method](/docs/guides/how-to-guides/fetch-price-data/solidity#solidity-library) on the oracle contract which you can access through the [DIA Oracle library](/docs/guides/how-to-guides/fetch-price-data/solidity#solidity-library) or the [interface](/docs/guides/how-to-guides/fetch-price-data/solidity#using-the-diaoraclev2-interface).

Below is an example of a contract consuming data from our oracle on CrossFi Testnet. If you pass `WBTC/USD` as the key, it will return the most recent price of BTC in USD with **8 decimal places** (e.g. 9601458065403 is \$96,014.58065403) along with the Unix timestamp of the last price update.

```solidity theme={"system"}

pragma solidity ^0.8.13;

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

contract DIAOracleV2Consumer{

    address immutable ORACLE = 0x859e221ada7cebdf5d4040bf6a2b8959c05a4233;

    function getPrice(string memory key)
    external
    view
    returns (
        uint128 latestPrice,
        uint128 timestampOflatestPrice
    ) {
        (latestPrice, timestampOflatestPrice) =
                 IDIAOracleV2(ORACLE).getValue(key);
    }
}
```

***

# Verifiable Randomness

### Oracle Details

| Chain   | Address                                                                                                                   |
| ------- | ------------------------------------------------------------------------------------------------------------------------- |
| Testnet | [0xad19b5b3a0bf2bacf028ed6cc9e3fc153cb405b6](https://test.xfiscan.com/address/0xad19b5b3a0bf2bacf028ed6cc9e3fc153cb405b6) |

### Oracle Configuration

The oracle uses [drand](https://drand.love/) randomness from quicknet to provide randomness on CrossFi.

### How to Access Data

To consume randomness data, you'll need to invoke the `getLastRound` method on the oracle contract. It will return the round ID of the latest update.

Using this round ID, you can call `getRandomValue` and will receive a return value of that randomness, the round ID and the BLS signature from the drand API.

Note that round IDs are used round-robin and will repeat after 1000 iterations.

Refer to the [Solidity guide](/docs/guides/how-to-guides/generate-randomness/solidity) for detailed steps on fetching random values from the oracle in your contract. You can learn more about the randomness protocol [here](/docs/dia-stack/data-products/verifiable-randomness).

***

## 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="/docs/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).
