From 52d65bd3b26fe7edfde40b766a2659ca04d48e22 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 06:23:55 +0000 Subject: [PATCH 1/4] Add callout explaining why price updates are needed in Pull integration - Added a warning callout before the 'Write Contract Code' section - Explains the pull-based oracle model concept - Highlights advantages: lower costs, lower latency, flexibility - Details the three steps required in Pull integration - Warns about StalePrice error when prices aren't updated Co-Authored-By: Nidhi Singh --- .../pull-integration/evm.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 85efcb3e..fed2729f 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,6 +46,24 @@ 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. + + ## Write Contract Code The code snippet below provides a general template for what your contract code should look like: From e07a7df192bcea6c5f4dc49a2c12e40871d330b3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 06:28:55 +0000 Subject: [PATCH 2/4] Fix formatting (prettier and trailing whitespace) Co-Authored-By: Nidhi Singh --- .../pull-integration/evm.mdx | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 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 fed2729f..f134f2c9 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 @@ -50,18 +50,21 @@ Then add the following line to your `remappings.txt` file: **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. + +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. + ## Write Contract Code From a189298ceefc7aaf962b0d47d524400a6cc54be5 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:22:28 +0000 Subject: [PATCH 3/4] Move title inside callout per review feedback 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 f134f2c9..c65030a9 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,10 +46,10 @@ 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. + **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: From c31ee4dcc1ce1c49166a3be5cacb7c4f7c0a4fea Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:32:54 +0000 Subject: [PATCH 4/4] Restructure to have section heading with Important note in callout Per feedback from @nidhi-singh02: - Added 'Why Update Prices' as a section heading - Moved explanatory content outside the callout - Kept only the Important note about StalePrice errors in the callout Co-Authored-By: Nidhi Singh --- .../use-real-time-data/pull-integration/evm.mdx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 c65030a9..f3278a72 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,10 +46,9 @@ Then add the following line to your `remappings.txt` file: @pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity ``` - - **Why Update Prices?** +## 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-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: @@ -63,8 +62,11 @@ In the Pull integration pattern, your contract must: 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**: 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. ## Write Contract Code