Liquidators: The Secret Whales Helping DeFi Function

Tom Schmidt
Jan 14 · 14 min read

Brother, Can You Spare a Gwei?

“There’s not a repo bot alive that doesn’t use gas tokens, kid”

Liquidators are underexamined actors in the DeFi space, working, like miners and validators, behind the scenes to keep the entire system functioning and being handsomely rewarded for doing so. Unlike miners and validators, however, liquidators require effectively no upfront capital investment, creating an ecosystem of professionals operating from potentially anywhere in the world, entirely anonymously, getting paid to keep markets solvent.

What are Liquidations?

Over the past two years, a number of decentralized lending protocols, including MakerDAO, Compound, dYdX, and others, have launched on Ethereum, allowing anyone to trustlessly lend or borrow cryptoassets. While these protocols vary in go-to-market approach, assets offered, loan terms, etc., the fundamental loan structure is the same. The borrower places collateral in a smart contract and, in return, is allowed to borrow some lesser amount of another asset provided by the lender. This form of secured lending is one of the most primitive financial instruments, dating back to Venetian banking in the Middle Ages, and contrasts with unsecured, credit-based lending that consumers are more familiar with.

Secured loans can work well when the value of the collateral exceeds the value of the loan, giving borrowers access to working capital without needing to sell their often less liquid assets. However, when the value of the collateral drops, rational borrowers are now incentivized to abscond with the loaned asset, leaving lenders potentially underwater. After all, why return 100 DAI to get back $99 of ETH? With more traditional forms of secured lending, such as auto title loans or mortgages, this is not an issue as the value of those assets are typically less volatile than cryptoassets. However, when taking out a loan with e.g. ETH as collateral, the value can plummet in a matter of seconds.

Collateralized borrowing can be risky without a liquidation process

To mitigate this risk, lending protocols typically require at least 115% collateralization, leaving plenty of buffer before collateral drops below the value of the loan. If the value of the collateral drops below this level, the borrower can simply top it up or sell it off to repay the lender and keep the system solvent. But this creates another set of issues. Transactions on Ethereum aren’t free and the borrower isn’t incurring any additional cost if they get liquidated, so no one is incentivized to keep the system solvent! In order to reward individuals for the costs and risks incurred in liquidating undercollateralized loans and to disincentivize borrowers from letting themselves become undercollateralized in the first place, lending protocols place an additional fee on liquidations which goes to the liquidators themselves. In this way, anyone can repay the debts of the borrowers and receive a nice bonus for doing so — paid for by selling the collateral at a discount to the liquidator — and keeping the system solvent.

Liquidators save lenders and keep markets solvent

Life of a Liquidator

Though liquidations vary in mechanism and terms across protocols, they fundamentally require the same components:

  • a bot that monitors pending Ethereum transactions and looks for loans that are eligible for liquidation
  • a decentralized exchange that can be used to instantly sell the liquidated collateral and guarantee a profit for the liquidator
  • a smart contract that allows the liquidation and sale of the collateral to occur atomically in one transaction

Some protocols provide their own off-the-shelf tooling that facilitates the above, but others rely on a burgeoning, homebrew ecosystem of liquidation bots. It’s easiest to understand these actors and their roles within the DeFi ecosystem by walking through a few examples of successful liquidations across the most popular lending protocols.

Compound

Compound offers one of the most straightforward borrowing and lending experiences in DeFi, and its liquidation process follows matches this simplicity. Let’s take a look at .

This liquidation involves two actors, our liquidator (0x64a) who we’ll call “Alice” and our borrower (0xb5b) who we’ll call “Bob”.

Bob took out a loan of USDC on Compound using ETH as collateral. This is often done to purchase more ETH using the lent USDC as a permissionless way to get leverage. Unfortunately for Bob, this loan period coincided with a large drop in the price of ETH, leaving the value of this borrower’s collateral below the required collateral ratio for ETH (133%). Because different assets have different levels of quality, price stability, and liquidity, Compound assigns a different collateralization ratio to each asset (up to 200% for REP at the moment).

