Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 52d65bd

Browse files
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 <[email protected]>
1 parent 4cd2638 commit 52d65bd

File tree

1 file changed

+18
-0
lines changed
  • pages/price-feeds/use-real-time-data/pull-integration

1 file changed

+18
-0
lines changed

pages/price-feeds/use-real-time-data/pull-integration/evm.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ Then add the following line to your `remappings.txt` file:
4646
@pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity
4747
```
4848

49+
## Why Update Prices?
50+
51+
<Callout type="warning" emoji="⚠️">
52+
**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.
53+
54+
This design offers several advantages:
55+
- **Lower costs**: You only pay for price updates when you need them
56+
- **Lower latency**: You can fetch the latest price update directly from Pyth's low-latency oracle network and submit it on-chain immediately
57+
- **Flexibility**: Different applications can update prices at different frequencies based on their needs
58+
59+
In the Pull integration pattern, your contract must:
60+
1. Accept `priceUpdate` data from the caller (fetched from [Hermes](../../how-pyth-works/hermes))
61+
2. Call `updatePriceFeeds()` to submit this data on-chain before reading prices
62+
3. Pay a small fee for each update (calculated via `getUpdateFee()`)
63+
64+
**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.
65+
</Callout>
66+
4967
## Write Contract Code
5068

5169
The code snippet below provides a general template for what your contract code should look like:

0 commit comments

Comments
 (0)