Skip to main content

Chainlink

Introduction

Chainlink data feeds are the quickest way to connect your smart contracts to oracle data, such as asset prices.

Chainlink is implemented as a smart contract on Neon EVM, making Chainlink data feeds from the Solana network available for smart contracts to consume.

Each Chainlink feed is available via its own contract. To use a feed, you create a "hybrid" smart contract, i.e. you build the integration with the feed contract into your own smart contract and deploy that. Learn more from Chainlink's documentation, or examine the boilerplate provided.

Deployed feeds

The Chainlink controller contract is deployed on Devnet. This contract implements the AggregatorV3Interface to support the following feeds:

Currency pairChainlink contract feed address
AVAX/USD0x1d6E632542B7E405FAA8D26C4805C981260A9e70
BTC/USD0x002A8368a4fd76C1809765ea66a9AFa3D424d8e0
BNB/USD0x3c864365f961f1fb31a6682EB388E84832fd159C
DAI/USD0xa13Cbd21e5De770Bb9104B951B0b0a876c46ef85
ETH/USD0xC55B1E0c36A69e2b40BD16759434B071F4bBe8df
LINK/USD0x22eE81bFA94049c9d880e81c5d40b12423307DFb
MATIC/USD0x5864ccda29c78845460639021287c3f192350816
OP/USD0x996c00D1E9DDA20a6d0B7dd516394D5978AC0B92
SOL/USD0x76721563EC3CF5fB94737Eb583F38f3cD166C7Bb
SRM/USD0xd010175e4eA718569A105FCbeAa8db44c590730E
USDC/USD0x8cb22a71AD5ef0384B85FF08Ba1343ec71880C35
USDT/USD0xba92eACD3fb46661E130577cD03fa32E6D4D757a

Boilerplate contract

View GitHub example

View in Remix

SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

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


contract TestChainlink {
/**
* Returns the latest price for specific price feed
*/
function getLatestPrice(address _priceFeed) external view returns (int) {
(
/* uint80 roundID */,
int price,
/*uint startedAt*/,
/*uint timeStamp*/,
/*uint80 answeredInRound*/
) = AggregatorV3Interface(_priceFeed).latestRoundData();
return price;
}

/**
* Returns the decimals for specific price feed
*/
function getDecimals(address _priceFeed) external view returns (uint8) {
return AggregatorV3Interface(_priceFeed).decimals();
}
}
Was this page helpful?