Alice notices that Bob is below the required collateralization ratio — presumably, by monitoring contract state or using Compound’s convenient liquidateBorrowAllowed function — and calling liquidateBorrow on Compound’s USDC market contract, triggering the liquidation process.

1. Compound first pays Bob any outstanding interest Bob has accrued on his collateral (which, after all, might put him over the require collateralization ratio)
2. Compound verifies that Bob is indeed in default using the market price from their oracles
3. Compound transfers the required amount of lent asset (USDC) from Alice to the market contract. In doing so, Alice is rewarded with Bob’s ETH collateral at a fixed discount to market price (currently, 5%). The ETH collateral is returned as cETH, allowing the liquidator to either keep earning interest on the borrower’s ETH, or redeem the cETH for ETH on Compound. In this scenario, Alice made a nice ~$7 in free ETH for her efforts.

While this particular liquidator held onto the cETH, other liquidators use smart contracts to atomically redeem and sell their cTokens, locking in the 5% profit they accrue from this trade. At first glance, one might suspect that this liquidation was done manually, especially given that Compound has not released any open source liquidation bots and the mild popularity of . However, when looking at the y, we can clearly see that it’s active around the clock, and therefore, most likely a bot.

Some juicy undercollateralized loans just waiting for a liquidator

More sophisticated bots such as will perform actions such as quickly borrowing from Compound to liquidate other accounts. We see this happen in , where the address redeems its USDC loan and uses it to liquidate another account’s USDC borrow, earning an easy 5% in a single transaction.

Maker

Maker’s liquidation process is a bit less straightforward as it occurs in two discrete steps: a “bite,” and then a “bust.” It’s similar to how a car might be liquidated — first it’s repossessed, and then it’s auctioned off to repay the owner’s debt. In the Maker system, repossession of a loan is triggered by calling bite and liquidation is triggered by calling bust on their set of smart contracts.

Let’s walk through a single liquidation of through two transactions, the and , involving three actors: the repossessor (0xc2e) who we’ll call Ralph, the borrower (0x9c3) who we’ll call Brittany, and the liquidator (0x5a2) who we’ll call Larry.

Brittany , placing this loan perfectly within Maker’s required collateralization ratio of 150% at the time of loan creation when ETH was at $170. Unfortunately, on December 27th, ETH fell to ~$125, making this CDP just slightly undercollateralized and allowing Ralph to call bite on the CDP, repossessing ownership of this CDP from SaiTub, the contract that holds all active CDPs, to the SaiTap, the contract that performs liquidation of repossessed CDPs.

At this point, the system is still undercollateralized. There is more DAI outstanding than there is ETH in the Maker system to support the value of that DAI at the required ratio. Luckily, Larry, the liquidator, spots this CDP and pays 8.5 DAI for the .067 Pooled ETH in the CDP, equivalent to about 0.07 ETH. This takes DAI off the market, raising the collateralization ratio and keeping the system solvent. For his effort, Larry was able to purchase ETH at ~$121 / ETH, a nice discount to market rate, that Larry immediately sells on Uniswap back for DAI to lock in his .002 ETH of profit.

Note that while Ralph spent money on gas to bite the risky CDP and initiate liquidation, he actually made no money from it, while Larry was rewarded for his effort with a nice 3% discount on ETH! While there are a large number of bots that will atomically to profit from their effort, also profiting from the liquidation!

Translator not included

So, are there just a large number of good Samaritan bots running around biting CDPs for free? While there are a small number that appear to be doing this, most of the bust-less bites appear to be bots that are unable to find an appropriate price to flip the discounted ETH for upon liquidation. As one such example, bites a CDP, gets the ETH-DAI quote from Maker, compares it to the best prices they could get on a DEX such as Oasis, and decides they’re better off not taking the risk and just lets the CDP sit in the SaiTap. Another reason could be the lack of default tooling provided by Maker. While Maker provides a that bites CDPs and an that will flip liquidated ETH on a decentralized exchange for a profit, some additional work is required to merge these into a single cohesive bot. With the transition to Multi-Collateral DAI, the system has moved to a collateral auction, which Maker’s bots can participate in to potentially purchase liquidated collateral at a profit.

