Author: Scott Winges
Translation: Zoe Zhou
Source: Crypto Valley
- QKL123 market analysis | When the dark moment is coming, when is the Jedi counterattack? (0925)
- The road to the listing of Bitcoin mining companies: once at the Hong Kong Stock Exchange, is now seeking IPO to the US
- Hard core! 360 senior security expert Peng Brewing takes Zcash as an example to talk about the security and privacy issues of zero-knowledge proof
- Graphic: Why is cryptocurrency investment diversified?
- The network is in short supply, the price is “four consecutive yangs”, is the spring of Ethereum coming?
- Blockchain technology company KEY GROUP announced the completion of tens of millions of A round of financing
- Loan / borrowing;
- Spot Trading;
- Margin trading
These features form the cornerstone of a prosperous economy, so they dominate most DeFi markets.
In this "trilogy" series, we will detail how these functions work in a decentralized world, how they are related to each other, and why they are so powerful.
Earlier, we have discussed decentralized lending and margin trading. Before reading this article, let's quickly recall the main contents of the first two articles.
Loans: Decentralized lenders use collateral deposited by borrowers as security, deposit assets into smart contracts, and then earn interest from borrowers.
Borrowing: Decentralized borrowers deposit collateral into smart contracts to obtain assets from lenders. If the borrower's collateral value is close to the loan amount, the collateral can be liquidated to repay the loan.
Margin trading: Use borrowings to establish leveraged positions in the market to amplify gains or losses and make price predictions. Margin trading well embodies the meaning of "high risk with high returns".
For the sake of convenience, the first two articles have omitted some of the key infrastructure to achieve these functions, but we will discuss this in more detail in this article.
Disclaimer: This series of articles is intended to provide educational information and does not constitute investment advice. We do not attempt to allow readers to try margin trading and assume no responsibility for related transactions.
Part III: Decentralized Spot Trading, Price Predictor and Clearing
What is decentralized spot trading?
Spot trading is the act of exchanging one asset for another. As an example of a digital asset, exchange 1 Ether with DAI (now 1 Ether is equivalent to 150 DAI). The term "spot" essentially means a leveraged transaction representing 1x.
Although there are many methods for spot trading, the most discussed in DeFi is asset trading on a decentralized exchange (DEX).
It can be said that if there is no normally operating spot trading market, the scope of DeFi will become extremely narrow.
Lego blocks vs local spot trading
The decentralized margin trading platform is actually leading us to an interesting decision: should we use our own spot trading market or someone else's spot trading market? For a centralized platform, this is a completely new issue.
The early decentralized margin trading platform was a Lego brick based on the existing decentralized trading platform. These platforms provide smart contracts for user borrowing, while transactions that support positions (sometimes clearing) are actually carried out on third-party trading platforms. Nuo, the latest opyn, and fulcrum (earlier versions of dyxd) fall into this category.
At present, there are two decentralized margin trading platforms that use local exchanges for trading. These two platforms are dydx and DDEX. These margin trading platforms have their own spot trading markets that can facilitate the establishment and closure of margin positions. There are pros and cons to this approach.
The biggest benefit is the ability for users to prioritize orders in the local market. Since these platforms do not have to combine multiple smart contracts (these combinations may not be completely suitable), users can see more professional trading functions (such as limit order, stop limit order, position adjustment, etc.) on unmanaged platforms ). Users also benefit from some QQL advantages, such as lower gas costs, no pre-runs and instant order matching.
The disadvantage is that these projects need to focus most of their efforts on maintaining a strong spot trading market. If they can't provide competitive spreads and depth, then they are likely to struggle to stay competitive in emerging areas.
Price prediction machine
In the previous two articles, we compared the concepts of collateral value and borrowing value to determine whether a loan should be liquidated. But we did not discuss how these asset values were determined. These values or prices are determined through a "price oracle".
We can make price predictions in a variety of forms, some more centralized and some more decentralized, but in general, price oracles price a given asset. Although this sounds simple and clear, in the situation of 24/7, it is much more complicated than you think to make sure that no mistakes are made.
Centralized margin trading has used various forms of price predictor systems, but these systems have their own disadvantages. Trying to decentralize the process makes it easy (downtime) in some areas, but more complicated (distrust) in some areas.
Why are price predictors so important in DeFi?
We mentioned earlier that borrowers must mortgage their items in order to obtain a loan. So, imagine you are a borrower who wants to borrow $ 100 of DAI with ETH as collateral. If the required mortgage rate of the platform is 150%, you need to deposit 150 USD worth of ETH. So how should the platform determine the value of the current ETH?
This is where the price predictor comes from. An ETF-DAI price predictor says "the current ETH price is $ 150", so users need to deposit 1 ETH to get a loan. So how does this price predictor calculate this value?
You might say: why not choose a price from the mid-market of a large exchange? This is a good way, but what if the server of the exchange goes down? What if the market liquidity drops? Or, what if someone deliberately manipulates market prices?
The Price Prediction Machine enables 24/7 reporting in a variety of ways. These reports are usually based on the aggregation of one or more price oracles. Data on the current value of assets can come from centralized oracles, blockchain-based oracles, or a variety of complex algorithms.
If you are borrowing on the DeFi platform now: Do you know how the price predictor gets data from the platform you use?
As a borrower, I feel very happy when the oracle fails and considers 1 ETH worth $ 10 million. With just 1 ETH mortgage, I can borrow and withdraw millions of other assets.
Let's talk about incentives. If someone can manipulate the oracle to give it wrong value, it can make a considerable profit from it.
Because someone can profit from the errors of oracles, protecting oracles has become a controversial topic in the DeFi field. An effective oracle must run smoothly because any failure can be catastrophic.
We learned that if the value of the collateral is close to the value of the loan, the collateral can be liquidated. But what's the use of liquidation? Why do we need it, and how does it work?
At present, there is still no perfect standard, because standards vary from platform to platform. I will introduce the main methods among them.
- Purpose of liquidation
The purpose of liquidation is to repay the borrower's loan.
The purpose of designing liquidation is to protect lenders from letting their borrowers default on their loans. This is achieved by taking the borrower's collateral and turning it into a loan.
- How does the clearing mechanism work?
Liquidation requires finding a way to convert borrower's collateral into loans. Therefore, if the borrower borrows DAI with ETH as collateral, it is necessary to replace the ETH sale with DAI during the liquidation to repay the loan.
Is it that simple? Just sell the collateral on the spot market and repay the loan-it's that easy! Unfortunately, only a few platforms actually use this approach. If several large positions are closed during periods of high market volatility, the spot market may run out of liquidity. If the spread becomes very large, selling the collateral on the spot market alone will not fully repay the loan.
Instead, many platforms use third-party clearing robots for clearing. These robots look for positions that can be liquidated-hoping to profit from unlucky borrowers.
- Liquidation incentives
Third-party liquidators are encouraged to clear because they want better prices than current market prices. Different platforms provide incentives to liquidators in various ways.
1. Both Maker and DDEX use a Dutch auction to gradually provide more borrowers' collateral to liquidators;
2. Other platforms like dydx provide instant rewards to liquidators, such as automatically giving a 5% discount at the middle market price;
3. Some platforms simply try to buy and sell collateral in their respective spot markets to repay as many loans as possible;
Each of these methods has advantages and disadvantages. Dutch auctions are more friendly to borrowers, but liquidators earn lower and slower profits. The automatic reward settlement mechanism is friendly to liquidators, but it can be quite cruel to borrowers who are already licking wounds. No matter what method is used, the way to repay the loan is successful liquidation!