Use Oracle Feeds
Acala's Open Oracle Gateway allows multiple oracles to be deployed on the Acala network, leveraging Acala's DeFi optimized oracle infrastructure, and serving any DApps on Acala, Polkadot, Kusama and beyond. The Open Oracle Gateway ensures Quality of Service, that is oracle transactions are classified as system transactions, and are guaranteed to be included in a block. Read more in Oracle Basics.
This pre-compiled contract make querying various price feeds for various assets available inside Acala EVM. Currently the
getPricemethod returns the aggregated price for a given asset. More price feed options are being made available.
NOTE: If you're running a local Acala node with EVM playground, you are like to have 0 prices for all of the tokens.
Oracle contract address:
// Get the price of the currency_id.
// Returns the (price, timestamp)
function getPrice(address token) public view returns (uint256, uint256);
Oracle Price Feedcontract and click the
token: addressfield, enter the ERC20 contract address (in the example DOT address as
0x0000000000000000000000000000000000000802) for the token of interest. Feeds are available for DOT, RenBTC and XBTC.
Click on the
Call resultsshould show the price and timestamp.