From aef4a371db321523ac395ac0c95c780966ec1dab Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:04:23 +0000 Subject: [PATCH 1/4] Move 'Why Update Prices' section to Understanding Pyth - Created new page at pages/price-feeds/how-pyth-works/why-update-prices.mdx - Updated EVM guide warning to link to the new page - Added new page to navigation in _meta.json Co-Authored-By: Nidhi Singh --- pages/price-feeds/how-pyth-works/_meta.json | 1 + .../how-pyth-works/why-update-prices.mdx | 17 +++++++++++++++ .../pull-integration/evm.mdx | 21 +------------------ 3 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 pages/price-feeds/how-pyth-works/why-update-prices.mdx diff --git a/pages/price-feeds/how-pyth-works/_meta.json b/pages/price-feeds/how-pyth-works/_meta.json index 4f3fddfc..13a6830f 100644 --- a/pages/price-feeds/how-pyth-works/_meta.json +++ b/pages/price-feeds/how-pyth-works/_meta.json @@ -2,6 +2,7 @@ "pythnet": "Pythnet", "oracle-program": "Oracle Program", "cross-chain": "Cross-chain", + "why-update-prices": "Why Update Prices", "fees": "Fees", "hermes": "Hermes", "price-aggregation": "Price Aggregation", diff --git a/pages/price-feeds/how-pyth-works/why-update-prices.mdx b/pages/price-feeds/how-pyth-works/why-update-prices.mdx new file mode 100644 index 00000000..a9e8f13f --- /dev/null +++ b/pages/price-feeds/how-pyth-works/why-update-prices.mdx @@ -0,0 +1,17 @@ +# Why Update Prices + +Pyth uses a pull-based oracle model. Unlike traditional push oracles that automatically update prices on-chain at regular intervals, Pyth requires users to explicitly update the on-chain price before reading it. + +This design offers several advantages: + +- **Lower costs**: You only pay for price updates when you need them +- **Lower latency**: You can fetch the latest price update directly from Pyth's low-latency oracle network and submit it on-chain immediately +- **Flexibility**: Different applications can update prices at different frequencies based on their needs + +In the Pull integration pattern, your contract must: + +1. Accept `priceUpdate` data from the caller (fetched from [Hermes](./hermes)) +2. Call `updatePriceFeeds()` to submit this data on-chain before reading prices +3. Pay a small fee for each update (calculated via `getUpdateFee()`) + +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. See [how to fetch price updates](../fetch-price-updates) for more details on obtaining price updates. diff --git a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx index f3278a72..495cdf3a 100644 --- a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx +++ b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx @@ -46,27 +46,8 @@ Then add the following line to your `remappings.txt` file: @pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity ``` -## Why Update Prices - -Pyth uses a pull-based oracle model. Unlike traditional push oracles that automatically update prices on-chain at regular intervals, Pyth requires users to explicitly update the on-chain price before reading it. - -This design offers several advantages: - -- **Lower costs**: You only pay for price updates when you need them -- **Lower latency**: You can fetch the latest price update directly from Pyth's low-latency oracle network and submit it on-chain immediately -- **Flexibility**: Different applications can update prices at different frequencies based on their needs - -In the Pull integration pattern, your contract must: - -1. Accept `priceUpdate` data from the caller (fetched from [Hermes](../../how-pyth-works/hermes)) -2. Call `updatePriceFeeds()` to submit this data on-chain before reading prices -3. Pay a small fee for each update (calculated via `getUpdateFee()`) - - **Important**: 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). See [how to fetch price - updates](../../fetch-price-updates) for more details. + **Important**: Pyth uses a pull-based 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](../../how-pyth-works/why-update-prices) and see [how to fetch price updates](../../fetch-price-updates) for implementation details. ## Write Contract Code From ec1d99ca8d9e51d058b5d47b820a90c2eb6c0015 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:08:45 +0000 Subject: [PATCH 2/4] Apply prettier formatting to EVM guide warning Co-Authored-By: Nidhi Singh --- .../use-real-time-data/pull-integration/evm.mdx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx index 495cdf3a..d6b59619 100644 --- a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx +++ b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx @@ -47,7 +47,12 @@ Then add the following line to your `remappings.txt` file: ``` - **Important**: Pyth uses a pull-based 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](../../how-pyth-works/why-update-prices) and see [how to fetch price updates](../../fetch-price-updates) for implementation details. + **Important**: Pyth uses a pull-based 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](../../how-pyth-works/why-update-prices) and see [how to + fetch price updates](../../fetch-price-updates) for implementation details. ## Write Contract Code From 6c55202dbc2afa73c89683d07c9aecd4b0a8d4e6 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:39:31 +0000 Subject: [PATCH 3/4] Address PR feedback: fix terminology and move page to top-level nav - Changed 'pull-based oracle model' to 'pull oracle model' (2 occurrences) - Changed 'Pull integration pattern' to 'pull integration pattern' (lowercase) - Moved why-update-prices.mdx from how-pyth-works/ to price-feeds/ level - Updated navigation to show in main 'Understanding Pyth' section - Updated all links to reflect new file location Co-Authored-By: Nidhi Singh --- pages/price-feeds/_meta.json | 1 + pages/price-feeds/how-pyth-works/_meta.json | 1 - .../use-real-time-data/pull-integration/evm.mdx | 10 +++++----- .../{how-pyth-works => }/why-update-prices.mdx | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) rename pages/price-feeds/{how-pyth-works => }/why-update-prices.mdx (63%) diff --git a/pages/price-feeds/_meta.json b/pages/price-feeds/_meta.json index 71e6bd4a..6d4ec639 100644 --- a/pages/price-feeds/_meta.json +++ b/pages/price-feeds/_meta.json @@ -60,5 +60,6 @@ }, "pull-updates": "What is a Pull Oracle?", + "why-update-prices": "Why Update Prices", "how-pyth-works": "How Pyth Works" } diff --git a/pages/price-feeds/how-pyth-works/_meta.json b/pages/price-feeds/how-pyth-works/_meta.json index 13a6830f..4f3fddfc 100644 --- a/pages/price-feeds/how-pyth-works/_meta.json +++ b/pages/price-feeds/how-pyth-works/_meta.json @@ -2,7 +2,6 @@ "pythnet": "Pythnet", "oracle-program": "Oracle Program", "cross-chain": "Cross-chain", - "why-update-prices": "Why Update Prices", "fees": "Fees", "hermes": "Hermes", "price-aggregation": "Price Aggregation", diff --git a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx index d6b59619..5326ba63 100644 --- a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx +++ b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx @@ -47,12 +47,12 @@ Then add the following line to your `remappings.txt` file: ``` - **Important**: Pyth uses a pull-based 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 + **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](../../how-pyth-works/why-update-prices) and see [how to - fetch price updates](../../fetch-price-updates) for implementation details. + to update prices](../../why-update-prices) and see [how to fetch price + updates](../../fetch-price-updates) for implementation details. ## Write Contract Code diff --git a/pages/price-feeds/how-pyth-works/why-update-prices.mdx b/pages/price-feeds/why-update-prices.mdx similarity index 63% rename from pages/price-feeds/how-pyth-works/why-update-prices.mdx rename to pages/price-feeds/why-update-prices.mdx index a9e8f13f..eb35e666 100644 --- a/pages/price-feeds/how-pyth-works/why-update-prices.mdx +++ b/pages/price-feeds/why-update-prices.mdx @@ -1,6 +1,6 @@ # Why Update Prices -Pyth uses a pull-based oracle model. Unlike traditional push oracles that automatically update prices on-chain at regular intervals, Pyth requires users to explicitly update the on-chain price before reading it. +Pyth uses a pull oracle model. Unlike traditional push oracles that automatically update prices on-chain at regular intervals, Pyth requires users to explicitly update the on-chain price before reading it. This design offers several advantages: @@ -8,10 +8,10 @@ This design offers several advantages: - **Lower latency**: You can fetch the latest price update directly from Pyth's low-latency oracle network and submit it on-chain immediately - **Flexibility**: Different applications can update prices at different frequencies based on their needs -In the Pull integration pattern, your contract must: +In the pull integration pattern, your contract must: -1. Accept `priceUpdate` data from the caller (fetched from [Hermes](./hermes)) +1. Accept `priceUpdate` data from the caller (fetched from [Hermes](./how-pyth-works/hermes)) 2. Call `updatePriceFeeds()` to submit this data on-chain before reading prices 3. Pay a small fee for each update (calculated via `getUpdateFee()`) -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. See [how to fetch price updates](../fetch-price-updates) for more details on obtaining price updates. +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. See [how to fetch price updates](./fetch-price-updates) for more details on obtaining price updates. From ea8794cc3d202e09c9fcf39b9042e489fe604c3f Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:40:55 +0000 Subject: [PATCH 4/4] Apply prettier formatting to EVM guide callout Co-Authored-By: Nidhi Singh --- .../price-feeds/use-real-time-data/pull-integration/evm.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx index 5326ba63..dd88fe63 100644 --- a/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx +++ b/pages/price-feeds/use-real-time-data/pull-integration/evm.mdx @@ -49,9 +49,9 @@ Then add the following line to your `remappings.txt` file: **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 + 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.