Oracles
Get Started
$ npm install @thundercore/oracle$ yarn add @thundercore/oracleimport { FeedRegistryConsumerInterface } from '@thundercore/oracle/TTOracle.sol';
contract MyProject {
address public constant TT_ORACLE = 0xD477d4d8132C6fce38f0bf38f46FcB62D6c5ddaE;
function getThunderTokenPrice() public view returns (int256) {
(
/* uint80 roundId */,
int256 answer,
/* uint256 startedAt */,
/* uint256 updatedAt */,
/* uint80 answeredInRound */
) = FeedRegistryConsumerInterface(TT_ORACLE)
.latestRoundData('TT/USDT');
return answer;
}
}import { FeedRegistryInterface } from "@chainlink/contracts/src/v0.8/interfaces/FeedRegistryInterface.sol";
import { Denominations } from '@thundercore/oracle/TTOracle.sol';
contract MyProject {
address public constant TT_ORACLE = 0xD477d4d8132C6fce38f0bf38f46FcB62D6c5ddaE;
function getThunderTokenPrice() public view returns (int256) {
(
/* uint80 roundId */,
int256 answer,
/* uint256 startedAt */,
/* uint256 updatedAt */,
/* uint80 answeredInRound */
) = FeedRegistryInterface(TT_ORACLE)
.latestRoundData(
Denominations.TT,
Denominations.USDT
);
return answer;
}
}Using Data Feeds
Solidity
ECMAScript (JavaScript)
Python
Getting a different price denomination
Historical Price Data
Solidity
ECMAScript (JavaScript)
Python
Feed Registry
Base and Quote
Solidity example code
ECMAScript (JavaScript) example
API Reference
Name
Description
decimals
description
version
hasRoundData
getRoundData
latestRoundData
getPreviousRoundId
getNextRoundId
Contract Addresses
Pair
Dec
Proxy
Pair
Dec
Proxy
Last updated