Skip to content

Commit e11dd01

Browse files
authored
Merge pull request #41 from api3dao/revise
Revise README
2 parents dc0500b + a7f7325 commit e11dd01

File tree

2 files changed

+46
-67
lines changed

2 files changed

+46
-67
lines changed

README.md

Lines changed: 35 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Nodary data feed reader example
22

3-
> An example project for reading Nodary data feeds
3+
> An example project that reads a [Nodary](https://nodary.io/) data feed
44
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.
77

88
## Instructions
99

@@ -19,93 +19,76 @@ yarn
1919
echo 'MNEMONIC="bike north stone..."' > .env
2020
```
2121

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
2323

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.
2626

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+
```
3030

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.
3233

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+
```
3537

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.
3940

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.
4243

4344
```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
4546
```
4647

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
5049

5150
```sh
52-
NETWORK=bsc-testnet PROXY=0x93F7efd59A74A3Ccc7168C0De481461e5Bd9518c yarn deploy
51+
NETWORK=ethereum-sepolia-testnet PROXY=0x93F7efd59A74A3Ccc7168C0De481461e5Bd9518c yarn deploy
5352
```
5453

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
5755

5856
```sh
59-
NETWORK=bsc-testnet yarn read-data-feed
57+
NETWORK=ethereum-sepolia-testnet yarn read-data-feed
6058
```
6159

6260
## Supported networks
6361

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+
6465
```sh
6566
yarn list-supported-chains
6667
```
6768

68-
See https://github.com/api3dao/chains for details
69-
7069
## Local development and testing
7170

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.
7473

7574
```sh
7675
yarn test
7776
```
7877

79-
# Advanced
80-
81-
### Update the proxy address of DataFeedReaderExample
78+
## Update the proxy address of `DataFeedReaderExample`
8279

83-
You can update the proxy that your DataFeedReaderExample reads from.
80+
You can update the proxy that your `DataFeedReaderExample` reads from.
8481

8582
- 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
8885

8986
```sh
90-
NETWORK=bsc-testnet PROXY=0x08506208E776ecbdF4cE9DB69C08Aa90A06825C0 yarn update-proxy
87+
NETWORK=ethereum-sepolia-testnet PROXY=0x08506208E776ecbdF4cE9DB69C08Aa90A06825C0 yarn update-proxy
9188
```
9289

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
10591

10692
```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
10894
```
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.

scripts/list-supported-chains.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@ const { CHAINS } = require('@api3/chains');
22
const { nodaryChainIds } = require('@nodary/utilities');
33

44
async function main() {
5-
const mainnets = [];
6-
const testnets = [];
5+
const supportedChains = nodaryChainIds()
6+
.map((nodaryChainId) => CHAINS.find(({ id }) => id === nodaryChainId))
7+
.map((chain) => {
8+
return {
9+
id: Number(chain.id),
10+
name: chain.alias,
11+
type: chain.testnet ? 'testnet' : 'mainnet',
12+
};
13+
})
14+
.sort((a, b) => a.name.localeCompare(b.name));
715

8-
nodaryChainIds().forEach((chainId) => {
9-
const chain = CHAINS.find(({ id }) => id === chainId);
10-
if (!chain) {
11-
throw new Error(`Chain ${chainId} does not exist in @api3/chains`);
12-
}
13-
const { alias: chainAlias } = chain;
14-
chain.testnet ? testnets.push(chainAlias) : mainnets.push(chainAlias);
15-
});
16-
17-
console.log('Mainnets:');
18-
mainnets.sort().forEach((chainAlias) => console.log(` ${chainAlias}`));
19-
console.log('Testnets:');
20-
testnets.sort().forEach((chainAlias) => console.log(` ${chainAlias}`));
16+
console.table(supportedChains);
2117
}
2218

2319
main()

0 commit comments

Comments
 (0)