Oracles and DeFi

Exploring the Risks, Benefits, and Use Cases of Oracles in Decentralized Finance

Article by Bruvton Edited by links Cover Art by Tonytad

From the days of Socrates in the legendary town of Delphi to the era of blockchains and unhealthy price prediction habits, oracles have played a monumental role in transferring information from one realm to another. Modern oracles, unlike their ancient Greek predecessors, aim to send information from the off-chain world to the blockchain, or vice versa. This technology can then be used in DeFi to enhance automated market makers (AMMs) and lending protocols alike. This article will explore these use cases and the risks they introduce.

What Is an Oracle

To help understand the use of oracles in AMMs in their simplest form, we can look at prediction markets. Users bet on an outcome (which can vary from real-world events like “Will Kanye West be elected as President in 2024?” to market predictions like “Will ether trade below $1k on February 15, 2023?”). When the set time or event occurs, an oracle relays the results and the money is distributed to the winners. Put simply: the oracle sends information to a smart contract, and that information determines which outcome occurs.

Risks, Benefits, and Use Cases of Oracles 

Two problems may be caused by the oracles in this case. Centralized oracles are faster and more efficient, but require trust in the operators (i.e. only the operator could falsely change the data). Decentralized oracles are open and trustless, but are more easily manipulated by bad actors. This risk can be mitigated by using secure protocols that involve parties without direct involvement in the information being relayed.

A real-life example is UMA’s Optimistic Oracle being used in the Polymarket betting market. It’s decentralized, and false information can be disputed before hitting the blockchain. This is done by UMA DAO members who do not have assets in the related markets.

Decentralized exchanges (DEXs) that use AMMs have a more complicated relationship with oracles. Some share the aforementioned risks of decentralized vs centralized oracles, while others raise the question of whether oracles are needed at all.

Constant Product AMMs exist without oracles and price changes happen independently of external markets. Liquidity providers (LPs) pool their assets, and the rate of trade between assets moves automatically. Liquidity providers run the risk of impermanent loss (i.e. when assets change in value disproportionately to each other). For example, if a liquidity pool has 100 ETH and 100,000 DAI (i.e. 0.001 ETH/DAI), a trade of 25 ETH for 25,000 DAI would greatly impact the price (i.e. 0.0016 ETH/DAI, a 60% price difference). So, these DEXs are constantly exposed to arbitrage. High-volume trades are also subject to slippage (i.e. the trade itself changes the price while being executed, giving the trader a worse rate than expected). Oracles can be used to mitigate these risks in a few ways.

Dynamic Automated Market Makers (dAMMs) use oracles to change the weight of each pooled asset to stay at a 50/50 proportion. In the ETH to DAI example used previously, if ETH went up in value the dAMM would automatically sell enough to keep the pool balanced. This is more capital-efficient and decreases permanent loss.

Virtual Automated Market Makers (vAMMs) depend on oracles to inform its tokenized derivatives. Users input collateral to receive leveraged virtual assets, and price feeds from oracles help keep the prices of these virtual assets similar to the originals. This squashes impermanent loss and price impact, but the risks are still high. Trading with leverage is only for the bravest (or stupidest) investors and has eliminated an enormous amount of capital. If the price moves against the trader, their collateral will be liquidated.

Proactive Market Makers (PMMs) aim to mimic human-style order books and keep adaptable liquidity pools. Oracles are used to stabilize pools and help them adapt to market conditions, and the price information provided is what helps maintain the order-book feel. Again this reduces impermanent loss and slippage, but similar to the previous two AMMs, these risks are replaced with oracle manipulation risks.

A common oracle used for these cases is Chainlink, which is decentralized and pulls its information from a collection of high-quality sources. It pulls price information directly from centralized exchange APIs and combines it, making the information extremely difficult to falsify.

Lending protocols are another essential service in decentralized finance that use oracles. They use them to determine whether a debt position is subject to liquidation. The lending market determines the price of collateral compared to the price of the loan, and if the ratio falls below a certain threshold, the position qualifies for liquidation

Let’s pretend ETH is $1000 again. Imagine you use 20 ETH (20,000 USD) as collateral to take out a loan of 15,000 DAI. The loan is over-collateralized with a liquidation threshold of 85%. If ETH decreases in value to 882.35 USD, your collateral would be worth $17,647 and you would be subject to liquidation. But how does a lending protocol like Maker determine the price of ETH? Oracles.

Using an oracle can help avoid bad debt and keep the lending protocol solvent. Information could be gathered to dictate what the maximum loan should be, accounting for the possible market impact it might have. Additionally, it could calculate a heavier interest rate for higher-interest loans, ensuring that there is always incentive to liquidate debt before it turns sour and loses its financial incentive. The integrity of the user can also be checked, evaluating their previous liquidation rates and financial health and analysis of the lenders.

Other than the previously mentioned oracle risks, this solution can be bypassed if large loans are scattered into many small loans. The oracle would have to somehow account for separate loans that may get liquidated at the same time to create a larger market impact.

Oracles Transfer Knowledge

Decentralized finance is the future of money, and AMMs and lending protocols play a large part in that. The use of oracles further develops those services to be safer, stronger, and more robust. Knowledge is power, and oracles can provide it in a trustless, decentralized manner. Sage advice is written in Delphi: “Know Thyself”. Our modern-day counterparts have an equally wise message: “Know Thy Markets”.

A version of this article initially appeared in BanklessDAO’s DeFi Download newsletter on January 19, 2023.

Author Bio

Bruvton is a poet and storyteller with a passion for the open-access movement. He currently studies in Prague where he is surrounded by good books and better beer.

Editor Bio

links is a web2 product leader and startup artist seeking inspiration in web3.

Designer Bio

Tonytad is a graphic designer who has worked locally and internationally with organisations and firms on over 200 projects, which includes branding, logo, flyers, cards, and covers.

BanklessDAO is an education and media engine dedicated to helping individuals achieve financial independence.

This post does not contain financial advice, only educational information. By reading this article, you agree and affirm the above, as well as that you are not being solicited to make a financial decision, and that you in no way are receiving any fiduciary projection, promise, or tacit inference of your ability to achieve financial gains.

Bankless Publishing is always accepting submissions for publication. We’d love to read your work, so please submit your article here!

More Like This

MEV in Traditional Finance by Jake and Stake

How To Learn Solidity by 0xzh

Proto-Danksharding Basics by Hiro Kennelly

Collect this post to permanently own it.
IndyPen CryptoMedia logo
Subscribe to IndyPen CryptoMedia and never miss a post.