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

Commit ff8168d

Browse files
authored
Update README.md (#29)
* Update README.md * Address comments * Update readme according to latest change
1 parent a97a2e3 commit ff8168d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ contract ExampleContract {
3131
pyth = IPyth(pythContract);
3232
}
3333
34-
function getBTCUSDPrice(bytes[] memory priceUpdateData) public returns (PythStructs.Price memory) {
35-
// Update the prices to be set to the latest values. The `priceUpdateData` data should be
36-
// retrieved from our off-chain Price Service API using the `pyth-evm-js` package.
34+
function getBTCUSDPrice(bytes[] calldata priceUpdateData) public returns (PythStructs.Price memory) {
35+
// Update the prices to the latest available values and pay the required fee for it. The `priceUpdateData` data
36+
// should be retrieved from our off-chain Price Service API using the `pyth-evm-js` package.
3737
// See section "How Pyth Works on EVM Chains" below for more information.
38-
pyth.updatePriceFeeds(priceUpdateData);
38+
uint fee = pyth.getUpdateFee(priceUpdateData);
39+
pyth.updatePriceFeeds{value: fee}(priceUpdateData);
3940
4041
bytes32 priceID = 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b;
4142
return pyth.getPrice(priceID);
@@ -47,11 +48,9 @@ contract ExampleContract {
4748

4849
Pyth prices are published on Solana, and relayed to EVM chains using the [Wormhole Network](https://wormholenetwork.com/) as a cross-chain message passing bridge. The Wormhole Network observes when Pyth prices on Solana have changed and publishes an off-chain signed message attesting to this fact. This is explained in more detail [here](https://docs.wormholenetwork.com/wormhole/).
4950

50-
This signed message can then be submitted to the Pyth contract on the EVM networks, which will verify the Wormhole message and update the Pyth contract with the new price.
51+
This signed message can then be submitted to the Pyth contract on the EVM networks along the required update fee for it, which will verify the Wormhole message and update the Pyth contract with the new price.
5152

52-
### On-demand price updates
53-
54-
Price updates are not submitted on the EVM networks automatically: rather, when a consumer needs to use the value of a price they should first submit the latest Wormhole update for that price to the Pyth contract on the EVM network they are working on. This will make the most recent price update available on-chain for EVM contracts to use. Updating the price needs to be done in an off-chain program, using the [pyth-evm-js](https://github.com/pyth-network/pyth-js/tree/main/pyth-evm-js) package.
53+
Please refer to [Pyth On-Demand Updates page](https://docs.pyth.network/consume-data/on-demand) for more information.
5554

5655
## Solidity Target Chains
5756

0 commit comments

Comments
 (0)