Pyth Network

Reliable, low-latency market data from institutional sources.

The first price provider supported by Coin X Oracle is Pyth Network. It is the leading Oracle provider on Sui Network and the largest first-party Oracle Network in the world. It supports of over 50 chains and offers 450 price feeds.

First Party Institutional Providers

Pyth network data sources do not rely on intermediaries to ensure reliability and liveness of the data.

Price Confidence

Pyth Network is the only provider that offers a price confidence metric in all price feeds. Assets do not have a single price in a market at any given point in time. By providing a confidence range, DeFi dApps can design their invariant to take into account price variance.

Structs

struct PriceInfoObjectKey has copy, drop, store {}

A dynamic field key to store the sui::object::ID of the pyth::price_info::PriceInfoObject that can that provide data to the oracle.

struct ConfidenceKey has copy, drop, store {}

A dynamic field key to save the minimum required price confidence. It is a percentage, where 100% is represented by 1e18.

struct PythFeed has drop {}

A witness that is added to the suitears::oracle::Request to prove that it collected data from Coin X Oracle's Pyth Network module.

Functions

report

It requests a price from Pyth Network and submits the information to a Coin X oracle request.

public fun report<Witness: drop>(
    oracle: &Oracle<Witness>, 
    request: &mut Request, 
    wormhole_state: &WormholeState,
    pyth_state: &PythState,
    buf: vector<u8>,
    price_info_object: &mut PriceInfoObject,
    pyth_fee: Coin<SUI>,
    clock_object: &Clock
 )
  • @param self. A suiterars::oracle::Oracle with this module's witness.

  • @param request. A hot potato issued from the self to create a suiterars::oracle::Price.

  • @param wormhole_state. The state of the Wormhole module on Sui.

  • @param pyth_state. The state of the Pyth module on Sui.

  • @param buf. Price attestations in bytes.

  • @param price_info_object. An object that contains price information. One per asset.

  • @param pyth_fee. There is a cost to request a price update from Pyth.

  • @param clock_object. The shared Clock object from Sui

Aborts

  • the price_info_object is not whitelisted.

  • the price confidence is out of range.

  • the price is negative or zero.

Last updated