Price Oracle Contract API
Description
One of the key advantages of the Bifrost Network is its native price oracle, which offers a wide range of digital asset prices sourced from centralized exchanges (CEXs) and decentralized exchanges (DEXs) on other networks. We have made the price oracle for CCCP-supported assets publicly available to all developers on the Bifrost Network. We hope many DApp developers will enjoy these benefits through our network.
To minimize the learning curve, our oracle service includes an abstraction layer that provides an interface compatible with Chainlink's. This design choice not only reduces the time needed for developers to adapt but also enables seamless integration for those already familiar with Chainlink's environment.
In the following sections, we will explain how to utilize Bifrost's price oracle.
Price Feed Methods
decimals()
Returns USD price decimals for a specific asset (e.g., the USD price of ETH).
Return values
Name | Type | Description |
---|---|---|
uint8 | The decimals (now only USD support) for a specific asset |
description()
Return the type of a specific oracle feeder (e.g., ETH/USD)
Return values
Name | Type | Description |
---|---|---|
string | The type of a specific oracle feeder |
version()
Return the version of a specific oracle feed contract.
Return values
Name | Type | Description |
---|---|---|
uint256 | The version of a specific oracle feed contract. |
getRoundData(_roundId)
Return the price information from the previous round along with the timestamp of that update.
Parameters
Name | Type | Description |
---|---|---|
_roundId | uint8 | The round ID of desired price information. |
Return values
Name | Type | Description |
---|---|---|
roundId | uint80 | The round ID. |
answer | int256 | The price information for this round. |
startedAt | uint256 | The timestamp of when the round started. |
updatedAt | uint256 | The timestamp of when the round was updated. |
answeredInRound | uint80 | The answers could take multiple rounds to be computed. |
latestRoundData()
Return the latest price information along with the timestamp of the most recent update.
Return values
Name | Type | Description |
---|---|---|
roundId | uint80 | The round ID. |
answer | int256 | The price information for this round. |
startedAt | uint256 | The timestamp of when the round started. |
updatedAt | uint256 | The timestamp of when the round was updated. |
answeredInRound | uint80 | The answers could take multiple rounds to be computed. |
Price Feed Contract Interface
Price Feed Contract Address
Asset/Fiat Type | Contract Address (mainnet/testnet) |
---|---|
ETH/USD | mainnet: |
USDC/USD | mainnet: |
BNB/USD | mainnet: |
MATIC/USD | mainnet: |
BIFI/USD | mainnet: |
BFC/USD | mainnet: |
USDT/USD | mainnet: |
DAI/USD | mainnet: |
WBTC/USD | mainnet: |
BTCB/USD | mainnet: |
Example: ETH/USD price oracle (testnet)
Last updated