|
1 | 1 | # Nodary data feed reader example |
2 | 2 |
|
3 | | -> An example project for reading Nodary data feeds |
| 3 | +> An example project that reads a [Nodary](https://nodary.io/) data feed |
4 | 4 |
|
5 | | -See https://github.com/api3dao/data-feed-reader-example for instructions for using API3-managed dAPIs. |
6 | | -This project demonstrates using Nodary feeds without depending on API3 data feed curation or the [API3 Market](https://market.api3.org/dapis) frontend. |
| 5 | +This project demonstrates using a single-source Nodary feed without depending on API3 data feed curation or the [market.api3.org](https://market.api3.org) frontend. |
| 6 | +See https://github.com/api3dao/data-feed-reader-example for an example that uses an API3 data feed. |
7 | 7 |
|
8 | 8 | ## Instructions |
9 | 9 |
|
|
19 | 19 | echo 'MNEMONIC="bike north stone..."' > .env |
20 | 20 | ``` |
21 | 21 |
|
22 | | -- Refer to [`feeds.json`](https://github.com/nodaryio/utilities/blob/main/data/feeds.json) to find a data feed you like |
| 22 | +- Go to [nodary.io/feeds](https://nodary.io/feeds) and find a data feed you like |
23 | 23 |
|
24 | | -- Derive the sponsor wallet addresses. |
25 | | - See the command below, but use your own `FEED_NAME` value. |
| 24 | + - Copy the data feed ID (denoted as the _Beacon ID_) from the table. |
| 25 | + You can also use the following command with your `FEED_NAME` value. |
26 | 26 |
|
27 | | -```sh |
28 | | -FEED_NAME=ETH/USD yarn get-sponsor-wallet-addresses |
29 | | -``` |
| 27 | + ```sh |
| 28 | + FEED_NAME=ETH/USD yarn get-data-feed-id |
| 29 | + ``` |
30 | 30 |
|
31 | | -- Fund the sponsor wallet (unless it is already funded) |
| 31 | + - Copy the sponsor wallet address corresponding to the deviation threshold you like from the table. |
| 32 | + You can also use the following command with your `FEED_NAME` value. |
32 | 33 |
|
33 | | -- Derive the data feed ID. |
34 | | - See the command below, but use your own `FEED_NAME` value. |
| 34 | + ```sh |
| 35 | + FEED_NAME=ETH/USD yarn get-sponsor-wallet-addresses |
| 36 | + ``` |
35 | 37 |
|
36 | | -```sh |
37 | | -FEED_NAME=ETH/USD yarn get-data-feed-id |
38 | | -``` |
| 38 | +- Fund the sponsor wallet (unless it is already funded). |
| 39 | + The Nodary feed will start updating within 15 minutes of the sponsor wallet being funded. |
39 | 40 |
|
40 | | -- Deploy the proxy to the data feed. |
41 | | - See the command below, but use your own `NETWORK` and `DATA_FEED_ID` values. |
| 41 | +- Deploy `DataFeedProxy` by using the command below with your `NETWORK` and `DATA_FEED_ID` values. |
| 42 | + See the [supported networks section](#supported-networks) for valid `NETWORK` values. |
42 | 43 |
|
43 | 44 | ```sh |
44 | | -NETWORK=bsc-testnet DATA_FEED_ID=0x4385954e058fbe6b6a744f32a4f89d67aad099f8fb8b23e7ea8dd366ae88151d yarn deploy-data-feed-proxy |
| 45 | +NETWORK=ethereum-sepolia-testnet DATA_FEED_ID=0x4385954e058fbe6b6a744f32a4f89d67aad099f8fb8b23e7ea8dd366ae88151d yarn deploy-data-feed-proxy |
45 | 46 | ``` |
46 | 47 |
|
47 | | -- Deploy DataFeedReaderExample. |
48 | | - See the command below, but use your own `NETWORK` and `PROXY` values. |
49 | | - See the [supported networks section](#supported-networks) for valid `NETWORK` values. |
| 48 | +- Deploy `DataFeedReaderExample` by using the command below with your `NETWORK` and `PROXY` values |
50 | 49 |
|
51 | 50 | ```sh |
52 | | -NETWORK=bsc-testnet PROXY=0x93F7efd59A74A3Ccc7168C0De481461e5Bd9518c yarn deploy |
| 51 | +NETWORK=ethereum-sepolia-testnet PROXY=0x93F7efd59A74A3Ccc7168C0De481461e5Bd9518c yarn deploy |
53 | 52 | ``` |
54 | 53 |
|
55 | | -- Have DataFeedReaderExample read from the proxy. |
56 | | - See the command below, but use your own `NETWORK` value. |
| 54 | +- Have `DataFeedReaderExample` read from the proxy you have deployed by using the command below with your `NETWORK` value |
57 | 55 |
|
58 | 56 | ```sh |
59 | | -NETWORK=bsc-testnet yarn read-data-feed |
| 57 | +NETWORK=ethereum-sepolia-testnet yarn read-data-feed |
60 | 58 | ``` |
61 | 59 |
|
62 | 60 | ## Supported networks |
63 | 61 |
|
| 62 | +Chains listed on [nodary.io/chains](https://nodary.io/chains) are all supported. |
| 63 | +You can run the following command to list them. |
| 64 | + |
64 | 65 | ```sh |
65 | 66 | yarn list-supported-chains |
66 | 67 | ``` |
67 | 68 |
|
68 | | -See https://github.com/api3dao/chains for details |
69 | | - |
70 | 69 | ## Local development and testing |
71 | 70 |
|
72 | | -`@api3/contracts` provides a MockProxy contract for local development testing. |
73 | | -See the tests for its usage, and run the tests with |
| 71 | +`@api3/contracts` provides a `MockProxy` contract for local development. |
| 72 | +See the [tests](./test/DataFeedReaderExample.sol.js) for its usage, and run the tests with the following command. |
74 | 73 |
|
75 | 74 | ```sh |
76 | 75 | yarn test |
77 | 76 | ``` |
78 | 77 |
|
79 | | -# Advanced |
80 | | - |
81 | | -### Update the proxy address of DataFeedReaderExample |
| 78 | +## Update the proxy address of `DataFeedReaderExample` |
82 | 79 |
|
83 | | -You can update the proxy that your DataFeedReaderExample reads from. |
| 80 | +You can update the proxy that your `DataFeedReaderExample` reads from. |
84 | 81 |
|
85 | 82 | - Follow the [instructions](#instructions) |
86 | | -- Deploy a new proxy |
87 | | -- See the command below, but use your own `NETWORK` and `PROXY` values |
| 83 | +- Find a new feed on [nodary.io/feeds](https://nodary.io/feeds) and deploy its proxy |
| 84 | +- Use the command below with your `NETWORK` and `PROXY` values |
88 | 85 |
|
89 | 86 | ```sh |
90 | | -NETWORK=bsc-testnet PROXY=0x08506208E776ecbdF4cE9DB69C08Aa90A06825C0 yarn update-proxy |
| 87 | +NETWORK=ethereum-sepolia-testnet PROXY=0x08506208E776ecbdF4cE9DB69C08Aa90A06825C0 yarn update-proxy |
91 | 88 | ``` |
92 | 89 |
|
93 | | -### Deploy a DataFeedProxyWithOev |
94 | | - |
95 | | -> This section is for deploying a proxy that can receive OEV updates (in addition to base data feed updates). |
96 | | -> This proxy can only receive OEV updates when it is used alongside the [API3 OEV Relay](https://github.com/api3dao/oev-litepaper/blob/main/oev-litepaper.pdf). |
97 | | -> The API3 OEV Relay is not open to the public yet. |
98 | | -
|
99 | | -OEV auction proceeds are collected at the Api3ServerV1 contract. |
100 | | -At any time, any account can withdraw the accumulated proceeds belonging to a specific proxy to its _OEV beneficiary_ (refer to the [implementation](https://github.com/api3dao/airnode-protocol-v1/blob/main/contracts/api3-server-v1/OevDataFeedServer.sol#L147) for exact information). |
101 | | -The OEV beneficiary of the proxy is specified while deploying it. |
102 | | - |
103 | | -Users that want OEV-support should deploy a DataFeedProxyWithOev (instead of a DataFeedProxy), and specify the address of the OEV beneficiary while doing so. |
104 | | -See the command below, but use your own `NETWORK`, `DATA_FEED_ID` and `OEV_BENEFICIARY` values. |
| 90 | +- Use the command below to confirm that `DataFeedReaderExample` now reads the new data feed |
105 | 91 |
|
106 | 92 | ```sh |
107 | | -NETWORK=bsc-testnet DATA_FEED_ID=0x4385954e058fbe6b6a744f32a4f89d67aad099f8fb8b23e7ea8dd366ae88151d OEV_BENEFICIARY=0x07b589f06bD0A5324c4E2376d66d2F4F25921DE1 yarn deploy-data-feed-proxy-with-oev |
| 93 | +NETWORK=ethereum-sepolia-testnet yarn read-data-feed |
108 | 94 | ``` |
109 | | - |
110 | | -Note that DataFeedProxy and DataFeedProxyWithOev have identical interfaces, which is exported by `@api3/contracts` as IProxy. |
111 | | -By using IProxy in your contract, you can seamlessly switch between a DataFeedProxy and a DataFeedProxyWithOev simply by updating the proxy address. |
0 commit comments