Some of the more advanced strategies we see the largest bots employ include:

  • Splitting CDP redemption across ETH through exiting the CDP and across DAI by booming and taking out more debt to maximize returns
  • Use of to be able to outbid other bots in the gas auction by using below-market-rate gas
  • Splitting ETH sales across many DEXs (a la dex.ag or 1inch) to minimize slippage and maximize the amount of DAI they receive in return

dYdX

dYdX’s liquidation process is a bit more similar to Compound’s, but differs in that dYdX does not expose a tokenized interface to its lending protocol like how Compound does through its cTokens. Instead, dYdX creates a series of trading accounts for each address within its main Solo Margin contract, and tracks the credits and debts of each account on each market it supports (ETH, DAI, USDC, etc.). Instead of having explicit function signatures like how Maker has bite and Compound has liquidateBorrow , dYdX has a single operate function that takes in different ‘action types’, where action type number 6 liquidates a borrower’s account. The liquidator is able to purchase collateral from the borrower at 5% discount, earning the same healthy spread as Compound.

dYdX contracts also natively support atomic transactions, allowing users to fund, liquidate, and withdraw assets in one step. However, users can themselves become undercollateralized in the process of performing a liquidation and put themselves at risk of being liquidated! Luckily, dYdX has thought of this problem and provided its own , which allows users to liquidate borrowers while keeping their accounts within a safe collateralization ratio. This has proven massively popular, with over 90% of liquidation volume going through this proxy. It’s probably no surprise then thatalso uses this proxy by default.

dYdX also differs from other protocols in that flash borrowing is built into the protocol, allowing liquidators to atomically borrow the required asset, liquidate, and repay the loan in one single transaction and without needing to use an external proxy contract, making it possible to make true, free profit on dYdX. This combined with their accessible, off-the-shelf liquidator bot might explain why dYdX liquidations have gotten so competitive over the past few months, as discussed later.

While some dYdX liquidations look similar to other protocols’ (such as ), others (such as ) appear inscrutable when looking at them through conventional chain analytics tools as no token transfer actually occurs and no exchange is actually made. It’s only when we look at the that we see what’s going on behind the scenes.

Again, we have liquidator Laura (0x679) and borrower Brad (0xa0d), but unlike in the other examples, Brad deposited DAI and borrowed ETH, presumably to short ETH. When Brad fell under the required collateral rate, Laura swooped in to transfer 53.45 ETH for 7573.97, an effective price of $141.70 / ETH, or ~4% above market at the time, for a profit of $289.05.

How Much Money Are Liquidators Making?

Technical details aside, it’s much more interesting to see what happens when these designs are put into practice, especially with pseudonymous, profit-seeking actors. Many and have been enticed by the idea of running liquidation bots as a way to generate alpha and support these networks, but as we’ve seen time and time again, there are no free lunches in crypto, and liquidations are no exception.

There were profits to be had

Undeniably, the foundations of the “generalized mining” concept in DeFi have merit. Individuals are making large sums of money by liquidating loans on DeFi! While amounts vary based on liquidation fee, asset, and market volatility, we see that protocols in aggregate have produced almost $1MM in pure profit for liquidators in certain months. Over the lifetime of these protocols, we’ve seen nearly . In certain cases, we’ve seen some!

Liquidator Profits by Protocol by Month

But competition is rapidly rising

The same attributes that make being a Liquidator compelling — low barrier to entry, high margins, off-the-shelf tooling — also work in reverse to attract competition, compressing margins for existing liquidators. We see this effect manifest in a few ways.

First, quite simply, the number of unique addresses attempting to liquidate loans on these protocols has been greatly increasing since the launch of these protocols, from 25 Monthly Active Liquidators in Jan 2018 up to . While there will be some duplication in these numbers from liquidators sharing or rotating addresses, the overall trend is clear.

Monthly Active Liquidators by Protocol

