Integral Logo
  1. Research

A Few More Liquidations Then Up Only

A DeFi Liquidations Primer

TL; DR: Liquidations are one of the least understood parts of all of the technical plumbing that keeps the decentralized finance ecosystem running. In this post, we will review the liquidation mechanisms for some of the most popular lending protocols.

What is an over-collateralized loan?

For the largest lending protocols like Aave, MakerDAO, Compound, and Euler finance, borrowing activity is all over-collateralized.

When a borrow is overcollateralized, this means that the borrower has posted more value in collateral than they have borrowed. For example, a borrower might be able to borrow $500 worth for each $1,000 of collateral they post. Loan-to-value (LTV) ratio is the ratio of borrowed asset value to the amount of collateral posted.

A user will deposit some collateral in the protocol, and they can then borrow up to a specific LTV amount. If this LTV goes below a certain level, then the collateral can be liquidated. Many DeFi lending protocols use this mechanism to ensure they are always solvent.

Depending on the collateral and the borrowed asset, a user will have different levels of loan-to-value ratio that they must maintain before getting liquidated. Lending protocols go to great lengths to customize the parameters of their markets to ensure that they will not incur bad debt.

If a position can not get liquidated for enough of the original borrowed asset, then the protocol can occur bad debt — they will have an outstanding borrow amount that is greater than the collateral they hold on the books.

Liquidation mechanisms are put in place to make sure that collateral that is dropping in value is quickly moved off the books and sold into the market. Since the protocols themselves can’t do this, they will set up a system of incentives and rules that allow market participants to run the liquidation. In practice, liquidations for lending protocols are a profitable business for MEV bots, which compete for the rewards inherent in a successful liquidation.

How do liquidations work?

Each protocol has a different mechanism for processing and rewarding liquidations. Here we will look at the way liquidations are done at the top lending protocols.

MakerDAO

MakerDAO, the lending protocol that issues DAI, is the largest DeFi protocol and one of the oldest. After going through numerous upgrades in response to market events, MakerDAO has settled on a liquidation mechanism that utilizes a collateral auction. When a vault holding collateral gets below its liquidation threshold, any user can submit a transaction to initiate an auction of the collateral.

Once the auction has started, users can bid in DAI. This will give the DAI to the protocol to repay the borrowed debt and in return, the successful liquidator will receive the deposited collateral. Liquidators will continually bid higher amounts of DA. If the amount of DAI offered exceeds the borrowed amount, then the auction process reverses and liquidators compete to give the best deal to the protocol.

Once the auction is closed, the winner sends their DAI to the protocol, pays off the debt, and receives the collateral. Most often, this collateral is sold off in the same transaction. Since the protocol auctions collateral with a slight discount to market price, it is a profitable activity for bots to initiate and compete for liquidations. Liquidation income is also passed back to MakerDAO through this system.

Aave

Unlike MakerDAO, Aave is a generalized lending protocol where users can deposit assets, and then these assets are made available for borrowers. Liquidations are important in this system to make sure there is no bad debt to the protocol and every depositor will be able to withdraw the original amount of assets they deposited.

Aave has also revised its liquidation mechanism several times and settled on the current version after lots of stress testing from the market.

In a single liquidation, up to 50% of a borrower’s debt can be repaid. That debt is sent back to the protocol and in exchange, the liquidator gets the deposited collateral and a liquidation bonus. The liquidation bonuses and the other relevant parameters for the loan-to-value ratio are customized per market.

Since all of the collateral is sold on the open market, the risk parameters must align with the overall market depth and liquidity to avoid the protocol incurring bad debt.

Compound

Compound is a money-market and lending protocol. Like Aave, they rely on a set of borrow and collateral parameters to keep the protocol overcollateralized. When an account gets below the liquidation level, bots will compete to liquidate the account through the protocol. The debt is repaid by the liquidator and in return, they receive discounted collateral, which they then usually sell directly in the same transaction. Similar to Aave, a borrowers debt can not be fully closed in a single liquidation.

Euler

Euler is a new lending protocol that offers the unique ability to create permissionless markets for long-tail assets. They allow this by only allowing some assets to be collateral for borrowing all assets in the market. Some assets are kept “isolated” meaning you can only deposit and borrow in the same market. This lets long-tail assets be safely added to the protocol and allows for short-selling opportunities on any asset with willing depositors.

Euler’s liquidation mechanism also functions differently from the other money markets like Aave and Compound. Euler has risk-adjusted parameters for both the collateral and borrow asset. When an account’s health factor goes below 1, a liquidator can initiate a liquidation. However, instead of allowing most of the collateral to be sold in the liquidation, Euler limits the amount of collateral liquidated to a smaller amount that will just bring the account up to an acceptable health factor. This is beneficial for borrowers since they will end up with less of their collateral liquidated compared to a similar position in another borrowing market.

Euler also implements a liquidation premium that allows bots to profit from quickly executing liquidations. In addition to the flat starting discount, the lower the borrower’s health factor, the higher the liquidation bonus. This allows the market to process liquidations on long-tail assets profitably.

When liquidations go wrong

Even though each protocol has different rules for when and how collateral is liquidated, at the end of the day, the collateral must be sold on the open market to process the liquidation. This means that is always important to have a liquid enough market to support the sale of posted collateral. When these factors are not aligned, then liquidations can’t happen properly and the protocol can be left with bad debt.

We have seen this play out a few times in the last months. Mango market on Solana was left with bad debt after Avraham Eisenberg conducted a market manipulation to pump the value of Mango’s native token. Since users could use this token to borrow in the protocol, a user pumped the price, deposited a bunch of Mango, and used this to borrow all of the hard assets from the protocol. Once the price of Mango fell, the protocol was left with a lot of worthless collateral and bad debt.

In a previous episode on Mango markets, a single whale had a large borrow collateralized with SOL tokens. It turned out that this account was so large that there would be no profitable way to sell the SOL collateral on-chain, ensuring that in a liquidation the protocol would be left with bad debt.

In a more recent example, Avraham Eisenberg struck again, this time targeting the Aave v2 protocol on mainnet. In a similar scheme to the one that broke Mango, he started to amass a large borrow position in CRV tokens. By continually borrowing and selling CRV, then taking the proceeds, depositing USDC, and borrowing more CRV, he was able to build a multi-million dollar short position against CRV. The episode ended with even more drama when the price started to pump towards his liquidation price and it turned out that there was not enough CRV on the market to profitably liquidate the position.

Changes to Avoid Bad Debt

While the Aave liquidation engine performed admirably, in the end, the protocol was left with a few million in CRV bad debt.

Aave has already put in a place plans to take care of the debt left over from the liquidation cascade. In the scheme of things it was an exciting, but rather inexpensive lesson for the protocol. In response, a number of governance proposals were voted through to reduce risk from long tail assets like CRV. It also serves a bit as a a wakeup call for the space, highlighting the importance of risk management and prudent protocol parameters.

Contributor