BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

The mysterious role behind the scenes of the DeFi science series: the liquidator

CortexLabs
特邀专栏作者
2020-06-01 05:43
This article is about 7132 words, reading the full article takes about 11 minutes
Let's learn how liquidators work together.
AI Summary
Expand
Let's learn how liquidators work together.

secondary title

What is a liquidator?

Over the past few years, numerous decentralized lending protocol projects have been launched on Ethereum. Including MakerDAO, Compound, dYdX and a few others that allow anyone to deposit or lend crypto assets in a decentralized manner. While these lending protocols differ in terms of access to the market, types of assets offered, loan terms, etc., the basic loan structure is the same. That is: the borrower puts collateral in a smart contract, and in return, the borrower can lend a small amount of the asset against another asset provided by the lender. This form of secured lending is one of the most primitive financial instruments, dating back to medieval Venetian banking, and it stands in stark contrast to the more familiar unsecured (credit-based) lending.

image description

Mortgages can be risky if liquidation can't be done

image description

secondary title

life of a liquidator

To become a liquidator, liquidation tools are necessary. Although the clearing mechanism varies between different lending protocols, they all basically require similar component tools:

1) A robot to monitor pending Ethereum transactions and find loans eligible for liquidation;

2) A decentralized exchange that can be used to immediately sell liquidated collateral and guarantee the liquidator's profit;

3) A smart contract that allows both collateral liquidation and sale in one transaction;

secondary title

Compound’s Liquidation Protocol

Compound offers the most straightforward lending experience in DeFi, and its liquidation process follows that simplicity. Let’s take a deeper look at Compound’s liquidation mechanism.

This liquidation involves two participants, the liquidator (0x64a), which we call"Alice". Borrower (0xb5b), let's call it"Bob "。

Bob borrows USDC with ETH as collateral.

This kind of lending is generally to continue to buy more ETH with the borrowed USDC, so as to obtain higher leverage (and does not require any permission).

Unfortunately for Bob, this loan coincides with a sharp drop in the price of ETH, making Bob's collateral value below the required collateralization ratio of ETH (133%). Since different assets have different situations, price stability, and liquidity levels, Compound assigns different mortgage rates to each asset. (For example, the mortgage rate of REP is as high as 200%).

Alice notices that the collateral value of Bob's loan is lower than the required mortgage rate (probably by monitoring the status of the smart contract or the LiquidateBorrowAllowed function in Compound), and then calls the LiquidateBorrow function on the USDC market contract in Compound, thereby The liquidation process is triggered.

1. Compound first pays Bob the outstanding interest accumulated on his collateral (after all, there is a certain possibility that his collateral will reach the minimum mortgage rate required by the system).

2. Compound verifies that Bob has indeed breached the contract through the market price provided by the oracle machine.

3. Compound transfers the required amount of the loan asset (USDC) from Alice to the cUSDC market contract. During this process, Alice will obtain the ETH mortgaged by Bob, and the price will have a fixed discount (about 5% at press time) relative to the market price at that time. ETH collateral is returned in cETH, allowing liquidators to continue to earn interest on borrowers’ ETH, or to exchange cETH for ETH on Compound. In this case, Alice earned some ETH from her actions.

image description

Some high-return undercollateralized loans are waiting for liquidators

More complex bots such as these will perform more complex operations like rapidly lending DAI from Compound and then fetching and liquidating other undercollateralized debt addresses. We've seen this happen in some special liquidations where an address redeems its USDC loan and uses it to liquidate another account's USDC loan, making an easy 5% on one transaction.

Maker's liquidation system

Maker's liquidation process is not so simple, because it occurs in two steps: "bite" and "bust". This is similar to how a car mortgage is liquidated: first its collateral is repossessed, and then it is auctioned off to pay off the owner's debt. In the Maker system, debt collection is triggered by calling bite, and liquidation is triggered by calling bust on the smart contract set.

Let's review the liquidation of CDP 17361 through two transactions: the first transaction and the second transaction involved three participants:

Foreclosed lender (0xc2e), let's call it Ralph

Lender (0x9c3), let's call it Brittany

Liquidator (0x5a2), let's call it Larry

