Oracle Contracts
| Chain | Contract Address |
|---|---|
| Hemi Mainnet | 0xE609bFAF4449da0B97C0F7a54b1ea8Fb8D8FD7ED |
| Ethereum Mainnet | 0xCE521b52513242c5094bc56f57887BB2A05B8129 |
Oracle Configuration
| Deviation (%) | 1% |
| Heartbeat | 1h |
Available Asset Feeds
| Chain | Price Feed | Type | Adapter Address (AggregatorV3Interface) |
|---|---|---|---|
| Hemi Mainnet | hemiBTC | Fundamental | 0x240B2470421f16c6eb1F41db39c6156fb719Cd94 |
| Ethereum | hemiBTC | Fundamental | 0x798c4b91168f5c9a3b571722941756934135b059 |
| Hemi Mainnet | satUSD | Market | N/A |
How to Access Data
getValue Method
To consume price data, you’ll need to invoke thegetValue method on the oracle contract which you can access through the DIA Oracle library or the interface.
Below is an example of a contract consuming data from the oracle on Hemi Mainnet chain using the IDIAOracleV2 interface. If you pass fairValue:hemiBTC as the key, it will return the fair-value of hemiBTC with 8 decimal places (e.g. 100580335 is $1.00580335) along with the Unix timestamp of the last price update.
You can also query the other values by passing the following keys to the getValue function:
usdValue:hemiBTC: the price of hemiBTC in USDnumerator:hemiBTC: the total BTC reservesdenominator:hemiBTC: the total hemiBTC supplyDEX:satUSD/USD: the price of satUSD in USD
Adapter contracts
To consume price data from our oracle, you can use the adapter smart contract located at the adapter address for each asset. This will allow you to access the same methods on theAggregatorV3Interface such as getRoundData & latestRoundData. You can learn more here.
This is a sample contract for consuming the hemiBTC fundamental price feed:
Request a Custom Oracle
DIA offers highly customizable oracles that are individually tailored to each dApp’s needs. Each oracle can be customized in the following ways, including:- Data Sources & Asset Feeds
- Pricing Methodologies
- Update Triggers (Frequency, Deviation, Heartbeat, …etc)