Skip to content

Commit c824b98

Browse files
Move 'Why Update Prices' section to Understanding Pyth (#909)
* 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 <[email protected]> * Apply prettier formatting to EVM guide warning Co-Authored-By: Nidhi Singh <[email protected]> * 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 <[email protected]> * Apply prettier formatting to EVM guide callout Co-Authored-By: Nidhi Singh <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Nidhi Singh <[email protected]>
1 parent ac2f3d1 commit c824b98

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

pages/price-feeds/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,6 @@
6060
},
6161

6262
"pull-updates": "What is a Pull Oracle?",
63+
"why-update-prices": "Why Update Prices",
6364
"how-pyth-works": "How Pyth Works"
6465
}

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

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,13 @@ 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-
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.
52-
53-
This design offers several advantages:
54-
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-
61-
1. Accept `priceUpdate` data from the caller (fetched from [Hermes](../../how-pyth-works/hermes))
62-
2. Call `updatePriceFeeds()` to submit this data on-chain before reading prices
63-
3. Pay a small fee for each update (calculated via `getUpdateFee()`)
64-
6549
<Callout type="warning" emoji="⚠️">
66-
**Important**: If you don't update the price or if the on-chain price becomes
67-
too stale, calls to `getPriceNoOlderThan()` will revert with a `StalePrice`
68-
error (0x19abf40e). See [how to fetch price
69-
updates](../../fetch-price-updates) for more details.
50+
**Important**: Pyth uses a pull oracle model that requires users to update
51+
prices on-chain before reading them. If you don't update the price or if the
52+
on-chain price becomes too stale, calls to `getPriceNoOlderThan()` will revert
53+
with a `StalePrice` error (0x19abf40e). Learn more about [why you need to
54+
update prices](../../why-update-prices) and see [how to fetch price
55+
updates](../../fetch-price-updates) for implementation details.
7056
</Callout>
7157

7258
## Write Contract Code
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Why Update Prices
2+
3+
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.
4+
5+
This design offers several advantages:
6+
7+
- **Lower costs**: You only pay for price updates when you need them
8+
- **Lower latency**: You can fetch the latest price update directly from Pyth's low-latency oracle network and submit it on-chain immediately
9+
- **Flexibility**: Different applications can update prices at different frequencies based on their needs
10+
11+
In the pull integration pattern, your contract must:
12+
13+
1. Accept `priceUpdate` data from the caller (fetched from [Hermes](./how-pyth-works/hermes))
14+
2. Call `updatePriceFeeds()` to submit this data on-chain before reading prices
15+
3. Pay a small fee for each update (calculated via `getUpdateFee()`)
16+
17+
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.

0 commit comments

Comments
 (0)