# Pyth Network

## [<mark style="color:blue;">Why Pyth?</mark>](https://pyth.network/)

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.

## [<mark style="color:blue;">Interface</mark>](https://github.com/interest-protocol/coin-x-oracle/blob/main/contracts/sources/pyth.move)

### Structs

```rust
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.

```rust
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.&#x20;

```rust
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.&#x20;

### Functions

#### <mark style="color:blue;">report</mark>

**It requests a price from Pyth Network and submits the information to a Coin X oracle request.**&#x20;

```rust
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.

{% embed url="<https://github.com/interest-protocol/coin-x-oracle/blob/main/contracts/sources/pyth.move>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.interestprotocol.com/overview/deprecated/coin-x-oracle/pyth-network.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
