An example project that reads a Nodary data feed
This project demonstrates using a single-source Nodary feed without depending on API3 data feed curation or the market.api3.org frontend. See https://github.com/api3dao/data-feed-reader-example for an example that uses an API3 data feed.
- Install dependencies
yarn- Create a
.envfile similar toexample.env
echo 'MNEMONIC="bike north stone..."' > .env-
Go to nodary.io/feeds and find a data feed you like
-
Copy the data feed ID (denoted as the Beacon ID) from the table. You can also use the following command with your
FEED_NAMEvalue.FEED_NAME=ETH/USD yarn get-data-feed-id
-
Copy the sponsor wallet address corresponding to the deviation threshold you like from the table. You can also use the following command with your
FEED_NAMEvalue.FEED_NAME=ETH/USD yarn get-sponsor-wallet-addresses
-
-
Fund the sponsor wallet (unless it is already funded). The Nodary feed will start updating within 15 minutes of the sponsor wallet being funded.
-
Deploy
DataFeedProxyby using the command below with yourNETWORKandDATA_FEED_IDvalues. See the supported networks section for validNETWORKvalues.
NETWORK=ethereum-sepolia-testnet DATA_FEED_ID=0x4385954e058fbe6b6a744f32a4f89d67aad099f8fb8b23e7ea8dd366ae88151d yarn deploy-data-feed-proxy- Deploy
DataFeedProxydeterministically by using the command below with yourNETWORKandDATA_FEED_IDvalues. This ensures that the contract is deployed at a predictable address. Deterministic deployment may not be supported on all networks.
NETWORK=ethereum-sepolia-testnet DATA_FEED_ID=0x4385954e058fbe6b6a744f32a4f89d67aad099f8fb8b23e7ea8dd366ae88151d yarn deploy-data-feed-proxy:deterministic- Deploy
DataFeedReaderExampleby using the command below with yourNETWORKandPROXYvalues
NETWORK=ethereum-sepolia-testnet PROXY=<0xDataFeedProxyAddress> yarn deploy- Have
DataFeedReaderExampleread from the proxy you have deployed by using the command below with yourNETWORKvalue
NETWORK=ethereum-sepolia-testnet yarn read-data-feedChains listed on nodary.io/chains are all supported. You can run the following command to list them.
yarn list-supported-chains@api3/contracts provides a MockProxy contract for local development.
See the tests for its usage, and run the tests with the following command.
yarn testYou can update the proxy that your DataFeedReaderExample reads from.
- Follow the instructions
- Find a new feed on nodary.io/feeds and deploy its proxy
- Use the command below with your
NETWORKandPROXYvalues
NETWORK=ethereum-sepolia-testnet PROXY=0x08506208E776ecbdF4cE9DB69C08Aa90A06825C0 yarn update-proxy- Use the command below to confirm that
DataFeedReaderExamplenow reads the new data feed
NETWORK=ethereum-sepolia-testnet yarn read-data-feed