Brittany lent 8.5 DAI and obtained 0.1 ETH as collateral. This loan is fully within the 150% collateralization rate required by Maker (according to the loan created when the ETH price was $170 at the time). Unfortunately, Ethereum later dropped to around $125, leaving this CDP slightly undercollateralized. In this case, Ralph is allowed to issue a bite command to the CDP to transfer the ownership of the CDP from SaiTup (a contract holding all active CDPs) to SaiTap (used to liquidate all recovered CDPs). At this point in time, the Maker system is still undercollateralized state. The loaned DAI is worth more than the ETH mortgaged in the system, so there is no way to maintain DAI anchored at $1.

Fortunately at this time, the liquidator Larry discovered the CDP and paid 8.5DAI for it to obtain 0.067 ETH in the CDP, which is approximately equivalent to 0.07 ETH. This makes DAI withdraw from the circulation market, which in turn increases the mortgage rate and maintains the solvency of the system.

Because of his operation, Larry was able to buy ETH at a price of about $121/ETH, which was a good discount compared to the market price at that time (as mentioned earlier, it fell to $125 at the time). Larry immediately sold ETH on Uniswap in exchange for the 8.5DAI just used for liquidation, and the remaining 0.002 ETH was locked as the profit of this operation.

Please note that in this case, if Ralph spends gas fees to recover these risky CDPs (actually his own) and start liquidation, there is actually no way for him to profit from it.

But Larry's operation paid off and he got about a 3% discount on ETH!

image description

does not include translation

Therefore, will there be a large number of good Samaritan robots (the parable of the Good Samaritan is quoted here, which means good-hearted robots) to execute the robot program of recovering the CDP purely voluntarily?

While a small number of bots appear to be doing this, most bots are forced to withdraw CDPs as a result of bots unable to perform liquidations. Because they cannot find the right price to exchange for the discounted ETH at the time of liquidation. It’s a bit confusing here, let’s take an example to illustrate: 0x8b2 This transaction withdraws a CDP, obtains the quotation of ETH/DAI from Maker, compares this quotation with the best price obtained on DEX (such as Oasis), and then Decided it was better not to take the risk and let the CDP stay in SaiTap. Another reason could be the lack of default tools provided by Maker. Although Maker provides a bite-keeper that recovers CDPs and an arbitrage robot that locks in profits by selling and liquidating ETH on a decentralized exchange, it takes some extra work to combine them into one Robots for continuous execution. As Maker transitions to multi-collateral DAI, the Maker system has shifted to collateral auctions, and Maker's auction bots can also participate, potentially profiting by purchasing collateral at a discount.

The larger bots we saw also used some more advanced strategies. include:

1. By adding and withdrawing the DAI on the existing CDP multiple times to split the CDP for the redemption of ETH to maximize the benefits

2. Be able to buy low-cost gas, and use more gas to gain an advantage in the auction.

secondary title

dYdX liquidation system

dYdX’s liquidation process is somewhat similar to Compound’s liquidation process, but the difference is that dYdX will not expose a tokenization interface to its lending protocol like it does through cToken. Instead, dYdX creates a series of trading accounts for each address in its main Solo Margin contract, and tracks the credits and liabilities of each account on each market it supports (ETH, DAI, USDC, etc.). Maker has bite, and Compound has liquidateBorrow. Unlike them, dYdX has a single function, which contains a series of operation types. The operation type numbered 6 is used to liquidate the borrower's account. Liquidators are able to buy collateral from borrowers at a 5% discount, earning a decent return similar to Compound.

The dYdX contract itself also supports atomic transactions, allowing users to raise, liquidate, and withdraw funds step by step. However, users may face the risk of insufficient collateral during the liquidation process, and then there is a risk of being liquidated!

Fortunately, dYdX thought of this problem ahead of time and provided its own proxy contract that allows users to liquidate borrowers while keeping their accounts within safe collateralization ratios. This feature has proven to be very popular, with more than 90% of the liquidation volume going through this proxy contract. It should come as no surprise, then, that the dYdX liquidation bot also uses this proxy contract by default.

