How do "liquidators," the secret whales that help DeFi run smoothly, work?

share
How do "liquidators," the secret whales that help DeFi run smoothly, work?

This article is authorized for reproduction by ChainNews. Source: ChainNews (ID: chainnewscom)

Clearing agents in the decentralized finance (DeFi) space play an underappreciated role, working behind the scenes like miners and validators to maintain the smooth operation of the entire system and in turn, reap substantial rewards. However, unlike miners and validators, clearing institutions do not actually require upfront capital investment, creating an ecosystem comprised of professionals who may operate anywhere in the world, completely anonymously, while ensuring the market's solvency through payment of rewards.

Author: Tom Schmidt, Junior Partner at Dragonfly Capital, a blockchain investment fund
Translated by: Janice Zhan

Advertisement - Continue scrolling for more content

Table of Contents

What is Liquidation?

Over the past two years, decentralized lending protocols such as MakerDAO, Compound, dYdX, and others have been deployed on Ethereum, allowing anyone to lend or borrow cryptocurrencies without trust. While these protocols differ in their listing methods, assets provided, and loan terms, the basic loan structure remains the same. Borrowers lock collateral into a smart contract and, in return, can borrow a different asset in an amount less than the collateral from the lender. This form of collateralized loan is one of the oldest financial tools, dating back to the Venetian banking industry in the Middle Ages, contrasting with the more familiar unsecured, credit-based loans to consumers.

When the value of the collateral exceeds the value of the loan, secured loans work well, allowing borrowers to access liquidity without selling less liquid assets. However, when the value of the collateral drops, rational borrowers have the incentive to default on the loan, which may leave the lender with bad debt. After all, why repay 100 DAI to redeem ETH worth only 99 US dollars?

For more traditional forms of secured loans, such as car title loans or property mortgages, this is not a problem as the volatility of these assets' values is typically lower than that of cryptocurrencies. However, when using ETH as collateral for a loan, its value can plummet within seconds.

No liquidation process, potential risks in collateralized loans

To mitigate this risk, loan protocols typically require at least 115% collateral, leaving enough buffer before the collateral value falls below the loan value. If the collateral's value drops below this level, the borrower can simply top up or sell the collateral to repay the lender and maintain the financial system's solvency.

However, this brings another set of problems. Ethereum transactions are not free, and if a borrower is liquidated, they incur no additional costs. Therefore, there is no incentive for anyone to participate in liquidation to maintain the system's solvency. To incentivize individuals to bear the costs and risks of undercollateralized loans during liquidation and to prevent borrowers from falling into undercollateralized situations from the start, loan protocols impose fees on liquidation, borne by the liquidators themselves. In this way, anyone can settle the borrower's debt and receive a substantial bonus by selling the collateral to the liquidator at a discount to pay off the debt while maintaining the financial system's solvency.

Liquidators save lenders and maintain market solvency

The Life of a Liquidator

Although different protocols have different mechanisms and terms, they essentially require the same components:

  • A bot that monitors pending Ethereum transactions and looks for eligible loans for liquidation
  • A decentralized exchange to sell liquidated collateral instantly and ensure profits for the liquidator
  • A smart contract that allows automatic liquidation and sale of collateral in a single transaction

Some protocols provide their own tools to achieve the above functions, while others rely on a thriving ecosystem of custom liquidation bots. The easiest way to understand these participants and their roles in the DeFi ecosystem is to browse successful liquidation cases in some of the most popular lending protocols.

Compound

In DeFi, Compound offers the most direct borrowing and lending experience, and its liquidation process follows this simplicity. Let's delve into the process of a single liquidation.

The liquidation involves two participants, one being our liquidator 0x64a, whom we'll call "Alice," and the other being our borrower 0xb5b, whom we'll call "Bob."

Bob borrows a USDC loan with ETH as collateral on Compound. This is typically done to use the borrowed USDC as leverage to buy more ETH. Unfortunately, during the loan period, the price of ETH drops significantly, causing the value of Bob's collateral to fall below the required collateralization ratio for ETH (133%). Different assets have different collateralization ratios on Compound (currently REP has the highest ratio at 200%).

Alice notices that Bob's collateralization ratio is below the requirement—presumably either through monitoring the contract status or using Compound's convenient liquidateBorrowAllowed function—and calls liquidateBorrow in Compound's USDC market contract, triggering the liquidation process.

  1. Compound first pays Bob any unpaid interest obtained from his collateral (as this could push him above the required collateralization ratio)
  2. Compound verifies Bob's default using the market price from their oracle
  3. Compound transfers the required loan asset USDC amount from Alice to the cUSDC market contract.

As a result, Alice acquires Bob's ETH collateral at a fixed discount relative to the market price (currently 5%). The ETH collateral is returned as cETH, allowing the liquidator to continue earning interest from the borrower's ETH or redeem cETH for ETH on Compound. In this case, Alice earns around $7 worth of ETH for free through her efforts.

