# Understanding Compound’s Liquidation

Executive summary

Decentralized Finance (DeFi) is one of today’s most compelling crypto narratives and Compound is one of its most prominent examples. As we are adding support for Compound within the ZenGo wallet, the ZenGo research team has taken a deeper look into one of the most intriguing and novel aspects of the Compound protocol, the Liquidation process.

This whitepaper offers a step-by-step technological explanation and financial survey of Compound’s Liquidation process and thus offers a learning opportunity on a prominent DeFi project, relevant for both experts and beginners.

## Key Findings and Predictions

• Supplying Liquidity on Compound is easy and is a very viable option for both beginners and experienced crypto holders to earn interest on their crypto.
• In contrast, borrowing and liquidating on the protocol are currently relevant for experts only, as they require technological, operational and economic skills and resources. We predict that they will be used as building blocks for other DeFi products that can be consumed by less sophisticated users.
• During 2019, $10,375,064 was repaid by liquidators using Compound version 2, resulting in a total of$518,752 profit for liquidators.
• The innovative incentive-based liquidation process seems to work, as mostly all of the risky borrowings are quickly liquidated once they cross the liquidation threshold.
• We have observed some sophisticated DeFi users that combine several DeFi solutions together to create new functionalities. We predict that it is a precursor for the next generation of DeFi products and services to be built upon the existing DeFi services.

## Outline

The paper is organized as follows:

• Section 1 gives a short intro to DeFi, Compound.
• Section 2 takes a deeper technical dive into Compound supplying, borrowing and liquidations
• Section 3 discusses the technical aspects of liquidation, including a step-by-step “do-it-yourself” recipe to liquidating.
• Section 4 analyzes the liquidation as observed in the wild, including statistics on the volumes of liquidations in 2019, identifying the main players and gaining more insights on liquidations
• Section 5 highlights some specific “hand picked” interesting liquidation incidents we have observed
• Section 6 concludes with our findings and insights

## DeFi and Ethereum

Decentralized Finance (DeFi) is one of today’s most compelling crypto narratives. The initial promise of cryptocurrencies was to make transferring money cheaper and more efficient while minimizing or eliminating altogether the role of intermediaries. DeFi takes this promise and extends it to more sophisticated financial services, such as lending and exchanging.

To do so, DeFi projects are mostly developed on the Ethereum blockchain to leverage its smart contract functionality. Smart contracts allow developers to define protocols, create products and have them executed on the blockchain. DeFi products and protocols are made possible by having the ability to code the rules of financial interactions into blockchains.

Source: defipulse.com

One of the first successful financial use cases enabled by smart contracts, which may be considered as the first generation of DeFi, is the ERC20 standard. ERC20 allows easy issuance of new Ethereum based coins. Some companies and projects used this standard to issue tokens (ICO) to get funding. Others have created stablecoins that are following the behavior of real world assets such as the US Dollar or Gold. As a result, a vibrant financial ecosphere of multiple Ethereum assets were created and which now requires financial services such as lending and exchanging. Naturally, a new generation of DeFi products have come to fill the gap.

• These result in a total of $518,752 of profit for the liquidators, assuming a constant 5% liquidation incentive and excluding transaction • 1800 liquidation events were executed on Compound v2 during the time • Given that the median liquidation profit is$6.35, and the average is $288 ## When do liquidations happen? A known adage claims that “deaths come in threes”. We found out that liquidations seem to adhere to a similar pattern as they come in clusters too. The reason behind this phenomena is that liquidations are highly correlated with steep changes in exchange rate. The changes cause borrowers that betted on the wrong side of the change to exceed their borrowing quota allowed by their collateral and become subject to liquidation. When the change is steep, unprepared borrowers either lack the liquidity or the operational readiness to repay their borrowings or to increase the collateral. We looked at the liquidation activity since the launch of Compound v2, through 2019. November was the month of most liquidations, both in transactions and in volume. This can be mostly attributed to price’ volatility during that month. Zooming in on the most active month liquidation-wise, November, we can examine our hypothesis on the correlation between sudden price changes and liquidation amounts. The upper chart shows price difference in ETH, while the bottom charts shows amounts repaid by liquidators on the same day. As expected, we notice that days with high volatility (close to 10% in price change), were the most lucrative days for liquidators to operate, with almost$2M changing hands and moving from borrowers to liquidators.

Ethereum price during November

Zooming in even further to November 21st, we can see sudden drops in ethereum price, at 03:00, 06:00 and 09:00.

Comparing the information to the liquidations performed on that day, the correlation is clear. We witness liquidations exactly at the time of sudden price changes. The data suggests that liquidation opportunities do not live very long and are immediately picked up by the liquidators.

Ethereum price per hour – November 21st

Liquidations per hour – November 21st

## Who are the liquidators and liquidated borrowers?

It appears that liquidation is a game of a few players. A total of 119 different liquidators were recorded, with the median profit being $3.4. The chart below presents the total profit earned by the top 20 liquidators, accounting for 50% of total earned profit. Similarly, looking at the 20 most liquidated accounts, we see many borrowers are liquidated multiple times, for high amounts. These are the risk takers, looking to maximize their profit from predicting the market and thus using a lot of leverage, often paying dearly for mispredictions.  Transaction Hash Date Profit ($) Liquidator Borrower Collateralized Token Repaid Token 0xa93b 2019-12-17 10910.69784 0x10aab 0x39bD ETH USDC 0x71c4 2019-12-23 10025.25404 0x10aab 0x586e ETH DAI 0x4a13 2019-12-04 8994.932718 0x10aab 0x586e ETH USDC 0x2bf2 2019-11-22 7715.455715 0x10aab 0x586e ETH USDC 0x06e3 2019-11-22 7272.64655 0x10aab 0x586e ETH USDC