dYdX is also different from other protocols in that the flash loan function is built into the protocol, allowing the liquidator to atomically lend the assets needed for liquidation, liquidate and repay the loan without using an external agency contract, making it possible Earn real, free profit (or cost-free arbitrage, so to speak) on dYdX. This, combined with its ready-made open-source liquidation bot, explains why dYdX liquidation has become so attractive over the past few months, which will be discussed later.

Although some dYdX liquidations are similar to other lending protocols, they are very difficult to understand when viewed with some conventional analytical tools, because there are no token transfers or transactions in actuality. Only when we go directly to the function call can we see what's going on behind the scenes.

secondary title

How much does a liquidator make?

Leaving aside the technical details, it is more interesting to see what happens when these designs are put into practice, and faced with a group of anonymous for profit?

Many individuals and funds are starting to think about running a liquidation bot as a way of generating alpha (excess returns) and backing these lending protocols. But as we’ve seen time and time again, there’s never a free lunch when it comes to crypto assets, and liquidations are no exception.

to be profitable

It is undeniable that in DeFi"General Mining"The conceptual basis has its merits. Individuals Make Big Money Liquidating DeFi Debt!

image description

text

But the competition is getting fiercer

Some common attributes also make "becoming a liquidator" very attractive: such as low threshold, high profits, and ready-made tools, but these attributes also intensify competition in turn, and anyone can participate, thus compressing the current Liquidator's profit margin. We can see these effects in different ways:

image description

Monthly Active Liquidators for Different Protocols

We can also see this competition over time by looking at liquidators' profit percentages. We can see that those"veteran"image description

Profit percentage for liquidator addresses on dYdX, veteran liquidators are slowly being squeezed

image description

secondary title

Borrowers are also getting savvier

Another point is that liquidators are not only experiencing increasing competition from other liquidators. Borrowers themselves are using new tools to prevent themselves from being liquidated in the first place. DeFi Saver (which can monitor the user's loan) and "release" the loan (similar to a bridge loan) by selling the borrowed assets, buying more collateral, and re-mortgaging the loan in one transaction when the user is at risk (similar to a bridge loan). Maker's own cdp-keep is completely different.

image description

secondary title

What is the future of liquidation?

In the spirit of making predictions for 2020, can we make some predictions about the future of the liquidation space?

Compress margins and move to dynamic systems

First, let's take a step back and revisit why we're even thinking about clearing fines in the first place. These penalties exist to incentivize borrowers to remain solvent and to encourage liquidators to step in and stabilize the system when borrowers are close to default. As we've seen so far, fines work very well on both fronts. The question now is, what should be the optimal liquidation penalty? Due to differences in factors such as borrowing time, assets and borrowers, any fixed static penalty amount may not be the optimal solution, and we believe that it should be determined by the market.

We’ve seen the ecosystem move in this direction, and Maker has moved from fixed-price sales of collateral in SCD (single-collateral lending) to collateral auctions in MCD (multiple-collateral lending). Under this setup, the liquidation penalty is less clear and takes the form of a "minimum bid increment" to ensure that there is a certain gap between the true market price and the price paid in the auction. Given that MCD is already developing a competitive liquidation system, we may see this minimum bid price decrease over time, effectively reducing liquidation penalties and letting the market determine the collateral price that should be paid. We can also similarly think of Set Protocol’s rebalancing auction, even though it’s not strictly a lending protocol. Because they are sold in exchange for an unknown amount of another asset, and then the market determines the exchange rate that the auction should use.

unsecured loan

unsecured loan

in conclusion

in conclusion

The story of the liquidators follows the pattern of many other stories in the crypto space:

Permissionless participation in financial instruments allows an anonymous global ecosystem of innovators to design new products and strategies and earn millions of dollars in rewards for doing so. These unsung heroes have helped the DeFi lending market scale to nearly $75 million in lending volume, while building the confidence of lenders, which is very necessary for DeFi to achieve the next million user scale. As new DeFi options and synthetic asset markets come online in the coming year, I expect to see more liquidator-like operators working behind the scenes to keep the system running smoothly, and getting paid handsomely for it.

DeFi
Welcome to Join Odaily Official Community