When this particular liquidator holds cETH, other liquidators automatically redeem and sell their c-tokens through a smart contract, locking in the 5% profit they obtained from the transaction.

At first glance, one might question whether this liquidation is done manually, especially considering that Compound has not released any open-source liquidation bots yet, and liquidation dashboards are not widely used. However, by examining the distribution of activity of this liquidator, it is clear that it operates 24/7, making it likely to be a bot.

Profitable undercollateralized loans await liquidators

More sophisticated bots will execute actions such as borrowing quickly from Compound to liquidate other accounts. We see this in a particular liquidation where the address redeemed its USDC loan and used it to liquidate another account's USDC loan, effortlessly earning a 5% profit in a single transaction.

Maker

The liquidation process of Maker is not as straightforward as it is divided into two separate steps: first, the "bite," and then the "bust." This is similar to the process of repossessing a car: first, it is taken back, then auctioned off to repay the owner's debt. In the Maker system, the repossession of the loan is triggered by calling bite, while the liquidation is triggered by calling bust on their smart contract.

Let's walk through a liquidation of CDP 17361 with two transactions, the first and second transactions involving three participants: the liquidator 0xc2e, whom we'll call Ralph; the borrower 0x9c3, whom we'll call Brittany; and the liquidator 0x5a2, whom we'll call Larry.

Brittany borrowed 8.5 DAI with her 0.1 ETH as collateral, making her loan fully compliant with Maker's required 150% collateralization ratio, with ETH valued at $170 during lending. Unfortunately, on December 27th, ETH dropped to around $125, slightly below the collateralization ratio for this CDP, leading Ralph to call bite on this CDP, transferring ownership of this CDP from SaiTub (the contract holding all valid CDPs) to SaiTap (the contract liquidating the reclaimed CDP).

At this point, the system was still undercollateralized. In the Maker system, there is more unpaid DAI than ETH to support the value at the required ratio. Fortunately, as the liquidator, Larry identified this CDP and paid 8.5 DAI, acquiring 0.067 PETH (Eth pool), equivalent to 0.07 ETH contained in the CDP. This caused DAI to exit the market, raised the collateralization ratio, and maintained the system's solvency. With Larry's effort, he was able to purchase ETH at around $121 per ETH, a good discount compared to the market price, allowing Larry to immediately sell back DAI on Uniswap to lock in his $289.05 profit.

It is worth noting that although Ralph spent money on gas to bite the risky CDP and initiate liquidation, he did not actually profit from it. Instead, Ralph obtained a decent 3% discount on ETH, and his efforts were rewarded!

While many bots automatically "bite" and "bust" CDPs for profit, only half of the liquidations are profitable among the bots that "bite."

Excluded from Compilers

Are there many "Good Samaritan" bots out there biting CDPs for free? Although a small portion seems to be doing so, most bots, when biting without busting, struggle to find the right price to throw out discounted ETH during liquidation. For example, transaction 0x8b2 bit a CDP, obtained an ETH-DAI quote from Maker, compared it with the best price on decentralized exchanges like Oasis and other DEXs, and decided it was best not to take the risk and let the CDP continue to remain in SaiTap. Another reason might be the lack of default tools provided by Maker. While Maker offers a "bite-keeper" tool to bite CDPs and an "arbitrage-keeper" tool to profit from liquidation on DEX, merging them into a unified bot requires additional work. With the transition to multi-collateral DAI, where the system has shifted to collateral auctions, Maker's auction-keeper bot can participate, potentially profiting from purchasing liquidated collateral.

Some of the largest bots use more advanced strategies, including:

  • Splitting CDP redemptions to exit ETH via exit, taking in more debt with DAI via boom, to maximize profits
  • Using gas tokens, outbidding other bots in gas auctions by using gas below market prices
  • Spreading ETH sales across multiple DEXs (such as dex.ag or 1inch) to minimize slippage and maximize the amount of DAI they receive

dYdX

dYdX's liquidation process is somewhat similar to Compound, but unlike Compound, dYdX does not have a tokenized interface to its lending protocol like cToken. Instead, dYdX creates a series of trading accounts for each address in its primary isolated margin contract, tracking the credit and debt for each account on each market they support (ETH, DAI, USDC, etc.).

Unlike Maker's bite or Compound's liquidateBorrow, dYdX does not have such explicit function signatures. It has a single operate function that takes different "operation types," with operation type 6 responsible for liquidating a borrower's account. Liquidators can purchase collateral from borrowers at a 5% discount, earning the same healthy spread as Compound.

dYdX contracts also support atomic transactions, allowing users to provide funds, liquidate, and withdraw assets in a single step. However, during the liquidation process, users themselves may face undercollateralization, putting themselves at risk of being liquidated!

