-
Notifications
You must be signed in to change notification settings - Fork 316
docs: replace deprecated getPrice() with getPriceNoOlderThan() in EVM troubleshooting guide #3324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
docs: replace deprecated getPrice() with getPriceNoOlderThan() in EVM troubleshooting guide #3324
Conversation
… troubleshooting guide Co-Authored-By: Nidhi Singh <nidhi2894@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
| - Update the prices by calling [`updatePriceFeeds()`](https://api-reference.pyth.network/price-feeds/evm/updatePriceFeeds) | ||
| by passing the latest updateData from [Hermes](https://hermes.pyth.network/docs/#/rest/latest_vaas). | ||
| - Another method to fetch the price is [`getPriceUnsafe()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L41) | ||
| - Another method to fetch the price is [`getPriceUnsafe()`](https://api-reference.pyth.network/price-feeds/evm/getPriceUnsafe) |
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.
this should point to
| function getPriceUnsafe( |
| To resolve this issue: | ||
|
|
||
| - Update the prices by calling [`updatePriceFeeds()`]("https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L88") | ||
| - Update the prices by calling [`updatePriceFeeds()`](https://api-reference.pyth.network/price-feeds/evm/updatePriceFeeds) |
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.
this should refer to the code
| function updatePriceFeeds( |
Co-Authored-By: Nidhi Singh <nidhi2894@gmail.com>
…back Co-Authored-By: Nidhi Singh <nidhi2894@gmail.com>
|
|
||
| - Fetch the latest fee by calling [`getUpdateFee()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method and | ||
| provide the required fee to `msg.value` when calling [`updatePriceFeeds()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method. | ||
| - Fetch the latest fee by calling [`getUpdateFee()`](https://api-reference.pyth.network/price-feeds/evm/getUpdateFee) method and |
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.
this should point to
| function getUpdateFee( |
| - Fetch the latest fee by calling [`getUpdateFee()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method and | ||
| provide the required fee to `msg.value` when calling [`updatePriceFeeds()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method. | ||
| - Fetch the latest fee by calling [`getUpdateFee()`](https://api-reference.pyth.network/price-feeds/evm/getUpdateFee) method and | ||
| provide the required fee to `msg.value` when calling [`updatePriceFeeds()`](https://api-reference.pyth.network/price-feeds/evm/updatePriceFeeds) method. |
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.
this should point to
| function updatePriceFeeds( |
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.
Done! I've updated all method links to point to GitHub source code. The updatePriceFeeds() link now points to
| function updatePriceFeeds( |
Co-Authored-By: Nidhi Singh <nidhi2894@gmail.com>
| To resolve this issue: | ||
|
|
||
| - Update the prices by calling [`updatePriceFeeds()`](https://api-reference.pyth.network/price-feeds/evm/updatePriceFeeds) | ||
| - Update the prices by calling [`updatePriceFeeds()`](https://github.com/pyth-network/pyth-crosschain/blob/9825470036fc24de3d52b139087ea0cd4117624a/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L90) |
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.
revert this one
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.
Done! Reverted the updatePriceFeeds() link in the PriceFeedNotFound section back to the API reference URL.
…API reference per review feedback Co-Authored-By: Nidhi Singh <nidhi2894@gmail.com>
| - Update the prices by calling [`updatePriceFeeds()`](https://github.com/pyth-network/pyth-crosschain/blob/9825470036fc24de3d52b139087ea0cd4117624a/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L90) | ||
| by passing the latest updateData from [Hermes](https://hermes.pyth.network/docs/#/rest/latest_vaas). | ||
| - Another method to fetch the price is [`getPriceUnsafe()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L41) | ||
| - Another method to fetch the price is [`getPriceUnsafe()`](https://github.com/pyth-network/pyth-crosschain/blob/9825470036fc24de3d52b139087ea0cd4117624a/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L43) | ||
| If the price feed is available, the method will return the latest prices with timestamp of last update. | ||
| NOTE: `getPriceUnsafe()` method does not check the freshness of the price. | ||
|
|
||
| #### getPrice() reverts with `PriceFeedNotFound()` or `0x14aebe68` error | ||
| #### getPriceNoOlderThan() reverts with `PriceFeedNotFound()` or `0x14aebe68` error | ||
|
|
||
| This error occurs when the requested price feed has not been updated on-chain, or the price feed id is incorrect. | ||
|
|
||
| To resolve this issue: | ||
|
|
||
| - Update the prices by calling [`updatePriceFeeds()`](https://api-reference.pyth.network/price-feeds/evm/updatePriceFeeds) | ||
| by passing the latest updateData from [Hermes](https://hermes.pyth.network/docs/#/rest/latest_vaas). | ||
| - Check the entered [price feed id](../price-feeds) and [pyth-contract address](https://docs.pyth.network/price-feeds/contract-addresses/evm) to make sure they are correct. | ||
|
|
||
| #### updatePriceFeeds() reverts with `InsufficientFee()` or `0x025dbdd4` error | ||
|
|
||
| This error occurs when the fee provided for updating the price feed is insufficient. | ||
| To resolve this issue: | ||
|
|
||
| - Fetch the latest fee by calling [`getUpdateFee()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method and | ||
| provide the required fee to `msg.value` when calling [`updatePriceFeeds()`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol#L112) method. | ||
| - Fetch the latest fee by calling [`getUpdateFee()`](https://github.com/pyth-network/pyth-crosschain/blob/9825470036fc24de3d52b139087ea0cd4117624a/target_chains/ethereum/sdk/solidity/IPyth.sol#L93) method and | ||
| provide the required fee to `msg.value` when calling [`updatePriceFeeds()`](https://github.com/pyth-network/pyth-crosschain/blob/9825470036fc24de3d52b139087ea0cd4117624a/target_chains/ethereum/sdk/solidity/AbstractPyth.sol#L90) method. |
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.
this is not from /main anymore, is that intended?
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.
Yes, this is intentional. @nidhi-singh02 requested that the method links point to a specific commit (9825470036fc24de3d52b139087ea0cd4117624a) rather than /main to ensure the line numbers remain stable and don't break if the source file is modified in the future.
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.
okay sir I didn't know you also respond lol
alexcambose
left a comment
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.
lgtm, seems the links have changed to 9825470036fc24de3d52b139087ea0cd4117624a commit though, idk if that's intended
Summary
Updates the EVM troubleshooting documentation to replace references to the deprecated
getPrice()method with the recommendedgetPriceNoOlderThan()method. Also updates method links to point to GitHub source code at a specific commit for stability.Rationale
The
getPrice()method is deprecated in the Pyth EVM SDK (as noted inAbstractPyth.sol). The recommended replacement isgetPriceNoOlderThan(), which provides more flexibility by allowing users to specify the maximum age of the price via theageparameter.Changes made:
getPrice()togetPriceNoOlderThan()ageparameter instead ofvalidTimePeriodgetValidTime()method9825470036fc24de3d52b139087ea0cd4117624a(except one link kept as API reference per review feedback)How has this been tested?
Documentation-only change. Verified the deprecated status of
getPrice()andgetValidTime()by reviewing the SDK source code intarget_chains/ethereum/sdk/solidity/AbstractPyth.sol.Human Review Checklist
updatePriceFeeds()→ AbstractPyth.sol#L90 (in StalePrice and InsufficientFee sections)getPriceUnsafe()→ AbstractPyth.sol#L43getUpdateFee()→ IPyth.sol#L93updatePriceFeeds()link in the PriceFeedNotFound section correctly uses the API reference URL (kept per review feedback)getPrice()methodLink to Devin run: https://app.devin.ai/sessions/87cef1e82e034658ad12642f6cf66e09
Requested by: Nidhi Singh (@nidhi-singh02)