diff --git a/apps/developer-hub/.gitignore b/apps/developer-hub/.gitignore index 3edbc4f043..6b360ee01f 100644 --- a/apps/developer-hub/.gitignore +++ b/apps/developer-hub/.gitignore @@ -1,3 +1,6 @@ .env*.local .source dist/ + +# Ai Migration +.ai/** \ No newline at end of file diff --git a/apps/developer-hub/content/docs/entropy/generate-random-numbers-evm.mdx b/apps/developer-hub/content/docs/entropy/generate-random-numbers-evm.mdx index 4a0a096a38..3da361d5a1 100644 --- a/apps/developer-hub/content/docs/entropy/generate-random-numbers-evm.mdx +++ b/apps/developer-hub/content/docs/entropy/generate-random-numbers-evm.mdx @@ -84,7 +84,7 @@ function requestRandomNumber() external payable { This method returns a sequence number and emits a [`Requested`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/entropy_sdk/solidity/EntropyEventsV2.sol#L30) event. You can store this sequence number to identify the request in next step. -Note that there are several variants of `requestV2` that allow the caller to configure the provider fulfilling the request and the gas limit for the callback. Refer [request callback variants](./entropy/request-callback-variants.mdx) for more details. +Note that there are several variants of `requestV2` that allow the caller to configure the provider fulfilling the request and the gas limit for the callback. Refer [request callback variants](./entropy/request-callback-variants) for more details. Please see the method documentation in the [IEntropyV2 interface](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/entropy_sdk/solidity/IEntropyV2.sol). diff --git a/apps/developer-hub/content/docs/entropy/set-custom-gas-limits.mdx b/apps/developer-hub/content/docs/entropy/set-custom-gas-limits.mdx index 3c61ef7f05..c98c2a2405 100644 --- a/apps/developer-hub/content/docs/entropy/set-custom-gas-limits.mdx +++ b/apps/developer-hub/content/docs/entropy/set-custom-gas-limits.mdx @@ -10,7 +10,7 @@ Custom gas limits are useful when your callback function requires more gas than ## Prerequisites -Before following this guide, you should first complete the basic setup from the [Generate Random Numbers in EVM Contracts](./entropy/generate-random-numbers-evm.mdx) guide. This guide builds upon that foundation and assumes you have: +Before following this guide, you should first complete the basic setup from the [Generate Random Numbers in EVM Contracts](./entropy/generate-random-numbers-evm) guide. This guide builds upon that foundation and assumes you have: - Installed the Pyth Entropy Solidity SDK - Set up your contract with the `IEntropyConsumer` interface diff --git a/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/benchmarks.mdx b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/benchmarks.mdx new file mode 100644 index 0000000000..6129028d89 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/benchmarks.mdx @@ -0,0 +1,13 @@ +--- +title: Benchmarks +description: Access Benchmarks API instances for Pyth Price Feeds +slug: /price-feeds/core/api-instances-and-providers/benchmarks +--- + +The Pyth Data Association hosts a public instance of the Benchmarks API at the following URL: + +| Channel | URL | +| ------- | ------------------------------- | +| Stable | https://benchmarks.pyth.network | + +There is currently no Benchmarks instance for the Beta channel. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/hermes.mdx b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/hermes.mdx similarity index 56% rename from apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/hermes.mdx rename to apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/hermes.mdx index f06cfac13d..e1ff56eaea 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/hermes.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/hermes.mdx @@ -1,19 +1,15 @@ --- -title: "Hermes: Open-Source Service for Pyth Price Updates" -description: >- - Experience real-time Pyth price feeds with Hermes: an open-source REST and - streaming API. Use public endpoints or self-host for reliable, decentralized - data. -full: false -index: false +title: Hermes +description: Guide to Hermes API endpoints for real-time Pyth price delivery +slug: /price-feeds/core/api-instances-and-providers/hermes --- -# Hermes +import { Callout } from "fumadocs-ui/components/callout"; Hermes is an open-source service that listens to the Pythnet and the Wormhole Network for Pyth price updates, and serves them via a convenient web API. -Hermes allows users to easily [fetch price updates](../fetch-price-updates) via a REST API, or subscribe to server-side streaming +Hermes allows users to easily [fetch price updates](../fetch-price-updates.mdx) via a REST API, or subscribe to server-side streaming updates. ## Public Endpoints @@ -23,16 +19,21 @@ Network: URL: https://hermes.pyth.network - -
For developers building on **Aptos testnet**, **Sui testnet** or **Near testnet**, please use the Hermes Beta endpoint:
+ +For developers building on **Aptos testnet**, **Sui testnet** or **Near testnet**, please use the Hermes Beta endpoint: +URL: https://hermes-beta.pyth.network -
URL: https://hermes-beta.pyth.network
+
-
+### Rate limits + +In order to maximize the reliability of the Public Hermes API, a request rate limit is enforced. +All endpoints limits are set at 30 requests every 10 seconds per IP address. +Clients issuing request above the limit will receive a 429 (Too Many Requests) response for the subsequent 60-second period. For production deployments, developers integrating with Pyth Network are **strongly encouraged** to use Node Providers for maximum resilience and decentralization. Moreover, Hermes is designed to be self-hosted, so developers can run their own -instance of Hermes to fetch Pyth price updates. Please note it is not recommended to use the public endpoint for production as it has rate limits. +instance of Hermes to fetch Pyth price updates. ## Node Providers @@ -48,4 +49,4 @@ The following node providers offer Hermes: The Pyth Data Association provides a Helm chart for running Hermes in [charts](https://github.com/pyth-network/charts/tree/main/charts/hermes) repository. Please refer to the chart's readme for the configuration values. -You will need a Pythnet RPC to run Hermes; see the [guide for accessing a Pythnet RPC](pythnet-rpc). +You will need a Pythnet RPC to run Hermes; see the [guide for accessing a Pythnet RPC](pythnet-rpc.mdx). diff --git a/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/index.mdx b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/index.mdx new file mode 100644 index 0000000000..a3078e6b31 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/index.mdx @@ -0,0 +1,12 @@ +--- +title: API Instances and Providers +description: Access API instances and providers for Pyth Price Feeds +slug: /price-feeds/core/api-instances-and-providers +--- + +This documentation explains how to get access to API instances and providers for Pyth Price Feeds. +See the following guides to learn more about how to access each service: + +- [Hermes](api-instances-and-providers/hermes.mdx) +- [Pythnet RPC](api-instances-and-providers/pythnet-rpc.mdx) +- [Benchmarks/Historical Price](api-instances-and-providers/benchmarks.mdx) diff --git a/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/meta.json b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/meta.json new file mode 100644 index 0000000000..16e916415f --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/meta.json @@ -0,0 +1,7 @@ +{ + "pages": [ + "[Hermes](./hermes)", + "[Benchmarks / Historical Prices](./benchmarks)", + "[Pythnet RPC](./pythnet-rpc)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/pythnet-rpc.mdx b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/pythnet-rpc.mdx similarity index 64% rename from apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/pythnet-rpc.mdx rename to apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/pythnet-rpc.mdx index 9e63db6d5a..bceadf3d00 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/pythnet-rpc.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/api-instances-and-providers/pythnet-rpc.mdx @@ -1,14 +1,9 @@ --- -title: "Pythnet RPC: How to Access and Use for Developers" -description: >- - Use Hermes to configure Pythnet RPC. Choose from trusted providers like Triton - or P2P, or self-host a node for secure, reliable data access. -full: false -index: false +title: Pythnet RPC +description: Access Pythnet RPC providers for Pyth price feeds +slug: /price-feeds/core/api-instances-and-providers/pythnet-rpc --- -# Pythnet RPC - You will need a Pythnet RPC to run Hermes, which you can obtain from any of the Pythnet RPC providers below: diff --git a/apps/developer-hub/content/docs/price-feeds/v1/api-reference.mdx b/apps/developer-hub/content/docs/price-feeds/core/api-reference.mdx similarity index 59% rename from apps/developer-hub/content/docs/price-feeds/v1/api-reference.mdx rename to apps/developer-hub/content/docs/price-feeds/core/api-reference.mdx index c93bbd504d..0afc016aca 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/api-reference.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/api-reference.mdx @@ -1,25 +1,18 @@ --- -title: "Pyth API Reference: On- and Off-Chain Developer Tools" -description: >- - Pyth Core’s API reference covers EVM, Aptos, CosmWasm, and Hermes. It provides - interactive documentation and guides for both on-chain and off-chain - integration. -full: false -index: false +title: API Reference +description: Explore interactive Pyth API references for on-chain and off-chain integrations +slug: /price-feeds/core/api-reference --- -# API Reference - The API reference is a comprehensive guide to the various APIs -- both on- and off-chain -- that developers can use in their applications. Developers can consult this reference to better understand what methods exist and what they do. The API reference is interactive, so developers can try out the APIs from the website to better understand their behavior. The following on-chain contracts are documented in the API reference: -- [EVM](api-reference/evm) -- [Aptos](api-reference/aptos) -- [CosmWasm](api-reference/cosmwasm) +- [EVM](https://api-reference.pyth.network/price-feeds/evm/getPriceNoOlderThan) Hermes also has interactive API documentation hosted by the service itself: - [Hermes](https://hermes.pyth.network/docs/) +- [Benchmarks / Historical Prices](https://benchmarks.pyth.network/docs) diff --git a/apps/developer-hub/content/docs/price-feeds/core/api-reference/meta.json b/apps/developer-hub/content/docs/price-feeds/core/api-reference/meta.json new file mode 100644 index 0000000000..23169d38f9 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/api-reference/meta.json @@ -0,0 +1,6 @@ +{ + "pages": [ + "[EVM \u2197](https://api-reference.pyth.network/price-feeds/evm/getPriceNoOlderThan)", + "[Hermes \u2197](https://hermes.pyth.network/docs/)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/best-practices.mdx b/apps/developer-hub/content/docs/price-feeds/core/best-practices.mdx similarity index 96% rename from apps/developer-hub/content/docs/price-feeds/v1/best-practices.mdx rename to apps/developer-hub/content/docs/price-feeds/core/best-practices.mdx index 1544482ef5..33e43ec1a4 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/best-practices.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/best-practices.mdx @@ -1,15 +1,9 @@ --- -title: "Pyth Price Feeds: Best Practices for Safe Use" -description: >- - Best practices for Pyth price feeds: secure fixed-point representation, - mitigate latency & threats, use confidence intervals, and follow futures - pricing guidelines. -full: false -index: false +title: Best Practices +description: Learn how to integrate Pyth price feeds safely and effectively +slug: /price-feeds/core/best-practices --- -# Best Practices - This page provides some technical details about Pyth price feeds that are necessary to use them safely and correctly. Please read this page before using Pyth price feeds in your application. @@ -31,7 +25,7 @@ Sometimes, Pyth will not be able to provide a current price for a product. This situation can happen for various reasons. For example, US equity markets only trade during certain hours, and outside those hours, it's not clear what an equity's price is. Pyth price feeds follow the traditional market hours for each asset class. \ -Consult [Market Hours](./market-hours.md) to know the market hours for each asset class. +Consult [Market Hours](./market-hours) to know the market hours for each asset class. Alternatively, a network outage (at the internet level, blockchain level, or at multiple data providers) may prevent the protocol from producing new price updates. (Such outages are unlikely, but integrators should still be prepared for the possibility.) @@ -54,7 +48,7 @@ The simplest way to guard against this attack vector is to incorporate a **stale The Pyth SDK provides the [`getPriceNoOlderThan()`](https://api-reference.pyth.network/price-feeds/evm/getPriceNoOlderThan) method to help users guard against this attack vector. This method returns the most recent price update that is not older than a specified threshold. Highly latency-sensitive protocols may wish to reduce the threshold to a few seconds to better suit their needs. -Please also see the section below on [latency mitigations](best-practices.md#latency) for additional ideas on how latency-sensitive protocols can minimize the impact of oracle latency. +Please also see the section below on [latency mitigations](#latency) for additional ideas on how latency-sensitive protocols can minimize the impact of oracle latency. ## Latency @@ -98,7 +92,7 @@ To expand upon the first option, it is recommended to use the confidence interva The same principle would apply if you wrote a derivative contract. If someone wants to open a derivative contract with you, you would value their collateral at the lower price. However, if you were deciding whether someone's margin limits were violated, you could value their outstanding leveraged position at the higher price. If a contract needs to be settled at a price, you could take approaches such as the following: -1. Using Pyth's exponential moving average price, which represents estimates of the average price of the asset over a specified time period (e.g., over the past 1 hour). The exponential moving average price is computed such that it lessens the influence of prices with wide confidence intervals. You may find more details in [EMA Price Aggregation](./how-pyth-works/ema-price-aggregation.md). +1. Using Pyth's exponential moving average price, which represents estimates of the average price of the asset over a specified time period (e.g., over the past 1 hour). The exponential moving average price is computed such that it lessens the influence of prices with wide confidence intervals. You may find more details in [EMA Price Aggregation](./how-pyth-works/ema-price-aggregation.mdx). 2. Using the aggregate price, which is Pyth's best estimate of the price at a single point in time. The quality of this estimate depends on the width of the confidence interval at settlement time and on occasion, it may be imprecise. However, it is the best you can do with Pyth data if you need a single price at that exact point in time. 3. Defining the contract to depend on confidence. For example, you could create an option that refunds the option premium to the buyer (so both sides of the transaction are even) if the strike price is within the confidence interval at settlement time. You could also create a contract that delayed settlement until the confidence interval was sufficiently small. If you choose this second option, you should ensure that your contract is guaranteed to eventually settle even if the confidence interval never narrows. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/aptos.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/aptos.mdx similarity index 82% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/aptos.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/aptos.mdx index 2fb61d5834..895279241e 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/aptos.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/aptos.mdx @@ -1,13 +1,10 @@ --- -title: "Aptos Pyth Contract Addresses (Mainnet, Testnet, Devnet)" -description: >- - Browse Pyth’s Aptos contract addresses on Mainnet, Testnet, and Devnet with - direct links to Pyth, Wormhole, and the Deployer for quick reference. -full: false -index: false +title: Price Feed Contract Addresses on Aptos +description: Find Pyth price feed contract addresses on Aptos networks +slug: /price-feeds/core/contract-addresses/aptos --- -# Price Feed Contract Addresses on Aptos +import CopyAddress from "../../../../../src/components/CopyAddress"; Pyth is currently deployed on Aptos Mainnet, Aptos Testnet, and Movement devnet. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/cosmwasm.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/cosmwasm.mdx similarity index 89% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/cosmwasm.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/cosmwasm.mdx index 05c7c2548b..dea9c8b242 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/cosmwasm.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/cosmwasm.mdx @@ -1,14 +1,9 @@ --- title: Price Feed Contract Addresses on CosmWasm Networks -description: >- - Find Pyth contract addresses on CosmWasm networks—mainnets and testnets across - multiple chains. Access your network’s address instantly. -full: false -index: false +description: Find Pyth price feed contract addresses across CosmWasm ecosystems +slug: /price-feeds/core/contract-addresses/cosmwasm --- -# Price Feed Contract Addresses on CosmWasm Networks - Pyth is currently available on the following cosmwasm chains: ### Stable diff --git a/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/evm.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/evm.mdx new file mode 100644 index 0000000000..d3fddf0d28 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/evm.mdx @@ -0,0 +1,206 @@ +--- +title: Price Feed Contract Addresses on EVM Networks +description: Find Pyth price feed contract addresses on supported EVM mainnets and testnets +slug: /price-feeds/core/contract-addresses/evm +--- + +import CopyAddress from "../../../../../src/components/CopyAddress"; + +Pyth is currently available on the EVM networks below using Pyth Stable price sources that are accessible via Hermes Stable. + +## Mainnets + +| Network | Contract address | +| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0G | | +| Abstract | | +| Apechain | | +| Arbitrum | | +| Aurora | | +| Avalanche | | +| Berachain | | +| Bittensor | | +| Blast | | +| BNB | | +| BTTC | | +| Base | | +| Boba | | +| Camp Network | | +| Canto | | +| Celo | | +| Chiliz | | +| Conflux eSpace | | +| Core DAO | | +| Cronos | | +| Cronos zkEVM | | +| EOS | | +| EVMOS | | +| Ethereum | | +| Etherlink | | +| Eventum | | +| Fantom | | +| Filecoin | | +| Flow | | +| Gnosis | | +| Gravity | | +| Hedera | | +| Hemi | | +| Horizen EON | | +| HyperEVM | | +| Injective EVM | | +| Injective inEVM | | +| Ink | | +| Iota | | +| Kava | | +| KCC | | +| Kaia | | +| LightLink Phoenix | | +| Linea | | +| Manta | | +| Mantle | | +| Merlin | | +| Meter | | +| Mezo | | +| Mode | | +| Morph | | +| Neon | | +| OpBNB | | +| Optimism | | +| Plasma | | +| Polygon | | +| Polygon zkEVM | | +| Polynomial | | +| Ronin | | +| Scroll | | +| Superseed | | +| Sei EVM | | +| Shimmer | | +| Skate | | +| Sonic | | +| Soneium | | +| Story Protocol | | +| Swellchain | | +| Taiko | | +| Unichain | | +| Viction | | +| WEMIX | | +| Worldchain | | +| ZKFair | | +| zkSync Era | | +| zetachain | | + +## Testnets + +| Network | Contract address | +| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Abstract testnet | | +| ApeChain (testnet) | | +| Arbitrum Blueberry (testnet) | | +| Arbitrum Sepolia (testnet) | | +| Aurora testnet | | +| BNB testnet | | +| BTTC testnet | | +| Base Sepolia (testnet) | | +| Berachain Bepolia testnet | | +| Bittensor testnet | | +| Blast Sepolia | | +| Ble testnet | | +| Boba Goerli (testnet) | | +| Boba Sepolia (testnet) | | +| Canto testnet | | +| Celo Alfajores (testnet) | | +| Chiado (Gnosis testnet) | | +| Chiliz testnet | | +| Conflux eSpace testnet | | +| Core DAO testnet | | +| Converge testnet | | +| Cronos testnet | | +| Cronos zkEVM Testnet | | +| Dela Deperp Testnet | | +| Dela Deperp Mithreum Testnet | | +| EOS testnet | | +| Etherlink Ghostnet testnet | | +| Etherlink Shadownet testnet | | +| Eventum testnet | | +| EVMOS testnet | | +| Fantom testnet | | +| Filecoin calibration | | +| Flow Testnet | | +| Fluent testnet | | +| Fuji (Avalanche testnet) | | +| Giwa Testnet | | +| Hedera testnet | | +| Hemi testnet | | +| Hoodi | | +| HyperEVM testnet | | +| Injective inEVM testnet | | +| Kakarot Sepolia testnet | | +| Kava testnet | | +| KCC testnet | | +| Klaytn | | +| Injective EVM | | +| Ink Sepolia | | +| Kaia testnet | | +| LightLink Pegasus | | +| Linea Goerli | | +| Linea Sepolia | | +| Manta testnet | | +| Manta Sepolia | | +| Mantle sepolia | | +| MegaEth Testnet | | +| Merlin testnet | | +| Merlin testnet V2 | | +| Meter testnet | | +| Mezo testnet | | +| Mode testnet | | +| Monad testnet | | +| Monad testnet - beta oracle | | +| Morph Hoodi | | +| Morph Holesky testnet | | +| Morph testnet | | +| Mumbai (Polygon testnet) | | +| Neon devnet | | +| Olive Testnet | | +| OpBNB Testnet | | +| Optimism Goerli (testnet) | | +| Optimism Sepolia (testnet) | | +| Optimism Celestia Raspberry | | +| Orange Avalanche Subnet (testnet) | | +| Polygon Amoy testnet | | +| Polygon Blackberry testnet | | +| Polygon zkEVM testnet | | +| Polynomial testnet | | +| Reya testnet | | +| Saigon (Ronin testnet) | | +| Sei EVM testnet | | +| Scroll Sepolia | | +| Sepolia (Ethereum testnet) | | +| Shimmer testnet | | +| Skate testnet | | +| Soneium (testnet) | | +| Sonic Blaze Testnet | | +| Sonic New Testnet | | +| Story Testnet | | +| Superseed Testnet | | +| Swellchain Testnet | | +| Tabi Testnet | | +| Taiko Hekla | | +| Taiko Hoodi | | +| Unichain Sepolia | | +| Viction testnet | | +| WEMIX testnet | | +| Worldchain testnet | | +| ZKFair testnet | | +| zetachain testnet | | +| zkSync Era Goerli (testnet) | | +| zkSync Era Sepolia (testnet) | | + +Pyth is available on the following network using Pyth Beta price sources: + +| Network | Contract address | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Horizen GOBI testnet | | + +## Price Feed IDs + +The price feed IDs for EVM chains are available [here](../price-feeds.mdx) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/fuel.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/fuel.mdx similarity index 59% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/fuel.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/fuel.mdx index 69aec422cb..9f7fd8ebaf 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/fuel.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/fuel.mdx @@ -1,17 +1,14 @@ --- -title: Pyth Fuel Contract Addresses | Mainnet & Testnet -description: >- - Instantly access Pyth Core Fuel Mainnet and Testnet price feed addresses with - direct links and one-click copy for seamless verification. -full: false -index: false +title: Price Feed Contract Addresses on Fuel +description: Find Pyth price feed contract addresses on Fuel mainnet and testnet +slug: /price-feeds/core/contract-addresses/fuel --- -# Price Feed Contract Addresses on Fuel +import CopyAddress from "../../../../../src/components/CopyAddress"; Pyth is currently deployed on Fuel Mainnet and Fuel Testnet. | Network | Contract address | | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Fuel Mainnet | | -| Fuel Testnet | | +| Fuel Testnet | | diff --git a/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/index.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/index.mdx new file mode 100644 index 0000000000..ae7bbdb1c9 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/index.mdx @@ -0,0 +1,23 @@ +--- +title: Contract Addresses +description: Find deployed Pyth contract addresses across supported blockchains +slug: /price-feeds/core/contract-addresses +--- + +The following sections list the addresses of deployed Pyth Price Feed contracts across blockchains. +The contracts are split by ecosystem into several different documents: + +- [EVM](./contract-addresses/evm) +- [Solana/SVM](./contract-addresses/solana) +- [Aptos](./contract-addresses/aptos) +- [Sui](./contract-addresses/sui) +- [IOTA](./contract-addresses/iota) +- [Movement](./contract-addresses/movement) +- [TON](./contract-addresses/ton) +- [Fuel](./contract-addresses/fuel) +- [CosmWasm](./contract-addresses/cosmwasm) +- [NEAR](./contract-addresses/near) +- [Starknet](./contract-addresses/starknet) +- [Pythnet](./contract-addresses/pythnet) + +Please see the relevant ecosystem document to find the Pyth contract address on your blockchain of choice. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/iota.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/iota.mdx similarity index 89% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/iota.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/iota.mdx index e417cc6029..dd675340ef 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/iota.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/iota.mdx @@ -1,22 +1,10 @@ --- -title: "IOTA Contract Addresses: Pyth & Wormhole Testnet/Mainnet" -description: >- - Provides Pyth and Wormhole contract addresses for IOTA testnet and mainnet, - with explorer links for each key ID to facilitate cross-chain integration. -full: false -index: false +title: Price Feed Contract Addresses on IOTA +description: Find Pyth price feed contract addresses on IOTA networks +slug: /price-feeds/core/contract-addresses/iota --- -# Price Feed Contract Addresses on IOTA - -#### IOTA testnet - -| Name | Address | -| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Pyth State ID | [`0x68dda579251917b3db28e35c4df495c6e664ccc085ede867a9b773c8ebedc2c1`](https://explorer.iota.org/object/0x68dda579251917b3db28e35c4df495c6e664ccc085ede867a9b773c8ebedc2c1?network=testnet) | -| Pyth Package ID | [`0x23994dd119480ea614f7623520337058dca913cb1bb6e5d8d51c7b067d3ca3bb`](https://explorer.iota.org/object/0x23994dd119480ea614f7623520337058dca913cb1bb6e5d8d51c7b067d3ca3bb?network=testnet) | -| Wormhole State ID | [`0x8bc490f69520a97ca1b3de864c96aa2265a0cf5d90f5f3f016b2eddf0cf2af2b`](https://explorer.iota.org/object/0x8bc490f69520a97ca1b3de864c96aa2265a0cf5d90f5f3f016b2eddf0cf2af2b?network=testnet) | -| Wormhole Package ID | [`0xfca58c557f09cddb7930588c4e2a4edbe3cdded1ac1ed2270aa2dfa8d2b9ae0d`](https://explorer.iota.org/object/0xfca58c557f09cddb7930588c4e2a4edbe3cdded1ac1ed2270aa2dfa8d2b9ae0d?network=testnet) | +Pyth is currently deployed on IOTA mainnet and testnet. #### IOTA mainnet @@ -26,3 +14,12 @@ index: false | Pyth Package ID | [`0x7792c84e1f8683dac893126712f7cf3ba5fcc82450839f0a481215f60199769f`](https://explorer.iota.org/object/0x7792c84e1f8683dac893126712f7cf3ba5fcc82450839f0a481215f60199769f) | | Wormhole State ID | [`0xd43b448afc9dd01deb18273ec39d8f27ddd4dd46b0922383874331771b70df73`](https://explorer.iota.org/object/0xd43b448afc9dd01deb18273ec39d8f27ddd4dd46b0922383874331771b70df73) | | Wormhole Package ID | [`0x88b00a6f1d56966d48680ffad3b42d7a25b01c519b73732a0858e0314a960801`](https://explorer.iota.org/object/0x88b00a6f1d56966d48680ffad3b42d7a25b01c519b73732a0858e0314a960801) | + +#### IOTA testnet + +| Name | Address | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Pyth State ID | [`0x68dda579251917b3db28e35c4df495c6e664ccc085ede867a9b773c8ebedc2c1`](https://explorer.iota.org/object/0x68dda579251917b3db28e35c4df495c6e664ccc085ede867a9b773c8ebedc2c1?network=testnet) | +| Pyth Package ID | [`0x23994dd119480ea614f7623520337058dca913cb1bb6e5d8d51c7b067d3ca3bb`](https://explorer.iota.org/object/0x23994dd119480ea614f7623520337058dca913cb1bb6e5d8d51c7b067d3ca3bb?network=testnet) | +| Wormhole State ID | [`0x8bc490f69520a97ca1b3de864c96aa2265a0cf5d90f5f3f016b2eddf0cf2af2b`](https://explorer.iota.org/object/0x8bc490f69520a97ca1b3de864c96aa2265a0cf5d90f5f3f016b2eddf0cf2af2b?network=testnet) | +| Wormhole Package ID | [`0xfca58c557f09cddb7930588c4e2a4edbe3cdded1ac1ed2270aa2dfa8d2b9ae0d`](https://explorer.iota.org/object/0xfca58c557f09cddb7930588c4e2a4edbe3cdded1ac1ed2270aa2dfa8d2b9ae0d?network=testnet) | diff --git a/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/meta.json b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/meta.json new file mode 100644 index 0000000000..01ca1a80b9 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/meta.json @@ -0,0 +1,16 @@ +{ + "pages": [ + "[EVM](./evm)", + "[Solana / SVM](./solana)", + "[Aptos](./aptos)", + "[Sui](./sui)", + "[IOTA](./iota)", + "[Movement](./movement)", + "[TON](./ton)", + "[Fuel](./fuel)", + "[CosmWasm](./cosmwasm)", + "[NEAR](./near)", + "[Starknet](./starknet)", + "[Pythnet](./pythnet)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/movement.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/movement.mdx similarity index 77% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/movement.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/movement.mdx index 7fb60aa404..2104459a2c 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/movement.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/movement.mdx @@ -1,18 +1,10 @@ --- -title: Movement Network Contract Addresses for Pyth Mainnet -description: >- - Discover Pyth Movement’s key contract addresses—Pyth, Wormhole, and - Deployer—and access direct explorer links. Integrate and verify effortlessly - on mainnet. -full: false -index: false +title: Price Feed Contract Addresses on Movement +description: Find Pyth price feed contract addresses on Movement networks +slug: /price-feeds/core/contract-addresses/movement --- -# Price Feed Contract Addresses on Movement - -Pyth is currently deployed on the following Movement networks. - -- [Mainnet](#mainnet) +import CopyAddress from "../../../../../src/components/CopyAddress"; ## Mainnet diff --git a/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/near.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/near.mdx new file mode 100644 index 0000000000..1186b05a45 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/near.mdx @@ -0,0 +1,10 @@ +--- +title: Price Feed Contract Addresses on NEAR +description: Find Pyth price feed contract addresses on NEAR networks +slug: /price-feeds/core/contract-addresses/near +--- + +| Network | Contract address | +| ------------ | --------------------- | +| NEAR Mainnet | `pyth-oracle.near` | +| NEAR Testnet | `pyth-oracle.testnet` | diff --git a/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/pythnet.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/pythnet.mdx new file mode 100644 index 0000000000..9df1b659f2 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/pythnet.mdx @@ -0,0 +1,37 @@ +--- +title: Price Feed Contract Addresses on Pythnet +description: Find Pyth price feed contract addresses on Pythnet +slug: /price-feeds/core/contract-addresses/pythnet +--- + +import { Callout } from "fumadocs-ui/components/callout"; + + + **Important:** The addresses on this page are for the Pythnet network itself, + which is used to construct and deliver Pyth prices to other blockchains. If + you are building an application on EVM, Solana, SVM, or another chain, you + should use the Pyth program deployed on your target chain instead. Please + refer to the [Contract Addresses](/price-feeds/contract-addresses) page and + select your specific blockchain environment. + + +The following tables contain the addresses of the programs deployed on Pythnet environments that operate together to construct Pyth prices and deliver them to other blockchains: + +Note: Pythnet is the mainnet network for Pyth, and Pythtest is a testnet for development purposes. + +#### Pythnet + +| Program | Program address | +| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | +| [Oracle Program](https://github.com/pyth-network/pyth-client/tree/main) | `FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH` | +| [Remote Executor](https://github.com/pyth-network/pyth-crosschain/tree/main/governance/remote_executor) | `exe6S3AxPVNmy46L4Nj6HrnnAVQUhwyYzMSNcnRn3qq` | +| [Message Buffer](https://github.com/pyth-network/pyth-crosschain/tree/main/pythnet/message_buffer) | `7Vbmv1jt4vyuqBZcpYPpnVhrqVe5e6ZPb6JxDcffRHUM` | + +#### Pythtest + +| Program | Program address | +| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | +| [Oracle Program](https://github.com/pyth-network/pyth-client/tree/main) | `gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s` | +| [Oracle Program](https://github.com/pyth-network/pyth-client/tree/main) | `8tfDNiaEyrV6Q1U4DEXrEigs9DoDtkugzFbybENEbCDz` | +| [Remote Executor](https://github.com/pyth-network/pyth-crosschain/tree/main/governance/remote_executor) | `exe6S3AxPVNmy46L4Nj6HrnnAVQUhwyYzMSNcnRn3qq` | +| [Message Buffer](https://github.com/pyth-network/pyth-crosschain/tree/main/pythnet/message_buffer) | `7Vbmv1jt4vyuqBZcpYPpnVhrqVe5e6ZPb6JxDcffRHUM` | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/solana.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/solana.mdx similarity index 89% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/solana.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/solana.mdx index fbe26ddc1c..7ea6ecdbbd 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/solana.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/solana.mdx @@ -1,13 +1,10 @@ --- -title: Solana Program Addresses & SVM Chains Overview -description: >- - Access Solana program addresses and SVM networks (mainnet, devnet, testnet, or - custom). Includes direct links and one-click copy for development workflows. -full: false -index: false +title: Price Feed Contract Addresses on Solana/SVM +description: Find Pyth price feed contract addresses on Solana and other SVM chains +slug: /price-feeds/core/contract-addresses/solana --- -# Program Addresses on Solana and other SVM chains +import CopyAddress from "../../../../../src/components/CopyAddress"; The Pyth Oracle consists of two different programs. @@ -25,6 +22,7 @@ The **Solana receiver program** is deployed at the following addresses: | Sonic Devnet | | | Atlas Testnet | | | Mantis Mainnet | | +| Fogo Testnet | | The **Price feed program** is deployed at the following addresses: @@ -40,3 +38,4 @@ The **Price feed program** is deployed at the following addresses: | Sonic Devnet | | | Atlas Testnet | | | Mantis Mainnet | | +| Fogo Testnet | | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/starknet.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/starknet.mdx similarity index 79% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/starknet.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/starknet.mdx index 3530be25d1..74eaf8576c 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/starknet.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/starknet.mdx @@ -1,13 +1,10 @@ --- -title: "Pyth Price Feed Contract Addresses on Starknet: Mainnet and Testnet" -description: >- - Pyth StarkNet contract addresses for Mainnet and Testnet, with links to their - StarkScan pages. -full: false -index: false +title: Price Feed Contract Addresses on Starknet +description: Find Pyth price feed contract addresses on Starknet networks +slug: /price-feeds/core/contract-addresses/starknet --- -# Price Feed Contract Addresses on Starknet +import CopyAddress from "../../../../../src/components/CopyAddress"; Pyth is deployed on both Starknet Mainnet and Testnet. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/sui.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/sui.mdx similarity index 90% rename from apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/sui.mdx rename to apps/developer-hub/content/docs/price-feeds/core/contract-addresses/sui.mdx index 5ee6fd2afc..f337e03a09 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/sui.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/sui.mdx @@ -1,14 +1,9 @@ --- -title: Sui Contract Addresses on Sui Blockchain -description: >- - This page lists Pyth’s Sui contract addresses on mainnet and testnet, - including contract IDs and explorer URLs for integration and verification. -full: false -index: false +title: Price Feed Contract Addresses on Sui +description: Find Pyth price feed contract addresses on Sui networks +slug: /price-feeds/core/contract-addresses/sui --- -# Price Feed Contract Addresses on Sui - Pyth is currently available on the following sui-based chains: ### Stable channel diff --git a/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/ton.mdx b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/ton.mdx new file mode 100644 index 0000000000..17a67639d6 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/contract-addresses/ton.mdx @@ -0,0 +1,15 @@ +--- +title: Price Feed Contract Addresses on TON +description: Find Pyth price feed contract addresses on TON networks +slug: /price-feeds/core/contract-addresses/ton +--- + +import CopyAddress from "../../../../../src/components/CopyAddress"; + +Pyth is currently deployed on TON Mainnet and TON Testnet. If you are using the deprecated TON Mainnet deployment, please migrate to the new address. + +| Network | Contract address | +| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| TON Mainnet (deprecated) | | +| TON Mainnet | | +| TON Testnet | | diff --git a/apps/developer-hub/content/docs/price-feeds/core/create-tradingview-charts.mdx b/apps/developer-hub/content/docs/price-feeds/core/create-tradingview-charts.mdx new file mode 100644 index 0000000000..2de72316b2 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/create-tradingview-charts.mdx @@ -0,0 +1,153 @@ +--- +title: How to Create TradingView Charts +description: Learn how to build TradingView charts powered by Pyth price feeds +slug: /price-feeds/core/create-tradingview-charts +--- + +import { Tab, Tabs } from "fumadocs-ui/components/tabs"; + +The TradingView integration allows users to view Pyth prices on their own website. All Pyth prices made available through the TradingView integration are originating from [Pythnet](/price-feeds/core/how-pyth-works/pythnet). + +## Choosing an Implementation Method for TradingView Integration + +There are primarily two methods to integrate TradingView with your website to display Pyth prices: + +### 1. Using the TradingView Widget + +- **Advantages**: + - **Simplicity**: This is a plug-and-play solution which allows for quick integration. You won't need to engage in complex setup processes or handle any backend configurations. +- **Disadvantages**: + - **Limited Customization**: The widget comes as-is, and while you can change basic parameters like the `symbol` or `theme`, more advanced customizations are restricted. + +### 2. Using the Datafeed URL with Charting Library + +- **Advantages**: + - **Deep Customization**: Suited for those who need a deeper level of integration and customization. By utilizing the UDF-compatible URL, you can tailor the look, feel, and functionality of the chart to better fit your application's needs. +- **Disadvantages**: + - **Added Complexity**: Integrating the Charting Library requires more technical know-how and potentially more time compared to the simpler widget integration. + +When deciding between the two, consider the user experience you want to provide, the technical expertise at hand, and the time you can allocate to the integration. For a rapid deployment with minimal adjustments, the TradingView Widget is the way to go. If you need more control and are prepared for a deeper dive into the implementation, the Datafeed URL with the Charting Library would be your best choice. + +## TradingView Widget + +1. Add the following script(s) from [TradingView](https://www.tradingview.com/widget/advanced-chart/) to your website depending on your framework: + + + + +```html copy + +
+
+ + +
+ +``` + +
+ + +```jsx copy +// TradingViewWidget.jsx +import { useEffect, useRef } from "react"; + +let tvScriptLoadingPromise; + +export default function TradingViewWidget() { + const onLoadScriptRef = useRef(); + + useEffect(() => { + onLoadScriptRef.current = createWidget; + + if (!tvScriptLoadingPromise) { + tvScriptLoadingPromise = new Promise((resolve) => { + const script = document.createElement("script"); + script.id = "tradingview-widget-loading-script"; + script.src = "https://s3.tradingview.com/tv.js"; + script.type = "text/javascript"; + script.onload = resolve; + + document.head.appendChild(script); + }); + } + + tvScriptLoadingPromise.then( + () => onLoadScriptRef.current && onLoadScriptRef.current(), + ); + + return () => (onLoadScriptRef.current = null); + + function createWidget() { + if (document.getElementById("tradingview") && "TradingView" in window) { + new window.TradingView.widget({ + autosize: true, + symbol: "PYTH:BTCUSD", + interval: "D", + timezone: "Etc/UTC", + theme: "light", + style: "1", + locale: "en", + toolbar_bg: "#f1f3f6", + enable_publishing: false, + allow_symbol_change: true, + container_id: "tradingview", + }); + } + } + }, []); + + return ( +
+
+
+ ); +} +``` + + + + +2. Replace the `symbol` parameter with the Pyth symbol you want to display. For example, to display the price of Ethereum, use `symbol: "PYTH:ETHUSD"`. + +3. Replace the `interval` parameter with the time interval you want to display. For example, to display the price of Ethereum in 1-minute intervals, use `interval: "1"`. Possible resolutions are daily (D or 1D, 2D ... ), weekly (1W, 2W ...), monthly (1M, 2M...) and an intra-day resolution – minutes(1, 2 ...). + +4. Replace the `timezone` parameter with the timezone you want to display. For example, to display the price of Ethereum in the Eastern Time Zone, use `timezone: "America/New_York"`. + +5. Replace the `theme` parameter with the theme you want to display. For example, to display the price of Ethereum in dark mode, use `theme: "dark"`. + +6. There is a fully working open-source example of the TradingView integration by one of Pyth's contributors [here](https://github.com/cctdaniel/pyth-tv-example). The example application is deployed [here](https://pyth-tv-example.vercel.app/). + +Note: The TradingView plug-and-play widget does not allow for much customization. If you want to customize the widget, you can use the [TradingView Charting Library](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/). Please see the next section for more details. + +## Using Datafeed URL with Charting Library + +We also provide a UDF-compatible URL that follows the [TradingView UDF spec](https://www.tradingview.com/charting-library-docs/latest/connecting_data/UDF). You can implement your own datafeed utilizing the API or use the built-in UDF adapter with the API. If you need a step-by-step guide, refer to the [How to connect data via Datafeed API](https://www.tradingview.com/charting-library-docs/latest/tutorials/implement_datafeed_tutorial/) tutorial, or you can reference the example [here](https://github.com/cctdaniel/pyth-tv-charting-lib), the main files that may be of interest are: [datafeed.js](https://github.com/cctdaniel/pyth-tv-charting-lib/blob/main/src/utils/datafeed.js) and [streaming.js](https://github.com/cctdaniel/pyth-tv-charting-lib/blob/main/src/utils/streaming.js). + +The datafeed URL is [here](https://benchmarks.pyth.network/v1/shims/tradingview) and documentation can be found [here](https://benchmarks.pyth.network/redoc) + +### Example + +- Symbol Info: https://benchmarks.pyth.network/v1/shims/tradingview/symbol_info +- History: https://benchmarks.pyth.network/v1/shims/tradingview/history?symbol=Crypto.ETH/USD&resolution=1&from=1690338541&to=1690338741 +- Stream of prices: https://benchmarks.pyth.network/v1/shims/tradingview/streaming +- Config: https://benchmarks.pyth.network/v1/shims/tradingview/config +- Symbols: https://benchmarks.pyth.network/v1/shims/tradingview/symbols?symbol=Crypto.BTC/USD +- Search: https://benchmarks.pyth.network/v1/shims/tradingview/search?query=bitcoin diff --git a/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/meta.json b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/meta.json new file mode 100644 index 0000000000..1ad7e99273 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/meta.json @@ -0,0 +1,8 @@ +{ + "title": "on EVM", + "pages": [ + "[Part 1: Create Pyth App](/price-feeds/core/create-your-first-pyth-app/evm/part-1)", + "[Part 2: Deploy Pyth App](/price-feeds/core/create-your-first-pyth-app/evm/part-2)" + ], + "defaultOpen": true +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/part-1.mdx b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/part-1.mdx similarity index 94% rename from apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/part-1.mdx rename to apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/part-1.mdx index 0d9dc803fc..0737c02d3d 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/part-1.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/part-1.mdx @@ -1,14 +1,10 @@ --- -title: Create a Pyth-Integrated Contract to Fetch ETH Price on EVM -description: >- - Learn how to deploy a Pyth EVM smart contract that delivers real-time ETH/USD - rates and powers accurate NFT pricing. Follow our step-by-step guide with - built-in data-freshness verification. -full: false -index: false +title: Create your first Pyth app on EVM +description: Build and test an EVM app using Pyth price feeds +slug: /price-feeds/core/create-your-first-pyth-app/evm/part-1 --- -# Create your first Pyth app on EVM +import { Step, Steps } from "fumadocs-ui/components/steps"; In this tutorial, we will use real-time Pyth price data to mint an NFT in exchange for $1 of ETH. Our solidity contract will read the price of ETH/USD from Pyth and use it to calculate the amount of ETH required to mint the NFT. @@ -20,9 +16,10 @@ This tutorial will cover the following topics: - Deploy the contract to OP-sepolia testnet. - Update and Fetch price using [hermes-client](https://github.com/pyth-network/pyth-crosschain/tree/main/apps/hermes/client/js). -This tutorial is divided into two parts: \ -[Part 1:](./part-1) Create a contract and fetch prices from Pyth oracles. \ -[Part 2:](./part-2) Deploy Your Pyth App +This tutorial is divided into two parts: + +- [Part 1:](./part-1) Create a contract and fetch prices from Pyth oracles. \ +- [Part 2:](./part-2) Deploy Your Pyth App ## Create a contract and fetch prices from Pyth oracles @@ -39,6 +36,9 @@ Please make sure these are installed on your system before continuing. - [curl](https://curl.se/download.html) - [jq](https://stedolan.github.io/jq/download/) + + + ### Create a Foundry project Create a new directory to hold your app and a `contracts` directory within. @@ -72,13 +72,17 @@ The Foundry project has been successfully initialized! At this point, delete the sample code from `src` and the test file from `test` -- we won't need them anymore. ```bash copy -rm -r src/* test/* +rm -r src/* test/* scripts/* ``` + + + + ### Install the Pyth SDK Pyth provides a Solidity SDK that can be used to interact with one-chain Pyth Price Feed contracts. -It exposes multiple [methods](/price-feeds/api-reference/evm) to read and interact with the contracts. +It exposes multiple [methods](/price-feeds/core/api-reference) to read and interact with the contracts. Use `npm` to add the Pyth SDK: @@ -95,6 +99,10 @@ echo '@pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidit This line tells Foundry where to find the Pyth SDK so that you can import it from Solidity contracts. + + + + ### Create a contract Next, open `src/MyFirstPythContract.sol` in your favorite editor and add the following code: @@ -174,6 +182,10 @@ Compiler run successful! The contract compiles! + + + + ### Create a test Before deploying the contract, let's write a test to make sure it works. @@ -275,6 +287,10 @@ The tests also print out the required payment to successfully mint the NFT -- th Notice that the payment is higher in the second test: when the price of ETH is \$99 (instead of \$100), more ETH is required to reach \$1. This difference demonstrates that your contract is successfully reading the price of ETH/USD from Pyth. + + + + ### Update Pyth prices While our code above seems to work properly, it has a problem. @@ -346,7 +362,7 @@ contract MyFirstPythContract { ``` The end of this function calls the `mint` function we defined before. -Before that, however, the function calls [`updatePriceFeeds`](../../api-reference/evm/updatePriceFeeds) on the Pyth contract. +Before that, however, the function calls [`updatePriceFeeds`](https://api-reference.pyth.network/price-feeds/evm/updatePriceFeeds) on the Pyth contract. This function takes a payload of `bytes[]` that is passed into the function itself. The Pyth contract requires a fee to perform this update; the code snippet above calculates the needed fee using [`getUpdateFee`](https://api-reference.pyth.network/price-feeds/evm/getUpdateFee). The caller of this function can pass in a recent Pyth price update as this payload, guaranteeing that the `StalePrice` error won't occur. @@ -545,4 +561,8 @@ contract MyFirstPythContractTest is Test { ``` -Check out [Part 2](./part-2) to learn how to deploy our contract to OP-sepolia testnet and fetch prices using hermes-client. + + + + +Check out [Part 2](./part-2.mdx) to learn how to deploy our contract to OP-sepolia testnet and fetch prices using hermes-client. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/part-2.mdx b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/part-2.mdx similarity index 95% rename from apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/part-2.mdx rename to apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/part-2.mdx index 2e1e6b6744..5b35c88e69 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/part-2.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/evm/part-2.mdx @@ -1,14 +1,10 @@ --- -title: "Part 2: Deploy & Interact with Pyth App on EVM Testnets" -description: >- - A step-by-step guide to deploying Pyth applications on the EVM, retrieving - real-time price feeds via Hermes, and integrating them into a TypeScript - project. -full: false -index: false +title: Deploy your Pyth App +description: Deploy your Pyth-powered EVM app and interact with it off-chain +slug: /price-feeds/core/create-your-first-pyth-app/evm/part-2 --- -# Deploy your Pyth App +import { Callout } from "fumadocs-ui/components/callout"; In this part of the tutorial, we will learn to deploy the `MyFirstPythContract.sol` contract and fetch the latest price from Pyth network. @@ -18,12 +14,11 @@ This part of the tutorial will conver the following: - Interact with the contract from the command line. - Update and fetch the price from the contract using [hermes-client](https://github.com/pyth-network/pyth-crosschain/tree/main/apps/hermes/client/js). - -
- This tutorial is continuation of the [Part 1: Create a Contract](./part-1). - If you haven't completed that part yet, please do so before continuing. -
-
+ + This tutorial is continuation of the [Part 1: Create a + Contract](./part-1.mdx). If you haven't completed that part yet, please do so + before continuing. + ## Deploy the contract @@ -61,8 +56,8 @@ Paste the address from the command above into the faucet to get your ETH. You can verify that the ETH has arrived in your wallet by running the command `cast balance $ADDRESS -r $RPC_URL -e` The final step before deploying is to get the arguments for the contract's constructor: -the [Pyth contract address](https://docs.pyth.network/price-feeds/contract-addresses/evm#testnets) for Optimism Sepolia -and the [price feed id](https://docs.pyth.network/price-feeds/price-feed-ids) for ETH/USD. +the [Pyth contract address](https://docs.pyth.network/price-feeds/core/contract-addresses/evm#testnets) for Optimism Sepolia +and the [price feed id](https://docs.pyth.network/price-feeds/price-feeds) for ETH/USD. We will also export these values as environment variables for convenience: ```bash copy @@ -77,6 +72,7 @@ Run the following command: forge create src/MyFirstPythContract.sol:MyFirstPythContract \ --private-key $PRIVATE_KEY \ --rpc-url $RPC_URL \ +--broadcast \ --constructor-args $PYTH_OP_SEPOLIA_ADDRESS $ETH_USD_ID ``` @@ -125,7 +121,7 @@ We can do this using `cast` by running the following command: cast send \ --private-key $PRIVATE_KEY \ --rpc-url $RPC_URL \ - -j \ + -j 1 \ --value 0.0005ether \ $DEPLOYMENT_ADDRESS \ "updateAndMint(bytes[])" \ @@ -185,7 +181,7 @@ Then open `src/mintNft.ts` and paste in the following content: import { createWalletClient, http, parseEther } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { optimismSepolia } from "viem/chains"; -import { EvmPriceServiceConnection } from "@pythnetwork/hermes-client"; +import { HermesClient } from "@pythnetwork/hermes-client"; import { getContract } from "viem"; export const abi = [ @@ -253,7 +249,7 @@ async function run() { console.log(priceFeedUpdateData); const hash = await contract.write.updateAndMint( - [priceFeedUpdateData as any], + [[`0x${priceFeedUpdateData.binary.data[0]}`]] as any, { value: parseEther("0.0005") }, ); console.log("Transaction hash:"); diff --git a/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/index.mdx b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/index.mdx new file mode 100644 index 0000000000..2d1964f3f6 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/index.mdx @@ -0,0 +1,20 @@ +--- +title: Create your first Pyth app +description: Build your first application that consumes Pyth price feeds +slug: /price-feeds/core/create-your-first-pyth-app +--- + +import { Callout } from "fumadocs-ui/components/callout"; + +This tutorial walks through creating a complete application that uses Pyth Price feeds. +The application includes a smart contract and an off-chain code invoking the contract. + + + The tutorial is an in-depth walkthrough of contract development; more + experienced developers may want to refer to [Use Real-time Price + Data](./use-real-time-data.mdx) for a more concise version. + + +Please choose your environment to get started: + +- [EVM](./create-your-first-pyth-app/evm/part-1) diff --git a/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/meta.json b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/meta.json new file mode 100644 index 0000000000..726c07b2f9 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/create-your-first-pyth-app/meta.json @@ -0,0 +1,5 @@ +{ + "title": "Create Your First Pyth App", + "pages": ["evm"], + "defaultOpen": false +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/current-fees.mdx b/apps/developer-hub/content/docs/price-feeds/core/current-fees.mdx similarity index 55% rename from apps/developer-hub/content/docs/price-feeds/v1/current-fees.mdx rename to apps/developer-hub/content/docs/price-feeds/core/current-fees.mdx index 0c2e421801..c30a4e8640 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/current-fees.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/current-fees.mdx @@ -1,24 +1,19 @@ --- -title: Current Pyth Network Price Feed Update Fees by Blockchain -description: >- - Compare Pyth Network's current fees for updating price feeds on Ethereum, - Avalanche, and 10+ blockchains. Optimize transactions with the best rates. -full: false -index: false +title: Current Fees +description: Review current update fees across supported Pyth networks +slug: /price-feeds/core/current-fees --- -# Current Fees +import { Callout } from "fumadocs-ui/components/callout"; The following tables shows the total fees payable when updating a price feed. Please note the fees shown below is the amount paid in `msg.value` per price feed update. - -
- **Note**: The default fee of all chains **not** mentioned below is - **1(one)** unit of the smallest denomination of the blockchain's native - token (e.g., **1 wei on Ethereum**). -
-
+ + **Note**: The default fee of all chains **not** mentioned below is **1 (one)** + unit of the smallest denomination of the blockchain's native token (e.g., **1 + wei on Ethereum**). + | **Network** | **Fees** | | ----------- | ---------------- | diff --git a/apps/developer-hub/content/docs/price-feeds/core/derive-cross-rate.mdx b/apps/developer-hub/content/docs/price-feeds/core/derive-cross-rate.mdx new file mode 100644 index 0000000000..b040b4f071 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/derive-cross-rate.mdx @@ -0,0 +1,123 @@ +--- +title: Derive Cross Rate +description: Learn how to derive synthetic cross rates using Pyth price feeds +slug: /price-feeds/core/derive-cross-rate +--- + +import { Tab, Tabs } from "fumadocs-ui/components/tabs"; + +This guide shows how to combine two price feeds to derive a cross rate. These are also known as "synthetic" price feeds. +Cross rates or Synthetic Price feeds are useful for trading pairs that are not directly supported by Pyth. + + + +### EVM + +For example, if you want to trade the price of **`ETH/EUR{:jsx}`**, which is not directly supported by Pyth, you can combine the price of **`ETH/USD{:jsx}`** and **`EUR/USD{:jsx}`** to derive the price of **`ETH/EUR{:jsx}`**. + +$$ +\large{\text{ETH/EUR} = \text{ETH/USD} \div \text{EUR/USD}} +$$ + +### Derive a cross rate + +The Pyth Solidity SDK provides [`deriveCrossRate`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/PythUtils.sol#L77) function to combine two price feeds. +This method is available in [Pyth solidity SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ethereum/sdk/solidity). + +This method takes the following parameters: + +- `price1`: The first price feed value, representing a / b (e.g., ETH/USD). Must be a signed integer (int64). +- `expo1`: The exponent for price1, indicating the number of decimal places. +- `price2`: The second price feed value, representing c / b (e.g., EUR/USD). +- `expo2`: The exponent for price2. +- `targetExponent`: The desired exponent for the output cross rate (a / c). The result will be scaled to this exponent. + +Returns: + +- `crossRate`: The computed cross rate (a / c), scaled to targetExponent. + +### Example + +```solidity copy +pragma solidity ^0.8.0; + +import "@pythnetwork/pyth-sdk-solidity/IPyth.sol"; +import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol"; +import "@pythnetwork/pyth-sdk-solidity/PythUtils.sol"; + +contract ExampleCrossRate { + IPyth public pyth; + + constructor(address _pythContract) { + pyth = IPyth(_pythContract); + } + + // priceUpdate should include both price feeds + function getEthPerEur( + bytes32 ethUsdId, + bytes32 eurUsdId, + bytes[] calldata priceUpdate + ) external payable returns (int64 price, int32 expo) { + // Update both feeds + uint fee = pyth.getUpdateFee(priceUpdate); + pyth.updatePriceFeeds{ value: fee }(priceUpdate); + + // Fetch prices + PythStructs.Price memory ethUsd = pyth.getPriceNoOlderThan(ethUsdId, 60); + PythStructs.Price memory eurUsd = pyth.getPriceNoOlderThan(eurUsdId, 60); + + // Derive ETH/EUR = ETH/USD / EUR/USD + int32 targetExpo = -8; + int64 ethPerEur = PythUtils.deriveCrossRate( + ethUsd.price, + ethUsd.expo, + eurUsd.price, + eurUsd.expo, + targetExpo + ); + + return (ethPerEur, targetExpo); + } +} + +``` + +#### ⚠️ Things to Keep in Mind + +- The function reverts if either price is **negative**, or if any exponent is **less than -255**. +- The result is rounded down. If the result is smaller than 1 in the given `targetExponent{:jsx}`, it will return 0. +- Confidence intervals are not derived in this function. If needed, you have to derive them manually. +- Reverts with `PythErrors.ExponentOverflow{:jsx}` if `targetExponent + expo1 - expo2{:jsx}` is outside the range **[-58, 58]**. + +### Additional Resources + +You may find these additional resources helpful. + +#### How to use real-time data in EVM contracts + +The [How to use real-time data in EVM contracts](./use-real-time-data/evm.mdx) guide provides a step-by-step guide on how to use real-time data in EVM contracts. + +#### Price Feed IDs + +The [Price Feed IDs](./price-feeds.mdx) page lists the price feed IDs for each asset supported by Pyth. + + + + +### SVM + +The Pyth Rust SDK provides [`get_price_in_quote`](https://github.com/pyth-network/pyth-sdk-rs/blob/d6598dcf8b556cd97bb597661cdc012398371be1/pyth-sdk/src/price.rs#L90) function to combine two price feeds. +This method is available in [Pyth Rust SDK](https://github.com/pyth-network/pyth-sdk-rs/tree/main/pyth-sdk). + +### Example + +```rust copy +let btc_usd: Price = ...; +let eth_usd: Price = ...; +// -8 is the desired exponent for the result +let btc_eth: Price = btc_usd.get_price_in_quote(ð_usd, -8); +println!("BTC/ETH price: ({} +- {}) x 10^{}", price.price, price.conf, price.expo); +``` + + + diff --git a/apps/developer-hub/content/docs/price-feeds/core/error-codes.mdx b/apps/developer-hub/content/docs/price-feeds/core/error-codes.mdx new file mode 100644 index 0000000000..f985fb45f0 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/error-codes.mdx @@ -0,0 +1,7 @@ +--- +title: Error Codes +description: Reference error codes for Pyth price feeds +slug: /price-feeds/core/error-codes +--- + +- [EVM](error-codes/evm) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/error-codes/evm.mdx b/apps/developer-hub/content/docs/price-feeds/core/error-codes/evm.mdx similarity index 90% rename from apps/developer-hub/content/docs/price-feeds/v1/error-codes/evm.mdx rename to apps/developer-hub/content/docs/price-feeds/core/error-codes/evm.mdx index 2d5136937d..ae84ea0f8f 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/error-codes/evm.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/error-codes/evm.mdx @@ -1,14 +1,9 @@ --- -title: "EVM Error Codes: Troubleshooting & Descriptions" -description: >- - Decode Pyth Network EVM errors to troubleshoot invalid arguments, missing - price feeds, governance issues, and more. Resolve issues quickly. -full: false -index: false +title: EVM Error Codes +description: Decode the error codes emitted by Pyth EVM contracts +slug: /price-feeds/core/error-codes/evm --- -# EVM Error Codes - The following table contains the errors used in the Pyth Network's [EVM contracts](https://github.com/pyth-network/pyth-crosschain/tree/a888ba318c0325c29070eaf5afcc3a4d443b058c/target_chains/ethereum/contracts/contracts). This information is derived from [PythErrors.sol](https://github.com/pyth-network/pyth-crosschain/blob/a888ba318c0325c29070eaf5afcc3a4d443b058c/target_chains/ethereum/sdk/solidity/PythErrors.sol#L8) in the Pyth SDK and can be used to decode error codes programmatically. diff --git a/apps/developer-hub/content/docs/price-feeds/core/error-codes/index.mdx b/apps/developer-hub/content/docs/price-feeds/core/error-codes/index.mdx new file mode 100644 index 0000000000..1789ec9c83 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/error-codes/index.mdx @@ -0,0 +1,7 @@ +--- +title: Error Codes +description: Directory of error code references for Pyth price feeds +slug: /price-feeds/core/error-codes +--- + +- [EVM](error-codes/evm) diff --git a/apps/developer-hub/content/docs/price-feeds/core/error-codes/meta.json b/apps/developer-hub/content/docs/price-feeds/core/error-codes/meta.json new file mode 100644 index 0000000000..6509527e0b --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/error-codes/meta.json @@ -0,0 +1,3 @@ +{ + "pages": ["[EVM](./evm)"] +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/fetch-price-updates.mdx b/apps/developer-hub/content/docs/price-feeds/core/fetch-price-updates.mdx similarity index 95% rename from apps/developer-hub/content/docs/price-feeds/v1/fetch-price-updates.mdx rename to apps/developer-hub/content/docs/price-feeds/core/fetch-price-updates.mdx index a71e14e94b..22d9a86c26 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/fetch-price-updates.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/fetch-price-updates.mdx @@ -1,13 +1,10 @@ --- -title: Fetch Real-Time Price Data via Pyth Hermes API -description: >- - Fetch real-time on-chain price updates with Pyth Hermes API via REST, - streaming, or SDK. Use Pyth Price Feeds for fast, accurate data delivery. -full: false -index: false +title: How To Fetch Price Updates +description: Learn how to retrieve Pyth price updates via REST, streaming, and SDK +slug: /price-feeds/core/fetch-price-updates --- -# How To Fetch Price Updates +import { Callout } from "fumadocs-ui/components/callout"; The following guide explains how to fetch price updates. Price updates can be submitted to the Pyth Price Feeds contract to update the on-chain price. @@ -20,14 +17,12 @@ provides three different ways to fetch price updates: 1. [Streaming](#streaming) 1. [SDK](#sdk) - -
- Fetching a price from Hermes requires a price feed ID. This ID serves as a - unique identifier for each price feed (e.g., BTC/USD). The complete list of - Pyth price feed IDs is available at - https://pyth.network/developers/price-feed-ids -
-
+ + Fetching a price from Hermes requires a price feed ID. This ID serves as a + unique identifier for each price feed (e.g., BTC/USD). The complete list of + Pyth price feed IDs is available at + https://docs.pyth.network/price-feeds/price-feeds + ## REST API @@ -128,7 +123,7 @@ The [`HermesClient`](https://github.com/pyth-network/pyth-crosschain/blob/main/a const connection = new HermesClient("https://hermes.pyth.network", {}); const priceIds = [ - // You can find the ids of prices at https://pyth.network/developers/price-feed-ids + // You can find the ids of prices at https://docs.pyth.network/price-feeds/price-feeds "0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43", // BTC/USD price id "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", // ETH/USD price id ]; diff --git a/apps/developer-hub/content/docs/price-feeds/v1/getting-started.mdx b/apps/developer-hub/content/docs/price-feeds/core/getting-started.mdx similarity index 68% rename from apps/developer-hub/content/docs/price-feeds/v1/getting-started.mdx rename to apps/developer-hub/content/docs/price-feeds/core/getting-started.mdx index faaa6f2a80..ce6181da3d 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/getting-started.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/getting-started.mdx @@ -1,15 +1,9 @@ --- -title: "Getting Started with Pyth Price Feeds: Developer Guide & Resources" -description: >- - Pyth offers tutorials, API documentation, and best practice guides for - integrating its price feeds. These resources help you build, test, and deploy - reliable on-chain crypto data. -full: false -index: false +title: Getting Started +description: Explore key resources to begin integrating Pyth price feeds +slug: /price-feeds/core/getting-started --- -# Getting Started - Integrating Pyth price feeds is quick and easy. Pyth price feeds are permissionless and available on-chain. You **don't** need to sign up or request an API key Pyth offers several different resources to help you get started. @@ -22,17 +16,18 @@ Developers interested in using Pyth can refer to the following resources: - [Create Your First Pyth App](./create-your-first-pyth-app/) is a tutorial that walks the reader through all of the steps required to develop, test and deploy a contract using Pyth price feeds. This guide is tailored toward new developers with less contract development experience. - [Use Real-Time Price Data](./use-real-time-data/) is a how-to guide that provides the minimal steps to integrate price feeds into your app. This guide is targeted towards more experienced developers who know the basics of smart contract development. +- [Use Historic Price Data](./use-historic-price-data/) is a how-to guide that provides the minimal steps to integrate historic price data into your app. - [API Reference](./api-reference) is an interactive playground that provides a detailed overview of the Pyth smart contract's functionality. This guide is useful for developers who want to understand the full capabilities of the Pyth oracles. In addition to the resources above, the following reference materials will be useful for developers as they integrate: -- [Price Feed IDs](https://www.pyth.network/developers/price-feed-ids) lists the price feed IDs for all the assets supported by Pyth. +- [Price Feed IDs](./price-feeds) lists the price feed IDs for all the assets supported by Pyth. - [Contract Addresses](./contract-addresses/) provides the contract addresses for Pyth on different chains. -- [Error Codes](./error-codes.mdx) lists the error codes that can be returned by the Pyth contracts. -- [Best Practices](./best-practices.mdx) explains how to use Pyth price feeds safely and effectively in your application. +- [Error Codes](./error-codes) lists the error codes that can be returned by the Pyth contracts. +- [Best Practices](./best-practices) explains how to use Pyth price feeds safely and effectively in your application. ## Learn For those interested in learning more about Pyth, the following resources are available: -- [How Pyth Works](./how-pyth-works.mdx) provides a high-level overview of Pyth architecture. +- [How Pyth Works](./how-pyth-works) provides a high-level overview of Pyth architecture. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/cross-chain.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/cross-chain.mdx similarity index 81% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/cross-chain.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/cross-chain.mdx index 0cccfa7ec4..c30485440e 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/cross-chain.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/cross-chain.mdx @@ -1,21 +1,15 @@ --- -title: Pyth Network Cross-Chain Price Transfer Mechanisms -description: >- - Securely transfer and verify real-time price feeds across blockchains with - Pyth’s cross-chain solutions, including Wormhole, Hermes, and native on-chain - protocols. -full: false -index: false +title: Cross-chain +description: Learn how Pyth prices move from Pythnet to target blockchains +slug: /price-feeds/core/how-pyth-works/cross-chain --- -# Cross-chain - -Pyth uses a cross-chain mechanism to transfer prices from [Pythnet](pythnet.md) to target chains. The diagram below +Pyth uses a cross-chain mechanism to transfer prices from [Pythnet](pythnet) to target chains. The diagram below shows how prices are delivered from Pythnet to target chains: -![](./assets/Pull-Architecture-Hermes.png) +![Pyth cross-chain architecture](/images/Pull-Architecture-Hermes.png) -Data providers publish their prices on Pythnet. The on-chain [oracle program](oracle-program.md) then aggregates prices +Data providers publish their prices on Pythnet. The on-chain [oracle program](oracle-program) then aggregates prices for a feed to obtain the aggregate price and confidence. Next, the Pythnet validators send a Wormhole message on each Pythnet slot to the Wormhole contract on Pythnet containing the Merkle root of all the prices. Wormhole guardians then observe the Merkle root message and create a signed VAA for the Merkle root message. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/ema-price-aggregation.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/ema-price-aggregation.mdx similarity index 88% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/ema-price-aggregation.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/ema-price-aggregation.mdx index 9f6e91f8f1..6e093cfd3c 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/ema-price-aggregation.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/ema-price-aggregation.mdx @@ -1,15 +1,9 @@ --- -title: "EMA Price Aggregation in Pyth Network: How It Works & Confidence Metrics" -description: >- - Ensure real-time price accuracy with Pyth’s EMA Price Aggregation, blending - slot-weighted and inverse confidence-weighted exponential moving averages for - reliable data. -full: false -index: false +title: EMA Price Aggregation +description: See how Pyth computes exponentially weighted price and confidence values +slug: /price-feeds/core/how-pyth-works/ema-price-aggregation --- -# EMA Price Aggregation - Pyth network also offers an exponentially-weighted moving average (EMA) price and confidence. These values are time-weighted averages of the aggregate price and confidence. For more details, please read out [Medium Blog](https://pythnetwork.medium.com/whats-in-a-name-302a03e6c3e1) on the topic. Both the EMA price (ema_price) and confidence (ema_confidence) are available from Pyth price accounts: @@ -33,7 +27,7 @@ price_account .. CqFJLrT4rSpA46RQkVYWn8tdBDuQ7p7RXcp6Um76oaph In an EMA the most recent samples receive the most weight, and samples further back in time get exponentially less weight the farther in the past they are. For a 1 hour EMA, the samples 1 hour in the past get 50% of the weighting, samples 2 hours in the past get 25% of the weighting, 3 hours in the past get 12.5% of the weighting, etc. -![](./assets/EMA_Price_Aggregation_1.png) +![EMA price aggregation example 1](/images/EMA_Price_Aggregation_1.png) While conceptually not as simple as an SMA (Simple Moving Average), the EMA has a particularly simple implementation for streaming applications such as Pyth. The exponential weighting method allows the entire history of prices and weights to be represented by a single number. @@ -48,6 +42,6 @@ The current Pyth averaging method is a slot-weighted, inverse confidence-weighte - **Slot weighted** — The Pyth EMA uses the Pythnet slot number to measure the passage of time. The averaging period is 5921 slots, which corresponds to approximately 1 hour on Pythnet. - **Inverse confidence weighted** — Weighting each sample by 1/Confidence lets the EMA give more weight to samples with tight confidence and ignore samples with very wide confidence. Below is an example of an outlier aggregate price with a wide confidence interval. Notice how the average using inverse confidence weighting does not get pulled up by the outlier sample while the uniform weighted average does. -![](./assets/EMA_Price_Aggregation_2.png) +![EMA price aggregation example 2](/images/EMA_Price_Aggregation_2.png) For more details and explanations, be sure to read the dedicated blog post on this topic [here](https://pythnetwork.medium.com/whats-in-a-name-302a03e6c3e1). diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/fees.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/fees.mdx similarity index 83% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/fees.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/fees.mdx index 9c38db6586..780c514228 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/fees.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/fees.mdx @@ -1,14 +1,9 @@ --- -title: Understanding Fees in the Pyth Network Protocol -description: >- - Learn how Pyth Network’s governance sets optional data fees for on-chain price - feeds, compensates providers, and ensures transparent, efficient pricing. -full: false -index: false +title: Fees +description: Understand how Pyth update fees are determined and paid +slug: /price-feeds/core/how-pyth-works/fees --- -# Fees - The Pyth Network protocol has been designed to allow for the optional enablement of data fees in order to update the state of an on-chain price feeds. The ongoing existence of and size of the fee will be determined by governance on a per-blockchain basis; until governance is live, the fee will be 1 of the smallest denomination of the blockchain's native token (e.g., 1 wei on Ethereum). The fees collected by the protocol will go toward compensating data providers and possibly other uses as determined by governance. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/hermes.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/hermes.mdx similarity index 83% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/hermes.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/hermes.mdx index d72601e38b..e97c63d3d6 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/hermes.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/hermes.mdx @@ -1,14 +1,9 @@ --- -title: "Hermes: Real-Time Price Data Service for Pyth Network" -description: >- - Provides real-time Pythnet and Wormhole price data via REST APIs and - server-sent events (SSE) for on-chain verification. -full: false -index: false +title: Hermes +description: Learn how Hermes delivers Pyth price updates and how to access it +slug: /price-feeds/core/how-pyth-works/hermes --- -# Hermes - [Hermes][hermes-repo] is a web service that listens to the Pythnet and the Wormhole Network for Pyth price updates, and serves them via a convenient web API. It provides Pyth's latest price update data format that are more cost-effective to verify and use on-chain. @@ -38,4 +33,4 @@ $ curl https://hermes.pyth.network/api/latest_price_feeds?ids[]=0xff61491a931112 Hermes is a permissionless service that can either be self-hosted or accessed through a third-party provider (similar to a blockchain RPC). The Pyth Data Association also operates a public instance for development purposes. -Please see [Hermes API Instances and Providers](../api-instances-and-providers/hermes) for more details. +Please see [Hermes API Instances and Providers](/price-feeds/core/api-instances-and-providers/hermes) for more details. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/index.mdx similarity index 55% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/index.mdx index 8b51b975f4..1c2ee23c63 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/index.mdx @@ -1,28 +1,21 @@ --- -title: "How Pyth Works: On-Chain Price Aggregation & Cross-Chain Data Transfer" -description: >- - Pyth Oracle provides real-time price data via cross-chain feeds. Publishers - submit signed price updates which are aggregated on-chain to ensure accuracy. - Developers can integrate these feeds directly into smart contracts for - blockchain applications. -full: false -index: false +title: How Pyth Works +description: Design Overview - Understand the high-level architecture of the Pyth Network +slug: /price-feeds/core/how-pyth-works --- -# Design Overview - Pyth is a protocol that allows market participants to publish pricing information on-chain for others to use. The protocol is an interaction between three parties: 1. _Publishers_ submit pricing information to Pyth's oracle program. Pyth has multiple data publishers for every product to improve the accuracy and robustness of the system. 2. Pyth's _oracle program_ combines publishers' data to produce a single aggregate price and confidence interval. 3. _Consumers_ read the price information produced by the oracle program. -Pyth's oracle program runs on [Pythnet](how-pyth-works/pythnet.md). -The prices constructed on Pythnet are transferred [cross-chain](how-pyth-works/cross-chain.md) to reach consumers on these blockchains. +Pyth's oracle program runs on [Pythnet](how-pyth-works/pythnet). +The prices constructed on Pythnet are transferred [cross-chain](how-pyth-works/cross-chain) to reach consumers on these blockchains. -The critical component of the system is the [oracle program](how-pyth-works/oracle-program.md) that combines the data from each individual publisher. -This program maintains a number of different [SVM accounts](pythnet-reference/account-structure.md) that list the products on Pyth and their current price data. +The critical component of the system is the [oracle program](how-pyth-works/oracle-program) that combines the data from each individual publisher. +This program maintains a number of different [SVM accounts](pythnet-reference/account-structure) that list the products on Pyth and their current price data. Publishers publish their price and confidence by interacting with the oracle program on every slot. The program stores this information in its accounts. -The first price update in a slot additionally triggers [price aggregation](how-pyth-works/price-aggregation.md), which combines the price data from the previous slot into a single aggregate price and confidence interval. +The first price update in a slot additionally triggers [price aggregation](how-pyth-works/price-aggregation), which combines the price data from the previous slot into a single aggregate price and confidence interval. This aggregate price is written to these SVM accounts of Pythnet where it is available for transmission to other blockchains. diff --git a/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/meta.json b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/meta.json new file mode 100644 index 0000000000..4125a08fe5 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/meta.json @@ -0,0 +1,11 @@ +{ + "pages": [ + "[Pythnet](./pythnet)", + "[Oracle Program](./oracle-program)", + "[Cross-chain](./cross-chain)", + "[Fees](./fees)", + "[Hermes](./hermes)", + "[Price Aggregation](./price-aggregation)", + "[EMA Price Aggregation](./ema-price-aggregation)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/oracle-program.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/oracle-program.mdx similarity index 64% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/oracle-program.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/oracle-program.mdx index 7d38a03367..37413c19db 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/oracle-program.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/oracle-program.mdx @@ -1,15 +1,9 @@ --- -title: "Oracle Program: How Pyth Maintains & Aggregates Price Feeds" -description: >- - Discover how Pyth’s oracle delivers accurate on-chain price feeds by - aggregating real-time data and computing moving averages for your - decentralized apps. -full: false -index: false +title: Oracle Program +description: Discover how the Pyth oracle program aggregates publisher data +slug: /price-feeds/core/how-pyth-works/oracle-program --- -# Oracle Program - The oracle program is responsible for several tasks: 1. Maintaining the set of price feeds. @@ -17,10 +11,10 @@ The oracle program is responsible for several tasks: 3. Combining the individual data providers' prices into a single aggregate price and confidence interval. 4. Performing any additional stateful computations on the resulting price series, such as computing moving averages. -The oracle solves these problems by maintaining a collection of [SVM accounts](../pythnet-reference/account-structure.md) to represent the set of price feeds. -Each feed has two accounts: a product account to store [metadata](../pythnet-reference/product-metadata.md) and a price account. +The oracle solves these problems by maintaining a collection of [SVM accounts](../pythnet-reference/account-structure) to represent the set of price feeds. +Each feed has two accounts: a product account to store [metadata](../pythnet-reference/product-metadata) and a price account. The price account stores a list of authorized data providers for this specific price feed, and allocates storage space for each data provider's price. The oracle program exposes an instruction called `upd_price` that enables an authorized data provider to update the price account with their current estimate of the price and confidence interval. -Additionally, the first time that `upd_price` is called in a slot, it will [aggregate](price-aggregation.md) the individual data provider's prices into an aggregate price and confidence interval. +Additionally, the first time that `upd_price` is called in a slot, it will [aggregate](price-aggregation) the individual data provider's prices into an aggregate price and confidence interval. Only the aggregate price and confidence are made available for use in downstream applications; the individual data providers prices are internal state of the oracle program. -Finally, the oracle program computes an [exponentially-weighted moving average](ema-price-aggregation.md) of the oracle price. +Finally, the oracle program computes an [exponentially-weighted moving average](ema-price-aggregation) of the oracle price. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/price-aggregation.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/price-aggregation.mdx similarity index 88% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/price-aggregation.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/price-aggregation.mdx index b4b6d4e7a4..d2feadc591 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/price-aggregation.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/price-aggregation.mdx @@ -1,25 +1,20 @@ --- -title: "Pyth Price Aggregation: Combining Data for Accurate Prices" -description: >- - Pyth delivers real-time market prices for DeFi and trading applications by - aggregating weighted data from multiple sources. -full: false -index: false +title: Price Aggregation +description: Learn how Pyth aggregates publisher prices and confidence intervals +slug: /price-feeds/core/how-pyth-works/price-aggregation --- -# Price Aggregation - Price aggregation combines the prices and confidences submitted by individual data providers into a single aggregate price and confidence. **Design Goals** The aggregation algorithm is designed to achieve 3 properties. First, it must be **robust to manipulation.** If most publishers are submitting a price of \$100 and one publisher submits a price of \$80, the aggregate price should remain near \$100 and not be overly influenced by the single outlying price. In the figure below, the aggregate price and confidence interval (represented by the blue star) is not influenced by the magenta publisher whose price is far away from the other publishers: -![](./assets/Price_Aggregation_1.png) +![Price aggregation example 1](/images/Price_Aggregation_1.png) Second, the **aggregate price should appropriately weight data sources with different levels of accuracy.** Pyth allows publishers to submit a confidence interval because they have varying levels of accuracy in observing the price of a product. This property can result in situations where one publisher reports a price of \$101 +/- 1, and another reports \$110 +/- 10. In these cases, aggregating the price to be closer to \$101 than \$110 is appropriate, as in the figure below. -![](./assets/Price_Aggregation_2.png) +![Price aggregation example 2](/images/Price_Aggregation_2.png) Finally, the **aggregate confidence interval should reflect the variation between publishers' prices.** Under normal market conditions, it is reasonable to expect a product to trade at a similar price across exchanges. @@ -27,7 +22,7 @@ In these cases, aggregate confidence interval is preferable to reflect the confi However, in some rare situations, a product can trade at different prices on different exchanges. In these cases, the aggregate confidence interval should widen out to reflect the variation between these prices, as shown in the figure on the right. -![](./assets/Price_Aggregation_3.png) +![Price aggregation example 3](/images/Price_Aggregation_3.png) **Algorithm** @@ -50,21 +45,21 @@ Finally, the bold red star depicts the aggregate price and the bold red line dep In the first scenario, one publisher with a tight confidence interval is an outlier. Although this publisher does influence the objective function (the red line is lower on the left side than the right), it does not have enough influence to affect either the aggregate price or confidence interval. -![](./assets/Price_Aggregation_4.png) +![Price aggregation example 4](/images/Price_Aggregation_4.png) The second scenario depicts how publishers with tighter confidence intervals can exert more influence over the location of the aggregate price, as long as their prices are consistent with the confidence intervals of other publishers. -![](./assets/Price_Aggregation_5.png) +![Price aggregation example 5](/images/Price_Aggregation_5.png) The third scenario demonstrates the typical case where there are many publishers whose prices and confidence intervals roughly agree. In this case, the desired behavior is for the aggregate price and confidence to reflect those of the individual publishers. -![](./assets/Price_Aggregation_6.png) +![Price aggregation example 6](/images/Price_Aggregation_6.png) Finally, the fourth scenario considers the case where the publishers publish distinct prices with non-overlapping confidence intervals. In this case, the confidence interval widens out because the dispersion between publishers creates a large gap between the aggregate price and the 25th/75th percentiles of the votes. -![](./assets/Price_Aggregation_7.png) +![Price aggregation example 7](/images/Price_Aggregation_7.png) **Further Reading** diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/pythnet.mdx b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/pythnet.mdx similarity index 81% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/pythnet.mdx rename to apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/pythnet.mdx index ce02f18753..d01a991f6c 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/pythnet.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/how-pyth-works/pythnet.mdx @@ -1,20 +1,15 @@ --- -title: "Pythnet: Real-Time Off-Chain Price Feeds on Solana" -description: >- - Pythnet on Solana delivers secure, real-time price data across multiple - blockchains with on-chain verification for smart contracts. -full: false -index: false +title: Pythnet +description: Learn about the purpose and design of the Pythnet blockchain +slug: /price-feeds/core/how-pyth-works/pythnet --- -# Pythnet - Pythnet is an application-specific blockchain operated by Pyth's data providers. This blockchain is a computation substrate to securely combine the data provider's prices into a single aggregate price for each Pyth price feed. Pythnet forms the core of Pyth's off-chain price feeds that serve all blockchains. Pythnet is powered by Solana technology: it runs the same validator software but is a Pyth-specific chain that is independent of Solana's mainnet. -The Pyth Data Association DAO enables each data provider to operate one validator by delegating them the necessary stake. +The Pythian Council enables each data provider to operate one validator by delegating them the necessary stake. The purpose of Pythnet is to provide a secure and reliable computing substrate for Pyth's price aggregation. Recall that Pyth's data providers submit their own price measurements for each product. diff --git a/apps/developer-hub/content/docs/price-feeds/core/index.mdx b/apps/developer-hub/content/docs/price-feeds/core/index.mdx new file mode 100644 index 0000000000..cdd255d85f --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/index.mdx @@ -0,0 +1,27 @@ +--- +title: Pyth Core +description: Pyth core documentation overview +slug: /price-feeds/core +--- + +# Introduction to Pyth Core + +Pyth Network provides real-time financial market data to smart contract applications on 100+ blockchains. +Data is sourced from 120+ first-party providers including major exchanges and market makers. + +## Key Features + +- **2000+ price feeds** across all major asset classes +- **Sub-second latency** with high-frequency updates +- **Cryptographically signed** and verifiable on-chain +- **Multi-chain support** including EVM, Cosmos, Solana, Aptos, and more + +## Quick Start + + + + + + + + diff --git a/apps/developer-hub/content/docs/price-feeds/v1/market-hours.mdx b/apps/developer-hub/content/docs/price-feeds/core/market-hours.mdx similarity index 75% rename from apps/developer-hub/content/docs/price-feeds/v1/market-hours.mdx rename to apps/developer-hub/content/docs/price-feeds/core/market-hours.mdx index 4dc7bde8fb..9fc897af6a 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/market-hours.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/market-hours.mdx @@ -1,15 +1,9 @@ --- -title: "Pyth Market Hours by Asset Class: Trading Schedules & Holidays" -description: >- - Pyth provides market hours data for cryptocurrencies, stocks, forex, metals, - interest rates, and commodities. It includes regular schedules, holiday - closures, and exceptions. -full: false -index: false +title: Market Hours +description: Trading hours followed by Pyth price feeds across asset classes +slug: /price-feeds/core/market-hours --- -# Market Hours - Pyth price feeds follow the [traditional market hours](https://www.cmegroup.com/trading-hours.html) of each asset classes and will be available at the following hours: | Asset Class | Opening Hours | Exceptions | | ----------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | @@ -17,6 +11,10 @@ Pyth price feeds follow the [traditional market hours](https://www.cmegroup.com/ | US Equities | Every weekday from 9.30AM ET to 4PM ET | Markets are closed on weekends, and follow [NYSE Holidays & Trading Hours](https://www.nyse.com/markets/hours-calendars) | | EU Equities | Paris, Amsterdam, Ireland: Every weekday from 9AM CET to 5.30PM CET | Markets are closed on weekends, and follow [Euronext Holidays & Trading Hours](https://live.euronext.com/en/resources/trading-hours-holidays) | | UK Equities | Every weekday from 8AM UK time to 4.30PM UK time | Markets are closed on weekends, and follow [LSE Holidays & Trading Hours](https://www.londonstockexchange.com/equities-trading/business-days) | +| DE Equities | Every weekday from 9AM to 5.30PM CET | Markets are closed on weekends, and follow [Xetra Holidays & Trading Hours](https://www.xetra.com/xetra-en/trading/trading-calendar-and-trading-hours) | +| HK Equities | Every weekday from 9.30AM to 12PM & 1PM to 4PM HKT | Markets are closed on weekends, and follow [HKEX Holidays & Trading Hours](https://www.hkex.com.hk/Services/Trading-hours-and-Severe-Weather-Arrangements/Trading-Hours/Securities-Market?sc_lang=en) | +| CN Equities | Every weekday from 9.30AM to 11.30AM & 1PM to 2:57PM CST | Markets are closed on weekends, and follow [SSE Holidays & Trading Hours](https://english.sse.com.cn/start/trading/schedule/) | +| JP Equities | Every weekday from 9AM to 11.30AM & 12.30PM to 3:30PM JST | Markets are closed on weekends, and follow [JPX Holidays & Trading Hours](https://www.jpx.co.jp/english/corporate/about-jpx/calendar/) | | FX | From Sunday 5PM ET to Friday 5PM ET | Trading continues during most US holidays | | Emerging Markets FX | From Sunday 6PM ET to Friday 5PM ET. For USDBRL, USDCOP, USDCLP and USDPEN, please refer to the [EM FX Market Hours Guide](https://pyth-network.notion.site/EM-FX-Market-Hours-Guide-1de2eecaaac980eea5eddf8f34398309) | Spot EM FX liquidity can be significantly limited at the start of the trading week, outside local market trading hours, and during local holidays, which can lead to wider confidence intervals. Pyth EM FX currencies: INR, IDR, PHP, KRW, TWD, CNH, TRY, ZAR, MXN, BRL, COP, CLP, PEN | | Metals | From Sunday 6PM ET to Friday 5PM ET | Daily maintenance window applies from 5PM ET to 6PM ET, Monday to Thursday. Spot gold and silver trading also follow [CME holiday closures](https://www.cmegroup.com/tools-information/holiday-calendar.html)| diff --git a/apps/developer-hub/content/docs/price-feeds/core/meta.json b/apps/developer-hub/content/docs/price-feeds/core/meta.json new file mode 100644 index 0000000000..527a5baf2d --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/meta.json @@ -0,0 +1,35 @@ +{ + "pages": [ + "getting-started", + "---Tutorials---", + "create-your-first-pyth-app", + "---How-To Guides---", + "use-real-time-data", + "[Use Historic Price Data](./core/use-historic-price-data)", + "[Fetch Price Updates](./core/fetch-price-updates)", + "[Schedule Price Updates](./core/schedule-price-updates)", + "[Create TradingView Charts](./core/create-tradingview-charts)", + "[Derive Cross Rate](./core/derive-cross-rate)", + "[Migrate an App to Pyth](./core/migrate-an-app-to-pyth)", + "[Use Pyth for Morpho Markets](./core/use-pyth-for-morpho)", + "[Publish Data](./core/publish-data)", + "[Troubleshoot Errors](./core/troubleshoot)", + "---Reference Material---", + "[API Reference](./core/api-reference)", + "[Price Feeds](./core/price-feeds)", + "[Current Fees](./current-fees)", + "[Push Feeds](./push-feeds)", + "[Market Hours](./core/market-hours)", + "[Best Practices](./core/best-practices)", + "[Rate Limits](./core/rate-limits)", + "[Error Codes](./core/error-codes)", + "[API Instances and Providers](./api-instances-and-providers)", + "[Contract Addresses](./contract-addresses)", + "[Pythnet Reference](./core/pythnet-reference)", + "[Example Applications \u2197](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds)", + "---Understanding Pyth---", + "[What is a Pull Oracle?](./core/pull-updates)", + "[Why Update Prices](./core/why-update-prices)", + "[How Pyth Works](./core/how-pyth-works)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/core/migrate-an-app-to-pyth/index.mdx b/apps/developer-hub/content/docs/price-feeds/core/migrate-an-app-to-pyth/index.mdx new file mode 100644 index 0000000000..882a0fd73a --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/migrate-an-app-to-pyth/index.mdx @@ -0,0 +1,9 @@ +--- +title: Migrate to Pyth from Another Oracle +description: Resources to help move existing oracle integrations onto Pyth price feeds +slug: /price-feeds/core/migrate-an-app-to-pyth +--- + +The guides in this section are designed to help developers migrate an application from another oracle to use Pyth price feeds. + +- [Chainlink](migrate-an-app-to-pyth/chainlink) diff --git a/apps/developer-hub/content/docs/price-feeds/core/migrate-an-app-to-pyth/meta.json b/apps/developer-hub/content/docs/price-feeds/core/migrate-an-app-to-pyth/meta.json new file mode 100644 index 0000000000..3b72e50d0f --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/migrate-an-app-to-pyth/meta.json @@ -0,0 +1,3 @@ +{ + "pages": ["[from Chainlink](./chainlink)"] +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/price-feeds/asset-classes.mdx b/apps/developer-hub/content/docs/price-feeds/core/price-feeds/asset-classes.mdx similarity index 89% rename from apps/developer-hub/content/docs/price-feeds/v1/price-feeds/asset-classes.mdx rename to apps/developer-hub/content/docs/price-feeds/core/price-feeds/asset-classes.mdx index 6fc5026e7c..753e1a5331 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/price-feeds/asset-classes.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/price-feeds/asset-classes.mdx @@ -1,15 +1,9 @@ --- -title: Understanding Asset Classes in Pyth Price Feeds -description: >- - Real-time Pyth price feeds for crypto, equities, FX, metals, commodities, and - energy. Integrate these feeds into trading and analytics systems to support - data-driven decision-making. -full: false -index: false +title: Asset Classes +description: Overview of the asset classes covered by Pyth price feeds +slug: /price-feeds/core/price-feeds/asset-classes --- -# Asset Classes - [Pyth price feeds](https://www.pyth.network/price-feeds) provide market data for the following asset classes: | Asset Class | Subclass | Definition | @@ -27,4 +21,4 @@ index: false **NOTE:** When integrating with **Energy Futures Price Feeds**, it is not recommended to rely solely on the first month expiry price feed as there is often lower liquidity towards expiration. Best practice is to combine, 1-month, 2-month and 3-month feeds or use the weighted average which is represented by spot price(USOILSPOT or UKOILSPOT). -Please refer to the [Best Practices](../best-practices.mdx#pricing-futures-based-assets) page for more information. +Please refer to the [Best Practices](/price-feeds/core/best-practices#pricing-futures-based-assets) page for more information. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/price-feeds.mdx b/apps/developer-hub/content/docs/price-feeds/core/price-feeds/index.mdx similarity index 73% rename from apps/developer-hub/content/docs/price-feeds/v1/price-feeds.mdx rename to apps/developer-hub/content/docs/price-feeds/core/price-feeds/index.mdx index cd0af73b2a..70af3c8476 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/price-feeds.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/price-feeds/index.mdx @@ -1,13 +1,10 @@ --- -title: "Pyth Price Feeds: Real-Time Data & Asset Identifiers" -description: >- - Get real-time Pyth Price Feeds with unique IDs for every blockchain asset - class. Learn to fetch, identify, and integrate them effortlessly. -full: false -index: false +title: Price Feeds +description: Overview of Pyth price feeds, asset classes, and feed IDs +slug: /price-feeds/core/price-feeds --- -# Price Feeds +import { Callout } from "fumadocs-ui/components/callout"; Pyth Price Feeds provide real-time, first-party, market data for a wide range of assets. @@ -20,7 +17,7 @@ Anyone can fetch available price feeds and their IDs via [Hermes API](https://he Every price feed belongs to an asset class. These asset classes distinguish between different types of assets, such as crypto, US equities, and metals. -Refer to the [Asset Classes](./price-feeds/asset-classes.md) page to learn more about the existing asset classes. +Refer to the [Asset Classes](./price-feeds/asset-classes) page to learn more about the existing asset classes. ## Price Feed IDs @@ -31,7 +28,9 @@ Applications need to store the IDs of the feeds they wish to read. However, the IDs may be represented in different formats (e.g. hex or base58) depending on the blockchain. Price feeds also have different IDs in the Stable and Beta channels. -Refer to the [Price Feed ID reference catalog](https://www.pyth.network/developers/price-feed-ids) to identify a feed's ID in your chosen ecosystem. +### Feed IDs + +Refer to the [Price Feed IDs](/price-feeds/core/price-feeds/price-feed-ids) page for the complete list of price feed IDs. ### Solana Price Feed Accounts diff --git a/apps/developer-hub/content/docs/price-feeds/core/price-feeds/meta.json b/apps/developer-hub/content/docs/price-feeds/core/price-feeds/meta.json new file mode 100644 index 0000000000..bfef8a56ea --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/price-feeds/meta.json @@ -0,0 +1,6 @@ +{ + "pages": [ + "[Price Feed IDs](./price-feed-ids)", + "[Asset Classes](./asset-classes)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/core/publish-data/meta.json b/apps/developer-hub/content/docs/price-feeds/core/publish-data/meta.json new file mode 100644 index 0000000000..625e66bae4 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/publish-data/meta.json @@ -0,0 +1,8 @@ +{ + "pages": [ + "[Understanding Publishing Slots](./understanding-publishing-slots)", + "[pyth-client Websocket API](./pyth-client-websocket-api)", + "[Confidence Interval and Crypto Exchange Fees](./confidence-interval-and-crypto-exchange-fees)", + "[Useful Resources for Publishers](./useful-resources-for-publishers)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/core/push-feeds/meta.json b/apps/developer-hub/content/docs/price-feeds/core/push-feeds/meta.json new file mode 100644 index 0000000000..47a53581a2 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/push-feeds/meta.json @@ -0,0 +1,10 @@ +{ + "pages": [ + "[EVM](./evm)", + "[Solana](./solana)", + "[Fogo](./fogo)", + "[Aptos](./aptos)", + "[Movement](./movement)", + "[Sui](./sui)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/core/pythnet-reference/meta.json b/apps/developer-hub/content/docs/price-feeds/core/pythnet-reference/meta.json new file mode 100644 index 0000000000..7ba3e930c2 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/pythnet-reference/meta.json @@ -0,0 +1,7 @@ +{ + "pages": [ + "[Account Structure](./account-structure)", + "[Product Metadata](./product-metadata)", + "[Schedule Format](./schedule-format)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/core/schedule-price-updates/meta.json b/apps/developer-hub/content/docs/price-feeds/core/schedule-price-updates/meta.json new file mode 100644 index 0000000000..c986fe3e59 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/schedule-price-updates/meta.json @@ -0,0 +1,7 @@ +{ + "pages": [ + "[Using Adrastia](./using-adrastia)", + "[Using Gelato](./using-gelato)", + "[Using Price Pusher](./using-price-pusher)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/core/troubleshoot/meta.json b/apps/developer-hub/content/docs/price-feeds/core/troubleshoot/meta.json new file mode 100644 index 0000000000..c854a73109 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/troubleshoot/meta.json @@ -0,0 +1,6 @@ +{ + "pages": [ + "[EVM Price Feeds Contract](./evm)", + "[SVM Price Feeds Contract](./svm)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/index.mdx b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/index.mdx new file mode 100644 index 0000000000..daf5078944 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/index.mdx @@ -0,0 +1,60 @@ +--- +title: How to Use Real-Time Price Data +description: Guides for using Pyth real-time price feeds +slug: /price-feeds/core/use-real-time-data +--- + +import { Callout } from "fumadocs-ui/components/callout"; + +The following guides demonstrate how to consume Pyth real-time prices on various blockchains. +These guides are intended for developers building on-chain applications that need the latest price data, i.e., the price data must +be on the blockchain. + +Pyth price feeds are available on 100+ blockchain ecosystems. +Check out the complete list of chains and implementation contract addresses at [Contract Addresses](../contract-addresses). +If your blockchain is not supported, please [ask in the dev-forum](https://dev-forum.pyth.network/latest). + +## Choosing Your Integration Method + +**Pull integration** is the default choice for most applications. In this integration, the application retrieves price data from a [webservice](../how-pyth-works/hermes) and submits it to +an on-chain smart contact as part of the transaction. This integration provides the lowest-latency access to Pyth price data. + +**Push integration** is for applications that don't want to pull prices in every transaction and prefer a purely on-chain integration. + + + All feeds are available through both integration methods. However, to use pull + integration, the application needs to submit the prices to the on-chain smart + contract as part of the transaction. Check out the Pull Integration section + below to get started. + + +## Pull Integration + +Consult the relevant ecosystem guide to get started using **pull integration**: + +- [EVM](../use-real-time-data/pull-integration/evm) +- [Solana](../use-real-time-data/pull-integration/solana) +- [Starknet](../use-real-time-data/pull-integration/starknet) +- [Aptos](../use-real-time-data/pull-integration/aptos) +- [CosmWasm](../use-real-time-data/pull-integration/cosmwasm) +- [Sui](./pull-integration/sui) +- [IOTA](./pull-integration/iota) +- [Near](./pull-integration/near) + +## Push Integration + +To consume real-time price data using **push** integration, check out the following guides: + +- [Using Push Integration](../use-real-time-data/push-integration) + +This guide will walk you through the steps to use real-time price data using push integration in every ecosystem. + +## Off-Chain Applications + +Pyth price feeds can also be used in off-chain applications. +For example, an application may need to show real-time asset prices on a website. +Developers building such applications can consult the following guide: + +- [Off-chain Apps](../fetch-price-updates) + +To fetch historical prices, application developers can check out the [Use Historic Price Data](../use-historic-price-data) guide. diff --git a/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/meta.json b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/meta.json new file mode 100644 index 0000000000..8e42f07d44 --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/meta.json @@ -0,0 +1,5 @@ +{ + "title": "Use Real-Time Price Data", + "pages": ["pull-integration", "push-integration"], + "defaultOpen": true +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/aptos.mdx b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/aptos.mdx similarity index 71% rename from apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/aptos.mdx rename to apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/aptos.mdx index f2e55341a0..27f11e5b35 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/aptos.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/aptos.mdx @@ -1,13 +1,10 @@ --- -title: Using Real-Time Pyth Data in Aptos Contracts -description: >- - Integrate real-time Pyth price feeds into Aptos smart contracts. Step-by-step - setup, code samples, and BTC/USD data resources included. -full: false -index: false +title: How to Use Real-Time Data in Aptos Contracts +description: Consume Pyth Network prices in Aptos applications +slug: /price-feeds/core/use-real-time-data/pull-integration/aptos --- -# How to Use Real-Time Data in Aptos Contracts +import { Callout } from "fumadocs-ui/components/callout"; This guide explains how to use real-time Pyth data in Aptos applications. @@ -29,7 +26,7 @@ deployer = "0xb31e712b26fd295357355f6845e77c888298636609e93bc9b05f0f604049f434" wormhole = "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625" ``` -Consult [Aptos Contract Addresses](../contract-addresses/aptos) for the complete list of contract addresses on different Aptos networks. +Consult [Aptos Contract Addresses](../../contract-addresses/aptos) for the complete list of contract addresses on different Aptos networks. ## Write Contract Code @@ -52,7 +49,7 @@ module example::example { // Read the current price from a price feed. // Each price feed (e.g., BTC/USD) is identified by a price feed ID. - // The complete list of feed IDs is available at https://pyth.network/developers/price-feed-ids + // The complete list of feed IDs is available at https://docs.pyth.network/price-feeds/price-feeds // Note: Aptos uses the Pyth price feed ID without the `0x` prefix. let btc_price_identifier = x"e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"; let btc_usd_price_id = price_identifier::from_byte_vec(btc_price_identifier); @@ -62,33 +59,25 @@ module example::example { ``` - -
- The `pyth_price_update` argument contains verified prices from Pyth. Calling - `pyth::update_price_feeds` with this value updates the on-chain Pyth price - and ensures your application has recent price data. The pyth_price_update - can be fetched from Hermes; Consult [Fetch Price - Updates](../fetch-price-updates) for more information on how to fetch the - `pyth_price_update`. -
-
+ + The `pyth_price_update` argument contains verified prices from Pyth. Calling + `pyth::update_price_feeds` with this value updates the on-chain Pyth price and + ensures your application has recent price data. The pyth_price_update can be + fetched from Hermes; Consult [Fetch Price Updates](../../fetch-price-updates) + for more information on how to fetch the `pyth_price_update`. + The code snippet above does the following things: 1. Call `pyth::get_update_fee` to get the fee required to update the Pyth price feeds. 1. Call `pyth::update_price_feeds` and pass `pyth_price_update` to update the Pyth price feeds. -1. Call `pyth::get_price` to read the current price, providing the [price feed ID](https://pyth.network/developers/price-feed-ids) you wish to read. +1. Call `pyth::get_price` to read the current price, providing the [price feed ID](../../price-feeds) you wish to read. ## Additional Resources You may find these additional resources helpful for developing your Aptos application. -### API Reference - -The [Aptos API reference](../api-reference/aptos/) lets you interactively explore the complete API of the Pyth contract. - ### Example Applications - [Minimal on-chain contract](https://github.com/pyth-network/pyth-examples/blob/main/price_feeds/aptos/fetch_btc_price/sources/example.move), which updates and returns the BTC/USD price from Pyth price feeds. - [Mint NFT](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/aptos/mint_nft) that use Pyth price feeds to mint an NFT. - th price feeds to mint an NFT. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/cosmwasm.mdx b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/cosmwasm.mdx similarity index 54% rename from apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/cosmwasm.mdx rename to apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/cosmwasm.mdx index 2bbdcb4beb..baccef1698 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/cosmwasm.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/cosmwasm.mdx @@ -1,22 +1,15 @@ --- -title: "CosmWasm & Pyth Network: Integrating Real-Time Price Feeds" -description: >- - Add real-time market data to your CosmWasm smart contracts with Pyth Network - price feeds. Follow our step-by-step setup, update guidance, and resource - library for seamless integration. -full: false -index: false +title: Pyth on Cosmwasm +description: Consume Pyth Network prices in applications on Cosmwasm +slug: /price-feeds/core/use-real-time-data/pull-integration/cosmwasm --- -# Pyth on Cosmwasm - Cosmwasm contracts can update and fetch the Pyth prices using the Pyth Cosmwasm Contract, deployed on their network. The documented source code can be found [here](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/cosmwasm/contracts/pyth). -The [Cosmwasm API reference](../../cosmwasm) lets you interactively explore the complete API of the Pyth contract. ## Update Price Feeds -The mechanism by which price feeds are updated on Cosmwasm is explained [here](../pythnet-price-feeds/pull-updates.mdx). The [@pythnetwork/price-service-client](https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/client/js) typescript package can be used to fetch the latest price feed data which then can be passed to the contract as the [UpdatePriceFeeds](../api-reference/cosmwasm/execute-update-price-feeds) ExecuteMsg. +The mechanism by which price feeds are updated on Cosmwasm is explained [here](../../pull-updates). The [@pythnetwork/price-service-client](https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/client/js) typescript package can be used to fetch the latest price feed data which then can be passed to the contract as the `UpdatePriceFeeds` ExecuteMsg. Pyth publishes prices for two kinds of feeds: @@ -29,12 +22,9 @@ Pyth publishes prices for two kinds of feeds: ## Price Feed IDs -The price feed IDs for stable and edge feeds are different and can be found here. - -- [List of stable ids](https://pyth.network/developers/price-feed-ids#cosmwasm-stable) -- [List of beta ids](https://pyth.network/developers/price-feed-ids#cosmwasm-edge) +The price feed IDs for stable and edge feeds are different and can be found at https://docs.pyth.network/price-feeds/price-feeds. ## Contract Addresses Developers will need the address of the Pyth price feed contract on their blockchain in order to use Pyth. -Please consult [CosmWasm Contract Addresses](../contract-addresses/cosmwasm) to find the address for your blockchain. +Please consult [CosmWasm Contract Addresses](../../contract-addresses/cosmwasm) to find the address for your blockchain. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/evm.mdx b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/evm.mdx similarity index 63% rename from apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/evm.mdx rename to apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/evm.mdx index 8fbac64076..302ee70bf3 100644 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/evm.mdx +++ b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/evm.mdx @@ -1,16 +1,25 @@ --- -title: Integrate Real-Time Pyth Data into EVM Contracts -description: >- - This guide explains how to integrate Pyth Network’s real-time price feeds into - EVM smart contracts. It covers SDK installation and configuration, and - provides code examples for retrieving and using on-chain price data. -full: false -index: false +title: How to Use Real-Time Data in EVM Contracts +description: Use Pyth Network real-time data in EVM contracts using pull integration +slug: /price-feeds/core/use-real-time-data/pull-integration/evm --- -# How to Use Real-Time Data in EVM Contracts +import { Callout } from "fumadocs-ui/components/callout"; -This guide explains how to use real-time Pyth data in EVM contracts. For an interactive playground to explore the methods supported by the Pyth contract, see the [EVM API reference](../api-reference/evm/). +This guide explains how to use real-time Pyth data in EVM contracts using the pull integration. + +For an interactive playground to explore the methods supported by the Pyth contract, see the [EVM API reference](../../../api-reference). + + + If you want to use real-time price data using the push integration instead, you can use the following code snippet: + ```solidity copy + PythStructs.Price memory price = pyth.getPriceNoOlderThan(priceFeedId, 60); + ``` +Developers only need to pass the price feed ID to the above method from the [Push Feeds list](../../../push-feeds/evm). + +For complete example, refer to the [Push Integration guide](../../push-integration). + + ## Install Pyth SDK @@ -41,6 +50,15 @@ Then add the following line to your `remappings.txt` file: @pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity ``` + + **Important**: Pyth uses a pull oracle model that requires users to update + prices on-chain before reading them. If you don't update the price or if the + on-chain price becomes too stale, calls to `getPriceNoOlderThan()` will revert + with a `StalePrice` error (0x19abf40e). Learn more about [why you need to + update prices](../../../why-update-prices) and see [how to fetch price + updates](../../../fetch-price-updates) for implementation details. + + ## Write Contract Code The code snippet below provides a general template for what your contract code should look like: @@ -80,7 +98,7 @@ contract SomeContract { // Read the current price from a price feed if it is less than 60 seconds old. // Each price feed (e.g., ETH/USD) is identified by a price feed ID. - // The complete list of feed IDs is available at https://pyth.network/developers/price-feed-ids + // The complete list of feed IDs is available at https://docs.pyth.network/price-feeds/price-feeds bytes32 priceFeedId = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace; // ETH/USD PythStructs.Price memory price = pyth.getPriceNoOlderThan(priceFeedId, 60); } @@ -90,11 +108,11 @@ contract SomeContract { The code snippet above does the following things: -1. Instantiate the `IPyth` interface from the Solidity SDK using the price feeds [contract address](../contract-addresses/evm). -2. Select the [Price Feed IDs](https://pyth.network/developers/price-feed-ids) for the assets you want to fetch prices for. Price feeds come in two varieties, Stable and Beta. You should select Stable feed ids +1. Instantiate the `IPyth` interface from the Solidity SDK using the price feeds [contract address](../../../contract-addresses/evm). +2. Select the [Price Feed IDs](../../../price-feeds) for the assets you want to fetch prices for. Price feeds come in two varieties, Stable and Beta. You should select Stable feed ids 3. Call `IPyth.getUpdateFee` to calculate the fee charged by Pyth to update the price. 4. Call `IPyth.updatePriceFeeds` to update the price, paying the fee calculated in the previous step. -5. Call `IPyth.getPriceNoOlderThan` to read the current price, providing the [price feed ID](https://pyth.network/developers/price-feed-ids) that you wish to read and your acceptable staleness threshold for +5. Call `IPyth.getPriceNoOlderThan` to read the current price, providing the [price feed ID](../../../price-feeds) that you wish to read and your acceptable staleness threshold for the price. ## Additional Resources @@ -103,15 +121,15 @@ You may find these additional resources helpful for developing your EVM applicat ### API Reference -The [EVM API reference](../api-reference/evm/) lets you interactively explore the complete API of the Pyth contract. +The [EVM API reference](../../../api-reference) lets you interactively explore the complete API of the Pyth contract. ### Current Fees -The [Current Fees](../current-fees/) page lists the current fees for each network. +The [Current Fees](../../../current-fees) page lists the current fees for each network. ### Error Codes -The [EVM error codes](../error-codes/evm/) page lists the error codes that the Pyth contract may return. +The [EVM error codes](../../../error-codes/evm) page lists the error codes that the Pyth contract may return. ### Example Applications diff --git a/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/meta.json b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/meta.json new file mode 100644 index 0000000000..25c0f7aa2d --- /dev/null +++ b/apps/developer-hub/content/docs/price-feeds/core/use-real-time-data/pull-integration/meta.json @@ -0,0 +1,15 @@ +{ + "pages": [ + "[in EVM contracts](/price-feeds/core/use-real-time-data/pull-integration/evm)", + "[in Solana and SVM programs](/price-feeds/core/use-real-time-data/pull-integration/solana)", + "[in Starknet contracts](/price-feeds/core/use-real-time-data/pull-integration/starknet)", + "[in Fuel contracts](/price-feeds/core/use-real-time-data/pull-integration/fuel)", + "[in Stacks contracts](/price-feeds/core/use-real-time-data/pull-integration/stacks)", + "[in Aptos contracts](/price-feeds/core/use-real-time-data/pull-integration/aptos)", + "[in Sui contracts](/price-feeds/core/use-real-time-data/pull-integration/sui)", + "[in IOTA contracts](/price-feeds/core/use-real-time-data/pull-integration/iota)", + "[in TON contracts](/price-feeds/core/use-real-time-data/pull-integration/ton)", + "[in CosmWasm contracts](/price-feeds/core/use-real-time-data/pull-integration/cosmwasm)", + "[in Near contracts](/price-feeds/core/use-real-time-data/pull-integration/near)" + ] +} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers.mdx b/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers.mdx deleted file mode 100644 index 1f071b2cb0..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Access Hermes & Pythnet RPC: Developer API Guide" -description: >- - Streamline integration of Pyth Price Feeds with Hermes and Pythnet RPC. Choose - self-hosted or third-party instances to boost development efficiency. -full: false -index: false ---- - -# API Instances and Providers - -The following documentation explains how to get access to an instance of Hermes or a Pythnet RPC. -Developers may need access to these services in order to use Pyth Price Feeds. -Both services can be self-hosted or accessed through a third-party provider. -See the following guides to learn more about how to access each service: - -- [Hermes](api-instances-and-providers/hermes) -- [Pythnet RPC](api-instances-and-providers/pythnet-rpc) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/_meta.json deleted file mode 100644 index c7c060d649..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/api-instances-and-providers/_meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "hermes": "Hermes", - "pythnet-rpc": "Pythnet RPC" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/assets/Push-vs-Pull-Oracle.jpg b/apps/developer-hub/content/docs/price-feeds/v1/assets/Push-vs-Pull-Oracle.jpg deleted file mode 100644 index 45193c04e5..0000000000 Binary files a/apps/developer-hub/content/docs/price-feeds/v1/assets/Push-vs-Pull-Oracle.jpg and /dev/null differ diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses.mdx b/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses.mdx deleted file mode 100644 index f4ac318ac1..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses.mdx +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Pyth Contract Addresses for Multiple Blockchains -description: >- - Discover Pyth Price Feed contract addresses for EVM, Solana, Aptos, and more. - Visit our Developer Hub for quick access to your blockchain’s address. -full: false -index: false ---- - -# Contract Addresses - -The following sections list the addresses of deployed Pyth Price Feed contracts across blockchains. -The contracts are split by ecosystem into several different documents: - -- [EVM](contract-addresses/evm) -- [Solana/SVM](contract-addresses/solana) -- [Aptos](contract-addresses/aptos) -- [Sui](contract-addresses/sui) -- [IOTA](contract-addresses/iota) -- [Movement](contract-addresses/movement) -- [TON](contract-addresses/ton) -- [Fuel](contract-addresses/fuel) -- [CosmWasm](contract-addresses/cosmwasm) -- [NEAR](contract-addresses/near) -- [Starknet](contract-addresses/starknet) -- [Pythnet](contract-addresses/pythnet) - -Please see the relevant ecosystem document to find the Pyth contract address on your blockchain of choice. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/_meta.json deleted file mode 100644 index 1ad2188b36..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/_meta.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "evm": "EVM", - "solana": "Solana / SVM", - "aptos": "Aptos", - "sui": "Sui", - "iota": "IOTA", - "movement": "Movement", - "ton": "TON", - "fuel": "Fuel", - "cosmwasm": "CosmWasm", - "near": "NEAR", - "starknet": "Starknet", - "pythnet": "Pythnet" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/evm.mdx b/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/evm.mdx deleted file mode 100644 index c5375db075..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/evm.mdx +++ /dev/null @@ -1,199 +0,0 @@ ---- -title: Pyth Networks EVM Contract Addresses & Price Feed IDs -description: >- - Browse Pyth’s EVM contract addresses for mainnet and testnet, with direct - explorer links—stay up to date on all network deployments. -full: false -index: false ---- - -# Price Feed Contract Addresses on EVM Networks - -Pyth is currently available on the EVM networks below using Pyth Stable price sources that are accessible via Hermes Stable. - -## Mainnets - -| Network | Contract address | -| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| Abstract | [`0x8739d5024B5143278E2b15Bd9e7C26f6CEc658F1`](https://abscan.org/address/0x8739d5024B5143278E2b15Bd9e7C26f6CEc658F1) | -| Apechain | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://apechain.calderaexplorer.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Arbitrum | [`0xff1a0f4744e8582DF1aE09D5611b887B6a12925C`](https://arbiscan.io/address/0xff1a0f4744e8582df1ae09d5611b887b6a12925c) | -| Aurora | [`0xF89C7b475821EC3fDC2dC8099032c05c6c0c9AB9`](https://explorer.aurora.dev/address/0xF89C7b475821EC3fDC2dC8099032c05c6c0c9AB9) | -| Avalanche | [`0x4305FB66699C3B2702D4d05CF36551390A4c69C6`](https://snowtrace.io/address/0x4305fb66699c3b2702d4d05cf36551390a4c69c6) | -| Berachain | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://berascan.com/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| Bittensor | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://evm.taostats.io/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Blast | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://blastscan.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| BNB | [`0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594`](https://bscscan.com/address/0x4d7e825f80bdf85e913e0dd2a2d54927e9de1594) | -| BTTC | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://bttcscan.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Base | [`0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a`](https://basescan.org/address/0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a) | -| Boba | [`0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF`](https://bobascan.com/address/0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF) | -| Canto | [`0x98046Bd286715D3B0BC227Dd7a956b83D8978603`](https://canto.dex.guru/address/0x78357316239040e19fc823372cc179ca75e64b81) | -| Celo | [`0xff1a0f4744e8582DF1aE09D5611b887B6a12925C`](https://celoscan.io/address/0xff1a0f4744e8582df1ae09d5611b887b6a12925c) | -| Chiliz | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://scan.chiliz.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Conflux eSpace | [`0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc`](https://evm.confluxscan.io/address/0xe9d69cdd6fe41e7b621b4a688c5d1a68cb5c8adc) | -| Core DAO | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://scan.coredao.org/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Cronos | [`0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B`](https://cronoscan.com/address/0xe0d0e68297772dd5a1f1d99897c581e2082dba5b) | -| Cronos zkEVM | [`0x056f829183Ec806A78c26C98961678c24faB71af`](https://explorer.zkevm.cronos.org/address/0x056f829183ec806a78c26c98961678c24fab71af) | -| EOS | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://explorer.evm.eosnetwork.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| EVMOS | [`0x354bF866A4B006C9AF9d9e06d9364217A8616E12`](https://www.mintscan.io/evmos/evm/contract/0x354bF866A4B006C9AF9d9e06d9364217A8616E12) | -| Ethereum | [`0x4305FB66699C3B2702D4d05CF36551390A4c69C6`](https://etherscan.io/address/0x4305fb66699c3b2702d4d05cf36551390a4c69c6) | -| Etherlink | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer.etherlink.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Eventum | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer.evedex.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Fantom | [`0xff1a0f4744e8582DF1aE09D5611b887B6a12925C`](https://explorer.fantom.network/address/0xff1a0f4744e8582DF1aE09D5611b887B6a12925C) | -| Filecoin | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://filfox.info/en/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Flow | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://evm.flowscan.io/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Gnosis | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://gnosisscan.io/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| Gravity | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer.gravity.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Hedera | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://hashscan.io/mainnet/contract/0.0.4622850) | -| Hemi | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer-b81c3bd8.hemi.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Horizen EON | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://eon-explorer.horizenlabs.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| HyperEVM | [`0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc`](https://purrsec.com/address/0xe9d69cdd6fe41e7b621b4a688c5d1a68cb5c8adc) | -| XCHAIN (IDEX) Mainnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://xchain-explorer.kuma.bid/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Injective inEVM | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://inevm.calderaexplorer.xyz/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Ink | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer.inkonchain.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Iota | [`0x8D254a21b3C86D32F7179855531CE99164721933`](https://explorer.evm.iota.org/address/0x8D254a21b3C86D32F7179855531CE99164721933) | -| Kava | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://explorer.kava.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| KCC | [`0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B`](https://explorer.kcc.io/en/address/0xe0d0e68297772dd5a1f1d99897c581e2082dba5b) | -| Kinto | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://kintoscan.io/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Kaia | [`0x2880ab155794e7179c9ee2e38200202908c17b43`](https://kaiascan.io/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| LightLink Phoenix | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://phoenix.lightlink.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Linea | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://explorer.linea.build/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Manta | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://pacific-explorer.manta.network/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Mantle | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://mantlescan.info/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Merlin | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://scan.merlinchain.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Meter | [`0xbFe3f445653f2136b2FD1e6DdDb5676392E3AF16`](https://scan.meter.io/address/0xbfe3f445653f2136b2fd1e6dddb5676392e3af16) | -| Mode | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://explorer.mode.network/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Morph | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer.morphl2.io/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Neon | [`0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5`](https://neonscan.org/address/0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5) | -| OpBNB | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://opbnbscan.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Optimism | [`0xff1a0f4744e8582DF1aE09D5611b887B6a12925C`](https://optimistic.etherscan.io/address/0xff1a0f4744e8582df1ae09d5611b887b6a12925c) | -| Polygon | [`0xff1a0f4744e8582DF1aE09D5611b887B6a12925C`](https://polygonscan.com/address/0xff1a0f4744e8582df1ae09d5611b887b6a12925c) | -| Polygon zkEVM | [`0xC5E56d6b40F3e3B5fbfa266bCd35C37426537c65`](https://zkevm.polygonscan.com/address/0xc5e56d6b40f3e3b5fbfa266bcd35c37426537c65) | -| Polynomial | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer.polynomial.fi/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Ronin | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://app.roninchain.com/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| Scroll | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://blockscout.scroll.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Superseed | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer.superseed.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Sei EVM | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://seitrace.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43?chain=pacific-1) | -| Shimmer | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://explorer.evm.shimmer.network/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Skate | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://scan.skatechain.org/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Sonic | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://sonicscan.org/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| Soneium | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://soneium.blockscout.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Story Protocol | [`0xD458261E832415CFd3BAE5E416FdF3230ce6F134`](https://www.storyscan.xyz/address/0xD458261E832415CFd3BAE5E416FdF3230ce6F134) | -| Swellchain | [`0xDd24F84d36BF92C65F92307595335bdFab5Bbd21`](https://explorer.swellnetwork.io/address/0xDd24F84d36BF92C65F92307595335bdFab5Bbd21) | -| Taiko | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://taikoscan.network/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Unichain | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://uniscan.xyz/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| Viction | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://tomoscan.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| WEMIX | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://explorer.wemix.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Worldchain | [`0xe9d69cdd6fe41e7b621b4a688c5d1a68cb5c8adc`](https://worldscan.org/address/0xe9d69cdd6fe41e7b621b4a688c5d1a68cb5c8adc) | -| ZKFair | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://scan.zkfair.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| zkSync Era | [`0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834`](https://explorer.zksync.io/address/0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834) | -| zetachain | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://zetachain.blockscout.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | - -## Testnets - -| Network | Contract address | -| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Abstract testnet | [`0x47F2A9BDAd52d65b66287253cf5ca0D2b763b486`](https://explorer.testnet.abs.xyz/address/0x47F2A9BDAd52d65b66287253cf5ca0D2b763b486) | -| ApeChain (testnet) | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://curtis.explorer.caldera.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Arbitrum Blueberry (testnet) | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://arb-blueberry.gelatoscout.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Arbitrum Sepolia (testnet) | [`0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF`](https://sepolia-explorer.arbitrum.io/address/0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF) | -| Aurora testnet | [`0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E`](https://explorer.testnet.aurora.dev/address/0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E) | -| BNB testnet | [`0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb`](https://testnet.bscscan.com/address/0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb) | -| BTTC testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://testnet.bttcscan.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Base Sepolia (testnet) | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://base-sepolia.blockscout.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Berachain Bepolia testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://bepolia.beratrail.io/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Bittensor testnet | [`0x41955476936DdA8d0fA98b8d1778172F7E4fCcA1`]() | -| Blast Sepolia | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://testnet.blastscan.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Ble testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer-ethena-testnet-0.t.conduit.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Boba Goerli (testnet) | [`0x8D254a21b3C86D32F7179855531CE99164721933`](https://testnet.bobascan.com/address/0x8D254a21b3C86D32F7179855531CE99164721933) | -| Boba Sepolia (testnet) | [`0x8D254a21b3C86D32F7179855531CE99164721933`](https://28882.testnet.routescan.io/address/0x8D254a21b3C86D32F7179855531CE99164721933) | -| Canto testnet | [`0x26DD80569a8B23768A1d80869Ed7339e07595E85`](https://testnet-explorer.canto.neobase.one/address/0x26DD80569a8B23768A1d80869Ed7339e07595E85) | -| Celo Alfajores (testnet) | [`0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E`](https://explorer.celo.org/alfajores/address/0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E) | -| Chiado (Gnosis testnet) | [`0x98046Bd286715D3B0BC227Dd7a956b83D8978603`](https://blockscout.com/gnosis/chiado/address/0x98046Bd286715D3B0BC227Dd7a956b83D8978603) | -| Chiliz testnet | [`0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509`](https://spicy-explorer.chiliz.com/address/0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509) | -| Conflux eSpace testnet | [`0xDd24F84d36BF92C65F92307595335bdFab5Bbd21`](https://evmtestnet.confluxscan.io/address/0xDd24F84d36BF92C65F92307595335bdFab5Bbd21) | -| Core DAO testnet | [`0x8D254a21b3C86D32F7179855531CE99164721933`](https://scan.test.btcs.network/address/0x8D254a21b3C86D32F7179855531CE99164721933) | -| Converge testnet | [`0x87047526937246727E4869C5f76A347160e08672`](https://explorer-converge-testnet-1.t.conduit.xyz/address/0x87047526937246727E4869C5f76A347160e08672) | -| Cronos testnet | [`0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320`](https://cronos.org/explorer/testnet3/address/0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320) | -| Cronos zkEVM Testnet | [`0xB1DB1498902F08E16E11F1a423ec9CCB9537E1D6`](https://explorer.zkevm.cronos.org/testnet/address/0xb1db1498902f08e16e11f1a423ec9ccb9537e1d6) | -| Dela Deperp Testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://sepolia-delascan.deperp.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Dela Deperp Mithreum Testnet | [`0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc`](https://mithreum-sepolia.deperp.com/address/0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc) | -| EOS testnet | [`0x0708325268dF9F66270F1401206434524814508b`](https://explorer.testnet.evm.eosnetwork.com/address/0x0708325268dF9F66270F1401206434524814508b) | -| Etherlink testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://testnet.explorer.etherlink.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Eventum testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://testnet-blockscout.eh-dev.app/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| EVMOS testnet | [`0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E`](https://evm.evmos.dev/address/0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E) | -| Fantom testnet | [`0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb`](https://testnet.ftmscan.com/address/0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb) | -| Filecoin calibration | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://calibration.filfox.info/en/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Flow Testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://evm-testnet.flowscan.io/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Fuji (Avalanche testnet) | [`0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509`](https://testnet.snowtrace.io/address/0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509) | -| Hedera testnet | [`0xa2aa501b19aff244d90cc15a4cf739d2725b5729`](https://hashscan.io/testnet/contract/0.0.3042133) | -| Hemi testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://testnet.explorer.hemi.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| HyperEVM testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://testnet.purrsec.com/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| XCHAIN (IDEX) testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://xchain-testnet-explorer.kuma.bid/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Injective inEVM testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://inevm-testnet.explorer.caldera.xyz/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Kakarot Sepolia testnet | [`0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc`](https://sepolia.kakarotscan.org/address/0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc) | -| Kava testnet | [`0xfA25E653b44586dBbe27eE9d252192F0e4956683`](https://explorer.testnet.kava.io/address/0xfA25E653b44586dBbe27eE9d252192F0e4956683) | -| KCC testnet | [`0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E`](https://scan-testnet.kcc.network/address/0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E) | -| Klaytn | [`0x2880ab155794e7179c9ee2e38200202908c17b43`](https://baobab.klaytnfinder.io/account/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Injective EVM | [`0x2880ab155794e7179c9ee2e38200202908c17b43`](https://k8s.testnet.evm.blockscout.injective.network/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Ink Sepolia | [`0x2880ab155794e7179c9ee2e38200202908c17b43`](https://explorer-sepolia.inkonchain.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Kaia testnet | [`0x2880ab155794e7179c9ee2e38200202908c17b43`](https://kairos.kaiascan.io/address/0x2880ab155794e7179c9ee2e38200202908c17b43?tabId=txList&page=1) | -| LightLink Pegasus | [`0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167`](https://pegasus.lightlink.io/address/0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167) | -| Linea Goerli | [`0xdF21D137Aadc95588205586636710ca2890538d5`](https://goerli.lineascan.build/address/0xdF21D137Aadc95588205586636710ca2890538d5) | -| Linea Sepolia | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://sepolia.lineascan.build/address/0xa2aa501b19aff244d90cc15a4cf739d2725b5729) | -| Manta testnet | [`0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c`](https://pacific-explorer.testnet.manta.network/address/0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c) | -| Manta Sepolia | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://pacific-explorer.sepolia-testnet.manta.network/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Mantle sepolia | [`0x98046Bd286715D3B0BC227Dd7a956b83D8978603`](https://explorer.sepolia.mantle.xyz/address/0x98046Bd286715D3B0BC227Dd7a956b83D8978603) | -| MegaEth Testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://www.megaexplorer.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Merlin testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://testnet-scan.merlinchain.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Merlin testnet V2 | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://testnet-scan-v2.merlinchain.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Meter testnet | [`0x5a71C07a0588074443545eE0c08fb0375564c3E4`](https://scan-warringstakes.meter.io/address/0x5a71C07a0588074443545eE0c08fb0375564c3E4) | -| Mode testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://sepolia.explorer.mode.network/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Monad testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://testnet.monadexplorer.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Monad testnet - beta oracle | [`0xad2B52D2af1a9bD5c561894Cdd84f7505e1CD0B5`](https://testnet.monadexplorer.com/address/0xad2B52D2af1a9bD5c561894Cdd84f7505e1CD0B5) | -| Morph Holesky testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer-holesky.morphl2.io/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Morph testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://explorer-testnet.morphl2.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Mumbai (Polygon testnet) | [`0xFC6bd9F9f0c6481c6Af3A7Eb46b296A5B85ed379`](https://mumbai.polygonscan.com/address/0xFC6bd9F9f0c6481c6Af3A7Eb46b296A5B85ed379) | -| Neon devnet | [`0x0708325268dF9F66270F1401206434524814508b`](https://devnet.neonscan.org/address/0x0708325268dF9F66270F1401206434524814508b) | -| Olive Testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://olive-network-testnet.explorer.caldera.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| OpBNB Testnet | [`0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c`](https://testnet.opbnbscan.com/address/0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c) | -| Optimism Goerli (testnet) | [`0xDd24F84d36BF92C65F92307595335bdFab5Bbd21`](https://goerli-optimism.etherscan.io/address/0xDd24F84d36BF92C65F92307595335bdFab5Bbd21) | -| Optimism Sepolia (testnet) | [`0x0708325268dF9F66270F1401206434524814508b`](https://optimism-sepolia.blockscout.com/address/0x0708325268dF9F66270F1401206434524814508b) | -| Optimism Celestia Raspberry | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://opcelestia-raspberry.gelatoscout.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Orange Avalanche Subnet (testnet) | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://subnets-test.avax.network/orangetest/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Polygon Amoy testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://www.oklink.com/amoy/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| Polygon Blackberry testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://polygon-blackberry.gelatoscout.com/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| Polygon zkEVM testnet | [`0xFf255f800044225f54Af4510332Aa3D67CC77635`](https://testnet-zkevm.polygonscan.com/address/0xFf255f800044225f54Af4510332Aa3D67CC77635) | -| Polynomial testnet | [`0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509`](https://explorerl2new-polynomial-network-testnet-x0tryg8u1c.t.conduit.xyz/address/0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509) | -| Reya testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://reya-cronos.blockscout.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Saigon (Ronin testnet) | [`0xEbe57e8045F2F230872523bbff7374986E45C486`](https://saigon-app.roninchain.com/address/0xEbe57e8045F2F230872523bbff7374986E45C486) | -| Sei EVM testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://seitrace.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43?chain=atlantic-2) | -| Scroll Sepolia | [`0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c`](https://sepolia-blockscout.scroll.io/address/0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c) | -| Sepolia (Ethereum testnet) | [`0xDd24F84d36BF92C65F92307595335bdFab5Bbd21`](https://sepolia.etherscan.io/address/0xDd24F84d36BF92C65F92307595335bdFab5Bbd21) | -| Shimmer testnet | [`0x8D254a21b3C86D32F7179855531CE99164721933`](https://explorer.evm.testnet.shimmer.network/address/0x8D254a21b3C86D32F7179855531CE99164721933) | -| Skate testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://testnet.skalenodes.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Soneium (testnet) | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://soneium-minato.blockscout.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Sonic Blaze Testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://blaze.soniclabs.com/address/0x2880ab155794e7179c9ee2e38200202908c17b43) | -| Story Testnet | [`0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320`](https://aeneid.storyscan.xyz/address/0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320) | -| Superseed Testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://sepolia-explorer.superseed.xyz/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Swellchain Testnet | [`0x26DD80569a8B23768A1d80869Ed7339e07595E85`](https://swell-testnet-explorer.alt.technology/address/0x26DD80569a8B23768A1d80869Ed7339e07595E85) | -| Tabi Testnet | [`0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb`](https://testnetv2.tabiscan.com/address/0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb) | -| Taiko Hekla | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://hekla.taikoscan.network/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Unichain Sepolia | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://unichain-sepolia.blockscout.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| Viction testnet | [`0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167`](https://testnet.tomoscan.io/address/0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167) | -| WEMIX testnet | [`0x26DD80569a8B23768A1d80869Ed7339e07595E85`](https://explorer.test.wemix.com/address/0x26DD80569a8B23768A1d80869Ed7339e07595E85) | -| Worldchain testnet | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://worldchain-sepolia.explorer.alchemy.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) | -| ZKFair testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://testnet-scan.zkfair.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | -| zetachain testnet | [`0x0708325268dF9F66270F1401206434524814508b`](https://explorer.zetachain.com/address/0x0708325268dF9F66270F1401206434524814508b) | -| zkSync Era Goerli (testnet) | [`0x8739d5024B5143278E2b15Bd9e7C26f6CEc658F1`](https://goerli.explorer.zksync.io/address/0x8739d5024B5143278E2b15Bd9e7C26f6CEc658F1) | -| zkSync Era Sepolia (testnet) | [`0x056f829183Ec806A78c26C98961678c24faB71af`](https://sepolia.explorer.zksync.io/address/0x056f829183Ec806A78c26C98961678c24faB71af) | - -Pyth is available on the following network using Pyth Beta price sources: - -| Network | Contract address | -| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| Horizen GOBI testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://gobi-explorer.horizenlabs.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) | - -## Price Feed IDs - -The price feed IDs for EVM chains are available [here](https://pyth.network/developers/price-feed-ids#pyth-evm-stable) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/near.mdx b/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/near.mdx deleted file mode 100644 index 129cddf420..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/near.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: NEAR Price Feed Contract Addresses for Mainnet & Testnet -description: >- - This resource lists the current Pyth NEAR contract addresses for mainnet and - testnet. Use them to integrate on-chain price feeds and ensure your - configuration stays up to date. -full: false -index: false ---- - -# Price Feed Contract Addresses on NEAR - -| Network | Contract address | -| ------------ | --------------------- | -| NEAR Mainnet | `pyth-oracle.near` | -| NEAR Testnet | `pyth-oracle.testnet` | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/pythnet.mdx b/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/pythnet.mdx deleted file mode 100644 index bad98d851e..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/pythnet.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Pythnet & Testnet Contract Addresses for Cross-Chain Price Feeds -description: >- - Easily access Pythnet and testnet contract addresses for blockchain price - feeds. View mainnet/testnet details, reference links, and comprehensive - program information. -full: false -index: false ---- - -# Price Feed Program Addresses on Pythnet - - -
- **Important:** The addresses on this page are for the Pythnet network - itself, which is used to construct and deliver Pyth prices to other - blockchains. If you are building an application on EVM, Solana, SVM, or - another chain, you should use the Pyth program deployed on your target chain - instead. Please refer to the [Contract - Addresses](/price-feeds/contract-addresses) page and select your specific - blockchain environment. -
-
- -The following table contains the addresses of the programs deployed on Pythnet that operate together to construct Pyth prices and deliver them to other blockchains: - -| Network | Program | Program address | -| -------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | -| Pythnet | [Oracle Program](https://github.com/pyth-network/pyth-client/tree/main) | `FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH` | -| Pythnet | [Remote Executor](https://github.com/pyth-network/pyth-crosschain/tree/main/governance/remote_executor) | `exe6S3AxPVNmy46L4Nj6HrnnAVQUhwyYzMSNcnRn3qq` | -| Pythnet | [Message Buffer](https://github.com/pyth-network/pyth-crosschain/tree/main/pythnet/message_buffer) | `7Vbmv1jt4vyuqBZcpYPpnVhrqVe5e6ZPb6JxDcffRHUM` | -| Pythtest | [Oracle Program](https://github.com/pyth-network/pyth-client/tree/main) | `gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s` | -| Pythtest | [Oracle Program](https://github.com/pyth-network/pyth-client/tree/main) | `8tfDNiaEyrV6Q1U4DEXrEigs9DoDtkugzFbybENEbCDz` | -| Pythtest | [Remote Executor](https://github.com/pyth-network/pyth-crosschain/tree/main/governance/remote_executor) | `exe6S3AxPVNmy46L4Nj6HrnnAVQUhwyYzMSNcnRn3qq` | -| Pythtest | [Message Buffer](https://github.com/pyth-network/pyth-crosschain/tree/main/pythnet/message_buffer) | `7Vbmv1jt4vyuqBZcpYPpnVhrqVe5e6ZPb6JxDcffRHUM` | - -Note that Pythnet above is the mainnet network for Pyth, and Pythtest is a testnet for development purposes. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/ton.mdx b/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/ton.mdx deleted file mode 100644 index 3856ce32cd..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/contract-addresses/ton.mdx +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: TON Contract Addresses (Mainnet & Testnet) | Pyth -description: >- - Explore Pyth’s TON Mainnet & Testnet contract addresses. Verify them instantly - on TONScan. -full: false -index: false ---- - -# Price Feed Contract Addresses on TON - -Pyth is currently deployed on TON Mainnet and TON Testnet. - -| Network | Contract address | -| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| TON Mainnet | | -| TON Testnet | | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app.mdx b/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app.mdx deleted file mode 100644 index 5b28f99fbf..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app.mdx +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Build Your First Pyth Price Feed for EVM -description: >- - Use the Pyth network to create real-time price feeds on EVM. This step-by-step - guide shows how to integrate price oracles into smart contracts and connect - off-chain code. -full: false -index: false ---- - -# Create your first Pyth app - -This tutorial walks through creating a complete application that uses Pyth Price feeds. -The application includes a smart contract and an off-chain code invoking the contract. - - -
- The tutorial is an in-depth walkthrough of contract development; more - experienced developers may want to refer to [Use Real-time Price - Data](./use-real-time-data) for a more concise version. -
-
- -Please choose your environment to get started: - -- [EVM](create-your-first-pyth-app/evm/part-1) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/_meta.json deleted file mode 100644 index 0f6a3b7da2..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/_meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "evm": { - "title": "on EVM", - "href": "/evm" - } -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/_meta.json deleted file mode 100644 index a76328f0e0..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/create-your-first-pyth-app/evm/_meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "part-1": "Part 1: Create a Contract", - "part-2": "Part 2: Deploy your App" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/error-codes.mdx b/apps/developer-hub/content/docs/price-feeds/v1/error-codes.mdx deleted file mode 100644 index 5d4decc119..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/error-codes.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Error Codes for Pyth Cross-Chain Apps: Complete List & Troubleshooting" -description: >- - List of Pyth cross-chain EVM error codes with descriptions and troubleshooting - steps. Use this reference to diagnose and resolve issues across EVM-compatible - chains. -full: false -index: false ---- - -# Error Codes - -- [EVM](error-codes/evm) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/error-codes/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/error-codes/_meta.json deleted file mode 100644 index 46bb37a222..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/error-codes/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "evm": "EVM" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/_meta.json deleted file mode 100644 index 4f3fddfca3..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/_meta.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "pythnet": "Pythnet", - "oracle-program": "Oracle Program", - "cross-chain": "Cross-chain", - "fees": "Fees", - "hermes": "Hermes", - "price-aggregation": "Price Aggregation", - "ema-price-aggregation": "EMA Price Aggregation" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-to-guides/index.mdx b/apps/developer-hub/content/docs/price-feeds/v1/how-to-guides/index.mdx deleted file mode 100644 index 53697149fe..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/how-to-guides/index.mdx +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Pyth Core Integration & Setup Guide -description: >- - The Pyth Core developer guides include step-by-step tutorials, a complete API - reference, and code examples for integration. -full: false -index: true ---- - -# Heading One - -The fastest and most reliable data powering more transactions than any other oracle. Permissionless integration on every blockchain. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/index.mdx b/apps/developer-hub/content/docs/price-feeds/v1/index.mdx deleted file mode 100644 index a174a64bf3..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/index.mdx +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "Pyth Network Price Feeds: Real-Time Data on 100+ Blockchains" -description: >- - Pyth Network provides real-time price feeds for multiple assets from data - providers across 100+ blockchains. Integrate these feeds into your - applications. -full: false -index: true ---- - -# Introduction - -Pyth Network price feeds provide real-time financial market data to smart contract applications on 100+ blockchains. -Pyth's market data is contributed by over [120+ reputable first-party data providers](https://insights.pyth.network/publishers?utm_source=docs), including some of the biggest exchanges and market making firms in the world. -Each price feed publishes a [robust aggregate](price-feeds/how-pyth-works/price-aggregation) of these prices multiple times per second. -The protocol offers over [1300+ price feeds](https://pyth.network/price-feeds/) covering a number of different asset classes, including US equities, commodities, and cryptocurrencies. - -Pythnet Price Feeds are available on [100+ blockchain ecosystems](./price-feeds/contract-addresses), and can also be used in off-chain applications. -They are available on mainnet for most [EVM chains](price-feeds/use-real-time-data/evm.md) -- including Ethereum, BNB, Avalanche, and more --several [Cosmos chains](price-feeds/use-real-time-data/cosmwasm.md), [Solana](https://docs.pyth.network/price-feeds/use-real-time-data/solana), -[Aptos](price-feeds/use-real-time-data/aptos.md), [Sui](price-feeds/use-real-time-data/sui.md), [Ton](price-feeds/use-real-time-data/ton.md), and [NEAR](price-feeds/use-real-time-data/near.md). -More ecosystems are coming soon! - -Follow the [Getting Started](price-feeds/getting-started.mdx) guide to learn more about Pyth and integrate Pyth Price Feeds into your application. - -Developers may also consider using [Benchmarks](../benchmarks) to access historical Pyth prices for both on- and off-chain use. -These historical prices can be used for settlement or other similar applications. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/meta.json b/apps/developer-hub/content/docs/price-feeds/v1/meta.json deleted file mode 100644 index 55fe56eaff..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/meta.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "root": true, - "title": "Price Feeds", - "description": "Real-time data from financial institutions", - "icon": "ChartLine", - "pages": [ - "index", - "getting-started", - "---Tutorials---", - "create-your-first-pyth-app", - "---Guides---", - "use-real-time-data", - "fetch-price-updates", - "schedule-price-updates", - "migrate-an-app-to-pyth", - "use-pyth-for-morpho", - "publish-data", - "troubleshoot", - "---Reference Material---", - "api-reference", - "price-feeds", - "current-fees", - "sponsored-feeds", - "market-hours", - "best-practices", - "error-codes", - "api-instances-and-providers", - "contract-addresses", - "pythnet-reference", - "---Understand Pyth---", - "pull-updates", - "how-pyth-works" - ] -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth.mdx b/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth.mdx deleted file mode 100644 index 159b92a11d..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Migrate to Pyth Oracle: Complete Guide for Developers" -description: >- - This guide provides step-by-step instructions to migrate real-time price feeds - from Chainlink to Pyth oracles, detailing configuration, data validation, and - performance considerations to improve price accuracy, update speed, and system - reliability. -full: false -index: false ---- - -# Migrate to Pyth from Another Oracle - -The guides in this section are designed to help developers migrate an application from another oracle to use Pyth price feeds. - -- [Chainlink](migrate-an-app-to-pyth/chainlink.md) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth/_meta.json deleted file mode 100644 index ff1a61c5e5..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "chainlink": "from Chainlink" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth/chainlink.md b/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth/chainlink.md deleted file mode 100644 index dea2f11d6c..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/migrate-an-app-to-pyth/chainlink.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "Migrating from Chainlink to Pyth: A Step-by-Step Guide" -description: >- - Migrate your EVM app from Chainlink to Pyth with our step-by-step guide. Set - up Pyth price feeds, automate updates, and access reliable price data. -full: false -index: false ---- - -Hello diff --git a/apps/developer-hub/content/docs/price-feeds/v1/price-feeds/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/price-feeds/_meta.json deleted file mode 100644 index 4310675f41..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/price-feeds/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "asset-classes": "Asset Classes" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data.mdx b/apps/developer-hub/content/docs/price-feeds/v1/publish-data.mdx deleted file mode 100644 index 9d71e5a708..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/publish-data.mdx +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: "How to Publish Data on Pyth Network: Step-by-Step Guide" -description: >- - To publish data on the Pyth Network, request access, generate a keypair, - configure validator connections, and integrate with pyth-agent. -full: false -index: false ---- - -# Publish Data - -Data providers can get started publishing data to the Pyth Network by performing the following steps. - -## Request access - -First, contact the Pyth Data Association and request to become a data provider. -You can reach out on [Discord](https://discord.gg/Ff2XDydUhu) or [Telegram](https://t.me/Pyth_Network). -**Only data providers with first-party data (exchanges, market makers, and trading firms) are allowed to participate in the network.** - -## Generate keypair - -Every data provider is identified on the network by a public key, and their prices are signed by the corresponding private key. -You will need a Solana public/private key pair for this purpose. -If you do not already have a keypair, you can create one using the instructions below: - -```sh copy -# Install the Solana Tool Suite, needed for creating the key used to sign your transactions. -# See https://docs.solana.com/cli/install-solana-cli-tools for the latest version -sh -c "$(curl -sSfL https://release.solana.com/v1.14.13/install)" - -# Generate a public/private keypair. -solana-keygen new --no-bip39-passphrase --outfile publish_key_pair.json -``` - -This command will create a public/private keypair in `publish_key_pair.json`. -Please extract the public key from this file and share it with the Pyth Data Association so they can enable you to publish prices. - -```sh copy -# Print the public key of the keypair. -solana-keygen pubkey publish_key_pair.json -``` - -This command will output the public key in base58 encoding and will look something like: - -```sh copy -5rYvdyWAunZgD2EC1aKo7hQbutUUnkt7bBFM6xNq2z7Z -``` - -Most data providers choose to generate two separate keypairs, one for testing and one for production. -If you do so, please share both public keys with the Pyth Data Association. - -## Procure validators - -Every data provider to the network will require both a Solana RPC node and a Pythnet validator. -The Pyth Data Association will assist you with this step. - -## pyth-agent - -Data providers can publish data to the network using the [pyth-agent](https://github.com/pyth-network/pyth-agent) software package. -This package abstracts away all of the communication with the underlying blockchain and exposes a simple JSON RPC interface for submitting price data. -Please see the [README](https://github.com/pyth-network/pyth-agent) of that package for instructions on using it. -This software requires you to configure both the keypair and validators from the previous steps in order to run. -Please also see the [JSON RPC API documentation](publish-data/pyth-client-websocket-api.md). -Finally, the [example publisher](https://github.com/pyth-network/example-publisher) is a fully-worked example of how to integrate with the pyth-agent API. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/publish-data/_meta.json deleted file mode 100644 index 6802325b08..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/_meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "understanding-publishing-slots": "Understanding Publishing Slots", - "pyth-client-websocket-api": "pyth-client Websocket API", - "confidence-interval-and-crypto-exchange-fees": "Confidence Interval and Crypto Exchange Fees", - "useful-resources-for-publishers": "Useful Resources for Publishers" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/confidence-interval-and-crypto-exchange-fees.mdx b/apps/developer-hub/content/docs/price-feeds/v1/publish-data/confidence-interval-and-crypto-exchange-fees.mdx deleted file mode 100644 index bc5c390b9e..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/confidence-interval-and-crypto-exchange-fees.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Crypto Fee Adjustments for Accurate Confidence Intervals -description: >- - Learn Pyth Core’s fee-adjusted crypto pricing for confidence interval - calculations with multi-exchange order book modeling and precise data - adjustments. -full: false -index: false ---- - -# Confidence Interval and Crypto Exchange Fees - -It is very important that publishers consider crypto exchange aggressive fees when calculating their price and confidence intervals from one or more exchange order books. Ask prices should be moved up by the best publicly available aggressive fee rate, and bid prices should be moved down by the same rate. - -```sh copy -ask_adjusted = ask * (1.0 + fee_rate) -bid_adjusted = bid * (1.0 - fee_rate) -``` - -This is to reflect the "after fee" effective prices that could be gotten on that exchange. This is important for crypto markets because the fees are often MUCH larger than the typical bid-ask spread. It is not important for other markets (such as US equities) where fees are small compared with the bid-ask spread. The rationale for this adjustment is that the "fair price" could be above the best ask or below the best bid by as much as the aggressive fees before an informed trader would be able to profitably trade on this exchange and move the best price. Because of that, the best price on the exchange could be "wrong" by as much as +/- the aggressive fees. - -Example 1 - Exchange A has best aggressive fee of 10bps - -![](./assets/Confidence_Interval_and_Crypto_Exchange_Fees_Table_1.png) - -Exchange A should publish a price of \$50,000.01 and a confidence of \$50.005 (half the bid-ask spread after fee adjustment). It would be wrong to publish a confidence of \$0.005 based on the "not fee-adjusted" raw exchange bid-ask spread. - -Example 2 - Exchange A has a best aggressive fee of 10bps. Exchange B has a best aggressive fee of 1bps, and a publisher is combining them into a single combined book. Exchange books are combined by taking the best ask across both exchanges and the best bid across both exchanges. - -![](./assets/Confidence_Interval_and_Crypto_Exchange_Fees_Table_2.png) - -In this example, if a publisher were combining the books of Exchange A and Exchange B to get a combined price, they should publish a price of \$49,978.13 and confidence of \$28.125, which corresponds to the midprice and half the bid-ask spread of the combined fee-adjusted books. It would be wrong to publish a price of \$50,000.01 and confidence of \$0.01 based on the "not fee-adjusted" raw exchange prices. Note that in this example, not only is the confidence changed by including the exchange fees, but the price reported is also substantially different once fees are properly accounted for. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/pyth-client-websocket-api.mdx b/apps/developer-hub/content/docs/price-feeds/v1/publish-data/pyth-client-websocket-api.mdx deleted file mode 100644 index f91f3a03e4..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/pyth-client-websocket-api.mdx +++ /dev/null @@ -1,349 +0,0 @@ ---- -title: "pyth-agent WebSocket API: JSON-RPC Methods & Usage" -description: >- - The Pyth Client WebSocket API provides real-time market data using JSON-RPC - 2.0 methods such as get_product_list, update_price, and subscribe_price_sched. -full: false -index: false ---- - -# pyth-agent API - -[pyth-agent](https://github.com/pyth-network/pyth-agent) supports a websocket interface based on the json-rpc 2.0 standard. Methods include: - -- [get_product_list](pyth-client-websocket-api.md#get_product_list) -- [update_price](pyth-client-websocket-api.md#update_price) -- [subscribe_price_sched](pyth-client-websocket-api.md#subscribe_price_sched) -- [get_product](pyth-client-websocket-api.md#get_product) -- [get_all_products](pyth-client-websocket-api.md#get_all_products) - -Batch requests are processed in the order the requests appear within the batch. **Batching is highly recommended if the client sends -updates to over 50 price feeds.** - -## get_product_list - -Get the list of available symbols and associated metadata. - -Please note that all of the fields in the `attr_dict` dictionary should be considered optional: your publishing software should gracefully handle cases where any of these fields are missing. - -The request looks like: - -```json copy -{ - "jsonrpc": "2.0", - "method": "get_product_list", - "id": 1 -} -``` - -A successful response looks something like: - -```json copy -{ - "jsonrpc": "2.0", - "result": [ - { - "account": "9F6eBgAfktth93C9zmtKDXFXNjZkq6JwJR56VPKqWmJm", - "attr_dict": { - "symbol": "SYMBOL1/USD", - "asset_type": "Equity", - "country": "USA", - "description": "pyth example product #1", - "quote_currency": "USD", - "tenor": "Spot", - "cms_symbol": "SYMBOL1", - "cqs_symbol": "SYMBOL1", - "nasdaq_symbol": "SYMBOL1" - }, - "price": [ - { - "account": "CrZCEEt3awgkGLnVbsv45Pp4aLhr7fZfZr3ubzrbNXaq", - "price_exponent": -4, - "price_type": "price" - } - ] - }, - { - "account": "HCFaDYyz1ajS57HfCaaqzA1cZSaa2oEccQejbHaaofd4", - "attr_dict": { - "symbol": "SYMBOL2/USD", - "asset_type": "Equity", - "country": "USA", - "description": "pyth example product #2", - "quote_currency": "USD", - "tenor": "Spot", - "cms_symbol": "SYMBOL2", - "cqs_symbol": "SYMBOL2", - "nasdaq_symbol": "SYMBOL2" - }, - "price": [ - { - "account": "7FUsKvvtN5rB1fgYFWZLo5DLcqHTTeu63bUPThYT6MiS", - "price_exponent": -4, - "price_type": "price" - } - ] - } - ], - "id": null -} -``` - -## update_price - -Update component price of some symbols using the publishing key of pyth-agent. - -The request includes the pricing account from the get_product_list output and looks something like: - -```json copy -{ - "jsonrpc": "2.0", - "method": "update_price", - "params": { - "account": "CrZCEEt3awgkGLnVbsv45Pp4aLhr7fZfZr3ubzrbNXaq", - "price": 42002, - "conf": 3, - "status": "trading" - }, - "id": 1 -} -``` - -The price and confidence interval (conf) attributes are expressed as integers with an implied decimal point given by the price*exponent defined by the symbol. The price type is a string with one of the following values: "price" or "ema*\_price". The symbol status is a string with one of the following values: "trading" or "unknown". - -A successful response looks like: - -```json copy -{ - "jsonrpc": "2.0", - "result": 0, - "id": 1 -} -``` - -## subscribe_price_sched - -**This method can saturate the connection between the agent and the client. Please create a scheduler on the client side to avoid saturating the connection or -send price updates as soon as they are available.** - -Subscribe to price update schedule. pyth-agent will notify the client whenever it should submit the next price for a subscribed symbol. - -The request looks like: - -```json copy -{ - "jsonrpc": "2.0", - "method": "subscribe_price_sched", - "params": { - "account": "CrZCEEt3awgkGLnVbsv45Pp4aLhr7fZfZr3ubzrbNXaq" - }, - "id": 1 -} -``` - -A successful response looks like: - -```json copy -{ - "jsonrpc": "2.0", - "result": { - "subscription": 1234 - }, - "id": 1 -} -``` - -Where the result is an integer corresponding to a subscription identifier. All subsequent notifications for this subscription correspond to this identifier. - -```json copy -{ - "jsonrpc": "2.0", - "method": "notify_price_sched", - "params": { - "subscription": 1234 - } -} -``` - -## get_product - -Get the full set of data for the given product. - -Please note that all of the fields in the `attr_dict` dictionary should be considered optional: your publishing software should gracefully handle cases where any of these fields are missing. - -The request looks like: - -```json copy -{ - "jsonrpc": "2.0", - "method": "get_product", - "params": { - "account": "4aDoSXJ5o3AuvL7QFeR6h44jALQfTmUUCTVGDD6aoJTM" - }, - "id": 1 -} -``` - -A successful response looks something like: - -```json copy -{ - "jsonrpc": "2.0", - "result": { - "account": "4aDoSXJ5o3AuvL7QFeR6h44jALQfTmUUCTVGDD6aoJTM", - "attr_dict": { - "asset_type": "Crypto", - "symbol": "BTC/USD", - "country": "US", - "quote_currency": "USD", - "description": "BTC/USD", - "tenor": "Spot", - "generic_symbol": "BTCUSD" - }, - "price_accounts": [ - { - "account": "GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU", - "price_type": "price", - "price_exponent": -8, - "status": "trading", - "price": 4426101900000, - "conf": 4271150000, - "ema_price": 4433467600000, - "ema_confidence": 1304202670, - "valid_slot": 91402257, - "pub_slot": 91402259, - "prev_slot": 91402256, - "prev_price": 4425895500000, - "prev_conf": 3315350000, - "publisher_accounts": [ - { - "account": "HekM1hBawXQu6wK6Ah1yw1YXXeMUDD2bfCHEzo25vnEB", - "status": "trading", - "price": 4426958500000, - "conf": 1492500000, - "slot": 91402255 - }, - { - "account": "GKNcUmNacSJo4S2Kq3DuYRYRGw3sNUfJ4tyqd198t6vQ", - "status": "trading", - "price": 4424690000000, - "conf": 3690000000, - "slot": 91402256 - } - ] - } - ] - }, - "id": 1 -} -``` - -## get_all_products - -Get full set of data for the given product. - -Please note that all of the fields in the `attr_dict` dictionary should be considered optional: your publishing software should gracefully handle cases where any of these fields are missing. - -The request looks like: - -```json copy -{ - "jsonrpc": "2.0", - "method": "get_all_products", - "id": 1 -} -``` - -A successful response looks something like: - -```json copy -{ - "jsonrpc": "2.0", - "result": [ - { - "account": "5uKdRzB3FzdmwyCHrqSGq4u2URja617jqtKkM71BVrkw", - "attr_dict": { - "asset_type": "Crypto", - "symbol": "BCH/USD", - "country": "US", - "quote_currency": "USD", - "description": "BCH/USD", - "tenor": "Spot", - "generic_symbol": "BCHUSD" - }, - "price_accounts": [ - { - "account": "5ALDzwcRJfSyGdGyhP3kP628aqBNHZzLuVww7o9kdspe", - "price_type": "price", - "price_exponent": -8, - "status": "trading", - "price": 60282000000, - "conf": 26000000, - "ema_price": 60321475000, - "ema_confidence": 22504746, - "valid_slot": 91402601, - "pub_slot": 91402604, - "prev_slot": 91402600, - "prev_price": 60282000000, - "prev_conf": 26000000, - "publisher_accounts": [ - { - "account": "HekM1hBawXQu6wK6Ah1yw1YXXeMUDD2bfCHEzo25vnEB", - "status": "trading", - "price": 60282000000, - "conf": 26000000, - "slot": 91402599 - }, - { - "account": "2V7t5NaKY7aGkwytCWQgvUYZfEr9XMwNChhJEakTExk6", - "status": "unknown", - "price": 0, - "conf": 0, - "slot": 0 - } - ] - } - ] - }, - { - "account": "3nuELNFBkbXqsXtnCzphRPCX6toKKYxVDnkyr9pTwB1K", - "attr_dict": { - "asset_type": "Crypto", - "symbol": "SABER/USD", - "country": "US", - "quote_currency": "USD", - "description": "SABER/USD", - "tenor": "Spot", - "generic_symbol": "SABERUSD" - }, - "price_accounts": [ - { - "account": "8Td9VML1nHxQK6M8VVyzsHo32D7VBk72jSpa9U861z2A", - "price_type": "price", - "price_exponent": -8, - "status": "trading", - "price": 5785000, - "conf": 5000, - "ema_price": 5856365, - "ema_confidence": 10241, - "valid_slot": 91402601, - "pub_slot": 91402604, - "prev_slot": 91402600, - "prev_price": 5785000, - "prev_conf": 5000, - "publisher_accounts": [ - { - "account": "GKNcUmNacSJo4S2Kq3DuYRYRGw3sNUfJ4tyqd198t6vQ", - "status": "trading", - "price": 5785000, - "conf": 5000, - "slot": 91402601 - } - ] - } - ] - } - ], - "id": 1 -} -``` diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/understanding-publishing-slots.mdx b/apps/developer-hub/content/docs/price-feeds/v1/publish-data/understanding-publishing-slots.mdx deleted file mode 100644 index f30bd05416..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/understanding-publishing-slots.mdx +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: "Understanding Publishing Slots in Pyth: How Price Updates Work" -description: >- - Pythnet’s publishing slots deliver ordered price updates on Solana, prevent - on-chain data conflicts, and improve cross-chain update efficiency. -full: false -index: false ---- - -# Understanding Publishing Slots - -When a quoter publishes a price, the pyth-client API also forwards what it thinks is the current slot on Solana and Pythnet. This is known as its publishing slot. - -The publishing slot and price is stored as the latest update for that publisher on-chain but only if the price is for a later slot than that currently stored. This is to prevent prices from being updated out-of-order and to facilitate arbitration between multiple publishers. - -The aggregation algorithm only combines prices from publishers that were published within 25 slots of the current on-chain slot. - -Not all published prices get included in the pyth contract due to unreliable transports and the way Solana and Pythnet formulate and reach consensus on each slot. - -A quoter may detect if a published price is dropped by comparing the list of publishing slots it submits vs what it subsequently receives in each aggregate price callback. - -For example, here is an excerpt of a log take from a run of the test_publish.cpp example program against mainnet-beta. It logs everything it sends and everything it receives. - -The publishing slots of six consecutive price submissions have been annotated with the labels A, B, C, D, E and F or slots 79018079, 79018084, 79018085, 79018086, 79018087, 79018092. - -The API submits a new price every time it receives notification of a new slot but note that prices for slots 79018080 thru 79018083 and 79018088 thru 79018091 were not submitted. This is because solana does not always publish consecutive slots and gaps can occur. Solana can also publish slots out-of-order, but the API ignores these and is guaranteed only to issue callbacks for slots that are strictly increasing. - -Price updates occur for slots labelled A, B, C and F. Slots D and E (79018086, 79018087) were dropped and did not get executed on the chain. - -```sh copy -[2021-05-18T22:36:14.048435Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.116000,spread=0.001000,slot=79018079,sub_id=1 - ^^ A ^^^ -[2021-05-18T22:36:14.237644Z 654359 INF received aggregate price update ] symbol=SYMBOL1/USD,price_type=price,status=trading,agg_price=0.112000,agg_spread=0.001000,valid_slot=79018076,pub_slot=79018077,my_price=0.112000,my_conf=0.001000,my_status=trading,my_slot=79018075 -[2021-05-18T22:36:14.405182Z 654359 INF received aggregate price update ] symbol=SYMBOL1/USD,price_type=price,status=trading,agg_price=0.113000,agg_spread=0.001000,valid_slot=79018077,pub_slot=79018078,my_price=0.113000,my_conf=0.001000,my_status=trading,my_slot=79018076 -[2021-05-18T22:36:16.099126Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.117000,spread=0.001000,slot=79018084,sub_id=1 - ^^ B ^^^ -[2021-05-18T22:36:16.962077Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.118000,spread=0.001000,slot=79018085,sub_id=1 - ^^ C ^^^ -[2021-05-18T22:36:17.519741Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.119000,spread=0.001000,slot=79018086,sub_id=1 - ^^ D ^^^ -[2021-05-18T22:36:17.671924Z 654359 INF received aggregate price update ] symbol=SYMBOL1/USD,price_type=price,status=trading,agg_price=0.114000,agg_spread=0.001000,valid_slot=79018078,pub_slot=79018079,my_price=0.114000,my_conf=0.001000,my_status=trading,my_slot=79018077 -[2021-05-18T22:36:18.109491Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.120000,spread=0.001000,slot=79018087,sub_id=1 - ^^ E ^^^ -[2021-05-18T22:36:20.537479Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.121000,spread=0.001000,slot=79018092,sub_id=1 - ^^ F ^^^ -[2021-05-18T22:36:21.195836Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.122000,spread=0.001000,slot=79018093,sub_id=1 -[2021-05-18T22:36:21.529074Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.123000,spread=0.001000,slot=79018094,sub_id=1 -[2021-05-18T22:36:21.802004Z 654359 INF received aggregate price update ] symbol=SYMBOL1/USD,price_type=price,status=trading,agg_price=0.116000,agg_spread=0.001000,valid_slot=79018079,pub_slot=79018085,my_price=0.116000,my_conf=0.001000,my_status=trading,my_slot=79018079 - ^^ A ^^^ -[2021-05-18T22:36:21.969477Z 654359 INF received aggregate price update ] symbol=SYMBOL1/USD,price_type=price,status=trading,agg_price=0.117000,agg_spread=0.001000,valid_slot=79018085,pub_slot=79018087,my_price=0.117000,my_conf=0.001000,my_status=trading,my_slot=79018084 - ^^ B ^^^ -[2021-05-18T22:36:22.304469Z 654359 INF received aggregate price update ] symbol=SYMBOL1/USD,price_type=price,status=trading,agg_price=0.118000,agg_spread=0.001000,valid_slot=79018087,pub_slot=79018093,my_price=0.118000,my_conf=0.001000,my_status=trading,my_slot=79018085 - ^^ C ^^^ -[2021-05-18T22:36:22.758348Z 654359 INF submit price to block-chain ] symbol=SYMBOL1/USD,price_type=price,price=0.125000,spread=0.001000,slot=79018096,sub_id=1 -[2021-05-18T22:36:23.121339Z 654359 INF received aggregate price update ] symbol=SYMBOL1/USD,price_type=price,status=trading,agg_price=0.121000,agg_spread=0.001000,valid_slot=79018093,pub_slot=79018094,my_price=0.121000,my_conf=0.001000,my_status=trading,my_slot=79018092 - ^^ F ^^^ -``` - -The API keeps track of the "hit-rate" of price submissions that show up in the update callbacks and tracks end-to-end latency statistics at the 25th, 50th, 75th and 99th percentiles both in terms of seconds of elapsed time and in number of slot updates observed. For example, from the same log: - -```sh copy -[2021-05-18T22:37:26.685518Z 654359 INF publish statistics ] symbol=SYMBOL1/USD,price_type=price,num_sent=135,hit_rate=73.333333,secs_p25=2.000000,secs_p50=2.500000,secs_p75=3.000000,secs_p99=7.500000,slot_p25=4,slot_p50=4,slot_p75=6,slot_p99=16 -``` diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/useful-resources-for-publishers.mdx b/apps/developer-hub/content/docs/price-feeds/v1/publish-data/useful-resources-for-publishers.mdx deleted file mode 100644 index 99cde378f4..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/useful-resources-for-publishers.mdx +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Essential Resources for Pyth Publishers: Monitoring & Analytics" -description: >- - Provides Pyth publishing support on Solana Explorer and Pythnet. Includes - transaction tracking, live price data monitoring, ranking exploration, and - detailed analytics. -full: false -index: false ---- - -# Useful Resources for Publishers - -This page contains useful tools for publishers to analyse, monitor and review their price data. - -- [Price Monitoring & Alerting Script](https://github.com/pyth-network/publisher-utils#monitoring): This monitoring script will provide alerts if a publishers data activity is suspicious i.e. price deviation, bad confidence interval -- [Pyth Price Feeds & Metrics](https://pyth.network/price-feeds): Publishers can review their price data metrics for permissioned symbols. The conformance logs that can be downloaded contain useful metrics that show publisher uptime, price deviations and alerts. The metrics page can be accessed by selecting the environment > symbol > publisher key tab -- [Pyth Publisher Ranking Page](https://pyth.network/publishers/ranking): This page provides a full breakdown of publisher ranking and inactive/active price feeds -- [Pyth Agent API GitHub Repository](https://github.com/pyth-network/pyth-agent): This repository contains the latest release for the Pyth-Agent API -- [Solana Explorer](https://explorer.solana.com): Solana Explorer allows publishers to monitor their public keys balance and transactions. It also provides live cluster statistics. For Pythnet or Pythtest, publishers should select 'Custom RPC URL' and add the the RPC http URL -- [Pythnet Statistics](https://pyth.network/stats): A useful tool to review pythnet uptime per publisher key diff --git a/apps/developer-hub/content/docs/price-feeds/v1/pull-updates.mdx b/apps/developer-hub/content/docs/price-feeds/v1/pull-updates.mdx deleted file mode 100644 index 71bc9162b2..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/pull-updates.mdx +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: "Pull vs. Push Oracles: Key Differences & Use Cases" -description: >- - Compare push vs. pull oracles by update frequency, latency, blockchain - compatibility, and integration to select the ideal solution for real-time data - needs. -full: false -index: false ---- - -# What is a Pull Oracle? - -Most oracles today are push oracles where the oracle operator is responsible for submitting price updates to the blockchain. -Pyth is different: it is a _pull oracle_ where anyone can permissionlessly update the on-chain price. -This document explains the differences between push and pull oracles. - -## Push Oracles - -_Push oracles_ periodically update an on-chain price based on external trigger conditions. -The oracle has a smart contract that stores the current price. -The contract also has a set of permissioned operators who are authorized to update the price. -The oracle operators then commit to updating the on-chain price at a specific cadence, for example, once every 30 minutes or if the price moves by 1%. -Thus, in a push oracle, the on-chain price is periodically updated, regardless of whether or not anyone is using it. - -## Pull Oracles - -In contrast to push oracles, _pull oracles_ only update the on-chain price when requested. -There are different ways for users to request an updated price from a pull oracle. -Some pull oracles respond to on-chain requests: applications send one transaction to request data from the oracle, which then submits the response in a second transaction. -Pyth uses a simpler system where users can request the latest price update from an off-chain service. -Anyone can submit a price update to the on-chain Pyth contract, which verifies its authenticity and stores it for later use. -This system allows applications to use a single transaction flow that first updates the price then performs the necessary application logic. - -For a more in-depth explanation on the differences between push and pull oracles, refer to the following video tutorial: -[How to Build with Pyth's Pull Oracle Design: Pyth Tutorials](https://youtu.be/qdwrs23Qc9g) - -## Comparing Push and Pull - -{/* ![](./assets/Push-vs-Pull-Oracle.jpg) */} - -Push and pull oracles differ on a number of important dimensions: - -- **Update frequency** -- In a push oracle, every price feed updates at a fixed update frequency. - The oracle operator determines the frequency, but it typically ranges from every 10 minutes to 1 hour. - In contrast, pull oracles can update at a much higher frequency. - For example, every Pyth price feed updates every 400 milliseconds. -- **Latency** -- An oracle's update frequency also affects its prices' latency. - The higher update frequencies of pull oracles allow applications to access lower-latency data. -- **Blockchain support** -- Pull oracles support a wide variety of different blockchains. - Push oracles typically support a smaller number of blockchains, as each additional chain requires ongoing gas expenditures. -- **Price feed selection** -- Similar to the item above, pull oracles also support a wide selection of price feeds. - In contrast, push oracles typically have a more limited selection. - Push oracles generally cannot support a wide selection of feeds due to the gas cost of periodically updating each feed. - -A fundamental reason for these differences is that push oracles incur gas costs for price updates. -These gas costs limit their scalability across all of the dimensions above. - -### Integration Differences - -Push oracles and pull oracles require applications to integrate in different ways. -With a push oracle, applications typically read the current price out of a smart contract. -Since the push oracle periodically updates the price, the application can assume the data in the smart contract is (reasonably) fresh. -With a pull oracle, applications need to update the on-chain price before reading it. -Developers using Pyth can refer to [How to Use Real-Time Price Data](/price-feeds/use-real-time-data) to learn how to perform these steps. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference.mdx b/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference.mdx deleted file mode 100644 index d118f65681..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Pythnet Reference: Account Structure, Metadata & Schedule Format" -description: >- - Explore Pythnet’s account structure, product metadata, and schedule formats. - Learn best practices to optimize and manage your Pythnet accounts effectively. -full: false -index: false ---- - -# Pythnet Reference - -The documentation in this section describes the structure of Pythnet accounts and their contents: - -- [Account Structure](/price-feeds/pythnet-reference/account-structure.mdx) describes the accounts that exist and their high-level contents -- [Product Metadata](/price-feeds/pythnet-reference/product-metadata.mdx) describes the metadata associated with each product account -- [Schedule Format](/price-feeds/pythnet-reference/schedule-format.mdx) describes the `schedule` field of the product metadata diff --git a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/_meta.json deleted file mode 100644 index 18f229720e..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/_meta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "account-structure": "Account Structure", - "product-metadata": "Product Metadata", - "schedule-format": "Schedule Format" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/account-structure.mdx b/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/account-structure.mdx deleted file mode 100644 index fc3216b4b1..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/account-structure.mdx +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Account Structure of PythNet Oracle Accounts -description: >- - Dive into Pyth oracle accounts on Pythnet: understand product and price data - structures, on-chain mappings, real-world examples, and network interactions. -full: false -index: false ---- - -# Account Structure - -The Pyth oracle program manages a number of on-chain accounts. There are three different types of accounts: - -1. _Product accounts_ store metadata about a product, such as its symbol (e.g., "BTC/USD") and asset type. -2. _Price accounts_ store the current price information for a particular product. This account has fields such as the current price, a confidence interval, an exponential moving average price, an exponential moving average confidence interval and whether or not a price is currently available. -3. _Mapping accounts_ serve as a listing of other accounts. The mapping accounts are organized into a linked list whose values are the set of product accounts. These accounts allow applications to enumerate the full list of products whose prices are available on Pyth. - -The [Pyth Rust SDK](https://github.com/pyth-network/pyth-sdk-rs) contains a sample application that prints the current content of all Pyth accounts. The following sections use the output of this application to better understand the content of these accounts. - -**Product Accounts** - -Product accounts store metadata about a product. This metadata is represented as a set of reference attributes, stored as a list of text key/value pairs. Not all product accounts follow the same structure; for a comprehensive overview, visit the [Product Metadata page](product-metadata.md). For example, the product account for AAPL contains the following fields: - -```sh copy -product_account .. G89jkM5wFLpmnbvRbeePUumxsJyzoXaRfgBVjyx2CPzQ - symbol.......... Equity.US.AAPL/USD - asset_type...... Equity - quote_currency.. USD - description..... APPLE INC - base............ AAPL - country......... US - cms_symbol...... AAPL - cqs_symbol...... AAPL - nasdaq_symbol... AAPL - price_account... CqFJLrT4rSpA46RQkVYWn8tdBDuQ7p7RXcp6Um76oaph -``` - -This snippet shows the reference attributes for AAPL. The set of available reference attributes depends on the `asset_type`. Every product account has `symbol` , `asset_type`, `quote_currency` , and `price_account` . US equity products additionally include additional reference symbology that is useful for mapping Pyth products to other industry-standard identifiers. The product account also contains a pointer to a price account that contains the product's current pricing information. - -As another example, here is the product account for BTC/USD: - -```sh copy -product_account .. 3m1y5h2uv7EQL3KaJZehvAJa4yDNvgc5yAdL9KPMKwvk - symbol.......... Crypto.BTC/USD - asset_type...... Crypto - quote_currency.. USD - description..... BTC/USD - generic_symbol.. BTCUSD - base............ BTC - price_account .. HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J -``` - -**Price Accounts** - -Price accounts store the current price of a product along with additional useful information. For example, consider the following content of AAPL's price account: - -```sh copy -price_account .. CqFJLrT4rSpA46RQkVYWn8tdBDuQ7p7RXcp6Um76oaph - price ........ 16297000 x 10^-5 - conf ......... 27952 x 10^-5 - price_type ... price - exponent ..... -5 - status ....... trading - corp_act ..... nocorpact - num_qt ....... 2 - valid_slot ... 110430111 - publish_slot . 110430112 - ema_price ......... 16247409 x 10^-5 - ema_confidence ......... 19415 x 10^-5 -``` - -This account stores the current price in a fixed-point format. The price is computed by taking the `price` field and multiplying by `10^exponent`. The account also includes a confidence interval that represents Pyth's uncertainty about the current price. This confidence interval can be interpreted as the standard deviation of a Laplace distribution centered around the price. `conf` is also stored in the same fixed-point format. In the example above, the price is 12276250, the conf is 1500 and the exponent is -5. These values translate into a price of \$122.76250 +- 0.015. - -Price accounts include several other useful fields. First, each account has a `status` that indicates whether or not the price is valid. Pricing information for a product can be unavailable for various reasons, for example, US equity markets only trade during certain hours. The status field indicates whether or not Pyth currently has a price for the product. **Only prices with a value of `status=trading` should be used**. If the status is not `trading` but is Unknown, Halted or Auction the Pyth price can be an arbitrary value. - -**Mapping Accounts** - -Mapping accounts serve as an index of the pricing information currently available on Pyth. These accounts are organized into a linked list whose values are product accounts. Applications can traverse this linked list to enumerate all products currently available on Pyth. - -The on-chain relationship between different account types is as follows: - -``` - ------------- ------------- ------------- - | |1 m| | | | - | mapping |------->| product |------>| price | - | | | | | | - ------------- ------------- ------------- - | - V - ------------- - | | - | mapping | - | | - ------------- - | - V - ... -``` - -Each mapping account contains a list of product account ids, plus an optional pointer to the subsequent mapping account. Each product account in turn points to the price account that stores the current price information for that product. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/product-metadata.mdx b/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/product-metadata.mdx deleted file mode 100644 index 4c30bac73a..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/product-metadata.mdx +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: "Product Metadata: Structure & Best Practices for Asset Accounts" -description: >- - Pyth’s product metadata schema covers equities, cryptocurrencies, FX, and - metals. This guide describes the schema’s key attributes and recommended usage - patterns to optimize data processing. -full: false -index: false ---- - -# Product Metadata - -Product accounts store metadata about a product. This metadata is represented as a set of reference attributes, stored as a list of text key/value pairs but not all products share the same account structure. Metadata is network dependent. - -Every product has `product_account`, `symbol`, `asset_type`, `quote_currency`, `base` and `price_account`. However, the remaining fields of a product account will depend on its `asset_type`. - -**Equity** - -As a rule, all products with `asset_type` = Equity will follow the below Product Account structure: - -```sh copy -product_account... Solana Account - asset_type...... AssetType - base............ BaseCurrency - cms_symbol...... NYSESymbol - cqs_symbol...... SIPSSymbol - country......... Country - description..... Description - nasdaq_symbol... ComstockSymbol - quote_currency.. QuoteCurrency - symbol.......... AssetType.Country.BaseCurrency/QuoteCurrency - weekly_schedule. WeeklySchedule - price_account... Solana Account -``` - -`symbol`: AssetType.Country.BaseCurrency/QuoteCurrency where the `base`: BaseCurrency is, in order of availability: - -1. `cms_symbol`: NYSESymbol -2. `cqs_symbol`: SIPSSymbol -3. `nasdaq_symbol`: ComstockSymbol - -Here is a snapshot of the Apple product account on Pythnet: - -```sh copy -product_account .. 3mkwqdkawySvAm1VjD4f2THN5mmXzb76fvft2hWpAANo - asset_type...... Equity - base............ AAPL - cms_symbol...... AAPL - cqs_symbol...... AAPL - country......... US - description..... APPLE INC / US DOLLAR - nasdaq_symbol... AAPL - quote_currency.. USD - symbol.......... Equity.US.AAPL/USD - weekly_schedule. America/New_York,9:30-16:00,9:30-16:00,9:30-16:00,9:30-16:00,9:30-16:00,C,C - price_account... 5yixRcKtcs5BZ1K2FsLFwmES1MyA92d6efvijjVevQCw -``` - -**Crypto** - -As a rule, all products with `asset_type` = Crypto will follow the below Product Account structure: - -```sh copy -product_account .. Solana Account - asset_type...... AssetType - base............ BaseCurrency - description..... Description - generic_symbol.. JLQDSymbol - quote_currency.. QuoteCurrency - symbol.......... AssetType.BaseCurrency/QuoteCurrency - weekly_schedule. WeeklySchedule - price_account .. Solana Account -``` - -Here is a snapshot of the Ethereum product account on Pythnet: - -```sh copy -product_account .. EMkxjGC1CQ7JLiutDbfYb7UKb3zm9SJcUmr1YicBsdpZ - asset_type...... Crypto - base............ ETH - description..... ETHEREUM / US DOLLAR - generic_symbol.. ETHUSD - quote_currency.. USD - symbol.......... Crypto.ETH/USD - weekly_schedule. America/New_York,O,O,O,O,O,O,O - price_account .. JBu1AL4obBcCMqKBBxhpWCNUt136ijcuMZLFvTP7iWdB -``` - -**Foreign Currency & Metal** - -Lastly, are Foreign Currencies (FX) and Metal assets. Those 2 `asset_type` share a common product account structure that follows the below template: - -```sh copy -product_account .. Solana Account - asset_type...... AssetType - base............ BaseCurrency - description..... Description - generic_symbol.. JLQDSymbol - quote_currency.. QuoteCurrency - symbol.......... AssetType.BaseCurrency/QuoteCurrency - tenor........... Maturity - weekly_schedule. WeeklySchedule - price_account .. Solana Account -``` - -Here is a snapshot of the Japanese Yen product account on Pythnet: - -```sh copy -product_account .. eAnmHaCS2J1XPEb6zohWFrnXD3Mni3wTrfKGhkoQmcZ - asset_type...... FX - base............ USD - description..... US DOLLAR / JAPANESE YEN - generic_symbol.. USDJPY - quote_currency.. JPY - symbol.......... FX.USD/JPY - tenor........... Spot - weekly_schedule. America/New_York,O,O,O,O,00:00-17:00,C,17:00-24:00 - price_account .. H6dt83FavYgfJR8oV7HewKWZjzveFFiDhq41VbmDYnVF -``` - -**Other Fields** - -- `weekly_schedule` - Optional field. When set, contents are used by publishers to learn about a symbol's typical market hours. See [Weekly Schedule Format](schedule-format#weekly-schedule-format-deprecated) for a detailed format specification. - -**Best Practices** - -The users should not rely on the symbol name being unchanging or parse data out of the symbol. - -Instead, programs should always use the different attributes to identify the product you are interested in. You have to ensure that anything which is used to compose the symbol is made available as a stand-alone attribute. - -**Caveats** - -There is a limit of 464 bytes to store the attribute dictionary in v2 (the product account is 512 bytes and 48 are used for other fields). This has to hold all the keys and values, plus field separators. There is no data compression or abbreviation. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/schedule-format.mdx b/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/schedule-format.mdx deleted file mode 100644 index 471715b5e7..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/pythnet-reference/schedule-format.mdx +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: "PythNet Schedule Format: Market Hours, Timezones & Holidays" -description: >- - Explore PythNet’s schedule format: discover its structure, components, and - usage with real-world examples for market hours, timezones, and holidays. -full: false -index: false ---- - -# Schedule Format - -This document describes the format for the `schedule` field in Pyth product metadata. -The `schedule` field defines a product's market hours, including its timezone, weekly schedule, and any holiday exceptions. -It controls the publishing schedule of `pyth-agent`, restricting it to follow a predetermined timetable. -This field is particularly useful for: - -- FX -- Metals -- Stocks - -## Format - -```plain -Timezone;WeeklySchedule;Holidays -``` - -**If `schedule` is omitted for a symbol, pyth-agent will revert to the deprecated [`weekly_schedule`](schedule-format#weekly-schedule-format-deprecated) field. -If `weekly_schedule` is also undefined, pyth-agent will default to 24/7 publishing, which was the standard behavior prior to this feature.** - -**Detailed Definitions** - -- `Timezone` - A human-readable tz database TZ identifier of the market’s local timezone, such as `America/New_York`. - **Full list of identifiers can be found [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)**. - -
Daylight-saving time is automatically handled by the pyth-agent.
-
-- `WeeklySchedule` - A list of seven comma-separated `DaySchedule` entries that define the recurring weekly schedule of a product’s market hours. - Each `DaySchedule` entry corresponds to a day of the week, starting from Monday. - None of the comma-separated values can be omitted. -- `Holidays` - A list of comma-separated `MonthDay/DaySchedule` entries. - Each entry specifies the schedule for a specific day of the year, overriding the `WeeklySchedule` for that date. - This list can be empty. `MonthDay` is a compact date format where the first two digits represent the month (01 for January, 12 for December), - and the last two digits represent the day of the month (e.g., `0415` for April 15th). **Leading zeros are mandatory**. -- `DaySchedule` - A single day’s schedule. `DaySchedule` can be one of the following: - - - `O` for all-day open - - `C` for all-day closed - - `HourMinute-HourMinute[&HourMinute-HourMinute[&...]]` for specific open and close times in the market-local timezone. - The hour and minute are combined into a single 4-digit number, where the first two digits represent the hour (00 to 24), - and the last two digits represent the minute (00 to 59). - For example, `0415` represents 4:15 AM. The open time must precede the close time, and the range is inclusive. - - - `24` can only be used to specify `2400`, which represents the final moment of a given day. - - Context: Without this special case, the next best thing would be `2359` which could cause a symbol to go down between `2359` and the next day’s `0000` for a full minute. - - **Leading zeros are mandatory**. - - If there are multiple open and close times per day (e.g., maintenance window) you can specify them by using `&` in between. For instance `0000-1200&1300-2400` means that the - market is open all day except between 12:00 and 13:00. - -**Examples** - -- `Europe/Lisbon;O,O,O,O,O,C,C;` - 24h open from Monday to Friday, according to Lisbon’s perspective of midnight. Closed on Saturdays and Sundays. -- `America/New_York;0930-1630,0930-1630,0930-1630,0930-1630,0930-1630,C,C;` - Open 9:30AM - 4:30PM ET (EDT or EST) - from Monday to Friday. Closed outside specified ranges, on Saturdays and on Sundays. Based off real-life NASDAQ hours. -- `Israel;0959-1714,0959-1714,0959-1714,0959-1714,C,C,0959-1539;` - Interesting edge case of the Tel-Aviv Stock Exchange. Open with reduced hours on Sundays, closed on Friday and Saturday. Note the slash-less timezone name. -- `Africa/Johannesburg;C,C,C,C,C,C,C;` - Trivial made-up example. The market is not trading on any day - exact opposite of 24/7 trading. Pyth-agent instances observing this value will not publish the product at any time. Note: The timezone has no effect in this case. -- `Europe/London;O,O,O,O,O,O,O;` - Trivial example. The market is open at all times and the timezone has no effect. Equivalent to default 24/7 behavior when `schedule` and `weekly_schedule` is not specified on a symbol. -- `America/New_York;O,O,O,O,O,C,C;1224/0930-1300,1225/C` - An example of specifying holidays. The market closes early on Christmas Eve and is fully closed on Christmas Day. -- `America/New_York;C,C,C,C,0930-1530&1830-2200,C,C;` - Only open Friday between 9:30AM - 3:30PM and 6:30PM - 10:00PM ET (EDT or EST) - -## Weekly Schedule Format (Deprecated) - - -
This field is deprecated in favor of `schedule`.
-
- -This document outlines the rules for specifying contents of a new Pyth product metadata field - `weekly_schedule` . The field specifies the recurring weekly schedule of a product’s market hours. It serves as a reference for `pyth-agent` to stop publishing outside the hours specified in the schedule. Notable use cases include: - -- FX -- Metals -- Stocks - -## Format - -```plain -Timezone,MHKind,MHKind,MHKind,MHKind,MHKind,MHKind,MHKind -``` - -**Note: None of the comma-separated values can be ommitted - exactly one timezone and seven subsequent per-day schedules are required. That said, ommitting `weekly_schedule` on a symbol is allowed and will cause pyth-agent to default to 24/7 publishing (the usual behavior before this feature)** - -**Detailed Definitions** - -- `Timezone` - A human-readable tz database TZ identifier of the market’s local timezone - e.g. `America/New_York`. **Full list of identifiers can be found [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)**. Notes: - - Daylight-saving time - Handled automatically by pyth-agent code dealing with the format. -- `MHKind` - A single week day’s schedule. The `MHKind` values describe week days from Monday to Sunday, in that order. `MHKind` is defined as one of: - - `O` - all-day open - - `C` - all-day closed - - `Hour:Minute-Hour:Minute` - specific open and close times in the market-local timezone. Open time must come before close time. **The range is inclusive.** Definitions: - - `Hour` - number of hours from `00` to `24` . Notes: - - Leading zeros are optional - e.g. `9` and `09`, `0` and `00` are equivalent. - - `24` can only be used to specify `24:00`. This value is used to express the final moment of a given day (split-second before `00:00` on the next day). Context: Without this special case, the next best thing would be `23:59` which could cause a symbol to go down between `23:59` and the next day’s `00:00` for a full minute. - - `Minute` - number of minutes from `00` to `59`. Notes: - - Leading zeros are **mandatory** - e.g. `9:05`, `9:00`, `15:07` - -**Examples** - -- `Europe/Lisbon,O,O,O,O,O,C,C` - 24h open from Monday to Friday, according to Lisbon’s perspective of midnight. Closed on Saturdays and Sundays. -- `America/New_York,9:30-16:30,9:30-16:30,9:30-16:30,9:30-16:30,9:30-16:30,C,C` - Open 9:30AM - 4:30PM ET (EDT or EST) from Monday to Friday. Closed outside specified ranges, on Saturdays and on Sundays. Based off real-life NASDAQ hours. -- `Israel,9:59-17:14,9:59-17:14,9:59-17:14,9:59-17:14,C,C,9:59-15:39` - Interesting edge case of the Tel-Aviv Stock Exchange. Open with reduced hours on Sundays, closed on Friday and Saturday. Note the slash-less timezone name. -- `Africa/Johannesburg,C,C,C,C,C,C,C` - Trivial made-up example. The market is not trading on any day - exact opposite of 24/7 trading. Pyth-agent instances observing this value will not publish the product at any time. Note: The timezone has no effect in this case. -- `Europe/London,O,O,O,O,O,O,O` - Trivial example. The market is open at all times and the timezone has no effect. Equivalent to default 24/7 behavior when `weekly_schedule` is not specified on a symbol. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates.mdx b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates.mdx deleted file mode 100644 index 153db6efe6..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Schedule Pyth Price Updates Using Adrastia, Gelato, or Scheduler" -description: >- - Use Adrastia, Gelato, or Scheduler to automate Pyth price updates on EVM - chains. Schedule on-chain price feed updates programmatically to ensure - timely, consistent data. -full: false -index: false ---- - -# How To Schedule Price Updates - -The following guides explain how to schedule Pyth price updates to occur at regular intervals. -As a pull oracle, Pyth's users are typically responsible for updating the state of on-chain feeds. -Please see [What is a Pull Oracle?](/price-feeds/pull-updates) to learn more about pull updates. - -The Pyth Data Association sponsors regular on-chain updates for some price feeds. -See [Sponsored Feeds](/price-feeds/sponsored-feeds) for the current list of feeds and their update parameters. -If you would like to see additional feeds on this list, please [contact the association via this form](https://tally.so/r/nGz2jj). - -There are also three different tools to schedule price updates: - -- [Adrastia's Pyth Price Feed Updater](schedule-price-updates/using-adrastia) is a white-glove service that automates price updates based on time and price deviations, supporting any EVM chain. -- [Gelato](schedule-price-updates/using-gelato) provides a turnkey automation solution for scheduled updates. -- [Scheduler](schedule-price-updates/using-scheduler) is a service that developers can run to trigger price updates when certain time or price change conditions are met. - -For developers comparing these three options, Adrastia and Gelato are simpler, in that they do not require you to operate a service. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/_meta.json deleted file mode 100644 index cea14c6e3d..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/_meta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "using-adrastia": "Using Adrastia", - "using-gelato": "Using Gelato", - "using-scheduler": "Using Scheduler" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/dedicated-msg-sender.png b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/dedicated-msg-sender.png deleted file mode 100644 index e2ec248e0c..0000000000 Binary files a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/dedicated-msg-sender.png and /dev/null differ diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/storage-pyth-config.png b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/storage-pyth-config.png deleted file mode 100644 index a740000453..0000000000 Binary files a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/storage-pyth-config.png and /dev/null differ diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/task-creation-gist-id.png b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/task-creation-gist-id.png deleted file mode 100644 index bc1d9ee394..0000000000 Binary files a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/task-creation-gist-id.png and /dev/null differ diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/task-execution.png b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/task-execution.png deleted file mode 100644 index 69165169d8..0000000000 Binary files a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/task-execution.png and /dev/null differ diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-adrastia.mdx b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-adrastia.mdx deleted file mode 100644 index 5d7e5cda89..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-adrastia.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "Pyth Core: Using Adrastia for Real-Time Price Updates" -description: >- - Adrastia automates secure, real-time access to Pyth price feeds for DeFi - applications. It provides a straightforward integration process, performance - optimizations, and consistently reliable market data. -full: false -index: false ---- - -# Using Adrastia to Schedule Real-Time Price Updates - -## About Adrastia - -Established in 2021, [Adrastia](https://adrastia.io) is an automation platform founded by TRILEZ SOFTWARE INC. and leverages over a decade of experience in building and running AI agents to deliver reliable, high-performance automated systems. Adrastia operates with the core values of reliability, transparency, and prudence with a focus on enhancing the security, performance, and efficiency of DeFi systems. - -## Pyth Price Feed Updater - -Adrastia's Pyth Price Feed Updater is a managed white-glove solution that reliably pushes price updates with speed and efficiency when specified trigger conditions are met. The setup process is simple and Adrastia handles all the heavy lifting. - -## Process - -Adrastia is working on a decentralized, permissionless system for managing this service where you'll be able to effortlessly choose your preferred service provider and manage all details in an app. In the meantime, they've made the offchain integration process as simple as possible. - -1. Reach out to them via email ([support@adrastia.io](mailto:support@adrastia.io)) or [Discord](https://discord.adrastia.io/). -2. Provide them with the price feed IDs for which you'd like to schedule price updates. -3. They'll create a public (or private) GitHub repository for you to view the configuration and suggest changes. -4. They'll send you a Service Agreement to authorize. -5. They'll provide you with a set of Automatos (automation) worker addresses for you to fund with gas. -6. They'll start the service and provide you with access to a data analytics dashboard. -7. They'll provide you with a status page for your service, at your request. -8. They'll bill you at the end of the month. - -## Configuration - -Every price feed supports updates based on either: - -1. The price changing by at least the specified threshold, or -2. The heartbeat period being met (i.e. requiring at least one update every so often) - -Additionally, every feed also supports early update conditions as an extension of the above criteria. When one feed requires an update based on the regular criteria, additional criteria can be applied to preemptively update other specified price feeds. This early update mechanism saves gas by reducing the amount of update transactions, with the cost savings rooted in performing a minimal amount of proof validations. - -## More details - -This page covers the key aspects of Adrastia's Pyth Price Feed Updater. For more details including aspects like costs, analytics, terms, and technical specifications, please visit [Adrastia's documentation page](https://docs.adrastia.io/automatos/pyth-price-feed-updater). diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-gelato.mdx b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-gelato.mdx deleted file mode 100644 index 4d1cabc2af..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-gelato.mdx +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: "Automate Pyth Price Updates with Gelato: Step-by-Step Guide" -description: >- - Gelato automates Pyth price feeds on EVM chains by scheduling off-chain - updates. Configure, deploy, and monitor these updates to keep price data - synchronized. -full: false -index: false ---- - -# How to Schedule Price Updates with Gelato - -This guide explains how to create an automated Gelato task that updates Pyth price feeds on a schedule. The task will -update the on-chain price after either a fixed time interval or if the price has changed by a certain percentage. - -### Introduction to Gelato - -[Gelato](https://www.gelato.network/) is web3’s decentralized backend empowering developers to create augmented smart contracts that are automated, -gasless and off-chain aware on all major EVM-compatible blockchains. Gelato offers Web3 Functions (W3F) that connect your -smart contracts to off-chain data and computation by running decentralized cloud functions. - -### Gelato W3F Pyth Task - -The Gelato W3F Pyth Task is a Gelato task that updates Pyth price feeds on a schedule. -The task is deployed to IPFS and can be used by anyone to schedule price updates for any Pyth price feed. -The task is configured via file called `config.yaml` which contains various parameters such as the price -feeds to update, the update frequency, price deviation threshold. - -## Steps - -#### 1. Join Gelato Web3 Functions whitelist - -Web3 functions like Solidity functions and automated transactions can be used directly. However, to use TypeScript-based Web3 Functions, you must be added to the whitelist. -To apply, please reach out to the Gelato team for access [here](https://discord.com/invite/ApbA39BKyJ). - -#### 2. Configure your task - -[//]: # "TODO: redirect this to pyth fork of repo)" - -The Gelato task reads a yaml configuration file from a GitHub gist. -Create a GitHub gist by logging into GitHub and navigating to [here](https://gist.github.com/). Add a file called `config.yaml`. -Copy the [example gist](https://gist.github.com/swimricky/18b2a5ad9c1a605f1cf5c19ac1d2f1d9) and edit the parameters for -the environment you're deploying to and configure your price feeds and update thresholds. See -[directory](https://github.com/pyth-network/w3f-pyth-poc-v2/tree/master/web3-functions/pyth-oracle-w3f-priceIds) for -some example configuration files. These parameters can be updated at any time by editing the gist even if the task has -already been deployed. The task will automatically pick up these configuration changes and use them for subsequent executions. - -#### 3. Create the task - -Use the link below to auto-populate the task parameters with the Pyth web3 function code: - -https://app.gelato.network/new-task?cid=QmTFQHpiThqkVKvuW2KU8cETNBdyXHB9uP34woL6Vc5w6g - -The pyth web3 function code is deployed to IPFS, so you can use it via the cid/link above. -You can find a copy of the web3 function code [here](https://github.com/pyth-network/w3f-pyth-poc-v2/tree/master/web3-functions/pyth-oracle-w3f-priceIds) - -Choose network, and then in the "Task secrets" section, set `GIST_ID` to the gistId of the gist you created in step 2. -![](./assets/guides/gelato/task-creation-gist-id.png) - -**Note that the free tier have certain limits, Checkout all subscription plans and choose the one that best fits your needs [here](https://app.gelato.network/1balance/subscriptions/functions?networkGroup=mainnets&type=monthly)**. - -#### 4. Fund the task - -There are two sets of fees that must be paid before the task can execute successfully : - -**Gelato Fees** - -Gelato's fees are paid through [1Balance](https://docs.gelato.network/web3-services/1balance). Once you are -whitelisted, visit the 1Balance section on [Gelato app](https://app.gelato.network/1balance) and deposit USDC on Polygon to top up -your Gelato balance which will be used to pay the Gelato fees on all supported chains. These include computational costs -and transaction gas fees. Testnet executions are subsidized by Gelato and free. -Note : You can deposit USDC from any chain supported by Circle CCTP. - -Deposit USDC -![](./assets/guides/gelato/deposit-usdc.png) - -**Pyth Fees** - -Updating a pyth price feed requires the caller to pay a small fee. Pyth fees are paid in the native token of the chain -where the task is running. The method that updates the price is payable and the update transaction has to include the -corresponding fee in the `msg.value`. - -The on-chain transaction executed via a web3 function gets routed through a proxy smart contract -which is solely owned by the web3 function task creator. This proxy smart contract is known as the `dedicatedMsgSender` -and will be deployed the first time a task is created for a given wallet address. - -Pyth fees are paid by the `dedicatedMsgSender` and transaction fees as well as computational costs by 1Balance. -You will need to transfer over the native tokens to `dedicatedMsgSender` on every chain where you want to run -the task using a standard transfer. The `dedicatedMsgSender` address can be found in the Gelato App settings and on the Task dashboard as well. - -![](./assets/guides/gelato/dedicated-msg-sender.png) - -You can simply open your wallet and send native tokens to `dedicatedMsgSender` on the chain(s) where you want to run the -task. - -#### 5. Check task execution - -Once your task has been successfully created, you can check the task execution details on the Task dashboard in the Gelato app. - -![](./assets/guides/gelato/task-execution.png) - -## Managing your Gelato Task - -#### Monitoring - -To ensure that your tasks are running as expected, you can set up monitoring. Gelato supports monitoring 1Balance and -address balances as well as execution statuses for tasks. You can set up monitoring for your Gelato balance and -the `dedicatedMsgSender` address on each chain where you are running tasks and receive notifications in either -Telegram or Discord. - -See the following links for more information: - -- [1Balance Alerts](https://docs.gelato.network/web3-services/1balance/1balance-alerts) -- [Balance Alerts](https://docs.gelato.network/web3-services/web3-functions/analytics-and-monitoring) - -#### Updating configuration - -To update the configuration of your task, such as adding/removing new price feeds or changing the deviation thresholds, -you can simply update the `config.yaml` file in your gist. The task will automatically pick up the changes and use them. -Note that the `config.yaml` includes a `configRefreshRateInSeconds` parameter which determines how often the task will -fetch the latest configuration from the gist vs reading a locally cached version. This is to prevent the task from being -rate-limited by GitHub. To verify that your most recent task execution used the latest configuration, you can check the -"Storage" tab on the task details page and look at the configuration stored under the `pythConfig` key. - -![](./assets/guides/gelato/storage-pyth-config.png) - -## Notes - -If you want to customize the behavior of the web3 function beyond what is supported by updating the config.yaml, you can -clone this [repo](https://github.com/pyth-network/w3f-pyth-poc-v2) and deploy your own version of the web3 function. -You can then use the cid of your deployed web3 function to create a new task. See [README.md](https://github.com/pyth-network/w3f-pyth-poc-v2/tree/master/web3-functions/pyth-oracle-w3f-priceIds/README.md) and -[Gelato Web3 Function Documentation](https://docs.gelato.network/web3-services/web3-functions) for more details. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-scheduler.mdx b/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-scheduler.mdx deleted file mode 100644 index 795585fe86..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/using-scheduler.mdx +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "Pyth Scheduler: Schedule Off-Chain Price Updates Guide" -description: >- - Pyth’s off-chain scheduler triggers on-chain price updates when predefined - conditions are met, maintaining reliable blockchain integration and supporting - seamless migration from existing oracles with minimal downtime. -full: false -index: false ---- - -# Scheduler - -The [scheduler](https://github.com/pyth-network/pyth-crosschain/tree/main/apps/price_pusher) (previously known as "price pusher") -is an off-chain application that regularly pulls price updates on to a blockchain. -Anyone can run this service to regularly update the on-chain Pyth price based on various conditions, such as a minimum update frequency, or a price change threshold. -This service can simplify the process of migrating to Pyth from other oracles. -Protocols that currently depend on regular push updates can simply run this service. -Please see the README linked above for additional information about this service. - -In addition, you can find an in-depth explanation from one of Pyth's contributors, Ali: -[How to Build with Pyth Data on EVM Chains (with Pusher): Pyth Tutorials](https://youtu.be/yhmo81JOH10) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds.mdx b/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds.mdx deleted file mode 100644 index 21211b0c2a..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "Pyth Data Association Sponsored Feeds: Networks & Updates" -description: >- - Pyth Data Association provides real-time price updates across EVM, Solana, - Aptos, Sui, and Movement. It supports sponsored feeds through a simple - integration. -full: false -index: false ---- - -# Sponsored Feeds - -The Pyth Data Association sponsors price updates for some feeds on some networks. -Sponsored feeds are updated at a specific heartbeat rate or when the price changes by a specific percentage. -Developers don't need to [pull prices](./fetch-price-updates.mdx) for sponsored feeds, unless they required short update intervals. - -The sponsored feeds can vary by network. Please see the relevant section below for the network of interest. - -- [EVM](sponsored-feeds/evm) -- [Solana](sponsored-feeds/solana) -- [Aptos](sponsored-feeds/aptos) -- [Sui](sponsored-feeds/sui) -- [Movement](sponsored-feeds/movement) - - -
- DISCLAIMER: While the Pyth Data Association strives to deliver timely - updates, these sponsored feeds may occasionally experience delays in updates - caused by chain halts, gas estimations and other issues. Applications are - advised to run their own scheduler. Find out how you can run your own - scheduler [here](/price-feeds/schedule-price-updates/using-scheduler). -
-
- -If you would like to see additional feeds on this list, please fill in this [form](https://tally.so/r/nGz2jj) to signal your interest. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/_meta.json deleted file mode 100644 index 41e0cafa6e..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/_meta.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "evm": "EVM", - "solana": "Solana / SVM", - "aptos": "Aptos", - "movement": "Movement", - "sui": "Sui" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/aptos.mdx b/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/aptos.mdx deleted file mode 100644 index 8f4de1e811..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/aptos.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: "Sponsored Price Feeds on Aptos: IDs & Update Parameters" -description: >- - API access to Aptos price feeds updated every 15 seconds with a maximum - deviation of ±0.5%. Data is sponsored to ensure consistent availability for - market monitoring and trading applications. -full: false -index: false ---- - -# Sponsored Feeds on Aptos - -The price feeds listed in the table below are currently sponsored in **Aptos mainnet**. - -Update Parameters: **15 second heartbeat or 0.5% price deviation** - -| Name | Price Feed Id | -| --------------- | ------------------------------------------------------------------ | -| APT/USD | `03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5` | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| SOL/USD | `ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d` | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| CAKE/USD | `2356af9529a1064d41e32d617e2ce1dca5733afa901daba9e2b68dee5d53ecf9` | -| SUI/USD | `23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744` | -| CETUS/USD | `e5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef` | -| BNB/USD | `2f95862b045670cd22bee3114c39763a4a08beeb663b145d283c31d7d1101c4f` | -| WBTC/USD | `c9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33` | -| THL/USD | `74e3fbb0d33e0ed8c0078b56134dcebdae38852f0858a8ea4de4c5ea7474bd42` | -| USDY/USD | `e393449f6aff8a4b6d3e1165a7c9ebec103685f3b41e60db4277b5b6d10e7326` | -| WETH/USD | `9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6` | -| THAPT/USD | `b29276972267db5d64ae718fb7f107ad9e72a79cabf9992f0e9bc75ad451a7f6` | -| STONE/USD | `4dcc2fb96fb89a802ef9712f6bd2246d3607cf95ca5540cb24490d37003f8c46` | -| MOD/USD | `9a2a116d85a31d6f1bed19771105557276457094e31791a892758148aa54023d` | -| SUSDE/USD | `ca3ba9a619a4b3755c10ac7d5e760275aa95e9823d38a84fedd416856cdba37c` | -| USDE/USD | `6ec879b1e9963de5ee97e9c8710b742d6228252a5e2ca12d4ae81d7fe5ee8c5d` | -| STHAPT/THAPT.RR | `ea07fce25d7d716fe6ad10b267451011baadc8f3724b28487026072ddce3ba1b` | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/evm.mdx b/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/evm.mdx deleted file mode 100644 index 3e3ba566d2..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/evm.mdx +++ /dev/null @@ -1,275 +0,0 @@ ---- -title: "Pyth EVM Sponsored Feeds: Asset Pairs & Hashes" -description: >- - Streamline DApp development with sponsored EVM price feeds on Ethereum, Base, - and Berachain. Access feed IDs and update parameters for seamless integration. -full: false -index: false ---- - -# Sponsored Feeds on EVM - -The following EVM chains have sponsored price feeds: - -- [Ethereum Mainnet](#ethereum-mainnet) -- [Base Mainnet](#base-mainnet) -- [Berachain Mainnet](#berachain-mainnet) -- [HyperEVM Mainnet](#hyperevm-mainnet) -- [Kraken Mainnet](#kraken-mainnet) -- [Unichain Mainnet](#unichain-mainnet) -- [Mode Mainnet](#mode-mainnet) -- [Sonic Mainnet](#sonic-mainnet) -- [Story Mainnet](#story-mainnet) -- [Optimism Sepolia](#optimism-sepolia) -- [Unichain Sepolia](#unichain-sepolia) -- [Ble Testnet](#ble-testnet) - -## Ethereum Mainnet - -The price feeds listed in the table below are currently sponsored in **Ethereum mainnet**. - -Update Parameters: **1 hour heartbeat or 2% price deviation** - -| Name | Price Feed Id | -| ---------- | ------------------------------------------------------------------ | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| UNI/USD | `78d185a741d07edb3412b09008b7c5cfb9bbbd7d568bf00ba737b456ba171501` | -| PYTH/USD | `0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff` | -| USR/USD | `10b013adec14c0fe839ca0fe54cec9e4d0b6c1585ac6d7e70010dac015e57f9c` | -| WSTUSR/USR | `b74c2bc175c2dab850ce5a5451608501c293fe8410cb4aba7449dd1c355ab706` | -| USDTB/NAV | `967549f1ff4869f41cb354a7116b9e5a9a3091bebe0b2640eeed745ca1f7f90b` | - -## Base Mainnet - -The price feeds listed in the table below are currently sponsored in **Base mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ---------- | ------------------------------------------------------------------ | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| WETH/USD | `9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6` | -| PUFETH/USD | `e5801530292c348f322b7b4a48c1c0d59ab629846cce1c816fc27aee2054b560` | -| WEETH/USD | `9ee4e7c60b940440a261eb54b6d8149c23b580ed7da3139f7f08f4ea29dad395` | -| EZETH/USD | `06c217a791f5c4f988b36629af4cb88fad827b2485400a358f3b02886b54de92` | -| CBETH/USD | `15ecddd26d49e1a8f1de9376ebebc03916ede873447c1255d2d5891b92ce5717` | -| WSTETH/USD | `6df640f3b8963d8f8358f791f352b8364513f6ab1cca5ed3f1f7b5448980e784` | -| RSETH/USD | `0caec284d34d836ca325cf7b3256c078c597bc052fbd3c0283d52b581d68d71f` | -| PYTH/USD | `0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff` | -| SUI/USD | `23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744` | -| XRP/USD | `ec5d399846a9209f3fe5881d70aae9268c94339ff9817e8d18ff19fa05eea1c8` | -| USR/USD | `10b013adec14c0fe839ca0fe54cec9e4d0b6c1585ac6d7e70010dac015e57f9c` | -| USR/USD.RR | `512a79cc65f49531f0bbb72956353e79ecdc1e4a6e5241847196c1f9a11d8a52` | -| RLP/USD | `7265d5cf8ee0e7b5266f75ff19c42c5b7697a9756c9304aa78b6be4fbb8d823d` | -| RLP/USD.RR | `796bcb684fdfbba2b071c165251511ab61f08c8949afd9e05665a26f69d9a839` | - -## Berachain Mainnet - -The price feeds listed in the table below are currently sponsored in **Berachain mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| --------------------- | ------------------------------------------------------------------ | -| BERA/USD | `962088abcfdbdb6e30db2e340c8cf887d9efb311b1f2f17b155a63dbb6d40265` | -| BERASTONE/USD | `950fe827fa92b73e81cd49043673e9132a8424b24e35989156606073f2385e21` | -| BERASTONE/ETH.RR | `b8004b055f64f9e13468e0bff616bb87232c241a962cdf87c7a781ec31194803` | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| LIQUIDBERABTC/WBTC.RR | `c869104c9feab6b6b303add2d48fa7443fc119493f8d8cafd4df23890659ed78` | -| LIQUIDBERAETH/ETH.RR | `bedaf537ab909117259282b9463b0f54d67dd575d64dcd564bfbdbfc0f57f99d` | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| PYUSD/USD | `c1da1b73d7f01e7ddd54b3766cf7fcd644395ad14f70aa706ec5384c59e76692` | -| SUSDE/USDE.RR | `271c64ce459937abf721d42552035713b6c58f80eeceab716a624607fda4b10f` | -| HONEY/USD | `f67b033925d73d43ba4401e00308d9b0f26ab4fbd1250e8b5407b9eaade7e1f4` | -| RSETH/USD | `0caec284d34d836ca325cf7b3256c078c597bc052fbd3c0283d52b581d68d71f` | -| RSETH/ETH.RR | `56e9b5eb08e62dd4b445f29e4ec7d3b3d49617d64f2d331d36a2101d4904e3c4` | -| IBGT/USD | `c929105a1af143cbfc887c4573947f54422a9ca88a9e622d151b8abdf5c2962f` | -| STBGT/USD | `ffd5448b844f5e7eeafbf36c47c7d4791a3cb86f5cefe02a7ba7864b22d81137` | -| HENLO/USD | `d90813d7fc7f4f5d786f3a6a35701aff4f628db0ecd998de66be0ff8264c67a2` | -| IBERA/USD | `eb943c0b5c9e02a529f799ac91070c3b7046f9412f3e5b0a90ba00267b838f34` | -| NECT/USD | `ddf0dd319060db4561b5aa8f84a94816d33579f8dc2af2d8f74583bce20cd260` | -| HONEY/USD.RR | `8bb3695875f9c33594097b0e0a1daa881aa81290088f0eac3a07b700fc7612ba` | - -## HyperEVM Mainnet - -The price feeds listed in the table below are currently sponsored in **HyperEVM mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ----------------- | ------------------------------------------------------------------ | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| HYPE/USD | `4279e31cc369bbcc2faf022b382b080e32a8e689ff20fbc530d2a603eb6cd98b` | -| HFUN/USD | `61db931fcfd322223fb84dc4bfc9c6481bd5610a31403782bc396df213e3ce12` | -| PURR/USD | `e0154bf4dfbcf835fad3428c0d8c1078b83f687e4d6afafb827f7f9af70ec326` | -| SOL/USD | `ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d` | -| WSTETH/USD | `6df640f3b8963d8f8358f791f352b8364513f6ab1cca5ed3f1f7b5448980e784` | -| WSTETH/STETH.RR | `f59ead01ed0faba85332a1e2feae8ddb14a1c94ebac259f1c982c92fc7ce333e` | -| WEETH/USD | `9ee4e7c60b940440a261eb54b6d8149c23b580ed7da3139f7f08f4ea29dad395` | -| WEETH/EETH.RR | `343558e79f587e098c321218ecb34d031ba709ab3e84133126f3c98511b91f64` | -| LBTC/USD | `8f257aab6e7698bb92b15511915e593d6f8eae914452f781874754b03d0c612b` | -| LBTC/BTC.RR | `bade5c63f281d36a13dbb64ed0ae1c532a434b6771b11885f396a41f56cc3bd0` | -| CBBTC/USD | `2817d7bfe5c64b8ea956e9a26f573ef64e72e4d7891f2d6af9bcc93f7aff9a97` | -| WBTC/USD | `c9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33` | -| WETH/USD | `9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6` | -| USDE/USD | `6ec879b1e9963de5ee97e9c8710b742d6228252a5e2ca12d4ae81d7fe5ee8c5d` | -| SUSDE/USD | `ca3ba9a619a4b3755c10ac7d5e760275aa95e9823d38a84fedd416856cdba37c` | -| SUSDE/USDE.RR | `271c64ce459937abf721d42552035713b6c58f80eeceab716a624607fda4b10f` | -| WSTHYPE/STHYPE.RR | `1a78b5829a99f1d2897917dae2a02266c0210535a995a2e9d0692613bbc89e27` | -| LHYPE/USD | `9e3cadc2a8a0ebfd765b34d5ee5de77a4add3114672fc0b8d3ad09ac56940069` | -| FHYPE/HYPE.RR | `8f749681c078ce4ef65cd220994f25735b80264fca4386dd57b31eacf7e4610b` | -| USDXL/USD | `e10593860e9ee1c204e4f9569e877502f098dd1a4d84cc5bad06f23f77dcbfe2` | -| MHYPE/HYPE.RR | `e35aebd2d35795acaa2b0e59f3b498510e8ef334986d151d1502adb9e26234f7` | -| FEUSD/USD | `7f2e9a7365eb634c543e9ca72683a9cf778cdc16ee5b8bca73abe6d08c1410d5` | -| MHYPE/USD | `a7fb4cdafed5130e8731b8da7c9208881f24e9b671bb92438b1fbf361d578112` | -| STHYPE/USD | `068cd0617cbdd1dda615ed2b5ab4fe07d2e9f46347f5e785484844aa10d22dc5` | -| UETH/USD | `08c73e187b45ecb2ab8375b975865d3c4a225fef1ccc7f326ad6eec66a24567a` | -| UBTC/USD | `42bfb26778f3504a9f359a92c731f77d0c24aed9b7745276e3ad0c2d840b74c2` | -| CMETH/METH.RR | `cef5ad3be493afef85e77267cb0c07d048f3d54055409a34782996607e48cf0a` | -| METH/ETH.RR | `ee279eeb2fec830e3f535ad4d6524eb35eb1c6890cb1afc0b64554d08c88727e` | - -## Kraken Mainnet - -The price feeds listed in the table below are currently sponsored in **Kraken mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ----------- | ------------------------------------------------------------------ | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| WETH/USD | `9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6` | -| WSTETH/USD | `6df640f3b8963d8f8358f791f352b8364513f6ab1cca5ed3f1f7b5448980e784` | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| KBTC/BTC.RR | `5dd5ede8b038c39f015746942820595ed69f30c00c3d3700f01d9ec55e027700` | - -## Unichain Mainnet - -The price feeds listed in the table below are currently sponsored in **Unichain mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| -------- | ------------------------------------------------------------------ | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| UNI/USD | `78d185a741d07edb3412b09008b7c5cfb9bbbd7d568bf00ba737b456ba171501` | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| PYTH/USD | `0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff` | - -## Mode Mainnet - -The price feeds listed in the table below are currently sponsored in **Mode mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ---------- | ------------------------------------------------------------------ | -| wUSDM/USDM | `3d392a0fc3ae7fac4d6ba15e99a4c2bec2debbe1c9fc7d950ec0972ee716f559` | -| USDM/USD | `a6a0dfa49b6b3a93510658245618099f5e842514970f596cf64fad9e0d658193` | -| STONE/ETH | `7a508a94c9276cbc60d04e1a8cf839d20d835bb869a74487dfffa8f1bfd1ce42` | - -## Sonic Mainnet - -The price feeds listed in the table below are currently sponsored in **Sonic mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ------------------ | ------------------------------------------------------------------ | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| WETH/USD | `9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6` | -| WBTC/USD | `c9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33` | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| S/USD | `f490b178d0c85683b7a0f2388b40af2e6f7c90cbe0f96b31f315f08d0e5a2d6d` | -| SCUSD/USD | `316b1536978bee10c47b3c74c0b3995aabae973a3351621680a2aa383aca77b8` | -| SCETH/USD | `8bb5e69ed1ab19642a0e7e851b1ed7b3579d0548bc8ddd1077b0d9476bb1dabc` | -| WSTKSCETH/SCETH.RR | `b680422b70915df562e4802bd8679112ff0f6b0a29ec2c3762ae2720eda01e58` | -| WSTKSCUSD/SCUSD.RR | `caed0964240861da425cf03fae9737473f6f031fb80cbbd73c3fb8cddd7a2204` | -| STS/S.RR | `3b14bd355f182fa3a3feeea6824228e1f71e7c221a37bc91e8307280aee6a803` | -| ANON/USD | `7a36855b8a4a6efd701ed82688694bbf67602de9faae509ae28f91065013cb82` | -| OS/USD | `2bcd65e3c1b4580a5f59755ef30e11077238217dd418d301dd7ee4d252987675` | -| GOGLZ/USD | `82465d1155ddbb2c73bf3491457163000f8e8d02dea90c548b1b7e56ae9fe4b1` | -| SHADOW/USD | `6f02ad2b8a307411fc3baedb9876e83efe9fa9f5b752aab8c99f4742c9e5f5d5` | -| WANS/ANS.RR | `940b0948d828c46bff5fc3a3204fc032092b5b4239ef9364f33e01d37437ba65` | -| STS/USD | `19f463beb47cb398cf2e2c8037f1d0073583cf18209c91a636f051d755ce0662` | - -## Story Mainnet - -The price feeds listed in the table below are currently sponsored in **Story mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ---------- | ------------------------------------------------------------------ | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| WETH/USD | `9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6` | -| WBTC/USD | `c9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33` | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| IP/USD | `b620ba83044577029da7e4ded7a2abccf8e6afc2a0d4d26d89ccdd39ec109025` | -| STIP/IP.RR | `1997bb9bdde99431e222562f1d659c901a075fbf82502a8155d96fb2c7e33991` | -| VIP/IP.RR | `34471f3bcaecba4cf2b6f25bc6c365216869add332d0ed2e88e542e3a3bcc2c7` | - -## Optimism Sepolia - -The price feeds listed in the table below are currently sponsored in **Optimism Sepolia**. - -Update Parameters: **30 seconds heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| -------- | ------------------------------------------------------------------ | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | - -## Unichain Sepolia - -The price feeds listed in the table below are currently sponsored in **Unichain Sepolia**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ---------- | ------------------------------------------------------------------ | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| STETH/USD | `3af6a3098c56f58ff47cc46dee4a5b1910e5c157f7f0b665952445867470d61f` | -| UNI/USD | `78d185a741d07edb3412b09008b7c5cfb9bbbd7d568bf00ba737b456ba171501` | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| WSTETH/USD | `6df640f3b8963d8f8358f791f352b8364513f6ab1cca5ed3f1f7b5448980e784` | -| WETH/USD | `9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6` | -| AVAX/USD | `93da3352f9f1d105fdfe4971cfa80e9dd777bfc5d0f683ebb6e1294b92137bb7` | -| POL/USD | `ffd11c5a1cfd42f80afb2df4d9f264c15f956d68153335374ec10722edd70472` | -| DOGE/USD | `dcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c` | -| SHIB/USD | `f0d57deca57b3da2fe63a493f4c25925fdfd8edf834b20f93e1f84dbd1504d4a` | -| DAI/USD | `b0948a5e5313200c632b51bb5ca32f6de0d36e9950a942d19751e833f70dabfd` | -| OP/USD | `385f64d993f7b77d8182ed5003d97c60aa3361f3cecfe711544d2d59165e9bdf` | -| PYTH/USD | `0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff` | - -## Ble Testnet - -The price feeds listed in the table below are currently sponsored in **Ble Testnet**. - -Update Parameters: **30 seconds heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| ---------- | ------------------------------------------------------------------ | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| ETH/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| USDE/USD | `3af6a3098c56f58ff47cc46dee4a5b1910e5c157f7f0b665952445867470d61f` | -| SUSDE/USD | `78d185a741d07edb3412b09008b7c5cfb9bbbd7d568bf00ba737b456ba171501` | -| ENA/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| SUSDE/USDE | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| USDTB/NAV | `967549f1ff4869f41cb354a7116b9e5a9a3091bebe0b2640eeed745ca1f7f90b` | -| USDTB/USD | `e4731214382d8ed70a766930a7722c68064fc7ed4e6d70dbce3c84d4be81bc92` | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/movement.mdx b/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/movement.mdx deleted file mode 100644 index 9f7a00b057..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/movement.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: "Sponsored Price Feeds on Movement Mainnet: Key Updates" -description: >- - Movement mainnet provides on-chain sponsored price feeds with hourly updates - and a 1% deviation threshold. See the full list of available feeds. -full: false -index: false ---- - -# Sponsored Feeds on Movement - -The price feeds listed in the table below are currently sponsored in **Movement mainnet**. - -Update Parameters: **1 hour heartbeat or 1% price deviation** - -| Name | Price Feed Id | -| --------------- | ---------------------------------------------------------------- | -| MOVE/USD | 6bf748c908767baa762a1563d454ebec2d5108f8ee36d806aadacc8f0a075b6d | -| APT/USD | 03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5 | -| USDC/USD | eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a | -| USDT/USD | 2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b | -| SUSDE/USD | ca3ba9a619a4b3755c10ac7d5e760275aa95e9823d38a84fedd416856cdba37c | -| WETH/USD | 9d4294bbcd1174d6f2003ec365831e64cc31d9f6f15a2b85399db8d5000960f6 | -| MOD/USD | 9a2a116d85a31d6f1bed19771105557276457094e31791a892758148aa54023d | -| THAPT/USD | b29276972267db5d64ae718fb7f107ad9e72a79cabf9992f0e9bc75ad451a7f6 | -| STHAPT/APT.RR | ea07fce25d7d716fe6ad10b267451011baadc8f3724b28487026072ddce3ba1b | -| FRAX/USD | c3d5d8d6d17081b3d0bbca6e2fa3a6704bb9a9561d9f9e1dc52db47629f862ad | -| LBTC/USD | 8f257aab6e7698bb92b15511915e593d6f8eae914452f781874754b03d0c612b | -| LBTC/BTC.RR | bade5c63f281d36a13dbb64ed0ae1c532a434b6771b11885f396a41f56cc3bd0 | -| ETH/USD | ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace | -| BTC/USD | e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43 | -| WBTC/USD | c9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33 | -| AVALON.USDA/USD | 37c307959acbb353e1451bcf7da9d305c8cb8d54c64353588aaf900ffcffdd7d | -| WSTETH/USD | 6df640f3b8963d8f8358f791f352b8364513f6ab1cca5ed3f1f7b5448980e784 | -| SOLVBTC/USD | f253cf87dc7d5ed5aa14cba5a6e79aee8bcfaef885a0e1b807035a0bbecc36fa | -| WEETH/USD | 9ee4e7c60b940440a261eb54b6d8149c23b580ed7da3139f7f08f4ea29dad395 | -| WEETH/ETH.RR | 343558e79f587e098c321218ecb34d031ba709ab3e84133126f3c98511b91f64 | -| EZETH/USD | 06c217a791f5c4f988b36629af4cb88fad827b2485400a358f3b02886b54de92 | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/solana.mdx b/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/solana.mdx deleted file mode 100644 index fc8fbd022d..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/solana.mdx +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: "Sponsored Price Feeds on Solana: Assets, Accounts & Parameters" -description: >- - Access Solana’s sponsored price feeds: get mainnet & devnet configurations, - account addresses, update parameters, and essential asset feed IDs. -full: false -index: false ---- - -# Sponsored Feeds on Solana - -The price feeds listed in the table below are currently sponsored in **Solana mainnet and devnet**. - -Update Parameters for BTC, WBTC, SOL, JITOSOL , BONK and USDC: **60 seconds heartbeat or 0.02% price deviation** - -Update Parameters for other assets: **60 seconds heartbeat or 0.5% price deviation** - -The addresses represent the price feed account for shard 0 of the relevant price feed id: - -| Name | Account Address | Price Feed Id | -| ------------ | ---------------------------------------------- | ------------------------------------------------------------------ | -| SOL/USD | `7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE` | `ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d` | -| JITOSOL/USD | `AxaxyeDT8JnWERSaTKvFXvPKkEdxnamKSqpWbsSjYg1g` | `67be9f519b95cf24338801051f9a808eff0a578ccb388db73b7f6fe1de019ffb` | -| MSOL/USD | `5CKzb9j4ChgLUt8Gfm5CNGLN6khXKiqMbnGAW4cgXgxK` | `c2289a6a43d2ce91c6f55caec370f4acc38a2ed477f58813334c6d03749ff2a4` | -| BSOL/USD | `5cN76Xm2Dtx9MnrQqBDeZZRsWruTTcw37UruznAdSvvE` | `89875379e70f8fbadc17aef315adf3a8d5d160b811435537e03c97e8aac97d9c` | -| SSOL/SOL | `2doCYXwYNt2FhzfCdgpW4YAwczvdzB27xtJkzQd5Kre2` | `add6499a420f809bbebc0b22fbf68acb8c119023897f6ea801688e0d6e391af4` | -| BONK/USD | `DBE3N8uNjhKPRHfANdwGvCZghWXyLPdqdSbEW2XFwBiX` | `72b021217ca3fe68922a19aaf990109cb9d84e9ad004b4d2025ad6f529314419` | -| W/USD | `BEMsCSQEGi2kwPA4mKnGjxnreijhMki7L4eeb96ypzF9` | `eff7446475e218517566ea99e72a4abec2e1bd8498b43b7d8331e29dcb059389` | -| KMNO/USD | `ArjngUHXrQPr1wH9Bqrji9hdDQirM6ijbzc1Jj1fXUk7` | `b17e5bc5de742a8a378b54c9c75442b7d51e30ada63f28d9bd28d3c0e26511a0` | -| MEW/USD | `EF6U755BdHMXim8RBw6XSC6Yk6XaouTKpwcBZ7QkcanB` | `514aed52ca5294177f20187ae883cec4a018619772ddce41efcc36a6448f5d5d` | -| TNSR/USD | `9TSGDwcPQX4JpAvZbu2Wp5b68wSYkQvHCvfeBjYcCyC` | `05ecd4597cd48fe13d6cc3596c62af4f9675aee06e2e0b94c06d8bee2b659e05` | -| USDC/USD | `Dpw1EAVrSB1ibxiDQyTAW6Zip3J4Btk2x4SgApQCeFbX` | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | -| BTC/USD | `4cSM2e6rvbGQUFiJbqytoVMi5GgghSMr8LwVrT9VPSPo` | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | -| JTO/USD | `7ajR2zA4MGMMTqRAVjghTKqPPn4kbrj3pYkAVRVwTGzP` | `b43660a5f790c69354b0729a5ef9d50d68f1df92107540210b9cccba1f947cc2` | -| USDT/USD | `HT2PLQBcG5EiCcNSaMHAjSgd9F98ecpATbk4Sk5oYuM` | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | -| JUP/USD | `7dbob1psH1iZBS7qPsm3Kwbf5DzSXK8Jyg31CTgTnxH5` | `0a0408d619e9380abad35060f9192039ed5042fa6f82301d0e48bb52be830996` | -| ETH/USD | `42amVS4KgzR9rA28tkVYqVXjq9Qa8dcZQMbH5EYFX6XC` | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | -| PYTH/USD | `8vjchtMuJNY4oFQdTi8yCe6mhCaNBFaUbktT482TpLPS` | `0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff` | -| HNT/USD | `4DdmDswskDxXGpwHrXUfn2CNUm9rt21ac79GHNTN3J33` | `649fdd7ec08e8e2a20f425729854e90293dcbe2376abc47197a14da6ff339756` | -| RENDER/USD | `HAm5DZhrgrWa12heKSxocQRyJWGCtXegC77hFQ8F5QTH` | `3d4a2bd9535be6ce8059d75eadeba507b043257321aa544717c56fa19b49e35d` | -| ORCA/USD | `4CBshVeNBEXz24GZpoj8SrqP5L7VGG3qjGd6tCST1pND` | `37505261e557e251290b8c8899453064e8d760ed5c65a779726f2490980da74c` | -| SAMO/USD | `2eUVzcYccqXzsDU1iBuatUaDCbRKBjegEaPPeChzfocG` | `49601625e1a342c1f90c3fe6a03ae0251991a1d76e480d2741524c29037be28a` | -| WIF/USD | `6B23K3tkb51vLZA14jcEQVCA1pfHptzEHFA93V5dYwbT` | `4ca4beeca86f0d164160323817a4e42b10010a724c2217c6ee41b54cd4cc61fc` | -| LST/USD | `7aT9A5knp62jVvnEW33xaWopaPHa3Y7ggULyYiUsDhu8` | `12fb674ee496045b1d9cf7d5e65379acb026133c2ad69f3ed996fb9fe68e3a37` | -| INF/USD | `Ceg5oePJv1a6RR541qKeQaTepvERA3i8SvyueX9tT8Sq` | `f51570985c642c49c2d6e50156390fdba80bb6d5f7fa389d2f012ced4f7d208f` | -| PRCL/USD | `6a9HN13ZFf57WZd4msn85KWLe5iTayqS8Ee8gstQkxqm` | `5bbd1ce617792b476c55991c27cdfd89794f9f13356babc9c92405f5f0079683` | -| RAY/USD | `Hhipna3EoWR7u8pDruUg8RxhP5F6XLh6SEHMVDmZhWi8` | `91568baa8beb53db23eb3fb7f22c6e8bd303d103919e19733f2bb642d3e7987a` | -| FIDA/USD | `2cfmeuVBf7bvBJcjKBQgAwfvpUvdZV7K8NZxUEuccrub` | `c80657b7f6f3eac27218d09d5a4e54e47b25768d9f5e10ac15fe2cf900881400` | -| MNDE/USD | `GHKcxocPyzSjy7tWApQjKRkDNuVXd4Kk624zhuaR7xhC` | `3607bf4d7b78666bd3736c7aacaf2fd2bc56caa8667d3224971ebe3c0623292a` | -| MOBILE/USD | `DQ4C1tzvu28cwo1roN1Wm6TW35sfJEjLh517k3ZeWevx` | `ff4c53361e36a9b837433c87d290c229e1f01aec5ef98d9f3f70953a20a629ce` | -| IOT/USD | `8UYEn5Weq7toHwgcmctvcAxaNJo3SJxXEayM57rpoXr9` | `6b701e292e0836d18a5904a08fe94534f9ab5c3d4ff37dc02c74dd0f4901944d` | -| NEON/USD | `F2VfCymdNQiCa8Vyg5E7BwEv9UPwfm8cVN6eqQLqXiGo` | `d82183dd487bef3208a227bb25d748930db58862c5121198e723ed0976eb92b7` | -| AUD/USD | `6pPXqXcgFFoLEcXfedWJy3ypNZVJ1F3mgipaDFsvZ1co` | `67a6f93030420c1c9e3fe37c1ab6b77966af82f995944a9fefce357a22854a80` | -| GBP/USD | `G25Tm7UkVruTJ7mcbCxFm45XGWwsH72nJKNGcHEQw1tU` | `84c2dde9633d93d1bcad84e7dc41c9d56578b7ec52fabedc1f335d673df0a7c1` | -| EUR/USD | `Fu76ChamBDjE8UuGLV6GP2AcPPSU6gjhkNhAyuoPm7ny` | `a995d00bb36a63cef7fd2c287dc105fc8f3d93779f062f09551b0af3e81ec30b` | -| XAG/USD | `H9JxsWwtDZxjSL6m7cdCVsWibj3JBMD9sxqLjadoZnot` | `f2fb02c32b055c805e7238d628e5e9dadef274376114eb1f012337cabe93871e` | -| XAU/USD | `2uPQGpm8X4ZkxMHxrAW1QuhXcse1AHEgPih6Xp9NuEWW` | `765d2ba906dbc32ca17cc11f5310a89e9ee1f6420508c63861f2f8ba4ee34bb2` | -| INJ/USD | `GwXYEfmPdgHcowF9GZwbb1WiTGTn1fuT3hbSLneoBKK6` | `7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592` | -| SLND/USD | `6vPfd6612huknxXaDapfj6cVmB8NvCwKm3BHKFxzo1EZ` | `f8d030e4ef460b91ad23eabbbb27aec463e3c30ecc8d5c4b71e92f54a36ccdbd` | -| WEN/USD | `CsG7wXoqZKNxx4UnFtvozfwXQ9RgpKe7zSJa4LWh5MT9` | `5169491cd7e2a44c98353b779d5eb612e4ac32e073f5cc534303d86307c2f1bc` | -| BLZE/USD | `FFv5yoCGhEgWv6mXhwv4KX8A2dYcVAzi88a6Yu8Tf3iB` | `93c3def9b169f49eed14c9d73ed0e942c666cf0e1290657ec82038ebb792c2a8` | -| JLP/USD | `2TTGSRSezqFzeLUH8JwRUbtN66XLLaymfYsWRTMjfiMw` | `c811abc82b4bad1f9bd711a2773ccaa935b03ecef974236942cec5e0eb845a3a` | -| WBTC/USD | `9gNX5vguzarZZPjTnE1hWze3s6UsZ7dsU3UnAmKPnMHG` | `c9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33` | -| PENGU/USD | `27zzC5wXCeZeuJ3h9uAJzV5tGn6r5Tzo98S1ZceYKEb8` | `bed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61` | -| AI16Z/USD | `BxizdE1Rd9yeCXUaorGNGLc4qHbqBULxiBtjRX37HjSV` | `2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae` | -| TRUMP/USD | `9vNb2tQoZ8bB4vzMbQLWViGwNaDJVtct13AGgno1wazp` | `879551021853eec7a7dc827578e8e69da7e4fa8148339aa0d3d5296405be4b1a` | -| FARTCOIN/USD | `2t8eUbYKjidMs3uSeYM9jXM9uudYZwGkSeTB4TKjmvnC` | `58cd29ef0e714c5affc44f269b2c1899a52da4169d7acc147b9da692e6953608` | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/sui.mdx b/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/sui.mdx deleted file mode 100644 index 91987b826a..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/sponsored-feeds/sui.mdx +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "Sponsored Price Feeds on Sui Mainnet: Essential Parameters & Updates" -description: >- - Unlock Sui-sponsored BTC, ARB, and SUI price feeds with detailed heartbeat - intervals, price deviation thresholds, and update mechanisms for accurate, - real-time data. -full: false -index: false ---- - -# Sponsored Feeds on Sui - -The price feeds listed in the table below are currently sponsored in **Sui mainnet**. - -| Name | Price Feed Id | Update Parameters | -| ---------- | ------------------------------------------------------------------ | --------------------------------------------------- | -| BTC/USD | `e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | **3** seconds heartbeat / **0.5%** price deviation | -| ARB/USD | `ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | **3** seconds heartbeat / **0.5%** price deviation | -| SUI/USD | `23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744` | **3** seconds heartbeat / **0.5%** price deviation | -| SOL/USD | `ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d` | **3** seconds heartbeat / **0.5%** price deviation | -| ARB/USD | `3fa4252848f9f0a1480be62745a4629d9eb1322aebab8a791e344b3b9c1adcf5` | **15** seconds heartbeat / **0.5%** price deviation | -| APT/USD | `03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5` | **15** seconds heartbeat / **0.5%** price deviation | -| SEI/USD | `53614f1cb0c031d4af66c04cb9c756234adad0e1cee85303795091499a4084eb` | **15** seconds heartbeat / **0.5%** price deviation | -| AVAX/USD | `93da3352f9f1d105fdfe4971cfa80e9dd777bfc5d0f683ebb6e1294b92137bb7` | **15** seconds heartbeat / **0.5%** price deviation | -| TIA/USD | `09f7c1d7dfbb7df2b8fe3d3d87ee94a2259d212da4f30c1f0540d066dfa44723` | **15** seconds heartbeat / **0.5%** price deviation | -| POL/USD | `ffd11c5a1cfd42f80afb2df4d9f264c15f956d68153335374ec10722edd70472` | **15** seconds heartbeat / **0.5%** price deviation | -| BLUE/USD | `04cfeb7b143eb9c48e9b074125c1a3447b85f59c31164dc20c1beaa6f21f2b6b` | **15** seconds heartbeat / **0.5%** price deviation | -| DEEP/USD | `29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff` | **15** seconds heartbeat / **0.5%** price deviation | -| SEND/USD | `7d19b607c945f7edf3a444289c86f7b58dcd8b18df82deadf925074807c99b59` | **15** seconds heartbeat / **0.5%** price deviation | -| USDC/USD | `eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a` | **15** seconds heartbeat / **0.5%** price deviation | -| USDT/USD | `2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b` | **15** seconds heartbeat / **0.5%** price deviation | -| AUSD/USD | `d9912df360b5b7f21a122f15bdd5e27f62ce5e72bd316c291f7c86620e07fb2a` | **15** seconds heartbeat / **0.5%** price deviation | -| AFSUI/USD | `17cd845b16e874485b2684f8b8d1517d744105dbb904eec30222717f4bc9ee0d` | **15** seconds heartbeat / **0.5%** price deviation | -| HASUI/USD | `6120ffcf96395c70aa77e72dcb900bf9d40dccab228efca59a17b90ce423d5e8` | **15** seconds heartbeat / **0.5%** price deviation | -| VSUI/USD | `57ff7100a282e4af0c91154679c5dae2e5dcacb93fd467ea9cb7e58afdcfde27` | **15** seconds heartbeat / **0.5%** price deviation | -| NAVX/USD | `88250f854c019ef4f88a5c073d52a18bb1c6ac437033f5932cd017d24917ab46` | **15** seconds heartbeat / **0.5%** price deviation | -| SCA/USD | `7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc` | **15** seconds heartbeat / **0.5%** price deviation | -| USDY/USD | `e393449f6aff8a4b6d3e1165a7c9ebec103685f3b41e60db4277b5b6d10e7326` | **15** seconds heartbeat / **0.5%** price deviation | -| FUD/USD | `6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75` | **15** seconds heartbeat / **0.5%** price deviation | -| BUCK/USD | `fdf28a46570252b25fd31cb257973f865afc5ca2f320439e45d95e0394bc7382` | **15** seconds heartbeat / **0.5%** price deviation | -| CETUS/USD | `e5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef` | **15** seconds heartbeat / **0.5%** price deviation | -| HAEDAL/USD | `e67d98cc1fbd94f569d5ba6c3c3c759eb3ffc5d2b28e64538a53ae13efad8fd1` | **15** seconds heartbeat / **0.5%** price deviation | diff --git a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot.mdx b/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot.mdx deleted file mode 100644 index 85583bcef8..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Troubleshoot Pyth Price Feed Integration Errors -description: >- - Step-by-step instructions to resolve Pyth price feed issues in EVM and SVM - contracts, enabling data integration in minutes. -full: false -index: false ---- - -# Troubleshoot - -The following guide helps users integrating pyth price feeds to solve common issues they may encounter. -Please select the component where you are facing the issue to get the troubleshooting steps. - -- [EVM Price Feeds Contract](troubleshoot/evm) -- [SVM Price Feeds Contract](troubleshoot/svm) diff --git a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/_meta.json deleted file mode 100644 index c7e8d83301..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/_meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "evm": "EVM Price Feeds Contract", - "svm": "SVM Price Feeds Contract" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/evm.mdx b/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/evm.mdx deleted file mode 100644 index 0302a1e101..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/evm.mdx +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Troubleshoot Pyth EVM Price Feed Issues: Fix Common Errors" -description: >- - Troubleshoot Pyth Price Feed on EVM chains with our concise guide and official - resources. Quickly fix stale prices, wrong feed IDs, and low-fee errors. -full: true -index: false ---- - -# Troubleshoot EVM Price Feeds Contract - -This reference page is designed to help you troubleshoot common issues you may encounter when using Pyth Price Feeds on EVM chains. -Follow the steps provided below to diagnose and resolve the issue. - -#### getPrice() reverts with `StalePrice()` or `0x19abf40e` error - -This error occurs when the requested price feed has not been updated in the last `validTimePeriod`. -The valid time period for the feed can queried using the [`getValidTime()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L22) method. - -To resolve this issue: - -- Update the prices by calling [`updatePriceFeeds()`]("https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L88") - by passing the latest updateData from [Hermes](https://hermes.pyth.network/docs/#/rest/latest_vaas). -- Another method to fetch the price is [`getPriceUnsafe()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L41) - If the price feed is available, the method will return the latest prices with timestamp of last update. - NOTE: `getPriceUnsafe()` method does not check the freshness of the price. - -#### getPrice() reverts with `PriceFeedNotFound()` or `0x14aebe68` error - -This error occurs when the requested price feed has not been updated on-chain, or the price feed id is incorrect. - -To resolve this issue: - -- Update the prices by calling [`updatePriceFeeds()`](https://api-reference.pyth.network/price-feeds/evm/updatePriceFeeds) - by passing the latest updateData from [Hermes](https://hermes.pyth.network/docs/#/rest/latest_vaas). -- Check the entered [price feed id](https://pyth.network/developers/price-feed-ids) and [pyth-contract address](https://docs.pyth.network/price-feeds/contract-addresses/evm) to make sure they are correct. - -#### updatePriceFeeds() reverts with `InsufficientFee()` or `0x025dbdd4` error - -This error occurs when the fee provided for updating the price feed is insufficient. -To resolve this issue: - -- Fetch the latest fee by calling [`getUpdateFee()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method and - provide the required fee to `msg.value` when calling [`updatePriceFeeds()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/svm.mdx b/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/svm.mdx deleted file mode 100644 index 818033c135..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/troubleshoot/svm.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Troubleshoot SVM Price Feeds: Fix Anchor-Lang Version Mismatch" -description: >- - Step-by-step guide to align anchor-lang versions in Cargo.toml and Cargo.lock - to resolve Pyth SVM compilation errors affecting Solana price feeds. -full: false -index: false ---- - -# Troubleshoot Solana Price Feeds Contract - -This reference page is designed to help you troubleshoot common issues you may encounter when using Pyth Price Feeds on SVM chains. -Follow the steps provided below to diagnose and resolve the issue. - -1. `error[E0277]: the trait bound PriceUpdateV2: anchor_lang::AccountDeserialize is not satisfied{:rust}` - - This error happens when a program using the [`pyth-solana-receiver-sdk`](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/pyth_solana_receiver_sdk) fails to compile. It is caused by an `anchor-lang` version mismatch. - Make sure the transitive version of `anchor-lang` brought by `pyth-solana-receiver-sdk` - matches the version of `anchor-lang` of your program's `Cargo.toml`. - - You can fix it by following these steps: - - - Check the version of `anchor-lang` in your [`Cargo.toml`](https://github.com/guibescos/anchor-pyth/blob/broken-build/programs/anchor-pyth/Cargo.toml) (in the example `0.29.0{:js}`) call it `x.y.z` - - Check the version of `anchor-lang` in the `pyth-solana-receiver-sdk` tree in [`Cargo.lock`](https://github.com/guibescos/anchor-pyth/blob/broken-build/Cargo.lock#L1400) (in the example `0.30.1{:js}`) call it `a.b.c` - - Run `cargo update -p anchor-lang@a.b.c --precise x.y.z{:bash}` - replacing `a.b.c` and `x.y.z` by the versions in the previous steps. For example:\ - `cargo update -p anchor-lang@0.30.1 --precise 0.29.0{:bash}` diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-pyth-for-morpho.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-pyth-for-morpho.mdx deleted file mode 100644 index f3dec4f5b2..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-pyth-for-morpho.mdx +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: "Use Pyth for Morpho: Deployment & Update Guide" -description: >- - Step-by-step guide to deploy Pyth’s Chainlink-compatible PythAggregatorV3 - contract, automate price updates, and integrate with Morpho for seamless - oracle deployment. -full: false -index: false ---- - -import { Steps, Step } from "fumadocs-ui/components/steps"; - -# How to use Pyth for Morpho Markets - -This guide will show how you can leverage Pyth real time price data to power Morpho markets. - -At the time of writing, Morpho supports an [oracle interface](https://github.com/morpho-org/morpho-blue-oracles/tree/main/src) similar to [ChainlinkAggregatorV3Interface](https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol). -We need to wrap the Pyth oracle with this interface to use it with Morpho. - -There are three steps to use Pyth price feeds for Morpho markets: - -1. Deploy the [`PythAggregatorV3`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/PythAggregatorV3.sol) contract to provide a Chainlink-compatible feed interface. -2. Run the price pusher or scheduler. -3. Deploy the Morpho oracle contract. - - - - -### Deploy the `PythAggregatorV3` contract - -Pyth provides a wrapper called `PythAggregatorV3` that implements the ChainlinkAggregatorV3Interface. -This wrapper allows you to use Pyth price feeds with Morpho markets. -[Migrate from Chainlink to Pyth](./migrate-an-app-to-pyth/chainlink.md) explains how to deploy the `PythAggregatorV3` contract. - -You can use the forge [script](https://github.com/pyth-network/pyth-examples/blob/main/price_feeds/evm/chainlink_migration/script/PythAggregatorV3Deployment.s.sol) from the [pyth-examples](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/evm/chainlink_migration) directory to deploy the `PythAggregatorV3` contract. - -```bash copy -forge script script/PythAggregatorV3Deployment.s.sol --rpc-url $RPC_URL --broadcast --verify -``` - -This script will deploy the `PythAggregatorV3` contract and verify it on the target chain. -You have to run the script for both `BASE` and `QUOTE` price feeds. - - - - -### Run the price pusher or scheduler - -As a pull oracle, Pyth's users are typically responsible for updating the state of on-chain feeds. -Please see [What is a Pull Oracle?](/price-feeds/pull-updates) to learn more about pull updates. - -If you are using the `PythAggregatorV3` contract, you must push price updates to the contract at regular intervals. -The Pyth Data Association sponsors regular on-chain updates for some price feeds. -See [Sponsored Feeds](./sponsored-feeds.mdx) for the current list of feeds and their update parameters. - -If you don't find relevant price IDs in the [Sponsored Feeds](./sponsored-feeds.mdx) list, you can run the scheduler/price pusher for the price feed you need. - -Please see [Schedule Price Updates](./schedule-price-updates.mdx) for more information on how to schedule price updates. - - - - -### Deploy the Morpho oracle contract - -After deploying the `PythAggregatorV3` contract and scheduling price updates, you can deploy the Morpho oracle contract with the address of the `PythAggregatorV3` contract deployed in the first step. - -Please refer to the [Morpho documentation](https://docs.morpho.org/morpho/tutorials/deploy-an-oracle/) for more information on how to deploy the Morpho oracle contract. - - - - diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data.mdx deleted file mode 100644 index 3959cc4ae0..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: Integrate Pyth Real-Time Data on Blockchains & Off-Chain -description: >- - Integrate Pyth real-time data into blockchain and off-chain applications. - Includes detailed guides, contract addresses, and deployment best practices. -full: false -index: false ---- - -# How to Use Real-Time Price Data - -The following guides demonstrate how to consume Pyth real-time prices on various blockchains. -These guides are intended for developers building on-chain applications that need price data, i.e., the price data must -be on the blockchain. - -Pyth price feeds are available on 40+ blockchain ecosystems. -Check out the complete list of chains and implementation contract addresses at [Contract Addresses](contract-addresses). - -If your blockchain is not supported, please [ask in Discord](https://discord.gg/invite/PythNetwork). -Then, consult the relevant ecosystem guide to get started using Pyth real-time price data: - -- [EVM](use-real-time-data/evm) -- [Solana](use-real-time-data/solana) -- [Aptos](use-real-time-data/aptos.md) -- [CosmWasm](use-real-time-data/cosmwasm.md) -- [Sui](use-real-time-data/sui.md) -- [IOTA](use-real-time-data/iota.md) -- [Near](use-real-time-data/sui.md) - -Pyth price feeds can also be used in off-chain applications. -For example, an application may need to show real-time asset prices on a website. -Developers building such applications can consult the following guide: - -- [Off-chain Apps](use-real-time-data/off-chain.md) - -Off-chain application developers should also consider using [Benchmarks](../benchmarks). -In addition to real-time data, Benchmarks provides access to historical Pyth prices. -These historical prices are useful for building price charts or graphs. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/_meta.json b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/_meta.json deleted file mode 100644 index 9a646f5016..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/_meta.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "evm": "in EVM Contracts", - "solana": "in Solana and SVM Programs", - "starknet": "in Starknet Contracts", - "fuel": "in Fuel Contracts", - "aptos": "in Aptos Contracts", - "sui": "in Sui Contracts", - "iota": "in IOTA Contracts", - "ton": "in TON Contracts", - "cosmwasm": "in CosmWasm Contracts", - "near": "in Near Contracts", - "off-chain": "in Off-Chain Applications" -} diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/fuel.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/fuel.mdx deleted file mode 100644 index 0082297bad..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/fuel.mdx +++ /dev/null @@ -1,194 +0,0 @@ ---- -title: "Fuel Contracts: Integrate Real-Time Pyth Data" -description: >- - Use Fuel SDKs, code samples, and documentation to integrate Pyth Network - real-time price feeds into your contracts and retrieve accurate, up-to-date - data. -full: false -index: false ---- - -# How to Use Real-Time Data in Fuel Contracts - -This guide explains how to use real-time Pyth data in Fuel contracts. - -## Install the Pyth SDK - -Use the following dependency in your `Forc.toml` file to use the latest Pyth Fuel package: - -```toml copy -[dependencies] -pyth_interface = { git = "https://github.com/pyth-network/pyth-crosschain", tag = "pyth-fuel-contract-v0.5.0" } -``` - -Pyth also provides a javascript SDK to interact with the Pyth contract on Fuel. You can install it using the following command: - - - ``` npm install --save @pythnetwork/pyth-fuel-js ``` - ``` yarn add @pythnetwork/pyth-fuel-js ``` - - -## Write Contract Code - -The code snippet below provides an example module fetching the ETH/USD price from Pyth price feeds: - -```rust copy -contract; - -use pyth_interface::{data_structures::price::{Price, PriceFeedId}, PythCore}; - -use std::bytes::Bytes; - -abi UpdatePrice { - fn valid_time_period() -> u64; - fn get_price(price_feed_id: PriceFeedId) -> Price; - fn get_price_unsafe(price_feed_id: PriceFeedId) -> Price; - fn update_fee(update_data: Vec) -> u64; - #[payable] - fn update_price_feeds(update_fee: u64, update_data: Vec); -} - -const PYTH_MAINNET_CONTRACT_ID = 0x1c86fdd9e0e7bc0d2ae1bf6817ef4834ffa7247655701ee1b031b52a24c523da; // Mainnet Contract -const PYTH_TESTNET_CONTRACT_ID = 0x25146735b29d4216639f7f8b1d7b921ff87a1d3051de62d6cceaacabeb33b8e7; // Testnet Contract -const FUEL_ETH_BASE_ASSET_ID = 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07; - -impl UpdatePrice for Contract { - fn valid_time_period() -> u64 { - let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID); - let period = pyth_contract.valid_time_period(); - period - } - fn get_price(price_feed_id: PriceFeedId) -> Price { - let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID); - let price = pyth_contract.price(price_feed_id); - price - } - fn get_price_unsafe(price_feed_id: PriceFeedId) -> Price { - let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID); - let price = pyth_contract.price_unsafe(price_feed_id); - price - } - fn update_fee(update_data: Vec) -> u64 { - let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID); - let fee = pyth_contract.update_fee(update_data); - fee - } - #[payable] - fn update_price_feeds(update_fee: u64, update_data: Vec) { - let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID); - pyth_contract - .update_price_feeds { - asset_id: FUEL_ETH_BASE_ASSET_ID, - coins: update_fee, - }(update_data); - } -} -``` - -The `update_data` argument contains verified prices from Pyth. -Calling `pyth_contract.update_price_feeds` with this value updates the on-chain Pyth price and ensures your application has recent price data. -The `update_data` can be fetched from Hermes; Consult [Fetch Price Updates](https://docs.pyth.network/price-feeds/fetch-price-updates) for more information on how to fetch the `update_data`. - - -
- Regarding the Pyth contract on Fuel, the caller must pay the fee in the base - asset for functions like `update_price_feeds`. The fee is currently set to - the minimum possible value (1 wei). -
-
- -The code snippet above does the following things: - -1. Defines an `UpdatePrice` ABI with functions to interact with the Pyth contract. -2. Implements the `UpdatePrice` ABI for the contract, providing the following functionality: - - - `valid_time_period()`: Retrieves the valid time period from the Pyth contract. - - `get_price(price_feed_id)`: Gets the price for a given price feed ID. - - `get_price_unsafe(price_feed_id)`: Gets the price for a given price feed ID without staleness checks. - - `update_fee(update_data)`: Calculates the fee required to update the price feeds. - - `update_price_feeds(update_fee, update_data)`: Updates the price feeds with the provided data and fee. - -3. Uses the `PYTH_MAINNET_CONTRACT_ID` constant to interact with the Pyth contract on testnet. -4. Uses the `FUEL_ETH_BASE_ASSET_ID` constant as the asset ID for paying update fees. - -To use this contract, you would typically: - -1. Call `update_fee()` to get the required fee for updating price feeds. -2. Call `update_price_feeds()` with the fee and update data to refresh the price feeds. -3. Use `get_price()` or `get_price_unsafe()` to read the updated prices. - -### Write Client Code - -The code snippet below provides an example of how to fetch price updates using NextJS, a full example can be found [here](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/fuel/fetch-and-update-btc-price). - -```ts copy -import { TestContractAbi__factory } from "@/sway-api"; -import PYTH_CONTRACT_ABI from "../abi/pyth-contract-abi.json"; -import { arrayify, Contract, hexlify } from "fuels"; -import { HermesClient } from "@pythnetwork/hermes-client"; - -const HERMES_ENDPOINT = "https://hermes.pyth.network/"; -const FUEL_ETH_BASE_ASSET_ID = - "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"; -const ETH_USD_PRICE_FEED_ID = - "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace"; // ETH/USD - -const contractId = - CURRENT_ENVIRONMENT === "local" - ? contractIds.testContract - : (process.env.NEXT_PUBLIC_TESTNET_CONTRACT_ID as string); // Testnet Contract ID -const pythContractId = process.env - .NEXT_PUBLIC_PYTH_TESTNET_CONTRACT_ID as string; // Testnet Contract ID - -async function updateAndGetPrice() { - const fetchPriceUpdateData = async () => { - const connection = new HermesClient(HERMES_ENDPOINT); - - // Latest price updates - const priceUpdates = await connection.getLatestPriceUpdates([ - ETH_USD_PRICE_FEED_ID, - ]); - - const buffer = Buffer.from(priceUpdates.binary.data[0], "hex"); - return buffer; - }; - - const updateData = await fetchPriceUpdateData(); - - const { waitForResult: waitForResultFee } = await contract.functions - .update_fee([arrayify(updateData)]) - .addContracts([pythContract]) - .call(); - const { value: fee } = await waitForResultFee(); - - await contract.functions - .update_price_feeds(fee, [arrayify(updateData)]) - .addContracts([pythContract]) - .callParams({ - forward: [fee, hexlify(FUEL_ETH_BASE_ASSET_ID)], - }) - .call(); - - const { value: price } = await contract.functions - .get_price(hexlify(PRICE_FEED_ID)) - .addContracts([pythContract]) - .get(); - - console.log("Latest ETH/USD price after update:", price); - return price; -} - -updateAndGetPrice().catch(console.error); -``` - -## Additional Resources - -You may find these additional resources helpful for developing your Fuel application. - -### Interface - -The [Fuel Interface](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/fuel/contracts/pyth-interface/src) directory contains multiple files that define the functions and structures for interacting with the Pyth contract deployed on Fuel. - -### Example Applications - -- [fetch-and-update-btc-price](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/fuel/fetch-and-update-btc-price), which fetches the latest price update from Hermes and updates the Pyth price feeds on Fuel. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/iota.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/iota.mdx deleted file mode 100644 index bb67a44228..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/iota.mdx +++ /dev/null @@ -1,236 +0,0 @@ ---- -title: Integrating Real-Time Pyth Data into IOTA Contracts -description: >- - This SDK includes code samples and best practices for integrating live Pyth - price feeds into IOTA smart contracts. -full: false -index: false ---- - -# How to Use Real-Time Data in IOTA Contracts - -This guide explains how to use real-time Pyth data in IOTA applications. - -## Install Pyth SDK - -Use the following dependency in your `Move.toml` file to use the latest Pyth IOTA package and its dependencies: - - - - -```sh copy -[dependencies.Pyth] -git = "https://github.com/pyth-network/pyth-crosschain.git" -subdir = "target_chains/sui/contracts" -rev = "iota-contract-testnet" - -[dependencies.Wormhole] -git = "https://github.com/pyth-network/pyth-crosschain.git" -subdir = "target_chains/sui/contracts/vendor/wormhole_iota_testnet/wormhole" -rev = "iota-contract-testnet" - -[dependencies.Iota] -git = "https://github.com/iotaledger/iota.git" -subdir = "crates/iota-framework/packages/iota-framework" -rev = "751c23caf24efd071463b9ffd07eabcb15f44f31" -``` - - - - -```sh copy -[dependencies.Pyth] -git = "https://github.com/pyth-network/pyth-crosschain.git" -subdir = "target_chains/sui/contracts" -rev = "iota-contract-mainnet" - -[dependencies.Wormhole] -git = "https://github.com/pyth-network/pyth-crosschain.git" -subdir = "target_chains/sui/contracts/vendor/wormhole_iota_mainnet/wormhole" -rev = "iota-contract-mainnet" - -[dependencies.Iota] -git = "https://github.com/iotaledger/iota.git" -subdir = "crates/iota-framework/packages/iota-framework" -rev = "751c23caf24efd071463b9ffd07eabcb15f44f31" -``` - - - - -Pyth also provides a javascript SDK to construct transaction blocks that update price feeds: - - - - ```sh - # NPM - npm install --save @pythnetwork/pyth-iota-js - - # Yarn - yarn add @pythnetwork/pyth-iota-js - ``` - - - - -## Write Contract Code - -The code snippet below provides a general template for what your contract code should look like: - -```rust {18} copy -module pyth_example::main { - use iota::clock::Clock; - use pyth::price_info; - use pyth::price_identifier; - use pyth::price; - use pyth::pyth; - use pyth::price_info::PriceInfoObject; - - const E_INVALID_ID: u64 = 1; - - public fun use_pyth_price( - // Other arguments - clock: &Clock, - price_info_object: &PriceInfoObject, - ){ - let max_age = 60; - // Make sure the price is not older than max_age seconds - let price_struct = pyth::get_price_no_older_than(price_info_object,clock, max_age); - - // Check the price feed ID - let price_info = price_info::get_price_info_from_price_info_object(price_info_object); - let price_id = price_identifier::get_bytes(&price_info::get_price_identifier(&price_info)); - - // ETH/USD price feed ID - // The complete list of feed IDs is available at https://pyth.network/developers/price-feed-ids - // Note: IOTA uses the Pyth price feed ID without the `0x` prefix. - assert!(price_id!=x"ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", E_INVALID_ID); - - // Extract the price, decimal, and timestamp from the price struct and use them - let decimal_i64 = price::get_expo(&price_struct); - let price_i64 = price::get_price(&price_struct); - let timestamp_sec = price::get_timestamp(&price_struct); - } -} -``` - -One can consume the price by calling `pyth::get_price` abovementioned or other utility functions on the `PriceInfoObject` in the Move module - -The code snippet below provides an example of how to update the Pyth price feeds: - -```ts copy -import { IotaPriceServiceConnection, IotaPythClient } from "@pythnetwork/pyth-iota-js"; -import { Transaction } from "@iota/iota-sdk/transactions"; - -// Get the Stable Hermes service URL from https://docs.pyth.network/price-feeds/api-instances-and-providers/hermes -const connection = new IotaPriceServiceConnection("https://hermes-beta.pyth.network"); - -const priceIDs = [ - // You can find the IDs of prices at https://pyth.network/developers/price-feed-ids - "0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43", // BTC/USD price ID - "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", // ETH/USD price ID -]; - -const priceUpdateData = await connection.getPriceFeedsUpdateData(priceIDs); - -// It is either injected from the browser (https://www.npmjs.com/package/@iota/dapp-kit) -// or instantiated in the backend via some private key (https://www.npmjs.com/package/@iota/iota-sdk) -const wallet: SignerWithProvider = getWallet(); -// Get the state IDs of the Pyth and Wormhole contracts from -// https://docs.pyth.network/price-feeds/contract-addresses/iota -const wormholeStateId = "0x8bc490f69520a97ca1b3de864c96aa2265a0cf5d90f5f3f016b2eddf0cf2af2b"; -const pythStateId = "0x68dda579251917b3db28e35c4df495c6e664ccc085ede867a9b773c8ebedc2c1"; - -const client = new IotaPythClient(wallet.provider, pythStateId, wormholeStateId); -const tx = new Transaction(); -const priceInfoObjectIds = await client.updatePriceFeeds(tx, priceFeedUpdateData, priceIDs); - -tx.moveCall({ - target: `pyth_example::main::use_pyth_price`, - arguments: [ - ..., // other arguments needed for your contract - tx.object(priceInfoObjectIds[0]), - ], -}); - -const txBlock = { - transaction: tx, - wallet, - options: { - showEffects: true, - showEvents: true, - }, -}; - -const result = await wallet.signAndExecuteTransaction(txBlock); -``` - -By calling the `updatePriceFeeds` function, the `IotaPythClient` adds the necessary transactions to the transaction block to update the price feeds. - - - -
- Your IOTA Move module **should NOT** have a hard-coded call to - `pyth::update_single_price_feed.` In other words, a contract should **never - call** the IOTA Pyth `pyth::update_single_price_feed` entry point. Instead, it - should be called directly from client code (e.g., Typescript or Rust). -
- -
- When IOTA contracts are - [upgraded](https://docs.iota.org/developer/iota-101/move-overview/package-upgrades/introduction), - the address changes, which makes the old address no longer valid. If your - module has a hard-coded call to `pyth::update_single_price_feed` living at a - fixed call-site, it may eventually get bricked due to how Pyth upgrades are - implemented. (Pyth only allow users to interact with the most recent package - version for security reasons). -
- -
- Therefore, you should build a [IOTA programmable - transaction](https://docs.iota.org/developer/iota-101/transactions/ptb/programmable-transaction-blocks-overview) - that first updates the price by calling `pyth::update_single_price_feed` at - the latest call-site from the client-side and then call a function in your - contract that invokes `pyth::get_price` on the `PriceInfoObject` to get the - recently updated price. -
-
- You can use `IOTAPythClient` to build such transactions and handle all the - complexity of updating the price feeds. -
- -
- Consult [Fetch Price Updates](../fetch-price-updates) for more information on - how to fetch the `pyth_price_update`. -
- -
-## Additional Resources - -You may find these additional resources helpful for developing your IOTA application. - -### CLI Example - -[This example](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/iota/cli) shows how to update prices on a IOTA network. It does the following: - -1. Fetches update data from Hermes for the given price feeds. -1. Call the Pyth IOTA contract with a price update. - -You can run this example with `npm run example-relay`. A full command that updates prices on the IOTA testnet looks like this: - -```bash -export IOTA_KEY=YOUR_PRIV_KEY; -npm run example-relay -- --feed-id "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace" \ ---hermes "https://hermes.pyth.network" \ ---full-node "https://api.testnet.iota.cafe" \ ---pyth-state-id "0x68dda579251917b3db28e35c4df495c6e664ccc085ede867a9b773c8ebedc2c1" \ ---wormhole-state-id "0x8bc490f69520a97ca1b3de864c96aa2265a0cf5d90f5f3f016b2eddf0cf2af2b" -``` - -### Contract Addresses - -Consult [IOTA Contract Addresses](../contract-addresses/iota) to find the package IDs. - -### Pyth Price Feed IDs - -Consult [Pyth Price Feed IDs](https://pyth.network/developers/price-feed-ids) to find Pyth price feed IDs for various assets. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/near.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/near.mdx deleted file mode 100644 index 369b254789..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/near.mdx +++ /dev/null @@ -1,347 +0,0 @@ ---- -title: "Pyth on NEAR: Integrating Price Feeds & Real-Time Data" -description: >- - Integrate Pyth price feeds on NEAR with our step-by-step guide. Learn to use - the Pyth API, fetch off-chain data, and update on-chain seamlessly. -full: false -index: false ---- - -# Pyth on NEAR - -Pyth price feeds on NEAR are managed through the main NEAR Pyth smart -contract, enabling seamless interaction with on-chain data. In NEAR, -these interactions are facilitated by specific functions within the -Pyth receiver contract. This contract acts as an interface to Pyth -price feeds, handling the retrieval and updating of price data. - -The two Key functions in the Pyth receiver contract to get started -are as follows: - -1. [`update_price_feeds`](#update_price_feeds) - _(updates Pyth smart contract with the price feed you provide)_ - - - args: `data` - - type: `object` - - example: `{ "data": "504e41...' }` - -2. [`get_price`](#get_price) (fetches the most recent price stored in the contract)\_ - - args: `price_identifier` - - type: `object` - - example: `{ price_identifier: 'f9c0172ba10dfa8...' }` - -These functions are core for interacting with Pyth price feeds in -NEAR-based applications, providing a reliable and up-to-date source of -price information. - -For a full overview of methods provided by the NEAR -contract, see [the interface](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/near/receiver/src/ext.rs)] exposed by the receiver contract. - -## Getting Started - -To get started with Pyth oracle you will need to gather the following information which differ between networks: - -- Price ID(s) -- HermesAPI Endpoint -- Smart contract address - -| Network | Price Feed IDs | Hermes API Address | Contract Address | -| --------- | ------------------------------------------------------------------------------------------------ | -------------------------- | -------------------------------------------------------------------------------- | -| `testnet` | [NEAR `testnet` Price Feed IDs](https://www.pyth.network/developers/price-feed-ids#near-testnet) | `hermes-beta.pyth.network` | [pyth-oracle.testnet](https://testnet.nearblocks.io/address/pyth-oracle.testnet) | -| `mainnet` | [NEAR `mainnet` Price Feed IDs](https://www.pyth.network/developers/price-feed-ids#near-mainnet) | `hermes.pyth.network` | [pyth-oracle.near](https://nearblocks.io/address/pyth-oracle.near) | - -Note: When using Price Feed IDs, you will need to remove the `0x` prefix. - ---- - -### `update_price_feeds` - -> Updates the Pyth Oracle contract data with the price feed you provide. - -- args: `data` _(off-chain hex-encoded price feed)_ -- type: `object` -- example: `{ "data": "504e41...' }` - -Update the Pyth Oracle contract with new price feed data in two main steps: - -1. [Fetch off-chain price feed](#1-fetch-off-chain-price-feed) -2. [Update Pyth Oracle contract with off-chain price feed](#2-update-pyth-oracle-contract-price-feed) - -#### 1) Fetch off-chain price feed - -You can obtain an off-chain price feed using Pyth's [Hermes API](https://hermes-beta.pyth.network/docs/). - -To use these endpoints, you will need to provide a Price Feed ID and ensure you are targeting the correct network. See [Getting Started](#getting-started) for more information. - -Here is a node.js example of fetching the latest price feed using `/v2/updates/price/latest` endpoint: - -`Example:` - -```js -const axios = require("axios"); - -// There are separate endpoints for testnet and mainnet -const HERMES_TESTNET_URL = "https://hermes-beta.pyth.network"; -const HERMES_MAINNET_URL = "https://hermes.pyth.network"; - -async function getHermesPriceData(priceId, network) { - try { - let url; - network === "testnet" - ? (url = HERMES_TESTNET_URL) - : (url = HERMES_MAINNET_URL); - - // Fetch the price data from the Hermes API - const response = await axios.get( - `${url}/v2/updates/price/latest?ids[]=${priceId}`, - ); - - return response.data.binary.data[0]; - } catch (error) { - console.error( - "Error:", - error.response ? error.response.data : error.message, - ); - } -} - -module.exports = { getHermesPriceData }; -``` - -
- z [See full example on - GitHub](https://github.com/near-examples/near-js/blob/main/node-js/utils/fetch-hermes-price-data.js) -
- ---- - -### 2) Update Pyth Oracle Contract Price Feed - -After [fetching an off-chain price feed](#1-fetch-off-chain-price-feed), you can now perform a contract call to the Pyth Oracle contract to update. -Call `update_price_feeds` on the Pyth Oracle contract deployed on NEAR with `data` as your arguments. - -`example args:` - -```json -{ - "data": "504e41550100000000a00100000000010070b0ee3a00d1a3c07ee440887eb34a5a35860e6f4b9230fd62f0593fe35c8a3561735a6a37d269c5f166b84ead8918f710dc1be2ee6b51db5b22340ea2c173fc01673d544b00000000001ae101faedac5851e32b9b23b5f9411a8c2bac4aae3ed4dd7b811dd1a72ea4aa7100000000061bc18c014155575600000000000ab0f04600002710f41bc8c224ed983c68dbf5dab7dd34c9129fecfa03005500ca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a600000047e2eb4ef0000000000692480ffffffff800000000673d544b00000000673d544b00000048200e66a00000000005e495a60bb9370c458dd50558b34699b5b179f45e56be22f0a1a0feb1db8469adc8c5efeb53988495bac07bf9efed07f5eee43818150c55055882f6872a228e8e9bc78459ed3ea7fe0b86f3048f6bf0aad34befc46063ab7d200beb8bc9fe5839844d2233546f0742bb665f1e610370fcf8ce5be83d0f47e584b685af87cf3ebcb79e714827dcb99dba579e1a03785052ab3c7c7147d3f7bba822b04dbda159670e9a8d29e7ccf68474b2ca85e00224d29bf65b06b09f95e91703313e053b697b48ac1e4d1c57605a71ab77e7ef276bfe8a369c268333b9a37461bf2b7cb7fd4c005500ecf553770d9b10965f8fb64771e93f5690a182edc32be4a3236e0caaa6e0581a0000000e2ba8cd280000000001b40517fffffff800000000673d544b00000000673d544b0000000e3ea44c6800000000016aee120b47b853f55949284cb8ba0b63824ff9b48cd1da8417f45421b79ee3195fc8d107540a0bbb95c2445b66065754f135cb842db09a7e7ab33f79c546a48db872bd7197b04e3d7b52fbb55b3b9f51707c5a55fac3707cb563dbcde4aadeecc3649c237454cecf519dc567c0da03d81808523aa4fa71815eab25ce7da61b48647bac645d403208135002aab5fde2d7ab3c7c7147d3f7bba822b04dbda159670e9a8d29e7ccf68474b2ca85e00224d29bf65b06b09f95e91703313e053b697b48ac1e4d1c57605a71ab77e7ef276bfe8a369c268333b9a37461bf2b7cb7fd4c" -} -``` - -To perform this contract call you must first create a NEAR account which can be done using `near-cli`. - -Fist, install `near-cli`: - -```bash - -npm install -g near-cli-rs@latest - -``` - -This CLI allows you to simply run `near` and let the prompts guide you through the process. - -To quickly create a NEAR account, run the following command (replacing `your-new-account.testnet` with your desired account name): - -```bash -near account \ -create-account sponsor-by-faucet-service \ -your-new-account.testnet \ -autogenerate-new-keypair save-to-legacy-keychain \ -network-config testnet \ -create -``` - -To perform a contract call to the Pyth Oracle contract, run the following command: - -Replace: - -- `your-account.testnet` with your account name -- `'{"data": "504e41550100..."}'` with your off-chain price feed - -``` -near contract \ - call-function \ - as-transaction pyth-oracle.testnet update_price_feeds \ - json-args '{"data": "504e41550100..."}' \ - prepaid-gas '300.0 Tgas' \ - attached-deposit '0.01 NEAR' \ - sign-as your-account.testnet \ - network-config testnet \ - sign-with-legacy-keychain \ - send -``` - -**Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/integrations/pyth/real-time-price-data/update-price-feed.json)** - -Alternatively, you can use `near-js` libraries to perform the contract call. For this example we will create a simple node.js project. - -First, install the `near-js` libraries we will use: - -```bash -npm install @near-js/client @near-js/keystores-node -``` - -To setup a NEAR connection, we'll create a `connect.js` file that will initialize an RPC provider and signer. This will look for your NEAR credentials in your `.near-credentials` directory. - -```js -// node.js imports -const { join } = require("node:path"); -const { homedir } = require("node:os"); - -// near-js imports -const { - getTestnetRpcProvider, - getSignerFromKeystore, -} = require("@near-js/client"); -const { UnencryptedFileSystemKeyStore } = require("@near-js/keystores-node"); - -// initialize RPC provider and signer -const nearConnect = (sender, network) => ({ - rpcProvider: getTestnetRpcProvider(), - signer: getSignerFromKeystore( - sender, - network, - new UnencryptedFileSystemKeyStore(join(homedir(), ".near-credentials")), - ), -}); - -module.exports = { nearConnect }; -``` - -Next we can create a `update-oracle.js` file that will perform the contract call to update the Pyth Oracle contract's price feed. - -```js -// near-js imports -// https://www.npmjs.com/package/@near-js/client -const { nearConnect } = require("../utils/connect"); -const { functionCall } = require("@near-js/client"); - -const sender = "your-account.testnet"; -const receiver = "pyth-oracle.testnet"; -const network = "testnet"; - -const PRICE_IDS = [ - // Price ids can be found at https://www.pyth.network/developers/price-feed-ids#near-testnet - // NOTE: Ensure you are using NEAR specific price ids & remove the '0x' prefix before using them - "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b", // BTC/USD price id - "ca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6", // ETH/USD price id -]; - -async function updatePythContractPriceFeeds(network) { - // Connect to the NEAR network - const { rpcProvider, signer } = nearConnect(sender, network); - - // Update the Pyth Oracle contract with the price data - // Performs a NEAR function call to the Pyth Oracle contract - // Deposit for transaction fee (balance will be refunded) - const result = await functionCall({ - sender, - receiver, - method: "update_price_feeds", - args: { data: "504e4155010..." }, - deposit: 10000000000000000000000, - deps: { rpcProvider, signer }, - }); - - console.log( - `Transaction 👉 https://testnet.nearblocks.io/txns/${result.outcome.transaction.hash}`, - ); - return result; -} - -updatePythOracle(); -``` - -
- [See full example on - GitHub](https://github.com/near-examples/near-js/blob/main/node-js/oracle-example/pyth-oracle-update.js) -
- -Although unused deposit will be refunded, you can calculate an estimate by calling the `get_update_fee_estimate` method against the Pyth contract. - ---- - -### `get_price` - -> Fetches the most recent price feed stored in the Pyth Oracle contract. Is a view method, so does not require a signature or payment. - -- args: `price_identifier` _(unique [price feed identifier](#environment-variables))_ -- type: `object` -- example: `{ price_identifier: 'f9c0172ba10dfa8...' }` - -After [updating the price feed](#update_price_feeds), you can view the feed on-chain by calling `get_price` on the Pyth Oracle contract. Note that this is a view method and does not require a signature or deposit. - -#### NEAR CLI example - -```bash -near contract \ - call-function \ - as-read-only pyth-oracle.testnet get_price \ - json-args '{"price_identifier": "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b"}' \ - network-config testnet \ - now - -``` - -**Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/integrations/pyth/real-time-price-data/get-price.json)** - -#### NEAR-JS Example - -For this example we will create a simple node.js project. First, install the [`near-js\client`](https://www.npmjs.com/package/@near-js/client) library: - -```bash -npm install @near-js/client -``` - -Create a `get-price.js` file that will perform the view call from the Pyth Oracle contract. Note that this does not require a signature or deposit. - -```js -// near-js import -// https://www.npmjs.com/package/@near-js/client -const { getTestnetRpcProvider, view } = require("@near-js/client"); - -const PRICE_IDS = [ - // Price ids can be found at https://www.pyth.network/developers/price-feed-ids#near-testnet - // NOTE: Ensure you are using NEAR specific price ids & remove the '0x' prefix before using them - "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b", // BTC/USD price id - "ca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6", // ETH/USD price id -]; - -async function getPrice(price_ID, symbol) { - try { - const rpcProvider = getTestnetRpcProvider(); - const result = await view({ - account: "pyth-oracle.testnet", - method: "get_price", - args: { price_identifier: price_ID }, - deps: { rpcProvider }, - }); - console.log(symbol, result); - } catch (error) { - console.error(`Error fetching ${symbol} price:`, error.message); - } -} - -getPrice(PRICE_IDS[0], "BTC/USD:"); -``` - -
- [See full example on - GitHub](https://github.com/near-examples/near-js/blob/main/node-js/oracle-example/pyth-oracle-view.js) -
- ---- - -## On-Chain Prices - -For on-chain price interactions, see the [example contract][] in the -Pyth Github repo for an example of how to update and use prices -within a NEAR contract. - -[example contract]: https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/near/example - -A CLI-based approach can also be taken for interacting with Pyth prices, -see the [update.sh][] example script in the repository to see how to -pull prices with the official NEAR cli. - -[update.sh]: https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/near/scripts/update.sh diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/off-chain.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/off-chain.mdx deleted file mode 100644 index cba7d33b07..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/off-chain.mdx +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Real-Time Price Updates in Off-Chain Apps with Hermes-Client -description: >- - Harness hermes-client to retrieve real-time prices and subscribe to live - updates in your off-chain applications. (Note: price-service-sdk is - deprecated.) -full: false -index: false ---- - -# How to Use Real-Time Data in Off-Chain Applications - -This guide explains how to fetch the latest prices and subscribe to real-time price updates in off-chain applications. - - -
[`price-service-sdk`](https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/client/js) was is deprecated and replaced by the [`hermes-client`](https://github.com/pyth-network/pyth-crosschain/tree/main/apps/hermes/client/js). - It can be used for fetching prices for off-chain applications as well as fetching price updates.
- -
Please refer to the [fetch-price-updates](../fetch-price-updates) guide for the details.
-
diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/solana.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/solana.mdx deleted file mode 100644 index 4b6e15fc27..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/solana.mdx +++ /dev/null @@ -1,384 +0,0 @@ ---- -title: Using Pyth Network for Real-Time Data in Solana & SVM Programs -description: >- - Fetch real-time Pyth price feeds in Solana programs: configure the SDK, read - on-chain data, integrate with your frontend, and use TWAP for reliable - pricing. -full: false -index: false ---- - -# How to Use Real-Time Data in Solana Programs - -This guide explains how to use real-time Pyth data in Solana applications. - -## Install Pyth SDKs - -Pyth provides two SDKs for Solana applications to cover the on- and off-chain portions of the integration: - -### Rust SDK - -The [pyth-solana-receiver-sdk](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/pyth_solana_receiver_sdk) crate can be used to consume Pyth prices inside Solana programs written in Rust. -Add this crate to the dependencies section of your `Cargo.toml` file: - -```toml copy -[dependencies] -pyth-solana-receiver-sdk ="x.y.z" # get the latest version from https://crates.io/crates/pyth-solana-receiver-sdk -``` - - -
At the time of writing, [pyth-solana-receiver-sdk](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/pyth_solana_receiver_sdk) is compatible with Anchor `v0.28.0{:js}`, `v0.29.0{:js}`, and `v0.30.1{:js}`. -If you are on `v0.30.0{:js}` or any other version, please move to `v0.30.1{:js}`.
-
- -### Typescript SDK - -Pyth provides two Typescript packages, [@pythnetwork/hermes-client](https://github.com/pyth-network/pyth-crosschain/tree/main/apps/hermes/client/js) and [@pythnetwork/pyth-solana-receiver](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/sdk/js/pyth_solana_receiver), for fetching Pyth prices and submitting them to the blockchain respectively. -Add these packages to your off-chain dependencies: - -```bash copy -npm install --save @pythnetwork/hermes-client @pythnetwork/pyth-solana-receiver -``` - -## Write Contract Code - -Add the following code to your Solana program to read Pyth prices. -Pyth prices are posted to price update accounts that can be passed to any instruction that needs price data. -For developers using Anchor, simply add an `Account<'info, PriceUpdateV2>` field to the `Context` struct: - -```rust {9} copy -use pyth_solana_receiver_sdk::price_update::{PriceUpdateV2}; - -#[derive(Accounts)] -#[instruction()] -pub struct Sample<'info> { - #[account(mut)] - pub payer: Signer<'info>, - // Add this account to any instruction Context that needs price data. - pub price_update: Account<'info, PriceUpdateV2>, -} -``` - - -
Users must ensure that the account passed to their instruction is owned by the Pyth Pull Oracle program. -Using Anchor with the `Account<'info, PriceUpdateV2>` type will automatically perform this check. -However, it is the developer's responsibility to perform this check if they are not using Anchor.
-
- -Next, update the instruction logic to read the price from the price update account: - -```rust copy -pub fn sample(ctx: Context) -> Result<()> { - let price_update = &mut ctx.accounts.price_update; - // get_price_no_older_than will fail if the price update is more than 30 seconds old - let maximum_age: u64 = 30; - // get_price_no_older_than will fail if the price update is for a different price feed. - // This string is the id of the BTC/USD feed. See https://pyth.network/developers/price-feed-ids for all available IDs. - let feed_id: [u8; 32] = get_feed_id_from_hex("0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43")?; - let price = price_update.get_price_no_older_than(&Clock::get()?, maximum_age, &feed_id)?; - // Sample output: - // The price is (7160106530699 ± 5129162301) * 10^-8 - msg!("The price is ({} ± {}) * 10^{}", price.price, price.conf, price.exponent); - - Ok(()) -} -``` - - -
Users must validate the price update for the appropriate **price - feed** and **timestamp**. `PriceUpdateV2` guarantees that the account contains - a verified price for _some_ price feed at _some_ point in time. There are - various methods on this struct (such as `get_price_no_older_than`) that users - can use to implement the necessary checks.
- -
- If you choose the price feed account integration (see below), you can use an - account address check to validate the price feed ID. -
- -
- -## Write Frontend Code - -There are two different paths to the frontend integration of Pyth prices on Solana. -Developers can choose to use two different types of accounts: - -- **Price feed accounts** hold a sequence of prices for a specific price feed ID that always moves forward in time. - These accounts have a fixed address that your program can depend on. - The Pyth Data Association maintains a set of price feed accounts that are continuously updated. - Such accounts are a good fit for applications that always want to consume the most recent price. -- **Price update accounts** are ephemeral accounts that anyone can create, overwrite, and close. - These accounts are a good fit for applications that want to consume prices for a specific timestamp. - -Both price feed accounts and price update accounts work identically from the perspective of the on-chain program. -However, the frontend integration differs slightly between the two. -Both options are explained in the sections below, and developers should pick the one that is best suited for their use case. - -### Price Feed Accounts - -For developers using price feed accounts, the frontend code needs to pass the relevant price feed **account address** to the transaction. -Price feed accounts are program-derived addresses and thus the account ID for any price feed can be derived automatically. -The `PythSolanaReceiver` class provides a method for deriving this information: - -```typescript copy -import { PythSolanaReceiver } from "@pythnetwork/pyth-solana-receiver"; - -// You will need a Connection from @solana/web3.js and a Wallet from @coral-xyz/anchor to create -// the receiver. -const connection: Connection; -const wallet: Wallet; -const pythSolanaReceiver = new PythSolanaReceiver({ connection, wallet }); - -// There are up to 2^16 different accounts for any given price feed id. -// The 0 value below is the shard id that indicates which of these accounts you would like to use. -// However, you may choose to use a different shard to prevent Solana congestion on another app from affecting your app. -const solUsdPriceFeedAccount = pythSolanaReceiver - .getPriceFeedAccountAddress(0, SOL_PRICE_FEED_ID) - .toBase58(); -``` - - -
The Price Feed Accounts integration assumes that an off-chain process is - continuously updating each price feed. The Pyth Data Association sponsors - price updates for a subset of commonly used price feeds on shard 0. Please see - [Sponsored Feeds](/price-feeds/sponsored-feeds) for a list of sponsored feeds - and their account addresses.
- -
Additionally, updating a price feed is a -permissionless operation, and anyone can run this process. Please see [Using -Scheduler](/price-feeds/schedule-price-updates/using-scheduler) for more -information. Running the scheduler can help with reliability and update -feed/shard pairs that are not part of the default schedule.
-
- -### Price Update Accounts - -To use price update accounts, the frontend code needs to perform two different tasks: - -1. Fetch price updates from Hermes -2. Post the price updates to Solana and invoke your application logic - -#### Fetch price updates - -Use `PriceServiceConnection` from `@pythnetwork/hermes-client` to fetch Pyth price updates from Hermes: - -```typescript copy -import { HermesClient } from "@pythnetwork/hermes-client"; - -// The URL below is a public Hermes instance operated by the Pyth Data Association. -// Hermes is also available from several third-party providers listed here: -// https://docs.pyth.network/price-feeds/api-instances-and-providers/hermes -const priceServiceConnection = new HermesClient( - "https://hermes.pyth.network/", - {}, -); - -// Hermes provides other methods for retrieving price updates. See -// https://hermes.pyth.network/docs for more information. -const priceUpdateData = ( - await priceServiceConnection.getLatestPriceUpdates( - ["0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"], - { encoding: "base64" }, - ) -).binary.data; - -// Price updates are strings of base64-encoded binary data. Example: -// ["UE5BVQEAAAADuAEAAAADDQJoIZzihVp30/71MXDexqiJDjGpEUEcHj/D06pRiYTPPlRPZKKiVFaZdqiGZ7vvGBj1kK69fKRncCKHXlGyS0LcAQPREzVlm7AcY+X0/hCupv8M5KMhEgOCxq5LxCCKQjL/xwm4jTCJrwkHn/PBaoirnlbHMjxAlwJaFF4RGeE1KRDeAASQIFjfbbobiq2OcSRnK3Ny1NY2Zd012ahIhoWpqxbv4UqDZXLh+bPm4Q14SfO/llRTOmqG6O4v+nfjZa7WNjgxAAZFANqAEooKvijK+476YBITKono+vJ4bSQHUiXOaiGs/zcI6WYGRM0xc6ov2mfCaTuH7mx3ElaLyPGvRX4D9DyHAAf+dPg+NEepwMJI1qPLRcTy0xoz2Yq0k2MuL87gCBsYVlS31atGsQcrXfHr4xcTKKyEUh1tIaOfRbPdX1cvs4D6AAj2/vuKpAgYWhd2gtqHsQLV1vMgq8SKH8wiOmhaMZ06GAQSM1pYLpHZRhYaUQbrUJAeqEeX+qMMqQFMPSSUnEKNAAmCE98NUYbHuEoxJGMDybTGCyDEXCmaNM0q6GT0qrbSmT6NF50yz9CE30WWHNOZzFtK2rCyBYFH2aAp6lQ1JKfmAQpW/wUaOhSdwGiEPWvpY3FWL077i0c4auXQjSQNaDD0cBnmvJTS5R3KxK5aunuUvVAT1mHTnpKHIzNKyu7ICM2zAQvrIFfWRFjVE0zRCvoAcvMpmpS7atWu8VgvklpZh9Qt9xYSO2Yq/asgNsMSQaowXiU0MfjggS+UJ8yWaOpUg18vAAxAMuUlOjNzFj6oPES850YNu2k7PM7AGL8Gb/8+HshkfjG0GsNR8H8/vB8v/iEcaScxQFXwtLT0OSgjWMa0ByknAA7PScKUEP8N7iJKYv6lmEs26DZnxzdpGVZRGqbbC0mxyjY0HqsT0rv2wNvy3MbAtABDMsLumII00cRCKBsZXGlKARCC0NzsKnduLsgGfqxYL4yuf910DKrRp5j+fKLmF2QiB2yVT90ja0782/u6BZZUGRMoA/AWl1qvswBtnlSkHcWEABIp74UFLiiA+MBBvBzhLBxSTKXldiLJ75+U/eqK/ej6qT+I+6S1pzT/ntXdpD25jmQhjtsYEqs/rmgs5U2p4AVRAGYULPcAAAAAABrhAfrtrFhR4yubI7X5QRqMK6xKrj7U3XuBHdGnLqSqcQAAAAAC8IR2AUFVV1YAAAAAAAf6dUkAACcQMZv+5jfvAe6sflX1cL7xu9WWQ9UBAFUA5i32yLSoX+GmfbRNwS3l2zMPesZrctxliv7fD0pBW0MAAAaBiqrXwAAAAADYu55y////+AAAAABmFCz3AAAAAGYULPYAAAaFH6MbAAAAAADcBIdMCre0t06ngCnw+N4IkFpZVqOz9YuwKL+UFdt13ZBtay0YZnkw7QGoaTDCLlsNK1tk1F/qgMyOcYozjOTj41XriIpEPeG2HPYl+u0CKolGlCsz1IDu4w2lyh6LWVaMkEybGz7ih4H2RqCj6BVu182ZqsZgJx9ghzKImAo4cIlWzRTwpm4daAqHa4JEyimFDpFt6UeqvS5TNu2F8W+X+edeiph20EulTI7sx38jwhq5Yc0Mf2ElvFgToGQ806Vs2HynuLwh9OIuTTZh"] -console.log(priceUpdateData); -``` - -Consult [Fetch Price Updates](/price-feeds/fetch-price-updates) for more information on fetching price updates from Hermes. - -#### Post price updates - -Finally, post the price update to the Pyth program on Solana. -This step will create the price update account that your application reads from. -Applications typically combine posting the price update and invoking their application into a sequence of transactions. -The `PythSolanaReceiver` class in `@pythnetwork/pyth-solana-receiver` provides a convenient transaction builder to help with this process: - -```typescript copy -import { PythSolanaReceiver } from "@pythnetwork/pyth-solana-receiver"; - -// You will need a Connection from @solana/web3.js and a Wallet from @coral-xyz/anchor to create -// the receiver. -const connection: Connection; -const wallet: Wallet; -const pythSolanaReceiver = new PythSolanaReceiver({ connection, wallet }); - -// Set closeUpdateAccounts: true if you want to delete the price update account at -// the end of the transaction to reclaim rent. -const transactionBuilder = pythSolanaReceiver.newTransactionBuilder({ - closeUpdateAccounts: false, -}); -await transactionBuilder.addPostPriceUpdates(priceUpdateData); - -// Use this function to add your application-specific instructions to the builder -await transactionBuilder.addPriceConsumerInstructions( - async ( - getPriceUpdateAccount: (priceFeedId: string) => PublicKey, - ): Promise => { - // Generate instructions here that use the price updates posted above. - // getPriceUpdateAccount() will give you the account for each price update. - return []; - }, -); - -// Send the instructions in the builder in 1 or more transactions. -// The builder will pack the instructions into transactions automatically. -await pythSolanaReceiver.provider.sendAll( - await transactionBuilder.buildVersionedTransactions({ - computeUnitPriceMicroLamports: 50000, - }), - { skipPreflight: true }, -); -``` - -The [SDK documentation](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/sdk/js/pyth_solana_receiver) contains more information about interacting with the Pyth solana receiver contract, including working examples. - - -
- Posting and verifying price updates currently requires multiple transactions - on Solana. If your usecase requires a single transaction, you can reduce the - verification level of the posted price updates by replacing - `addPostPriceUpdates` by `addPostPartiallyVerifiedPriceUpdates` in the - transaction builder. Please read the - [VerificationLevel](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/pyth_solana_receiver_sdk/src/price_update.rs#L20) - docs to understand more about the data integrity tradeoffs when using - partially verified price updates. -
-
- -## Time-Weighted Average Price (TWAP) - -Pyth also provides Time-Weighted Average Price (TWAP) for Solana applications. TWAP represents the average price over a specified time window, which can be useful for reducing the impact of short-term price volatility. The TWAP window is currently limited to a maximum of 10 minutes (600 seconds). - -### Using TWAP in Solana Programs - -To use TWAP in your Solana program, import the `TwapUpdate` struct from the Pyth Solana receiver SDK. The process for fetching and posting TWAP updates is similar to regular price updates from Hermes. - -```rust copy -use pyth_solana_receiver_sdk::price_update::{TwapUpdate}; - -#[derive(Accounts)] -#[instruction(twap_window_seconds: u64)] -pub struct SampleWithTwap<'info> { - #[account(mut)] - pub payer: Signer<'info>, - // Add this account to any instruction Context that needs TWAP data - pub twap_update: Account<'info, TwapUpdate>, -} -``` - -Update your instruction logic to read the TWAP from the update account: - -```rust copy -pub fn sample_with_twap( - ctx: Context, - twap_window_seconds: u64, -) -> Result<()> { - let twap_update = &mut ctx.accounts.twap_update; - // get_twap_no_older_than will fail if the price update is more than 30 seconds old - let maximum_age: u64 = 30; - // Specify the price feed ID and the window in seconds for the TWAP - let feed_id: [u8; 32] = get_feed_id_from_hex("0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43")?; - let price = twap_update.get_twap_no_older_than( - &Clock::get()?, - maximum_age, - twap_window_seconds, - &feed_id, - )?; - - // Sample output: - // The TWAP price is (7160106530699 ± 5129162301) * 10^-8 - msg!("The TWAP price is ({} ± {}) * 10^{}", price.price, price.conf, price.exponent); - - Ok(()) -} -``` - -### Fetching and Posting TWAP Updates - -To use TWAP updates in your application, you need to fetch them from Hermes and post them to Solana: - -#### Fetch TWAP updates from Hermes - -Use `HermesClient` from `@pythnetwork/hermes-client` to fetch TWAP updates: - -```typescript copy -import { HermesClient } from "@pythnetwork/hermes-client"; - -// The URL below is a public Hermes instance operated by the Pyth Data Association. -// Hermes is also available from several third-party providers listed here: -// https://docs.pyth.network/price-feeds/api-instances-and-providers/hermes -const hermesClient = new HermesClient("https://hermes.pyth.network/", {}); - -// Specify the price feed ID and the TWAP window in seconds (maximum 600 seconds) -const twapWindowSeconds = 300; // 5 minutes -const twapUpdateData = await hermesClient.getLatestTwaps( - ["0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"], // BTC/USD feed ID - twapWindowSeconds, - { encoding: "base64" }, -); - -// TWAP updates are strings of base64-encoded binary data -console.log(twapUpdateData.binary.data); -``` - -For a complete example of fetching TWAP updates from Hermes, see the [HermesClient example script](https://github.com/pyth-network/pyth-crosschain/blob/main/apps/hermes/client/js/src/examples/HermesClient.ts) in the Pyth crosschain repository. - -#### Post TWAP updates to Solana - -Use `PythSolanaReceiver` to post the TWAP updates and consume them in your application: - -```typescript copy -import { PythSolanaReceiver } from "@pythnetwork/pyth-solana-receiver"; - -// You will need a Connection from @solana/web3.js and a Wallet from @coral-xyz/anchor -const connection: Connection; -const wallet: Wallet; -const pythSolanaReceiver = new PythSolanaReceiver({ connection, wallet }); - -// Create a transaction builder -const transactionBuilder = pythSolanaReceiver.newTransactionBuilder({ - closeUpdateAccounts: false, -}); - -// Add the TWAP update to the transaction -await transactionBuilder.addPostTwapUpdates(twapUpdateData.binary.data); - -// Add your application's instructions that use the TWAP update -await transactionBuilder.addTwapConsumerInstructions( - async ( - getTwapUpdateAccount: (priceFeedId: string) => PublicKey, - ): Promise => { - // Generate instructions here that use the TWAP updates posted above - // getTwapUpdateAccount() will give you the account for each TWAP update - return []; // Replace with your actual instructions - }, -); - -// Send the instructions -await pythSolanaReceiver.provider.sendAll( - await transactionBuilder.buildVersionedTransactions({ - computeUnitPriceMicroLamports: 50000, - }), - { skipPreflight: true }, -); -``` - -For a complete example of posting TWAP updates to Solana, see the [post_twap_update.ts example script](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/sdk/js/pyth_solana_receiver/examples/post_twap_update.ts) in the Pyth crosschain repository. - -## Additional Resources - -You may find these additional resources helpful for developing your Solana application. - -### Example Application - -See an end-to-end example of using Pyth Network prices in the [SendUSD Solana Demo App](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/solana/send_usd). The app allows users to send a USD-denominated amount of SOL using either spot prices or TWAP prices. -It demonstrates how to fetch price data from Hermes from a frontend, post it to the Solana blockchain, and consume it from a smart contract. - -The example includes: - -- A React frontend for interacting with the contract -- Solana programs that consumes spot price updates (Price Update Accounts) and time-averaged price updates (TWAP Accounts) -- Complete transaction building for posting and consuming price data diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/starknet.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/starknet.mdx deleted file mode 100644 index 944f1f364d..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/starknet.mdx +++ /dev/null @@ -1,182 +0,0 @@ ---- -title: Using Real-Time Pyth Data in Starknet Contracts -description: >- - The SDK offers code examples for integrating live Pyth price feeds into - Starknet smart contracts, enabling automated real-time on-chain data updates. -full: false -index: false ---- - -# How to Use Real-Time Data in Starknet Contracts - -This guide explains how to use real-time Pyth data in Starknet contracts. - -## Install the Pyth SDK - -Use the following dependency in your `Scarb.toml` file to use the latest Pyth Starknet package: - -```toml copy -[dependencies] -pyth = { git = "https://github.com/pyth-network/pyth-crosschain.git", tag = "pyth-starknet-contract-v0.1.0"} -``` - -Pyth also provides a javascript SDK to interact with the Pyth contract on Starknet. You can install it using the following command: - - - ```sh copy npm install --save @pythnetwork/pyth-starknet-js ``` - ```sh copy yarn add @pythnetwork/pyth-starknet-js ``` - - -## Write Contract Code - -The code snippet below provides an example module fetching the STRK/USD price from Pyth price feeds: - -```cairo {2,17,47,55,64,71-73} copy -use starknet::ContractAddress; -use pyth::ByteBuffer; - -#[starknet::interface] -pub trait IExampleContract { - // pyth_price_update is the price update data from Pyth to update the price feeds. - // It should be passed as a ByteBuffer. - fn example_method( - ref self: T, pyth_price_update: ByteBuffer - ); -} - -#[starknet::contract] -mod example_contract { - use core::panic_with_felt252; - use starknet::{ContractAddress, get_caller_address, get_contract_address}; - use pyth::{ByteBuffer, IPythDispatcher, IPythDispatcherTrait, UnwrapWithFelt252}; - use openzeppelin::token::erc20::interface::{IERC20CamelDispatcherTrait, IERC20CamelDispatcher}; - - const MAX_PRICE_AGE: u64 = 3600; // 1 hour - // Storage to store the Pyth contract address, the ERC20 contract address representing ETH, and the ETH/USD price feed ID. - #[storage] - struct Storage { - pyth_address: ContractAddress, - strk_erc20_address: ContractAddress, - } - - // Constructor to initialize the contract storage. - // * @param pyth_address: The address of the Pyth contract on Starknet. - // * @param strk_erc20_address: The address of the ERC20 contract representing STRK on Starknet. - #[constructor] - fn constructor( - ref self: ContractState, - pyth_address: ContractAddress, - strk_erc20_address: ContractAddress, - ) { - self.pyth_address.write(pyth_address); - self.strk_erc20_address.write(strk_erc20_address); - } - - #[abi(embed_v0)] - impl ExampleContract of super::IExampleContract { - fn example_method( - ref self: ContractState, - pyth_price_update: ByteBuffer - ) { - let pyth = IPythDispatcher { contract_address: self.pyth_address.read() }; - let strk_erc20 = IERC20CamelDispatcher { - contract_address: self.strk_erc20_address.read() - }; - let caller = get_caller_address(); - let contract = get_contract_address(); - - // Get the fee required to update the Pyth price feeds. - let pyth_fee = pyth.get_update_fee(pyth_price_update.clone(), strk_erc20.contract_address); - if !strk_erc20.transferFrom(caller, contract, pyth_fee) { - panic_with_felt252('insufficient allowance for fee'); - } - if !strk_erc20.approve(pyth.contract_address, pyth_fee) { - panic_with_felt252('approve failed'); - } - - // Submit a pyth_price_update to the Pyth contract to update the on-chain price. - pyth.update_price_feeds(pyth_price_update); - - // Read the current price from a price feed. - // STRK/USD price feed ID - // The complete list of feed IDs is available at https://pyth.network/developers/price-feed-ids - let strk_usd_price_id = - 0x6a182399ff70ccf3e06024898942028204125a819e519a335ffa4579e66cd870; - let price = pyth - .get_price_no_older_than(strk_usd_price_id, MAX_PRICE_AGE) - .unwrap_with_felt252(); - let _: u64 = price.price.try_into().unwrap(); // Price in u64 - } - } -} -``` - -The pyth_price_update argument contains verified prices from Pyth. -Calling pyth.update_price_feeds with this value updates the on-chain Pyth price and ensures your application has recent price data. -The pyth_price_update can be fetched from Hermes; Consult [Fetch Price Updates](https://docs.pyth.network/price-feeds/fetch-price-updates) for more information on how to fetch the pyth_price_update. - - -
- Unlike Ethereum, there is no native token on Starknet. You cannot pass - tokens implicitly when calling functions. Moreover, there is no concept of a - designated payer account, unlike Solana. In Starknet, all token transfers - must be performed explicitly by calling functions on the token's ERC20 - contract. Regarding the Pyth contract on Starknet, the caller must approve - the fee transfer before calling `update_price_feeds` or using similar - methods. You can use **STRK** or **ETH** to pay the fee, but STRK is - preferred. The fee is currently set to the minimum possible value (1e-18 - STRK, 1 WEI). -
-
- -The code snippet above does the following things: - -1. Call `pyth.get_update_fee` to get the fee required to update the Pyth price feeds. -1. Call `pyth.update_price_feeds` and pass `pyth_price_update` to update the Pyth price feeds. -1. Call `pyth.get_price_no_older_than` to read the price, providing the [price feed ID](https://pyth.network/developers/price-feed-ids) you wish to read. - -### Write Client Code - -The code snippet below provides an example of how to fetch price updates and convert to `ByteBuffer` for Starknet using the `pyth-starknet-js` in JavaScript: - -```ts {16} copy -import { PriceServiceConnection } from "@pythnetwork/price-service-client"; -import { ByteBuffer } from "@pythnetwork/pyth-starknet-js"; -// The URL below is a public Hermes instance operated by the Pyth Data Association. -// Hermes is also available from several third-party providers listed here: -// https://docs.pyth.network/price-feeds/api-instances-and-providers/hermes -const connection = new PriceServiceConnection("https://hermes.pyth.network", { - priceFeedRequestConfig: { - binary: true, - }, -}); - -const priceId = - "0x6a182399ff70ccf3e06024898942028204125a819e519a335ffa4579e66cd870"; // STRK/USD - -// Get the latest values of the price feeds as json objects. -const currentPrices = await connection.getLatestPriceFeeds([priceId]); - -// Convert the price update to Starknet format. -const pythUpdate = ByteBuffer.fromBase64(currentPrices[0].vaa); -``` - - -
- Price updates must be converted to `ByteBuffer` before being passed on to - the Pyth contract on Starknet. Use the `ByteBuffer` type from - `@pythnetwork/pyth-starknet-js` package as shown above. -
-
- -## Additional Resources - -You may find these additional resources helpful for developing your Starknet application. - -### Interface - -The [Starknet Interface](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/starknet/contracts/src/pyth/interface.cairo#L9) provides a list of functions that can be called on the Pyth contract deployed on Starknet. - -### Example Applications - -- [Send-USD](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/starknet), which updates and consumes STRK/USD price feeds on Starknet to send USD to a recipient. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/sui.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/sui.mdx deleted file mode 100644 index 90963450f2..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/sui.mdx +++ /dev/null @@ -1,216 +0,0 @@ ---- -title: Using Real-Time Pyth Data in Sui Contracts -description: >- - Pyth provides SDKs, sample contracts, and tutorials for integrating real-time - price feeds into Sui applications. You can fetch current price data and update - on-chain feeds using these tools. -full: false -index: false ---- - -# How to Use Real-Time Data in Sui Contracts - -This guide explains how to use real-time Pyth data in Sui applications. - -## Install Pyth SDK - -Use the following dependency in your `Move.toml` file to use the latest Pyth Sui package and its dependencies: - - - -```sh copy -[dependencies.Pyth] -git = "https://github.com/pyth-network/pyth-crosschain.git" -subdir = "target_chains/sui/contracts" -rev = "sui-contract-mainnet" - -[dependencies.Wormhole] -git = "https://github.com/wormhole-foundation/wormhole.git" -subdir = "sui/wormhole" -rev = "sui/mainnet" - -# Pyth is locked into this specific `rev` because the package depends on Wormhole and is pinned to this version. - -[dependencies.Sui] -git = "https://github.com/MystenLabs/sui.git" -subdir = "crates/sui-framework/packages/sui-framework" -rev = "041c5f2bae2fe52079e44b70514333532d69f4e6" - -```` - - -```sh copy -[dependencies.Pyth] -git = "https://github.com/pyth-network/pyth-crosschain.git" -subdir = "target_chains/sui/contracts" -rev = "sui-contract-testnet" - -[dependencies.Wormhole] -git = "https://github.com/wormhole-foundation/wormhole.git" -subdir = "sui/wormhole" -rev = "sui/testnet" - -# Pyth is locked into this specific `rev` because the package depends on Wormhole and is pinned to this version. -[dependencies.Sui] -git = "https://github.com/MystenLabs/sui.git" -subdir = "crates/sui-framework/packages/sui-framework" -rev = "041c5f2bae2fe52079e44b70514333532d69f4e6" -```` - - - - -Pyth also provides a javascript SDK to construct transaction blocks that update price feeds: - - - - ```sh - # NPM - npm install --save @pythnetwork/pyth-sui-js - - # Yarn - yarn add @pythnetwork/pyth-sui-js - ``` - - - - -## Write Contract Code - -The code snippet below provides a general template for what your contract code should look like: - -```rust {18} copy -module pyth_example::main { - use sui::clock::Clock; - use pyth::price_info; - use pyth::price_identifier; - use pyth::price; - use pyth::pyth; - use pyth::price_info::PriceInfoObject; - - const E_INVALID_ID: u64 = 1; - - public fun use_pyth_price( - // Other arguments - clock: &Clock, - price_info_object: &PriceInfoObject, - ){ - let max_age = 60; - // Make sure the price is not older than max_age seconds - let price_struct = pyth::get_price_no_older_than(price_info_object,clock, max_age); - - // Check the price feed ID - let price_info = price_info::get_price_info_from_price_info_object(price_info_object); - let price_id = price_identifier::get_bytes(&price_info::get_price_identifier(&price_info)); - - // ETH/USD price feed ID - // The complete list of feed IDs is available at https://pyth.network/developers/price-feed-ids - // Note: Sui uses the Pyth price feed ID without the `0x` prefix. - assert!(price_id!=x"ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", E_INVALID_ID); - - // Extract the price, decimal, and timestamp from the price struct and use them - let decimal_i64 = price::get_expo(&price_struct); - let price_i64 = price::get_price(&price_struct); - let timestamp_sec = price::get_timestamp(&price_struct); - } -} -``` - -One can consume the price by calling `pyth::get_price` abovementioned or other utility functions on the `PriceInfoObject` in the Move module - -The code snippet below provides an example of how to update the Pyth price feeds: - -```ts copy -import { SuiPriceServiceConnection, SuiPythClient } from "@pythnetwork/pyth-sui-js"; -import { TransactionBlock } from "@mysten/sui.js"; - -// Get the Stable Hermes service URL from https://docs.pyth.network/price-feeds/api-instances-and-providers/hermes -const connection = new SuiPriceServiceConnection("https://hermes-beta.pyth.network"); - -const priceIDs = [ - // You can find the IDs of prices at https://pyth.network/developers/price-feed-ids - "0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43", // BTC/USD price ID - "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", // ETH/USD price ID -]; - -const priceUpdateData = await connection.getPriceFeedsUpdateData(priceIDs); - -// It is either injected from the browser or instantiated in the backend via some private key -const wallet: SignerWithProvider = getWallet(); -// Get the state IDs of the Pyth and Wormhole contracts from -// https://docs.pyth.network/price-feeds/contract-addresses/sui -const wormholeStateId = "0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a"; -const pythStateId = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"; - -const client = new SuiPythClient(wallet.provider, pythStateId, wormholeStateId); -const tx = new TransactionBlock(); -const priceInfoObjectIds = await client.updatePriceFeeds(tx, priceFeedUpdateData, priceIDs); - -tx.moveCall({ - target: `pyth_example::main::use_pyth_price`, - arguments: [ - ..., // other arguments needed for your contract - tx.object(priceInfoObjectIds[0]), - ], -}); - -const txBlock = { - transactionBlock: tx, - options: { - showEffects: true, - showEvents: true, - }, -}; - -const result = await wallet.signAndExecuteTransactionBlock(txBlock); -``` - -By calling the `updatePriceFeeds` function, the `SuiPythClient` adds the necessary transactions to the transaction block to update the price feeds. - - -
Your Sui Move module **should NOT** have a hard-coded call to `pyth::update_single_price_feed.` In other words, a contract should **never call** the Sui Pyth `pyth::update_single_price_feed` entry point. Instead, it should be called directly from client code (e.g., Typescript or Rust).
- -
When Sui contracts are [upgraded](<(https://docs.sui.io/build/package-upgrades)>), the address changes, which makes the old address no longer valid. If your module has a hard-coded call to `pyth::update_single_price_feed` living at a fixed call-site, it may eventually get bricked due to how Pyth upgrades are implemented. (Pyth only allow users to interact with the most recent package version for security reasons).
- -
- Therefore, you should build a [Sui programmable - transaction](https://docs.sui.io/build/prog-trans-ts-sdk) that first updates - the price by calling `pyth::update_single_price_feed` at the latest call-site - from the client-side and then call a function in your contract that invokes - `pyth::get_price` on the `PriceInfoObject` to get the recently updated price. - You can use `SuiPythClient` to build such transactions and handle all the - complexity of updating the price feeds. -
- -
Consult [Fetch Price Updates](../fetch-price-updates) for more information on how to fetch the `pyth_price_update`.
-
- -## Additional Resources - -You may find these additional resources helpful for developing your Sui application. - -### CLI Example - -[This example](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/sui/cli) shows how to update prices on a Sui network. It does the following: - -1. Fetches update data from Hermes for the given price feeds. -1. Call the Pyth Sui contract with a price update. - -You can run this example with `npm run example-relay`. A full command that updates prices on the Sui testnet looks like this: - -```bash -export SUI_KEY=YOUR_PRIV_KEY; -npm run example-relay -- --feed-id "5a035d5440f5c163069af66062bac6c79377bf88396fa27e6067bfca8096d280" \ ---hermes "https://hermes-beta.pyth.network" \ ---full-node "https://fullnode.testnet.sui.io:443" \ ---pyth-state-id "0xd3e79c2c083b934e78b3bd58a490ec6b092561954da6e7322e1e2b3c8abfddc0" \ ---wormhole-state-id "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790" -``` - -### Contract Addresses - -Consult [Sui Contract Addresses](../contract-addresses/sui) to find the package IDs. - -### Pyth Price Feed IDs - -Consult [Pyth Price Feed IDs](https://pyth.network/developers/price-feed-ids) to find Pyth price feed IDs for various assets. diff --git a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/ton.mdx b/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/ton.mdx deleted file mode 100644 index 16be590fd7..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v1/use-real-time-data/ton.mdx +++ /dev/null @@ -1,148 +0,0 @@ ---- -title: "Pyth Network TON Integration: Real-Time Data Usage" -description: >- - Easily integrate Pyth Network’s live price feeds into your TON apps. Use our - SDK, handle smart contract interactions, and automate data updates for - precise, on-chain pricing. -full: false -index: false ---- - -# How to Use Real-Time Data in TON Contracts - -This guide explains how to use real-time Pyth data in TON applications. - -## Install the Pyth SDK - -Install the Pyth TON SDK and other necessary dependencies using npm: - - - - {/* prettier-ignore-start */} - - ```sh copy - npm install @pythnetwork/pyth-ton-js @pythnetwork/hermes-client @ton/core @ton/ton @ton/crypto - ``` - - {/* prettier-ignore-end */} - - - - {/* prettier-ignore-start */} - - ```sh copy - yarn add @pythnetwork/pyth-ton-js @pythnetwork/hermes-client @ton/core @ton/ton @ton/crypto - ``` - - {/* prettier-ignore-end */} - - - - -## Write Contract Code - -The code snippet below provides an example sending a message to the Pyth price feed contract and call the `parse_price_feed_updates` method: - -```lisp copy - ;; Create message to Pyth contract according to schema - cell msg = begin_cell() - .store_uint(0x18, 6) ;; nobounce - .store_slice(ctx_pyth_address) ;; pyth contract address - .store_coins(forward_amount) ;; forward amount minus fees - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers - .store_uint(PYTH_OP_PARSE_PRICE_FEED_UPDATES, 32) ;; pyth opcode - .store_ref(price_update_data) ;; update data - .store_ref(price_ids) ;; price feed IDs - .store_uint(now() - 100, 64) ;; min_publish_time - .store_uint(now() + 100, 64) ;; max_publish_time - .store_slice(my_address()) ;; target address (this contract) - .store_ref(custom_payload) ;; custom payload with recipient and amount - .end_cell(); - - send_raw_message(msg, 0); -``` - -## Write Client Code - -The following code snippet demonstrates how to fetch price updates, interact with the Pyth contract on TON, and update price feeds: - -```typescript copy -import { TonClient, Address, WalletContractV4 } from "@ton/ton"; -import { toNano } from "@ton/core"; -import { mnemonicToPrivateKey } from "@ton/crypto"; -import { HermesClient } from "@pythnetwork/hermes-client"; -import { - PythContract, - PYTH_CONTRACT_ADDRESS_TESTNET, - calculateUpdatePriceFeedsFee, -} from "@pythnetwork/pyth-ton-js"; -const BTC_PRICE_FEED_ID = - "0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"; -async function main() { - // Initialize TonClient - const client = new TonClient({ - endpoint: "https://testnet.toncenter.com/api/v2/jsonRPC", - apiKey: "your-api-key-here", // Optional - }); - // Create PythContract instance - const contractAddress = Address.parse(PYTH_CONTRACT_ADDRESS_TESTNET); - const contract = client.open(PythContract.createFromAddress(contractAddress)); - // Get current guardian set index - const guardianSetIndex = await contract.getCurrentGuardianSetIndex(); - console.log("Guardian Set Index:", guardianSetIndex); - // Get BTC price from TON contract - const price = await contract.getPriceUnsafe(BTC_PRICE_FEED_ID); - console.log("BTC Price from TON contract:", price); - // Fetch latest price updates from Hermes - const hermesEndpoint = "https://hermes.pyth.network"; - const hermesClient = new HermesClient(hermesEndpoint); - const priceIds = [BTC_PRICE_FEED_ID]; - const latestPriceUpdates = await hermesClient.getLatestPriceUpdates( - priceIds, - { encoding: "hex" }, - ); - console.log("Hermes BTC price:", latestPriceUpdates.parsed?.[0].price); - // Prepare update data - const updateData = Buffer.from(latestPriceUpdates.binary.data[0], "hex"); - console.log("Update data:", updateData); - // Get update fee - const updateFee = await contract.getUpdateFee(updateData); - console.log("Update fee:", updateFee); - const totalFee = - calculateUpdatePriceFeedsFee(BigInt(updateFee)) + BigInt(updateFee); - // Update price feeds - const mnemonic = "your mnemonic here"; - const key = await mnemonicToPrivateKey(mnemonic.split(" ")); - const wallet = WalletContractV4.create({ - publicKey: key.publicKey, - workchain: 0, - }); - const provider = client.open(wallet); - await contract.sendUpdatePriceFeeds( - provider.sender(key.secretKey), - updateData, - totalFee, - ); - console.log("Price feeds updated successfully."); -} -main().catch(console.error); -``` - -This code snippet does the following: - -1. Initializes a `TonClient` and creates a `PythContract` instance. -2. Retrieves the current guardian set index and BTC price from the TON contract. -3. Fetches the latest price updates from Hermes. -4. Prepares the update data and calculates the update fee. -5. Updates the price feeds on the TON contract. - -## Additional Resources - -You may find these additional resources helpful for developing your TON application: - -- [TON Documentation](https://ton.org/docs/) -- [Pyth Price Feed IDs](https://pyth.network/developers/price-feed-ids) -- [Pyth TON Contract](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ton/contracts) -- [Pyth TON SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ton/sdk) -- [Pyth TON SDK Example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/ton/sdk_js_usage) -- [Pyth TON Send USD Example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/ton/send_usd) diff --git a/apps/developer-hub/content/docs/price-feeds/v2/acquire-an-access-token.mdx b/apps/developer-hub/content/docs/price-feeds/v2/acquire-an-access-token.mdx deleted file mode 100644 index 9370d279f9..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/acquire-an-access-token.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Acquire an Access Token" -description: "This guide explains how to acquire an access token for Pyth Lazer, which is required to authenticate websocket connections and subscribe to price updates." -full: false -index: false ---- - -This guide explains how to acquire an access token for Pyth Lazer, which is required to authenticate websocket connections and subscribe to price updates. - -## Request Access Token - -Please fill out [this form](https://tally.so/r/nP2lG5) to contact the Pyth team and get the access token. - - - Access tokens are required for all Pyth Lazer websocket connections. Make sure - to keep your token secure and do not share it publicly. - - -## Using the Access Token - -Once you receive your access token, use it to authenticate the websocket connection by passing it as an `Authorization` header with the value `Bearer {token}`. - -### Example Usage - -```js copy -import { PythLazerClient } from "@pythnetwork/pyth-lazer-sdk"; - -const client = await PythLazerClient.create( - ["wss://pyth-lazer.dourolabs.app/v1/stream"], - "YOUR_ACCESS_TOKEN", -); -``` - -## Next Steps - -After acquiring your access token, you can proceed to [subscribe to price updates](./subscribe-price-updates.mdx) using the Pyth Lazer websocket API. diff --git a/apps/developer-hub/content/docs/price-feeds/v2/getting-started.mdx b/apps/developer-hub/content/docs/price-feeds/v2/getting-started.mdx deleted file mode 100644 index c5b3adda18..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/getting-started.mdx +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Getting Started with Pyth Lazer" -description: "Please refer to the how-to guides to get started." -full: false -index: false ---- diff --git a/apps/developer-hub/content/docs/price-feeds/v2/index.mdx b/apps/developer-hub/content/docs/price-feeds/v2/index.mdx deleted file mode 100644 index e27c477362..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/index.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "Pyth Lazer" -description: >- - Pyth Lazer is a low latency, highly customizable price oracle. -full: false -index: true ---- - -Pyth Lazer is a low latency, highly customizable price oracle. -It offers a customizable set of price feeds, target chains (EVM or Solana) and channels (real time or fixed rate): - -- Real time channels send updates as frequently as they become available; -- Fixed rate channels send updates at fixed time intervals (you can choose between 50 ms or 200 ms). - -The table below shows the difference between Pyth Core and Pyth Lazer: - -| | **Pyth Core** | **Pyth Lazer** | -| ----------------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| **Solution Type** | Stable, secure, and decentralized price data source for a broad spectrum of DeFi or TradFi applications. | **Permissioned** service focused on **ultra-low-latency** price and market data for highly latency-sensitive users. | -| **Frequency** | 400ms on Pythnet appchain with support for risk mitigation via Benchmarks and confidence intervals. | **1ms** (**real-time**), 50ms, and 200ms channels, **customizable** frequencies, and throttling support to address different needs. | -| **Data Types** | Aggregate price and confidence intervals. | Aggregate price, bid/ask price, and **customizable** market data (market depth and more). | -| **Fees** | On-chain fee per signed cross-chain price update. | On-chain fee per signed cross-chain price update. | -| **Update Costs** | >1,000-byte proofs and complex signature verification. | **100-byte proofs** and simple signature verification. | -| **Integration Process** | Open and permissionless integration for any Web3 or Web2 protocol. | **Specialized** and **permissioned** solution for protocols prioritizing performance over some elements of decentralization. | diff --git a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/meta.json b/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/meta.json deleted file mode 100644 index 7407cf49fd..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "title": "Integrate as a Consumer", - "description": "Real-time data from financial institutions", - "icon": "ChartLine", - "pages": ["on-solana-and-fogo", "on-evm-chains"] -} diff --git a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/on-evm-chains.mdx b/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/on-evm-chains.mdx deleted file mode 100644 index fc1253adc9..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/on-evm-chains.mdx +++ /dev/null @@ -1,155 +0,0 @@ ---- -title: "On EVM chains" -description: "This guide explains how to integrate Pyth Lazer into your EVM smart contracts." -full: false -index: false ---- - -This guide is intended to serve users who wants to consume prices from the Pyth Lazer on **EVM chains**. - -Integrating with Pyth Lazer in smart contracts as a consumer is a three-step process: - -1. **Use** Pyth Lazer SDK in EVM smart contracts to parse the price updates. -2. **Subscribe** to Pyth Lazer websocket to receive price updates on backend or frontend. -3. **Include** the price updates into the smart contract transactions. - - - -### Use Pyth Lazer SDK in smart contracts - -Pyth Lazer provides a [Solidity SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/lazer/contracts/evm), which allows consumers to parse the price updates. - -```bash copy -forge install pyth-network/pyth-crosschain -``` - -Add the following to `requirements.txt{:js}` file: - -```bash copy -pyth-lazer-sdk/=lib/pyth-network/pyth-crosschain/lazer/contracts/evm -``` - -Once the SDK is installed, one can import the sdk into smart contracts: - -```solidity copy -import { PythLazer } from "pyth-lazer-sdk/PythLazer.sol"; -import { PythLazerLib } from "pyth-lazer-sdk/PythLazerLib.sol"; - -``` - -After importing the SDK, initialize the [`PythLazer`](https://github.com/pyth-network/pyth-crosschain/blob/main/lazer/contracts/evm/src/PythLazer.sol#L7) contract and set up state varables to store prices and timestamps: - -```solidity copy -contract ExampleConsumer { - // Example state. - PythLazer pythLazer; - uint64 public price; - uint64 public timestamp; - - //... - - constructor(address pythLazerAddress) { - pythLazer = PythLazer(pythLazerAddress); - } -} - -``` - -Add an argument of type `bytes calldata{:solidity}` to the method which will receive the Pyth Lazer price udpate: - -```solidity copy -function updatePrice(bytes calldata priceUpdate) public payable { - uint256 verification_fee = pythLazer.verification_fee(); - (bytes calldata payload, ) = verifyUpdate{ value: verification_fee }(update); - //... -} - -``` - -The `verifyUpdate` function will verify the price update and return the payload and the verification fee. This call takes a fee which can be queried from [`verification_fee(){:solidity}`](https://github.com/pyth-network/pyth-crosschain/blob/main/lazer/contracts/evm/src/PythLazer.sol#L9) function and passed to the `verifyUpdate` call. This fee is used to cover the cost of verifying the price update. - -This SDK provides [`parsePayloadHeader`](https://github.com/pyth-network/pyth-crosschain/blob/main/lazer/contracts/evm/src/PythLazerLib.sol#L21) method to retrieve the values from the payload header. - -```solidity copy -(uint64 _timestamp, Channel channel, uint8 feedsLen, uint16 pos) = parsePayloadHeader(payload); -``` - -This method returns: - -- `_timestamp`: The timestamp of the price update. -- `channel`: The channel of the price update. -- `feedsLen`: The number of feeds in the price update. -- `pos`: The cursor position of the payload. - -One can iterate over all the feeds and properties present within the price update, modifying the state variables as necessary. - -Here is an example of how to iterate over the feeds and properties: - -```solidity copy -for (uint8 i = 0; i < feedsLen; i++) { - uint32 feedId; - uint8 num_properties; - (feedId, num_properties, pos) = parseFeedHeader(payload, pos); - for (uint8 j = 0; j < num_properties; j++) { - PriceFeedProperty property; - (property, pos) = parseFeedProperty(payload, pos); - if (property == PriceFeedProperty.Price) { - uint64 _price; - (_price, pos) = parseFeedValueUint64(payload, pos); - if (feedId == 2 && _timestamp > timestamp) { - price = _price; - timestamp = _timestamp; - } - } else if (property == PriceFeedProperty.BestBidPrice) { - uint64 _price; - (_price, pos) = parseFeedValueUint64(payload, pos); - } else if (property == PriceFeedProperty.BestAskPrice) { - uint64 _price; - (_price, pos) = parseFeedValueUint64(payload, pos); - } else { - revert("unknown property"); - } - } -} -``` - - - Make sure to pass the `pos` variable to every parsing call and assign the - returned `pos` value to the same variable. Failure to do so will cause - incorrect parsing results. - - - - When calling these parse functions, you must not skip price feeds or - properties. Every parsing function will modify your `pos` variable, so - skipping a call of `parseFeedHeader`, `parseFeedProperty`, or - `parseFeedValueUint64` will lead to incorrect parsing results. Keep in mind - that you can customize the set of price feeds and properties when requesting - price updates via WebSocket. This will be explained in the next step. - - -### Subscribe to Pyth Lazer to receive Price Updates - -Pyth Lazer provides a websocket endpoint to receive price updates. Moreover, Pyth Lazer also provides a [Typescript SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/lazer/sdk/js) to subscribe to the websocket endpoint. - -Consult [How to subscribe to price updates from Pyth Lazer](../subscribe-price-updates.mdx) for a complete step-by-step guide. - -### Include the price updates into smart contract transactions - -Now that you have the price updates, and your smart contract is able to parse the price updates, you can include the price updates into the smart contract transactions by passing the price updates received from the previous step as an argument to the `updatePrice` method of your smart contract. - - - -## Additional Resources - -You may find these additional resources helpful for integrating Pyth Lazer into your EVM smart contracts. - -### Price Feed IDs - -Pyth Lazer supports a wide range of price feeds. Consult the [Price Feed IDs](../price-feed-ids.mdx) page for a complete list of supported price feeds. - -### Examples - -[Pyth-lazer-example-evm](https://github.com/pyth-network/pyth-examples/tree/main/lazer/evm) is a simple example contract that parses and consumes price updates from Pyth Lazer. - -[pyth-lazer-example-js](https://github.com/pyth-network/pyth-examples/tree/main/lazer/js) is a simple example for subscribing to the Pyth Lazer websocket. diff --git a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/on-solana-and-fogo.mdx b/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/on-solana-and-fogo.mdx deleted file mode 100644 index 25ca7feb06..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-consumer/on-solana-and-fogo.mdx +++ /dev/null @@ -1,284 +0,0 @@ ---- -title: "On Solana and FOGO" -description: "This guide explains how to integrate Pyth Lazer into your Solana and FOGO smart contracts." -full: false -index: false ---- - -This guide is intended to serve users who wants to consume prices from the Pyth Lazer on **Solana and Fogo**. - -Integrating with Pyth Lazer in smart contracts as a consumer is a three-step process: - -1. **Use** Pyth Lazer SDK into SVM smart contracts to parse the price updates. -2. **Subscribe** to Pyth Lazer websocket to receive price updates on backend or frontend. -3. **Include** the price updates into the smart contract transactions. - - - -### Use Pyth Lazer SDK in smart contracts - -Pyth Lazer provides a [Solana SDK](https://docs.rs/pyth-lazer-solana-contract/latest/pyth_lazer_solana_contract/), -which allows consumers to parse and verify the price updates on Solana-compatible chains (such as Fogo). - -To start, add the following to your `Cargo.toml` file (please check the current latest version at [crates.io](https://crates.io/crates/pyth-lazer-solana-contract)): - -```toml copy -[dependencies] -pyth-lazer-solana-contract = { version = "x.y.z", features = ["no-entrypoint"] } -``` - -Now you can create an instruction or multiple instructions that will receive Pyth Lazer messages. -The instruction data sent to your program should include a byte array containing the Pyth Lazer message. The instruction data can also contain any other parameters your contracts may need. - -In order to successfully validate the Pyth Lazer message, the instruction needs to receive the following accounts: - -- Fee payer account -- Pyth Lazer program ([`pytd2yyk641x7ak7mkaasSJVXh6YYZnC7wTmtgAyxPt`](https://solscan.io/account/pytd2yyk641x7ak7mkaasSJVXh6YYZnC7wTmtgAyxPt)) -- Pyth Lazer storage account (`3rdJbqfnagQ4yx9HXJViD4zc4xpiSqmFsKpPuSCQVyQL`) -- Pyth Lazer treasury account (`Gx4MBPb1vqZLJajZmsKLg8fGw9ErhoKsR8LeKcCKFyak`) -- The standard Solana system program account -- The standard Solana instructions sysvar account - -You may also add any other accounts your contract needs. - - - The code snippets below are part of the full consumer contract example - [available on - Github](https://github.com/pyth-network/pyth-examples/tree/main/lazer/solana). - - -The following code can be used to set up a new instruction within a SVM contract: - -```rust copy -use num_derive::FromPrimitive; -use num_traits::FromPrimitive; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, FromPrimitive)] -pub enum Instruction { - //... - /// Update price. - /// Data: `UpdateArgs` followed by a signed Pyth Lazer update. - /// Accounts: - /// 1. payer account - /// 2. example data account [writable] - /// 3. pyth program account [readonly] - /// 4. pyth storage account [readonly] - /// 5. pyth treasury account [writable] - /// 6. system program [readonly] - /// 7. instructions sysvar sysvar account [readonly] - Update = 1, -} - -/// Inputs to the `Update` instruction. `UpdateArgs` must be followed by a signed Pyth Lazer message. -#[derive(Debug, Clone, Copy, Zeroable, Pod)] -#[repr(C, packed)] -pub struct UpdateArgs { - /// Example argument - pub hello: u64, -} - -/// Program entrypoint's implementation. -pub fn process_instruction( - program_id: &Pubkey, - accounts: &[AccountInfo], - instruction_data: &[u8], -) -> ProgramResult { - // In our example contract, the first byte is the ID of the instruction. - let instruction = *instruction_data - .first() - .ok_or(ProgramError::InvalidInstructionData)?; - let instruction = - Instruction::from_u8(instruction).ok_or(ProgramError::InvalidInstructionData)?; - let instruction_args = &instruction_data[1..]; - - match instruction { - Instruction::Initialize => { - process_initialize_instruction(program_id, accounts, instruction_args) - } - Instruction::Update => process_update_instruction(program_id, accounts, instruction_args), - } -} - -pub fn process_update_instruction( - program_id: &Pubkey, - accounts: &[AccountInfo], - instruction_args: &[u8], -) -> ProgramResult { - // Verify accounts passed to the instruction. - if accounts.len() != 7 { - return Err(ProgramError::NotEnoughAccountKeys); - } - let payer_account = &accounts[0]; - let data_account = &accounts[1]; - let _pyth_program_account = &accounts[2]; - let pyth_storage_account = &accounts[3]; - let pyth_treasury_account = &accounts[4]; - let system_program_account = &accounts[5]; - let instructions_sysvar_account = &accounts[6]; - // See below for next steps... -} -``` - -Invoke the Pyth Lazer on-chain program with appropriate arguments to validate the Pyth Lazer signature of the message. - -```rust copy -// We expect the instruction to the built-in ed25519 program to be -// the first instruction within the transaction. -let ed25519_instruction_index = 0; -// We expect our signature to be the first (and only) signature to be checked -// by the built-in ed25519 program within the transaction. -let signature_index = 0; -// Verify Lazer signature. -invoke( - &ProgramInstruction::new_with_bytes( - pyth_lazer_solana_contract::ID, - &VerifyMessage { - message_data: pyth_message.to_vec(), - ed25519_instruction_index, - signature_index, - } - .data(), - vec![ - AccountMeta::new(*payer_account.key, true), - AccountMeta::new_readonly(*pyth_storage_account.key, false), - AccountMeta::new(*pyth_treasury_account.key, false), - AccountMeta::new_readonly(*system_program_account.key, false), - AccountMeta::new_readonly(*instructions_sysvar_account.key, false), - ], - ), - &[ - payer_account.clone(), - pyth_storage_account.clone(), - pyth_treasury_account.clone(), - system_program_account.clone(), - instructions_sysvar_account.clone(), - ], -)?; -``` - - - Note: When using native ed25519 signatures on SVM, we must use the built-in - ed25519 program provided by the SVM runtime. This program can't be invoked - from another contract. Instead, it must be called in an explicit instruction - within the submitted transaction. This means that the sender of the - transaction must include that instruction in the transaction. Our SDK - leverages SVM runtime capabilities to ensure the ed25519 program has been - correctly called in the transaction. - - -Now parse the Pyth Lazer message. - -```rust copy -// Deserialize and use the payload. -let data = PayloadData::deserialize_slice_le(verified.payload) - .map_err(|_| ProgramError::InvalidInstructionData)?; - -if data.feeds.is_empty() || data.feeds[0].properties.is_empty() { - return Err(ProgramError::InvalidInstructionData); -} -``` - -Now you can update the state according to the contract's logic: - -```rust copy -// Read the data PDA of our example contract. -let mut state_data = data_account.data.borrow_mut(); -let state = - try_from_bytes_mut::(*state_data).map_err(|_| ProgramError::InvalidAccountData)?; - -if state.price_feed != data.feeds[0].feed_id.0 { - return Err(ProgramError::InvalidInstructionData); -} -if data.channel_id != Channel::RealTime.id() { - return Err(ProgramError::InvalidInstructionData); -} -if data.timestamp_us.0 <= state.latest_timestamp { - return Err(ProgramError::AccountAlreadyInitialized); -} -let PayloadPropertyValue::Price(Some(price)) = data.feeds[0].properties[0] else { - return Err(ProgramError::InvalidInstructionData); -}; -state.latest_price = price.into_inner().into(); -state.latest_timestamp = data.timestamp_us.0; -``` - - - Pyth Lazer also provides - [pyth_lazer_protocol](https://docs.rs/pyth-lazer-protocol/latest/pyth_lazer_protocol/) - Rust crate, which allows consumers to parse the price updates off-chain. - - -### Subscribe to Pyth Lazer to receive Price Updates - -Pyth Lazer provides a websocket endpoint to receive price updates. Moreover, Pyth Lazer also provides a [typescript SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/lazer/sdk/js) to subscribe to the websocket endpoint. - -Consult [How to subscribe to price updates from Pyth Lazer](../subscribe-price-updates.mdx) for a complete step-by-step guide. - -### Include the price updates into smart contract transactions - -Now that you have the price updates, and your smart contract is able to parse the price updates, you can include the price updates into the smart contract transactions by passing the price updates received from the previous step as an argument to the `update_price` method of your smart contract. - -In order to execute signature verification, you need to include an instruction for the built-in Solana ed25519 program in your transaction. - - - - In Rust, you can leverage helpers provided in the `pyth_lazer_solana_contract` crate: - -```rust copy -// Instruction #0 will be ed25519 instruction; -// Instruction #1 will be our contract instruction. -let instruction_index = 1; -// Total offset of Pyth Lazer update within the instruction data; -// 1 byte is the instruction type. -let message_offset = (size_of::() + 1).try_into().unwrap(); -let ed25519_args = pyth_lazer_solana_contract::Ed25519SignatureOffsets::new( - &message, - instruction_index, - message_offset, -); -let mut tx = Transaction::new_with_payer( - &[ - Instruction::new_with_bytes( - solana_program::ed25519_program::ID, - &pyth_lazer_solana_contract::ed25519_program_args(&[ed25519_args]), - vec![], - ), - Instruction::new_with_bytes( - pyth_lazer_solana_example::ID, - &update_data, - vec![ - AccountMeta::new(payer.pubkey(), true), - AccountMeta::new(data_pda_key, false), - AccountMeta::new(pyth_lazer_solana_contract::ID, false), - AccountMeta::new_readonly(pyth_lazer_solana_contract::STORAGE_ID, false), - AccountMeta::new(treasury, false), - AccountMeta::new_readonly(system_program::ID, false), - AccountMeta::new_readonly(sysvar::instructions::ID, false), - ], - ), - ], - Some(&payer.pubkey()), -); -``` - - - - In TypeScript and JavaScript, you can leverage helpers provided in the `@pythnetwork/pyth-lazer-sdk` NPM package. - {/* TODO: add example code */} - - - - -## Additional Resources - -You may find these additional resources helpful for integrating Pyth Lazer into your SVM smart contracts. - -### Price Feed IDs - -Pyth Lazer supports a wide range of price feeds. Consult the [Price Feed IDs](../price-feeds.mdx) page for a complete list of supported price feeds. - -### Examples - -[pyth-lazer-example-solana](https://github.com/pyth-network/pyth-examples/tree/main/lazer/solana) is a simple example contract that parses and consumes price updates from Pyth Lazer. - -[pyth-lazer-example-js](https://github.com/pyth-network/pyth-examples/tree/main/lazer/js) is a simple example for subscribing to the Pyth Lazer websocket. diff --git a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-publisher.mdx b/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-publisher.mdx deleted file mode 100644 index a8fe80a29a..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/integrate-as-a-publisher.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "How to Integrate Pyth Lazer as a Publisher" -description: "This guide explains how to integrate Pyth Lazer as a publisher." -full: false -index: false ---- - -We are working on this guide. Please check back later or contact us here if you wish to publish data on Pyth Lazer. diff --git a/apps/developer-hub/content/docs/price-feeds/v2/meta.json b/apps/developer-hub/content/docs/price-feeds/v2/meta.json deleted file mode 100644 index 904e0f9bea..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/meta.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "root": true, - "title": "Price Feeds V2", - "description": "Real-time data from financial institutions", - "icon": "ChartLine", - "pages": [ - "index", - "getting-started", - "---How-To Guides---", - "acquire-an-access-token", - "subscribe-to-prices", - "...integrate-as-a-consumer", - "integrate-as-a-publisher", - "---Reference Material---", - "price-feed-ids", - "api-reference", - "examples" - ] -} diff --git a/apps/developer-hub/content/docs/price-feeds/v2/subscribe-to-prices.mdx b/apps/developer-hub/content/docs/price-feeds/v2/subscribe-to-prices.mdx deleted file mode 100644 index cdd080dcd6..0000000000 --- a/apps/developer-hub/content/docs/price-feeds/v2/subscribe-to-prices.mdx +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: "Subscribe to Price Updates" -description: "This guide explains how to subscribe to price updates from Pyth Lazer." -full: false -index: false ---- - -This guide explains how to subscribe to price updates from Pyth Lazer. This guide will also explain various properties and configuration options to customize the price updates. - -Subscribing to price updates is a three-step process: - -1. **Acquire** an access token. -2. **Configure** subscription parameters. -3. **Subscribe** to the price updates via [websocket API](https://pyth-lazer.dourolabs.app/docs). - -The websocket server is available at `wss://pyth-lazer.dourolabs.app/v1/stream{:bash}`. - - - -### 1. Acquire an access token - -Please fill out [this form](https://tally.so/r/nP2lG5) to contact the Pyth team and get the access token. - -Use the access token to authenticate the websocket connection by passing it as an `Authorization{:bash}` header with the value `Bearer {token}{:bash}`. - -### 2. Configure subscription parameters - -Lazer supports several request/subscription parameters to customize the received price updates. -These parameters are configured by sending a subscription message to the webservice. -A sample request (using the Lazer SDK client -- see step 3) is shown below: - -```js copy -client.send({ - type: "subscribe", - subscriptionId: 1, - priceFeedIds: [1, 2], - properties: ["price"], - chains: ["solana"], - channel: "fixed_rate@200ms", -}); -``` - -The most significant parameters are: - -- `subscriptionId` is an arbitrary numeric identifier for a subscription. It will be returned back in response by the server. It does not affect the signed payload. -- `priceFeedIds` is the list of price feeds to receive updates for. Data for all price feeds will be present in the signed price updates generated. Refer to the [Price Feed IDs list](./price-feed-ids.mdx) for the supported price feeds. -- `properties` is the list of properties to retrieve, such as **price**, **bestBidPrice**, **bestAskPrice**, etc. -- `chains` is the list of chains to receive a signed payload for, such as **evm**, **solana**, etc. -- `channel` determines the update rate: updates in the **real_time** channel are sent as frequently as possible, while **fixed_rate@200ms** and **fixed_rate@50ms** channels are updated at fixed rates. - -There are also a few other configuration parameters -- see the [API documentation](https://pyth-lazer.dourolabs.app/docs) for more details. - -Determine the most suitable values for your application -- they will be used in the next step. - -### 3. Subscribe to the price updates - -To subscribe to the price updates, send a request to the websocket server. The server will respond with a signed price update. - -1. Pyth Lazer provides an [SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/lazer/sdk/js) to seamlessly integrate the websocket API into your application. - Install it using the following command: - -```bash copy -npm install --save @pythnetwork/pyth-lazer-sdk -``` - -2. Then create a [`PythLazerClient`](https://github.com/pyth-network/pyth-crosschain/blob/main/lazer/sdk/js/src/client.ts#L32) object using the URL and the access token requested from the Pyth team in the first step: - -```js copy -import { PythLazerClient } from "@pythnetwork/pyth-lazer-sdk"; - -const client = await PythLazerClient.create( - ["wss://pyth-lazer.dourolabs.app/v1/stream"], - "YOUR_ACCESS_TOKEN", -); -``` - -3. After the client is created, subscribe to updates (using the configuration parameters from step 2): - -```js copy -client.subscribe({ - type: "subscribe", - subscriptionId: 1, - priceFeedIds: [1, 2], - properties: ["price"], - chains: ["solana"], - channel: "fixed_rate@200ms", -}); -``` - -4. Once the connection is established, the server will start sending the price updates to the client: - -```js copy -client.addMessageListener((message) => { - console.log(message); -}); -``` - -By default, price updates contain the `parsed` field that one can use to easily interpret the price update in their backend or frontend, as well as `evm` and/or `solana` fields that contain data that one should include in the on-chain transaction: - -```json copy -{ - "type": "streamUpdated", - "subscriptionId": 1, - "parsed": { - "timestampUs": "1730986152400000", - "priceFeeds": [ - { - "priceFeedId": 1, - "price": "1006900000000" - }, - { - "priceFeedId": 2, - "price": "2006900000000" - } - ] - }, - "solana": { - "encoding": "hex", - "data": "b9011a82d239c094c52016990d6ca2b261dbb1157ad503cbd3ea0679493316150cf3457624d19ec3f6e0a0e94373ab0971e39d939beda15cc02eb3c5454eb700f1f7310df65210bee4fcf5b1cee1e537fabcfd95010297653b94af04d454fc473e94834f2a0075d3c7938094b99e52260600030201000000010000b5ea6fea00000002000000010000c58f44d3010000" - } -} -``` - - - -## Additional Resources - -You may find these additional resources helpful for subscribing to price updates from Pyth Lazer. - -### Price Feed IDs - -Pyth Lazer supports a wide range of price feeds. Consult the [Price Feed IDs](./price-feed-ids.mdx) page for a complete list of supported price feeds. - -### Examples - -[pyth-lazer-example-js](https://github.com/pyth-network/pyth-examples/tree/main/lazer/js) is a simple example for subscribing to the Pyth Lazer websocket. diff --git a/apps/developer-hub/migration-report.json b/apps/developer-hub/migration-report.json new file mode 100644 index 0000000000..fc21c8fd33 --- /dev/null +++ b/apps/developer-hub/migration-report.json @@ -0,0 +1,6 @@ +[ + { + "source": "pages/price-feeds/core/use-real-time-data/pull-integration/cosmwasm.mdx", + "target": "content/docs/price-feeds/core/use-real-time-data/pull-integration/cosmwasm.mdx" + } +] diff --git a/apps/developer-hub/migration-report.md b/apps/developer-hub/migration-report.md new file mode 100644 index 0000000000..d81796d37a --- /dev/null +++ b/apps/developer-hub/migration-report.md @@ -0,0 +1 @@ +pages/price-feeds/core/use-real-time-data/pull-integration/cosmwasm.mdx -> content/docs/price-feeds/core/use-real-time-data/pull-integration/cosmwasm.mdx diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/assets/Confidence_Interval_and_Crypto_Exchange_Fees_Table_1.png b/apps/developer-hub/public/images/Confidence_Interval_and_Crypto_Exchange_Fees_Table_1.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/publish-data/assets/Confidence_Interval_and_Crypto_Exchange_Fees_Table_1.png rename to apps/developer-hub/public/images/Confidence_Interval_and_Crypto_Exchange_Fees_Table_1.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/publish-data/assets/Confidence_Interval_and_Crypto_Exchange_Fees_Table_2.png b/apps/developer-hub/public/images/Confidence_Interval_and_Crypto_Exchange_Fees_Table_2.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/publish-data/assets/Confidence_Interval_and_Crypto_Exchange_Fees_Table_2.png rename to apps/developer-hub/public/images/Confidence_Interval_and_Crypto_Exchange_Fees_Table_2.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/EMA_Price_Aggregation_1.png b/apps/developer-hub/public/images/EMA_Price_Aggregation_1.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/EMA_Price_Aggregation_1.png rename to apps/developer-hub/public/images/EMA_Price_Aggregation_1.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/EMA_Price_Aggregation_2.png b/apps/developer-hub/public/images/EMA_Price_Aggregation_2.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/EMA_Price_Aggregation_2.png rename to apps/developer-hub/public/images/EMA_Price_Aggregation_2.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_1.png b/apps/developer-hub/public/images/Price_Aggregation_1.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_1.png rename to apps/developer-hub/public/images/Price_Aggregation_1.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_2.png b/apps/developer-hub/public/images/Price_Aggregation_2.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_2.png rename to apps/developer-hub/public/images/Price_Aggregation_2.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_3.png b/apps/developer-hub/public/images/Price_Aggregation_3.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_3.png rename to apps/developer-hub/public/images/Price_Aggregation_3.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_4.png b/apps/developer-hub/public/images/Price_Aggregation_4.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_4.png rename to apps/developer-hub/public/images/Price_Aggregation_4.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_5.png b/apps/developer-hub/public/images/Price_Aggregation_5.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_5.png rename to apps/developer-hub/public/images/Price_Aggregation_5.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_6.png b/apps/developer-hub/public/images/Price_Aggregation_6.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_6.png rename to apps/developer-hub/public/images/Price_Aggregation_6.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_7.png b/apps/developer-hub/public/images/Price_Aggregation_7.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Price_Aggregation_7.png rename to apps/developer-hub/public/images/Price_Aggregation_7.png diff --git a/apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Pull-Architecture-Hermes.png b/apps/developer-hub/public/images/Pull-Architecture-Hermes.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/how-pyth-works/assets/Pull-Architecture-Hermes.png rename to apps/developer-hub/public/images/Pull-Architecture-Hermes.png diff --git a/apps/developer-hub/public/images/guides/gelato/dedicated-msg-sender.png b/apps/developer-hub/public/images/guides/gelato/dedicated-msg-sender.png new file mode 100644 index 0000000000..9aea6f467d Binary files /dev/null and b/apps/developer-hub/public/images/guides/gelato/dedicated-msg-sender.png differ diff --git a/apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/deposit-usdc.png b/apps/developer-hub/public/images/guides/gelato/deposit-usdc.png similarity index 100% rename from apps/developer-hub/content/docs/price-feeds/v1/schedule-price-updates/assets/guides/gelato/deposit-usdc.png rename to apps/developer-hub/public/images/guides/gelato/deposit-usdc.png diff --git a/apps/developer-hub/public/images/guides/gelato/storage-pyth-config.png b/apps/developer-hub/public/images/guides/gelato/storage-pyth-config.png new file mode 100644 index 0000000000..96c39e2416 Binary files /dev/null and b/apps/developer-hub/public/images/guides/gelato/storage-pyth-config.png differ diff --git a/apps/developer-hub/public/images/guides/gelato/task-creation-gist-id.png b/apps/developer-hub/public/images/guides/gelato/task-creation-gist-id.png new file mode 100644 index 0000000000..661d0ea560 Binary files /dev/null and b/apps/developer-hub/public/images/guides/gelato/task-creation-gist-id.png differ diff --git a/apps/developer-hub/public/images/guides/gelato/task-execution.png b/apps/developer-hub/public/images/guides/gelato/task-execution.png new file mode 100644 index 0000000000..0d3dd9780e Binary files /dev/null and b/apps/developer-hub/public/images/guides/gelato/task-execution.png differ