Oracles
A guide on fetching and interacting with Initia's Enshrined Oracles via Skip Slinky
The Initia L1 has an Enshrined Oracle system powered by Skip Slinky to ensure fresh price data is posted to the chain each block. Slinky is highly performant, tied to the liveness of the chain, and flexible.
Learn more about Slinky
To view current price feeds that are being posted to Initia along with code snippets for initiad, cURL, and JS endpoints visit the Slinky Dashboard built by our friends at Alles Labs.
If there are certain price feeds you'd like to be included, please contact a member of the Initia team.
Interacting with Oracles on the L1
Get all tickers
In order to fetch prices, currency_pair_id
is required, which is equal to {Base}/{Quote}
.
All currency pairs information including its {Base}
and {Quote}
are returned by running the command line below.
> curl -X -GET "{lcd-url}/slinky/oracle/v1/get_all_tickers"
# {"currency_pairs":[{"Base":"ATOM","Quote":"USD"},{"Base":"BITCOIN","Quote":"USD"},{"Base":"ETHEREUM","Quote":"USD"}]}
Fetch Prices
Oracle price can be fetched by using the currency_pair_id
found from the above section.
Get price by using LCD
> curl -X -GET "{lcd-url}/slinky/oracle/v1/get_price?currency_pair_id={pair_id}"
# {"price":{"price":"277191500000","block_timestamp":"2024-02-15T06:26:07.884250155Z","block_height":"657085"},"nonce":"637976","decimals":"8","id":"1"}
Get price in MoveVM
use initia_std::oracle
fun get_price(pair_id: String) {
let (price, update_at, decimals) = oracle::get_price(pair_id);
...
}
Interacting with Oracles from a L2
Last updated