Our price feeds can be queried through two channels. FeedRegistry and FeedAdapters.
The FeedRegistry contract maintains registry of trading pairs and exposes API to query prices on the chain in the most convenient way possible. Registry allows users to:
- Query all the active trading pairs listed on the oracle
- Query prices by token string names along with addresses
- Query historical data
FeedAdapters conform to AggregatorV2V3Interface and offer compatibility to existing price consumer contracts.
Both the channels are access controlled and therefore users need to be whitelisted before using the service.
Even though access control is enforced for contracts, any EOA will be able to freely query all the FeedRegistry/FeedAdapter endpoints.
We have two types of access grants available for our users:
- Global access (Access to all the trading pairs)
- Pair-wise access (Access to selected trading pairs)
To obtain global access, please provide us with the contract address which reads the FeedRegistry/ FeedAdapter. For pair-wise access, along with the contract address, we require a list of trading pairs you would require access to. Even though the service is subscription based, some pairs are open for all. To check the currently available pairs as well as open access pairs, refer to feeds available.
Now, to get started with Binance Oracle, use the starter project. This repo has interfaces, sample consumer contracts and tests included which enable you to read prices on the chain.
For an existing project, add the npm dependency to your project.
What you'll need
- Solidity version 0.8.0 or above