You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 28, 2025. It is now read-only.
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]>
**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
+
49
67
## Write Contract Code
50
68
51
69
The code snippet below provides a general template for what your contract code should look like:
0 commit comments