Price Oracles
Last updated
Last updated
Price Feed oracles allow smart contracts to work with external data and open the path to many more use cases. Boba has several options to get real world price data directly into your contracts - each different in the way they operate to procure data for smart contracts to consume:
Witnet
Hybrid Compute
The Witnet multichain decentralized oracle enables smart contracts to realize their true potential by giving them access to all sorts of valuable data sets, and by attesting and delivering that information securely thanks to its strong cryptoeconomic guarantees.
Witnet can power most DeFi primitives like price feeds, stablecoins, synthetics, etc., as well as acting as a reliable source of randomness for creating uniqueness in NFTs.
A complete list of publicly available Witnet data feeds on Boba can be found in the Witnet Data Feeds website: https://feeds.witnet.io/boba
Request a new price feed on Boba or Create your own data feed.
Witnet price feeds can be integrated into your own Boba Mainnet contracts in two different ways:
Integrate through proxy Recommended for testing and upgradability. This is the preferred way to consume the Witnet-powered price feeds. Through using the Price Feeds Router.
Integrate directly Optimized for gas cost and decentralization
The WitnetPriceRouter smart contract is deployed in all the supported chains and allows your own smart contracts and Web3 applications to get the latest price of any of the supported currency pairs by providing the identifier of the pair to a single Solidity method. This removes the need to know the actual contract addresses handling the price updates from the Witnet oracle.
WitnetPriceRouterdocumentation
Mainnet: 0x93f61D0D5F623144e7C390415B70102A9Cc90bA5
Goerli: 0x36928Aeedaaf7D85bcA39aDfB2A39ec529ce221a
The Price Router contract is the easiest and most convenient way to consume Witnet price feeds on any of the supported chains.
The example below shows how to read the price of two different assets from the Witnet Price Router:
You may also read the latest price of any of the supported currency pairs from your Web3 application by interacting directly with the Price Router contract:
For more information about Witnet please refer to:
website | docs | github | twitter | telegram | discord
Hybrid Compute is Boba's off-chain compute system and among many other things you can fetch real-world market price data. Hybrid Compute gives you the flexibility to select and set up your own data source. Or even select and work with any other reliable service that can help provide such data. In the background, Hybrid Compute works with a modified L2Geth, by intercepting and injecting real world responses into the transaction. Learn more about Hybrid Compute here.
Note: Unlike a feed contract where every data query remains on-chain, Hybrid Compute requests are a call to an external endpoint to retrieve data - which are subject to unavailability or distortion. Best practices include using decentralized on-chain oracles and/or off-chain 'augmentation' where off-chain compute is used to estimate the reliability of on-chain oracles.
Goerli/Mainnet: potentially everything, dependent on your source
Fee: 0.01 BOBA per Hybrind Compute request