This repository was archived by the owner on Nov 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Move 'Why Update Prices' section to Understanding Pyth #909
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aef4a37
Move 'Why Update Prices' section to Understanding Pyth
devin-ai-integration[bot] ec1d99c
Apply prettier formatting to EVM guide warning
devin-ai-integration[bot] 6c55202
Address PR feedback: fix terminology and move page to top-level nav
devin-ai-integration[bot] ea8794c
Apply prettier formatting to EVM guide callout
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,27 +46,13 @@ 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()`) | ||
|
|
||
| <Callout type="warning" emoji="⚠️"> | ||
| **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. | ||
| </Callout> | ||
|
|
||
| ## Write Contract Code | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could go up a level (so it shows up in the nav menu for Understanding Pyth) because this is a pretty common question