Skip to content

Commit 147d895

Browse files
committed
update
1 parent 2726488 commit 147d895

File tree

4 files changed

+25
-50
lines changed

4 files changed

+25
-50
lines changed
Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 1 deletion
This file was deleted.

price_feeds/evm/pyth_sample/README.md

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,45 @@
1-
## Foundry
1+
# Pyth Oracle sample app
22

3-
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
3+
This directory contains an example of a smart contract using Pyth Price Feeds.
44

5-
Foundry consists of:
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.
66

7-
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
8-
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
9-
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
10-
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
7+
### Building
118

12-
## Documentation
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:
1311

14-
https://book.getfoundry.sh/
15-
16-
## Usage
17-
18-
### Build
19-
20-
```shell
21-
$ forge build
2212
```
23-
24-
### Test
25-
26-
```shell
27-
$ forge test
13+
forge install foundry-rs/[email protected] --no-git --no-commit
2814
```
2915

30-
### Format
16+
After installing the above dependencies, you need to install pyth-sdk-solidity.
3117

32-
```shell
33-
$ forge fmt
3418
```
35-
36-
### Gas Snapshots
37-
38-
```shell
39-
$ forge snapshot
19+
npm init -y
20+
npm install @pythnetwork/pyth-sdk-solidity
4021
```
4122

42-
### Anvil
23+
### Testing
4324

44-
```shell
45-
$ anvil
46-
```
25+
Simply run `forge test` from root directory.
4726

48-
### Deploy
4927

50-
```shell
51-
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
52-
```
28+
### Resources
5329

54-
### Cast
30+
- [Pyth Price Feeds Documentation](https://docs.pyth.network/price-feeds)
31+
- [Pyth Price Feed IDs](https://www.pyth.network/developers/price-feed-ids)
32+
- [Pyth Price Feeds Contracts](https://docs.pyth.network/price-feeds/contract-addresses/evm)
5533

56-
```shell
57-
$ cast <subcommand>
58-
```
34+
### Retrieve Price Updates.
5935

60-
### Help
36+
Price updates can be retrieved using Hermes. It provides various ways to retrieve price updates.
6137

62-
```shell
63-
$ forge --help
64-
$ anvil --help
65-
$ cast --help
38+
For example
39+
40+
```
41+
curl -X 'GET' \
42+
'https://hermes.pyth.network/v2/updates/price/latest?ids%5B%5D=0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43&ids%5B%5D=0xc96458d393fe9deb7a7d63a0ac41e2898a67a7750dbd166673279e06c868df0a'
6643
```
44+
45+
Checkout [How to Fetch Price Updates](https://docs.pyth.network/price-feeds/fetch-price-updates) for more details.

price_feeds/evm/pyth_sample/src/PythSample.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ contract PythSample {
1515
pyth = IPyth(_pyth);
1616
}
1717

18-
1918
// @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
2019
// @param priceUpdate: The encoded data to update the contract with the latest pricecontract-addresses/evm
2120
function getLatestPrice(bytes32 priceId, bytes[] calldata priceUpdate) public payable returns (PythStructs.Price memory) {
@@ -26,7 +25,6 @@ contract PythSample {
2625
return pyth.getPriceNoOlderThan(priceId, 60);
2726
}
2827

29-
3028
// @dev: This function is an example method to update multiple price feeds at once.
3129
// @param priceIds: The price ids of the price feeds.
3230
// @param priceUpdates: The encoded data to update the contract with the latest price

0 commit comments

Comments
 (0)