|
1 | | -## Foundry |
| 1 | +# Pyth Oracle sample app |
2 | 2 |
|
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. |
4 | 4 |
|
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. |
6 | 6 |
|
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 |
11 | 8 |
|
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: |
13 | 11 |
|
14 | | -https://book.getfoundry.sh/ |
15 | | - |
16 | | -## Usage |
17 | | - |
18 | | -### Build |
19 | | - |
20 | | -```shell |
21 | | -$ forge build |
22 | 12 | ``` |
23 | | - |
24 | | -### Test |
25 | | - |
26 | | -```shell |
27 | | -$ forge test |
| 13 | +forge install foundry-rs/[email protected] --no-git --no-commit |
28 | 14 | ``` |
29 | 15 |
|
30 | | -### Format |
| 16 | +After installing the above dependencies, you need to install pyth-sdk-solidity. |
31 | 17 |
|
32 | | -```shell |
33 | | -$ forge fmt |
34 | 18 | ``` |
35 | | - |
36 | | -### Gas Snapshots |
37 | | - |
38 | | -```shell |
39 | | -$ forge snapshot |
| 19 | +npm init -y |
| 20 | +npm install @pythnetwork/pyth-sdk-solidity |
40 | 21 | ``` |
41 | 22 |
|
42 | | -### Anvil |
| 23 | +### Testing |
43 | 24 |
|
44 | | -```shell |
45 | | -$ anvil |
46 | | -``` |
| 25 | +Simply run `forge test` from root directory. |
47 | 26 |
|
48 | | -### Deploy |
49 | 27 |
|
50 | | -```shell |
51 | | -$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> |
52 | | -``` |
| 28 | +### Resources |
53 | 29 |
|
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) |
55 | 33 |
|
56 | | -```shell |
57 | | -$ cast <subcommand> |
58 | | -``` |
| 34 | +### Retrieve Price Updates. |
59 | 35 |
|
60 | | -### Help |
| 36 | +Price updates can be retrieved using Hermes. It provides various ways to retrieve price updates. |
61 | 37 |
|
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' |
66 | 43 | ``` |
| 44 | + |
| 45 | +Checkout [How to Fetch Price Updates](https://docs.pyth.network/price-feeds/fetch-price-updates) for more details. |
0 commit comments