# Chainlink

## Introduction <a href="#docs-internal-guid-4f25971a-7fff-4217-8ee7-d1acc1209339" id="docs-internal-guid-4f25971a-7fff-4217-8ee7-d1acc1209339"></a>

Chainlink enables smart contracts on Opera to leverage extensive off-chain resources, such as tamper-proof price data, verifiable randomness, external APIs, and much more. This documentation describes access to various cryptocurrency price data available to be integrated into decentralized applications running on Opera.

* For implementation instructions, please refer to [Chainlink's documentation](https://docs.chain.link/data-feeds/using-data-feeds)
* For LINK token and faucet details, please refer to [LINK token contracts](https://docs.chain.link/docs/link-token-contracts/).

Note, off-chain equity and ETF assets are only traded during standard market hours (9:30 AM – 4:00 PM ET Monday–Friday). Using these feeds outside of those windows is not recommended.

## Supported Token Pairs

Currently, the list of supported symbols can be found below. Going forward, this list will continue to expand based on developer needs and community feedback.

### **Opera Mainnet**

| Pair          | Dec | Contract Address / Proxy                                                                                               |
| ------------- | --- | ---------------------------------------------------------------------------------------------------------------------- |
| `AAVE / USD`  | 8   | [`0xE6ecF7d2361B6459cBb3b4fb065E0eF4B175Fe74`](https://ftmscan.com/address/0xE6ecF7d2361B6459cBb3b4fb065E0eF4B175Fe74) |
| `BNB / USD`   | 8   | [`0x6dE70f4791C4151E00aD02e969bD900DC961f92a`](https://ftmscan.com/address/0x6dE70f4791C4151E00aD02e969bD900DC961f92a) |
| `BTC / USD`   | 8   | [`0x8e94C22142F4A64b99022ccDd994f4e9EC86E4B4`](https://ftmscan.com/address/0x8e94C22142F4A64b99022ccDd994f4e9EC86E4B4) |
| `CREAM / USD` | 8   | [`0xD2fFcCfA0934caFdA647c5Ff8e7918A10103c01c`](https://ftmscan.com/address/0xD2fFcCfA0934caFdA647c5Ff8e7918A10103c01c) |
| `DAI / USD`   | 8   | [`0x91d5DEFAFfE2854C7D02F50c80FA1fdc8A721e52`](https://ftmscan.com/address/0x91d5DEFAFfE2854C7D02F50c80FA1fdc8A721e52) |
| `ETH / USD`   | 8   | [`0x11DdD3d147E5b83D01cee7070027092397d63658`](https://ftmscan.com/address/0x11DdD3d147E5b83D01cee7070027092397d63658) |
| `FTM / USD`   | 8   | [`0xf4766552D15AE4d256Ad41B6cf2933482B0680dc`](https://ftmscan.com/address/0xf4766552D15AE4d256Ad41B6cf2933482B0680dc) |
| `LINK / USD`  | 8   | [`0x221C773d8647BC3034e91a0c47062e26D20d97B4`](https://ftmscan.com/address/0x221C773d8647BC3034e91a0c47062e26D20d97B4) |
| `SNX / USD`   | 8   | [`0x2Eb00cC9dB7A7E0a013A49b3F6Ac66008d1456F7`](https://ftmscan.com/address/0x2Eb00cC9dB7A7E0a013A49b3F6Ac66008d1456F7) |
| `SUSHI / USD` | 8   | [`0xCcc059a1a17577676c8673952Dc02070D29e5a66`](https://ftmscan.com/address/0xCcc059a1a17577676c8673952Dc02070D29e5a66) |
| `USDC / USD`  | 8   | [`0x2553f4eeb82d5A26427b8d1106C51499CBa5D99c`](https://ftmscan.com/address/0x2553f4eeb82d5A26427b8d1106C51499CBa5D99c) |
| `USDT / USD`  | 8   | [`0xF64b636c5dFe1d3555A847341cDC449f612307d0`](https://ftmscan.com/address/0xF64b636c5dFe1d3555A847341cDC449f612307d0) |

### **Opera Testnet**

| Pair         | Dec | Contract Address / Proxy                                                                                                       |
| ------------ | --- | ------------------------------------------------------------------------------------------------------------------------------ |
| `BTC / ETH`  | 18  | [`0x2a7e704E84d5093F3F31121D76A9b2343ccA13B8`](https://testnet.ftmscan.com/address/0x2a7e704E84d5093F3F31121D76A9b2343ccA13B8) |
| `BTC / USD`  | 8   | [`0x65E8d79f3e8e36fE48eC31A2ae935e92F5bBF529`](https://testnet.ftmscan.com/address/0x65E8d79f3e8e36fE48eC31A2ae935e92F5bBF529) |
| `ETH / USD`  | 8   | [`0xB8C458C957a6e6ca7Cc53eD95bEA548c52AFaA24`](https://testnet.ftmscan.com/address/0xB8C458C957a6e6ca7Cc53eD95bEA548c52AFaA24) |
| `FTM / USD`  | 8   | [`0xe04676B9A9A2973BCb0D1478b5E1E9098BBB7f3D`](https://testnet.ftmscan.com/address/0xe04676B9A9A2973BCb0D1478b5E1E9098BBB7f3D) |
| `LINK / ETH` | 18  | [`0xFE514ef0883F868fc2AE477A65e162f80CE9cD5D`](https://testnet.ftmscan.com/address/0xFE514ef0883F868fc2AE477A65e162f80CE9cD5D) |
| `LINK / USD` | 8   | [`0x6d5689Ad4C1806D1BA0c70Ab95ebe0Da6B204fC5`](https://testnet.ftmscan.com/address/0x6d5689Ad4C1806D1BA0c70Ab95ebe0Da6B204fC5) |
| `USDT / USD` | 8   | [`0x9BB8A6dcD83E36726Cc230a97F1AF8a84ae5F128`](https://testnet.ftmscan.com/address/0x9BB8A6dcD83E36726Cc230a97F1AF8a84ae5F128) |

## Querying Prices <a href="#docs-internal-guid-138b8b13-7fff-62c2-be26-16903e541420" id="docs-internal-guid-138b8b13-7fff-62c2-be26-16903e541420"></a>

Currently, there are two methods for developers to query prices from the Chainlink data feed: Through the Solidity *PriceConsumer* smart contract running on the hosting blockchain and through an external interface utilizing Chainlink *AggregatorInterface* ABI.

### **Solidity** <a href="#docs-internal-guid-2257afdc-7fff-eea1-073b-f2c9cb6e58b8" id="docs-internal-guid-2257afdc-7fff-eea1-073b-f2c9cb6e58b8"></a>

To consume price data, your smart contract should reference [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol), which defines the external functions implemented by Price Feeds. The latest RoundData function returns five values representing information about the latest price data. See Price Feeds API Reference for more details.

```solidity
pragma solidity ^0.6.7;

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

contract PriceConsumerV3 {

    AggregatorV3Interface internal priceFeed;

    /**
     * Network: Kovan
     * Aggregator: ETH/USD
     * Address: 0x9326BFA02ADD2366b30bacB125260Af641031331
     */
    constructor() public {
        priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
    }

    /**
     * Returns the latest price
     */
    function getThePrice() public view returns (int) {
        (
            uint80 roundID, 
            int price,
            uint startedAt,
            uint timeStamp,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        return price;
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fantom.foundation/build-on-opera/oracles/chainlink.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
