Advanced Concepts
Oracles

Oracles

Introduction

Sei supports both Pyth and a native oracle. To learn more about Pyth you can visit their website (opens in a new tab). In the following section, we will cover the native oracle module.

Sei has a native oracle module to support asset exchange rate pricing for use by other modules and contracts. When validating for the network, participation as an Oracle is expected and required in order to ensure the most reliable and accurate pricing for assets.

Below are some helpful APIs to interact with the native Oracle module

Actives

Returns the current active denoms for which there are exchange rates

seid q oracle actives
actives:
- uatom
- ubtc
- ueth
- usei

Exchange Rates

Returns the current exchange rates for supported assets. Optionally can query for a specific denom by entering it as an additional param.

seid q oracle exchange-rates
- denom: uatom
  oracle_exchange_rate:
    exchange_rate: "10.813741474077133110"
    last_update: "7809045"
- denom: ubtc
  oracle_exchange_rate:
    exchange_rate: "28378.473894707711800815"
    last_update: "7806841"
- denom: ueth
  oracle_exchange_rate:
    exchange_rate: "1865.245279694096497292"
    last_update: "7809045"

TWAPs

Returns the time weighted average price for a given time interval in seconds. The maximum lookback is determined by oracle parameters.

seid q oracle twaps $LOOKBACK_SECONDS
oracle_twaps:
- denom: uatom
  lookback_seconds: "12"
  twap: "10.820090685543308091"
- denom: ubtc
  lookback_seconds: "12"
  twap: "28356.159567933482758461"
- denom: ueth
  lookback_seconds: "12"
  twap: "1865.748268727863484183"

Params

Returns the current parameters for the oracle module

seid q oracle params
params:
lookback_duration: "3600"
min_valid_per_window: "0.050000000000000000"
reward_band: "0.020000000000000000"
slash_fraction: "0.000100000000000000"
slash_window: "201600"
vote_period: "1"
vote_threshold: "0.667000000000000000"
whitelist:
  - name: uatom
  - name: usei
  - name: ueth
  - name: ubtc