Fortunately, dYdX has recognized this issue and provides its proxy contract, allowing users to both liquidate borrowers and keep their accounts within a safe collateralization ratio. This move has proven to be very popular, with over 90% of liquidations being conducted through this proxy. Therefore, it is not surprising that dYdX liquidation bots default to using this proxy.

dYdX differs from other protocols in that it features fast borrowing within the protocol, allowing liquidators to atomically borrow the required assets, liquidate, and repay the loan in a single transaction without using external proxy contracts, enabling true profit-making on dYdX. Coupled with their user-friendly, ready-made liquidation bots, this may explain why dYdX liquidations have become so competitive in recent months, as we will discuss further in the following sections.

While some dYdX liquidations may appear similar to other protocols, reviewing them through traditional chain analysis tools reveals that other protocols may seem less understandable, as no token transfers actually occur, and no actual exchanges are made. Only by directly examining function calls can we see what is happening behind the scenes.

Here, we have liquidator Laura 0x679 and borrower Brad 0xa0d. However, unlike other examples, Brad deposits DAI and borrows ETH, possibly to short ETH. When Brad's collateral falls below the required collateralization ratio, Laura steps in, purchasing 53.45 ETH at a price of 7573.97, equivalent to 0.07 ETH. This enables DAI to leave the market, raises the collateralization ratio, and maintains the system's solvency. Through Laura's efforts, she is able to purchase ETH at around $121 per ETH, a good discount compared to the market price, allowing Laura to immediately sell back DAI on Uniswap to lock in her $289.05 profit.

How Much Money do Liquidators Make?

Setting aside technical details, observing how these designs are put into practice, especially when working with profit-seeking members, is more interesting. Running liquidation bots to generate returns and support these networks has attracted many individuals and funds. However, as we have seen time and time again, there is no free lunch in the crypto space, and liquidation is no exception.

Profit Potential

Undeniably, the concept of "generalized mining" in DeFi is valuable. Individuals can earn significant amounts by liquidating loans on DeFi. Although the amounts vary depending on liquidation fees, assets, and market fluctuations, we find that these protocols have brought nearly $1 million in pure profits per month to liquidators in some months. Over the course of these protocols' lifetimes, we see that liquidators have made nearly $5 million in profit. In some cases, we even see some liquidators earning over $100,000 in net profit in a single liquidation!

Recent months' profitability of liquidators in the mentioned protocols

But Competition is Intensifying Rapidly

What makes liquidators stand out is their low entry barriers, high profit margins, and existing tools, which, in turn, attract competition and compress the profit margins of existing liquidators. We can see this effect in several ways.

Firstly, it's straightforward: since the launch of these protocols, the number of unique addresses attempting to liquidate protocol loans has significantly increased, from 25 active liquidator addresses in January 2018 to 142 active liquidator addresses in November 2019. While liquidators may share or rotate addresses, causing some duplicates, the overall trend is clear.

Recent months' monthly active liquidator addresses in the protocols

By observing the changes in liquidator profit share over time, we can also see this competition. We can see that as new up-and-comers begin to win in the competition and claim liquidation bonuses, the "old guard" liquidators are slowly being squeezed out.

Changes in liquidator profit share across various liquidator addresses on dYdX, with the old guard liquidators being slowly bested

Looking at the gas price auctions liquidators conduct to grab lucrative profits, we can once again see this, similar to gas auctions among DEX arbitrage bots. With only one winner per liquidation, each liquidator's transaction is mined, the winner not only loses the liquidation bonus but also wastes a certain amount of ETH in failed liquidation calls. If looking at the failed liquidation transactions list on dYdX isn't convincing enough, we can further observe that as time progresses, the success rate of liquidation calls on dYdX has significantly decreased, indicating an intensifying competition in this area.

Decreasing success rate of liquidation calls on dYdX, indicating intensified competition

Borrowers are Getting Savvier

However, liquidators not only face competition from other liquidators but also from borrowers themselves who are using new tools to prevent themselves from being liquidated. DeFi Saver (formerly CDP Saver) monitors user loans and "unwinds" these loans when they face risks, selling borrowed assets, purchasing more collateral, and overcollateralizing the loan in a single transaction, similar to Maker's cdp-keeper.

While DeFi Saver faced issues in protecting CDPs during severe network congestion, we can see that it correctly triggered and began unwinding CDPs during ETH price drops, saving CDP owners a 3% liquidation penalty.

DeFi Saver triggering and protecting CDPs during ETH price drops

What is the Future of Liquidation?

Looking ahead to 2020, what are our predictions for the future of liquidation in the DeFi space?

Profit Compression and Transition to Dynamic Systems

Firstly, let's step back and reconsider why we have liquidation penalties. The purpose of these penalties is to encourage borrowers to maintain sol