We can also see this competition when looking at the . We can see the “old guard” liquidators getting slowly squeezed as new upstarts begin to outcompete them and win liquidation bonuses.

% of profits by liquidator address on dYdX. Old guard liquidators slowly getting beaten out.

This is once more evident simply by looking at the gas price auction amongst liquidators to grab those juicy profits, not unlike the very similar There can only be one winner per liquidation, meaning that every liquidator whose transaction gets mined after the winner’s not only loses out on the liquidation bonus, but also wastes some amount of ETH on a liquidation call that fails. If one look at the transactions is not enough to be convinced, we can also see the trend sharply downwards over time, indicative of the growing competition in this space.

Fewer and fewer dYdX liquidation calls are succeeding, indicating greater competition

And borrowers are getting savvier

But liquidators aren’t just experiencing competition from other liquidators. Borrowers themselves are employing new tools to prevent themselves from liquidated in the first place. (neé CDP Saver) monitors users loans and “unwinds” them when they become risky by selling the borrowed asset, buying more of the collateral, and re-collateralizing the loan in one transaction, not unlike Maker’s own .

Though saving CDPs during times of high network congestion, we can see it and start unwinding CDPs during ETH price drops, saving those CDPs’ owners the 3% liquidation penalty.

DeFi Saver kicks in and saves CDPs when the price of ETH drops

What is the future for liquidations?

In this spirit of making 2020 predictions, what might we forecast for the future of the liquidations space?

Compressing margins and move to dynamic systems

To start, let’s take a step back and re-examine why we even have liquidation penalties in the first place. These penalties exist to incentivize borrowers to remain solvent and to incentivize liquidators to step in and stabilize the system when borrowers are close to default. As we’ve seen so far, the penalties are working extremely well in both of these regards. The question now becomes what the optimal liquidation penalty should be — a fixed static amount across time, assets, and borrowers is probably suboptimal — which we believe should be answered by letting the market decide.

We already see the ecosystem moving this direction, with Maker moving away from a fixed price sale of collateral in SCD and to a in Multi-Collateral Dai. Under this setup, the liquidation penalty is less explicit, taking the form of a “minimum bid increment” that guarantees some gap between true market price and the price paid in auction. Given that MCD is already developing a competitive liquidation ecosystem, we might see this minimum bid increment decrease over time, effectively reducing the liquidation penalty and letting the market dictate what price should be paid for collateral. Though not a lending protocol, we can think of analogously in that they are selling off some amount of one assets for an unknown amount of another asset, and let the market dictate what that exchange rate should be through an auction.

I would expect to see more lending protocols move to an auction or variable fee system in the coming year, meaning lower fees for borrowers and less profit for liquidators.

Unsecured lending

Everything that we’ve been discussing so far has been in the context of secured lending, which has a surplus of collateral to be liquidated, but secured lending is simply the first step in building out a decentralized finance ecosystem. We expect to see an of appear in DeFi, enabling many more people to begin using these protocols and many more to be built. In this world, liquidation will be less or irrelevant, putting the current liquidation market at risk if this form of lending begins to eat marketshare from collateralized lending.

Conclusion

The story of liquidators follows the pattern of so many other stories in crypto: permissionless access to financial instruments allowing an ecosystem of anonymous, global innovators to devise new products and strategies, and being rewarded with millions of dollars for doing so. These unsung heroes have helped the DeFi lending market scale to nearly while building lender confidence, something that will be essential as DeFi reaches the next million users. With new DeFi markets for options and synthetic assets coming online in the next year, I expect to see more liquidator-like operators, working behind the scenes to keep the gears whirring and being handsomely rewarded for doing so.

Thanks to Haseeb Qureshi, Brock Elmore, Antonio Juliano, Calvin Liu, and Teo Leibowitz for editing earlier versions of this post.

Dragonfly Research

Original crypto research and analysis

Thanks to Haseeb Qureshi and Matteo Leibowitz

Tom Schmidt

Written by

Investing @dragonfly_cap. Previously Product @0xproject, @facebook and @instagram, engineering @Apple.

Dragonfly Research

Original crypto research and analysis

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade