What Kind of Oracles Do We Need for DeFi Derivatives?
Oracle is one of the key ingredients of the DeFi infrastructure. Among all the solutions, decentralized exchanges are a natural one, simply because they are the hubs where trades take place and prices are discovered. In this regard, Vitalik Buterin even proposed UNI should become an oracle token.
As a DeFi derivative project, Deri Protocol highly depends on oracle solutions. In fact, Deri Protocol represents a group of especially demanding users of oracles, the DeFi derivative dApps. Please note that there are indeed derivative dApps independent of oracles, which are not included in the scope of this discussion. Because of the business nature, the following properties are required for an oracle to be adopted for derivative use cases. Due to these requirements, while Uniswap is highly expected by Vitalik, its current oracle module is not suitable for derivatives.
- Low-latency. Following Vitalik’s phrasing, derivatives belong to the category of not-okay-with-high-latency use cases.
- Non-maintenance. Since blockchain is a state machine without the ability to take actions proactively, any maintenance job (e.g. regularly recording the TWAP values) would be a pain in the neck.
- Tradable price. Price is better tradable and backed with sufficient liquidity.
And here comes the good news. Recently with the rollout of Balancer V2 , Balancer has provided a comprehensive solution for derivative use cases. This is achieved by storing the snapshots of the prices at the beginning of the last block with swaps (lastChangeBlock) for the concerning token pairs.
The Balancer Labs team was probably the first to realize that the demands for oracle are divergent in different use cases. Therefore they have rolled out different types of oracles tailored for different scenarios. For example, algorithmic stablecoins and collateralized loans are usually pretty tolerant of latencies. Thus the TWAP-based oracle solution works just fine for them. However, that is not the case for Deri Protocol and other derivative dApps depending on oracles. If Deri were trading at prices with significant latencies, it would be front-run by high-frequency traders. Such exploitations would simply destroy the whole project.
To tackle the pricing issue in the not-okay-with-high-latency use cases, Balancer V2 rolled out the so-called instant oracle. With this oracle, we can get the most up-to-date prices with all the requirements met:
- Flashloan-proof: users can avoid flashloan manipulation with the Balancer V2 oracle prices.
- Low-latency: you can either get the price of the current block or the price snapshot at the beginning of the last block with swaps. In other words, you can get the most up-to-date prices that are not subject to flashloan manipulations.
- Non-maintenance: you get the prices as you go and no prerequisite job is necessary.
- Tradable price: The prices you get from Balancer V2 oracle are the real trading prices in the pools, which means you could buy/sell at these prices with Balancer. (You do need to pay attention to the pool’s TVL for slippage management).
Therefore, for any token pair with sufficient TVL in the pool, Balancer V2 provides a secure, efficient, and convenient oracle for its price. This is a cornerstone for DeFi derivatives and a milestone in DeFi history.
About Deri Protocol
Deri Protocol is a decentralized protocol for users to exchange risk exposures precisely and capital efficiently. It is the DeFi way to trade derivatives: to hedge, to speculate, to arbitrage, all on chain. This is achieved by liquidity pools playing the roles of counterparties for users. With Deri Protocol, risk exposures are tokenized as NFTs so that they can be imported into other DeFi projects for their own financial purpose. Having provided an effective on-chain mechanism to exchange and hold risk, Deri Protocol has minted one of the most important blocks of the DeFi infrastructure.
Balancer Protocol allows for automated portfolio management and providing liquidity turning the concept of an index fund on its head: instead of paying fees to portfolio managers, you collect fees from traders who rebalance your portfolio by following arbitrage opportunities. Developers leverage Balancer as a permissionless building block to innovate freely and create new treasury management systems. Balancer Lab’s mission is to become the primary source of DeFi liquidity by providing the most flexible and powerful platform for asset management and decentralized exchange.