ChainLink Price Feeds

Introduction

Chainlink enables smart contracts on Fantom protocol 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 Fantom Opera.

For implementation instructions, please refer to Get the Latest Price.

For LINK token and Faucet details, please refer to 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.

Fantom Mainnet

Fantom Testnet

Querying Prices

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

Solidity

To consume price data, your smart contract should reference AggregatorV3Interface, 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.

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;
    }
}

Last updated

© 2024 Fantom Foundation