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
This directory contains an example of a smart contract using Pyth Price Feeds.
4
+
5
+
Please see the [Pyth documentation](https://docs.pyth.network/documentation/pythnet-price-feeds) for more information about Pyth and how to integrate it into your application.
6
+
7
+
### Building
8
+
9
+
You need to have [Foundry](https://getfoundry.sh/) and `node` installed to run this example.
10
+
Once you have installed these tools, run the following commands from root directory to install forge dependencies:
// @param pyth: The contract address of the Pyth contract. Instantiate it with the Pyth contract address from https://docs.pyth.network/price-feeds/contract-addresses/evm
14
+
constructor(address_pyth) {
15
+
pyth =IPyth(_pyth);
16
+
}
17
+
18
+
// @param priceId: Each price feed (e.g., ETH/USD) is identified by a price feed ID. The complete list of feed IDs is available at https://pyth.network/developers/price-feed-ids
19
+
// @param priceUpdate: The encoded data to update the contract with the latest pricecontract-addresses/evm
20
+
function getLatestPrice(bytes32priceId, bytes[] calldatapriceUpdate) publicpayablereturns (PythStructs.Price memory) {
0 commit comments