ChainLink Price Feeds
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.
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.
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.
Pair | Dec | Contract Address / Proxy |
AAVE / USD | 8 | |
BNB / USD | 8 | |
BTC / USD | 8 | |
CREAM / USD | 8 | |
DAI / USD | 8 | |
ETH / USD | 8 | |
FTM / USD | 8 | |
LINK / USD | 8 | |
SNX / USD | 8 | |
SUSHI / USD | 8 | |
USDC / USD | 8 | |
USDT / USD | 8 |
Pair | Dec | Contract Address / Proxy |
BTC / ETH | 18 | |
BTC / USD | 8 | |
ETH / USD | 8 | |
FTM / USD | 8 | |
LINK / ETH | 18 | |
LINK / USD | 8 | |
USDT / USD | 8 |
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.
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;
}
}