Oracle is essential for almost any Defi product. Recently we developed our own decentralized cross-chain oracle — Power Oracle. It is aimed at providing free and public price feeds for Defi ecosystem.
Almost every Defi protocol relies on accurate asset price tracking. Assets are volatile and price changes significantly affect the viability and security of lending, derivative and other products.
Developing PowerPool, we faced a problem — there weren’t any trusted and publicly available price feeds for certain GTs on the market. Therefore, we decided to develop our own oracles to use trusted price feeds of any assets to allow secure and reliable PowerPool operation and contribute to the development of the Defi ecosystem as well.
PowerOracles are public decentralized oracles, reporting price feeds for certain sets of assets (mostly GTs) on Ethereum mainnet, xDAI, Matic, and Binance Smart Chain networks.
We expect that it would not only allow to run PowerPool (Power Index, GT Money Market, and other future products) securely and reliably but also significantly simplifies the experience of other teams to develop new Defi products, especially on L2 networks.
DISCLAIMER: this article covers a product, which development is still ongoing. Any details can be changed in the future. Check the Github, please.
For a long time, a lot of Defi protocols (even major ones, such as MakerDAO or Compound) relied on centralized oracles. It was a necessary measure as truly decentralized oracles weren’t production-ready and secure enough.
One of the core problems, preventing implementation of them was the fact that the price discovery for the majority of assets took place at centralized exchanges.
The main issue is that CEXes cannot be integrated with smart-contracts in a trustless way. It needs a trusted third-party which would execute interaction with CEX API and deliver this data to a contract. In addition, CEXes cannot be used as trusted data sources.
Another problem with the implementation of really decentralized and secure oracles is mechanism design. The basic issue is: how to incentivize independent economic agents to report price honestly and regularly?
The different mechanism design schemes were used to solve this issue. One of the most popular was to use the staking approach — allow to report price feed only nodes with skin in the game (the token stake). The generic scheme follows:
- There are a set of oracles with token stakes
- Each oracle is independent, collects and reports price to the system
- The system checks out all prices, remove statistical outliers from the dataset. The average price of remaining data points became a price, reported to a contract.
- All nodes, which reported statistical outlier data points get penalized (lose part of the token stake)
Of course, it is a very simplified design scheme. It contains a lot of complexity and drawbacks. But all of this can be significantly simpler if there will be decentralized and reliable sources of price information inside the industry itself. In this case, the task of creating a decentralized oracle significantly simplifies.
The adoption of DEXes, such as Uniswap lead to the decentralized price discovery. If the trading pair is liquid enough, it becomes a decentralized and accurate market price source.
If the source of the market price for an asset is presented in the ecosystem, oracle just needs to attract independent agents, which would report it to the target contract frequently and securely. PowerOracle design solves exactly this task.
The Power Oracle
PowerOracle is a decentralized cross-chain price oracle based on modified and upgraded Compound Open Price Feed code.
PowerOracle uses Uniswap V2 as a primary data source of time-weighted average prices (TWAPs) and independently operates by applying economic incentives for independent price reporters. It provides relevant information on market prices for any asset with sufficient liquidity on Uniswap and, using economic stimulus for independent network agents to record price information for a fee.
Price is continually recorded not only in Ethereum mainnet, but also in xDAI, Matic and Binance Smart chain.
In the future, the list of supported networks can be expanded, if there will be community demand.
How does it work?
Power Oracle is a modified fork of the Compound Open Price Feed that directly requests the asset price from Uniswap through the time-weighted average prices (TWAPs) mechanism. It is important to point out that it cannot work autonomously and needs to be constantly triggered by someone.
To execute such a request, an independent network agent (we refer this role to the “Price Keeper”) needs to interact with the oracle contract, request the price, record the returned result and pay the gas fee for all mentioned operations. It looks simple, but there are at least three issues to be solved:
- Motivation scheme of Price Keeper to trigger the contract, execute all operations, and pay gas fees
- Security mechanism to protect oracle from reporting false price and any other related possible fraudulent activity of Price Keeper
- The mechanism to protect oracle from misreporting (the situation when Price Keeper miss report point(s) and the price wasn’t reported)
We proposed and implemented the following mechanism design:
- Any independent network agent willing to act as a price reporter needs to deposit CVP stake into the contract
- Contract selects price reporter with a higher stake
- Selected price reporter provide necessary requests to oracle contract, make all transactions, and finally reports price
- For executing contract transactions price reporter pays ETH gas fees and get rewarded in CVP according to the formula: “current market price” + “additional reward” to make this activity profitable
- The contract architecture protects the system from false price reporting, requesting time-weighted average prices (TWAPs) from a decentralized and trusted source — Uniswap
In the case of misreporting, the stake is partially or completely slashed and tokens are used to reward Fisherman and community pool replenishment (dS). The value of dS can be set by community proposal in the future.
The scheme of oracle operation is presented below:
The Power Oracle is already developed and tested internally in Kovan. Now we are preparing it for the mainnet.
It would be used to track all GT prices once PowerPool products would be deployed in Ethereum mainnet. Also, price feeds would be reported to xDAI, Matic, and Binance Smart chains supporting PowerPool operation at the L2 network.
Power Oracles are open-source, public, decentralized, and offer free price feeds. So, they can be used by any external Defi project in permissionless mode. We estimate that Power Oracle would help to meet the growing demand for oracles in the Defi ecosystem, including L2 and Binance Smart chain networks.