Looking at the most lucrative liquidation events of 2019, we can see that all were executed by the same liquidator, and almost all for the same borrower.

A total of $120,065 was collected by the most successful liquidator, 20% of the total gained. ## Which assets are involved in liquidations? Liquidations are the results of unsuccessful bets on the direction of the market. Since during the observed period ETH mostly lost value against the USD we expected most liquidated collateral to be in ETH, while the repay borrow to be in stablecoins And indeed ETH was by far the most collected coin by the liquidators, while stablecoins (SAI, DAI, USDC) are most popular for repaying borrows. ## Section 5: Specific stories of liquidations in the wild While the statistics in the previous section tells the high level story of Compound’s liquidations, zooming in on some specific examples may yield additional insights. ## The biggest liquidation Big numbers are always interesting and indeed the biggest payout was made on December 17th 2019, resulting a payment of more than 88K cETH, which equates to$330K USD at the date the screenshot below was taken.

#### The biggest liquidation payout (source: etherscan)

It’s interesting to observe the behavior of the Liquidated account (0x39bde2f9254cfef7d0487a27e107ef6c1685e44).

#### On June 12th ETH price was ~ \$250 USD

The account started a long position on ETH (= expecting ETH to beat USD) on June 12th 2019, by supplying ETH and borrowing mostly USDC (and some SAI)

Shorting USD: supplying ETH, borrowing USDC

To increase the leverage the account used the Binance exchange to exchange the borrowed USDC back to ETH.

Specifically see the correlation in sums and dates, the 10K USDC borrowed on 7:49 are sent on 7:53 to Binance exchange and result a payment of ~40ETH that is soon added back to the borrowed sums in compound

Sending USDC to Binance (source: Etherscan)

Getting ETH from Binance (Source Etherscan)

The account never withdraws but makes some small repays, probably to prevent liquidations

When the account needed to repay they bought USDC on the Binance exchange as can be seen in the screenshots below

(source: coinmarketcap)

However, on December 17th ETH price steeply dropped.

This time, the account did not have enough liquidity to defend its position (either by increasing the collateral or by repaying) against liquidation and was liquidated for the biggest liquidation payout of 2019 shown above.

## Liquidating with a smart contract

The liquidation process often involves additional steps, as the liquidator may need to exchange its current coins with the one relevant to the repayment and/or need to exchange the collected collateral to another coin. In the case described below, the whole process was automated via a smart contract.

Liquidating with a smart contract (source: etherscan)

This smart contract automates the whole compound liquidation process: The liquidator sends ETH to a smart contract, the smart contract exchanges ETH to SAI (using uniswap, another DeFi product that enables exchanging between assets), then the smart contract uses the obtained SAI to repay the borrow and liquidate the collateral in BAT, and finally exchanges BAT back to ETH (using uniswap) and sends back to user for an easy ~6% profit.

Besides the elegant way to make some profit, it really shows the power of DeFi being able to freely mix and match services (in this case Compound and Uniswap) to create new earning opportunities.

Another advantage is that a smart contract either succeeds and its user gets back more ETH than they started with or completely fails. If this process was not implemented as a smart contract, in the case something goes wrong during the liquidation process, the user might have been left with some undesired intermediate results; owning SAI or BAT.

## Section 7: Findings and insights

• Supplying Liquidity on Compound is easy and is a very viable option for beginners to earn interest on their crypto. However, borrowing and liquidating on the protocol is aimed for experts only, as it requires technological and economical skills and resources.
• Specifically, borrowing requires operational excellence and available liquidity to quickly respond to market changes and restore the health of the borrowing account either by repaying borrowed funds or increasing collateral
• Similarly, to be a successful liquidator, operational excellence and available liquidity is required to quickly respond to liquidation opportunities and beat other potential liquidators. As a result only a few liquidators are actually successful.
• We had observed some sophisticated DeFi users that combine several DeFi solutions together to create new functionalities. We predict that it is a precursor for the next generation of DeFi products and services to be built Specifically we expect to see
• Services that offer leveraged trading based on Compound borrowing
• Services that allow user to participate in liquidation opportunities
• Services that combining exchanging with DeFi exchanges (e.g. Uniswap, Kyber) and Compound functionality
• The innovative incentive-based liquidation process seems to work, as mostly all of the risky borrowings are quickly liquidated once they cross the liquidation The between the appearance of the liquidation opportunity and its exercise is less than an hour (as we only have the historic price granularity of one hour resolution). We assume that the actual exercise time is much less than that and probably is within seconds.
• We predict that the emergence of DeFi will create a need for analytical tools to harvest the blockchain data and convert it to financially actionable insights.
• The use of automated trading via smart contracts with DeFi will increase the need for privacy solutions to protect the players’ investment strategy

## Authors and Acknowledgements

This report was assembled by ZenGo research team, main authors: Alex Manuskin and Tal Be’ery.

Some special thanks to Jeremy Felder, Dan Carmel for proofing, editing and designing the final report.