From Basics to Advanced, Comprehensive Discussion on the Liquidation Mechanism in DeFi

From Fundamentals to Expert-Level A Comprehensive Exploration of the DeFi Liquidation Mechanism

The best liquidation mechanism is a mechanism that minimizes the risk of bad debt at the lowest possible cost for users. However, users being liquidated must incur certain costs to persuade the liquidator to liquidate them.

Original title: Liquidations in Decentralized Finance: A Comprehensive Review

Original author: Alberto Cuesta Cañada

Original source: Hackernoon

Translation: Lynn

DeFi lending in DeFi is supported by liquidations, but these often feel like a dark art. Unlike traditional finance, decentralized liquidations are frequent, immediate, and typically carried out by anonymous operators.

In the early days of DeFi, liquidators made substantial profits and drove innovations like flash loans and mempool competitions. Meanwhile, decentralized financial lending institutions have experienced market volatility, which could potentially lead to the disappearance of traditional financial companies.

However, despite the large amount of funds involved and the heavy workload, information on how to establish liquidation mechanisms is fragmented and decentralized. This is an emerging field where new lenders are trying different mechanisms to solve existing or imagined problems.

In this article, we will take you from the basics to advanced understanding of liquidation mechanisms. We will explain the factors involved in liquidation mechanisms so that you can understand existing mechanisms and even design your own.

About Liquidation

As a traditional lender, you want borrowers to repay the loans they obtained from you. If they don’t do so, you will accumulate bad debt and possibly go bankrupt. One measure you can take to ensure borrowers repay the loans is to require them to provide something of value as collateral.

This is called collateral.

If a borrower fails to repay the loan, or the lender deems it unlikely to be repaid, the lender will sell the collateral and forcibly recover the loan. This is known as liquidation. Traditional lenders would hire trusted parties to liquidate loans that cannot be repaid and resort to legal procedures if necessary to avoid losses.

In decentralized finance, there is no legal recourse for unpaid loans, and bad debt cannot be recovered. On the other hand, the exact value of the collateral can be known at any time. For these reasons, in decentralized finance, loans that cannot be repaid are immediately liquidated rather than waiting for repayment on a given date.

People tend to view customers who cannot repay loans as bad customers and rarely consider their well-being. However, lenders want to protect these customers and make the liquidation process as smooth as possible because these customers may become repeat customers.

There is another difference between traditional finance and decentralized finance when it comes to liquidation, and that is the anonymity of the DeFi liquidators, who usually do not involve any scrutiny. We will see how incentives are devised to protect borrowers from bad debt by anonymous liquidators.

All liquidation processes are a balancing act between incentivizing liquidators and protecting users.

Solvency

In order for a loan to have solvency, the value of the collateral must always be higher than the value of the debt. The relative value of the two assets changes with volatility, and a loan that was originally able to repay the debt may become unable to do so in the future.

If a loan becomes insolvent, the borrower has no incentive to repay the debt as the value they get back from the collateral is less than the value of the debt they repay. The lender’s capital loss can accumulate rapidly, leading to bankruptcy.

To avoid this outcome, lenders allow for the liquidation of insolvent loans by selling the collateral to liquidators in exchange for repaying the debt.

Solvency as a comparison between collateral and debt value

In order to maintain solvency, basic liquidation can be implemented as follows:

  • Liquidation condition: Once the solvency formula is violated, the loan becomes eligible for liquidation: value(collateral) == value(debt)
  • Liquidation action: All collateral supporting the loan is sold in exchange for the assets needed to repay the debt.

The main flaw with the mentioned liquidation process is that the loan can only be liquidated when the market value of the collateral is lower than the market value of the assets needed to repay the debt. This is a problem because we need to convince anonymous entities to liquidate the loan, and they won’t do it without profit.

To ensure profitable liquidation, we need to explain the concept of collateralization ratio and make loans overcollateralized.

Decentralized

Solvency as a comparison between collateral and debt value

Collateralization ratio

The basic liquidation mechanism described in the previous section does not apply to anonymous liquidators as they do not profit from it.

One simple solution to this problem is to liquidate the loan before it becomes insolvent. If borrowers are required to provide more collateral than the value needed to repay the debt, liquidators have time to liquidate the loan and make a profit when prices drop.

The ratio of the loan’s collateral is defined as the value of the collateral divided by the value of the debt. The scenario mentioned above is a case of overcollateralized loan, where the collateralization ratio is required to be higher than 1.0.

ratio = value(collateral) / value(debt)

Considering the collateralization ratio, we now have a different formula to determine if a loan is healthy and not subject to liquidation. Bad loans still have solvency but are eligible for liquidation.

value(collateral) < value(debt) * ratio

A collateral ratio greater than 1.0 incentivizes liquidators to repay loans at risk of bankruptcy, protecting the lender. However, the collateral ratio is determined by the expected volatility between the debt and the collateral assets. The higher the expected volatility, the larger the collateral ratio must be to allow enough time for liquidators to act.

For borrowers, liquidating loans with high collateral ratios can be very expensive. Therefore, this liquidation model is only achieved in concept validation, such as Yield v1 and its predecessor Sai from MakerDAO.

To be safe, lenders may end up over-incentivizing liquidators. We will address this issue next.

Decentralization

An increased collateral ratio provides margin to prevent losses for the lender during liquidation.

Liquidation Incentives

Now, due to the selfish acts of liquidators repaying high-risk loans for personal gain, lenders can be protected from bad debt.

However, lenders must maintain a balance between their own ability to pay and attracting borrowers. The higher the collateral ratio, the safer the lenders, but users will bear higher costs during liquidation.

To manage the trade-off between liquidator profits, user loss magnitude, and lender ability to pay, a liquidation incentive has been applied since at least Compound v1. When a liquidation incentive is used, liquidators typically receive additional collateral for the repayment of their debt at a configurable coefficient (often much lower than the collateral ratio).

Of course, the liquidation incentive itself can be a function of any of the following:

  • Total debt or repaid debt

  • Collateral or total liquidation collateral

  • Other factors

Imagine a loan where 150 units of collateral are used to borrow 100 units of debt, resulting in a collateral ratio of 1.5. As the relative value between collateral and debt decreases, a liquidator steps in to repay the 100 units of debt. Without a liquidation incentive, the liquidator would receive 150 units of collateral and potentially make an instant profit of nearly 50%.

If the liquidation incentive is 5%, the liquidator would repay the 100 units of debt and receive 105 units of collateral, making a profit of 5%. The borrower’s debt would be eliminated and they would be able to withdraw the remaining 45 units of collateral, losing at most 5%.

When we add additional factors to the liquidation process, the risk of misconfigured settings increases.

With liquidation bonuses, we need to ensure that the minimum collateral ratio is higher than the liquidation bonus. Otherwise, either the liquidation bonus will never be fully paid or the borrower will go bankrupt.

Decentralized

Liquidation bonuses limit the profits of liquidators.

Closing Factors

If the liquidation bonus is a factor of the size of the loan being liquidated, then larger borrowers will pay more during liquidation than smaller borrowers. To solve this problem, lenders often only liquidate a portion of the loan.

If an indebted but unhealthy loan is divided into two portions, one of which is liquidated, the borrower will receive half of the loan, plus half of the collateral after liquidation (not counted as a liquidation bonus). This means that the remaining half of the loan will have more collateral than before.

Proximity Factors determine how much of the loan should be liquidated in order to minimize the size of the liquidation and recover the reduced loan to a healthy state. It is typically defined as a static value (e.g., 50%) in immediate liquidation mechanisms.

Consider an example:

  1. The user borrows $750 in assets by providing collateral worth $1000.

  2. The initial collateral ratio is 1.5, reflected in the account’s health status.

  3. The collateral’s price drops relative to its debt assets, resulting in insufficient collateral.

  4. In this example, let’s assume the proximity factor is 50%. The liquidation bonus is 8%.

Decentralized

Note that in this example, the ETH collateral ratio is defined as 75% – if you deposit $1000 worth of ETH, you can only take on debts worth up to $750.

At a lower collateral price, the collateral ratio is still higher than 1.0, and both the user and the lender have the ability to pay. The liquidator obtains $20 in collateral, which we hope is enough to cover their costs and achieve profit.

We cannot always perform partial liquidations. In some cases, the collateral returned to the borrower may not be enough to make the remaining loan healthy enough. It may still be unhealthy and be liquidated immediately, or it may be healthy but will be liquidated soon due to volatility. In these cases, the lender may choose to ignore the closing factor and liquidate the entire loan.

Liquidation Costs

Today, liquidation is closely integrated with various market mechanisms. Liquidators typically receive assets through flash loans to repay debts, which may come at a cost. Flash loans usually involve exchanging part of the collateral received from decentralized exchanges, which incurs additional costs such as exchange fees and slippage. Only the remaining collateral after deducting the costs is considered as profit.

The liquidator must also pay for the gas to execute the liquidation transaction. Liquidations typically occur when there is significant price volatility, fierce competition for block space, and gas prices higher than usual.

The liquidator incurs other costs as well, such as software development and maintenance, as the software must check all new blocks on the blockchain to compete with other liquidators for clearing loans.

Flash loans and transaction costs can erode the liquidation bonus factor, while development and maintenance costs remain constant. The liquidation bonus factor needs to be higher than the estimated flash loan and transaction factors for the profit to increase as the loan size grows.

Decentralized

Liquidation costs erode the liquidator’s profit

Please note that we assume the liquidation costs in this graphic are linear – this may vary in practice.

Throttling

Another factor to consider when looking at market mechanisms is market liquidity.

Post-liquidation, loan collateral is typically sold immediately unless the liquidator is keen on holding depreciating assets. But this is unlikely. Hence, concerns about market liquidity for such sales arise.

Some individuals hold specific assets more than their available liquidity; CRV is a recent infamous example. If loans are allowed to be collateralized with illiquid amounts, then these loans are effectively unliquidatable.

The solution is to enforce hard limits on the collateral allowed for each loan, such that a single liquidation will never exceed the tradable quantity of the collateral. Even if a borrower takes multiple loans with the highest collateral, these loans will be individually liquidated, giving the market a chance to handle them one by one.

An alternative solution is the dynamic closure factor, where large loans are broken down into smaller parts for liquidation, achieving a similar effect.

These solutions are not perfect as market liquidity cannot be consistently predicted in advance. Only integration between lenders and exchanges allows liquidation to be triggered not just by price changes but also by liquidity changes.

Dust

Once we take into account gas costs, smaller loans become unprofitable as the gas required to liquidate them is more expensive than the bonus granted by the borrower.

MakerDAO introduced a dust factor that prohibits loans with collateral amounts below the threshold expected to make the loan profitable.

This approach has issues as it depends on unknown and unpredictable factors like gas prices and the collateral value relative to the Ethereum price. Major lending institutions have refused to implement the dust threshold, and after years of operation, significant vulnerabilities remain unknown.

Considering the operational costs and attack surface dust of implementing thresholds, we will avoid them.

Auction

So far, we have been discussing instant settlement that occurs in a single transaction. A loan becomes unhealthy and is liquidated at the same moment to gain predictable profits. The profits are also proportional to the loan size.

This means that larger loans result in higher profits for the liquidator, but also pose greater risks for the borrowers.

Lenders do not want to penalize their largest clients, so auction is sometimes used as a tool. In an auction for liquidating loans, the goal is to make liquidators compete and give the liquidation rights to the liquidator who accepts the minimum profit to execute.

The initial implementation of liquidation auctions may have been Sai, which used a Dutch auction where liquidators hold funds to repay the debt and quote prices that decrease the liquidation bonus over a certain period of time. Liquidators held funds, preventing them from using flash loans, making this method currently unusable.

MakerDAO introduced a Dutch auction. In a Dutch auction, the bonus paid to the liquidator increases over time during the auction. If the liquidator waits, it has the possibility of higher profits, but also the risk of being taken advantage of by other liquidators. In a competitive environment, the result is often that the auction ends once the liquidator surpasses its profit threshold.

If the Dutch auction is set to provide a liquidation bonus higher than 0% at the start of the auction, the effect may be an instant auction followed by gradually increasing the liquidation bonus if no liquidator is found. This is the method used by Yield v2.

For lenders implementing liquidation auctions and liquidators seeking profits, liquidation auctions are more complex than instant settlement. The benefits of dynamic debt pricing must be balanced against increased attack surface and entry barriers for liquidators.

In any of the above cases, the additional complexity of implementing auction liquidation must be considered. In instant settlement, there is only one participant, the liquidator, and only one transaction, the liquidation. In an auction, we will have an auctioneer and a liquidator who typically submit a transaction at different times and must be rewarded for it. The attack surface significantly increases, and the incentive scheme becomes more complex, which might not always be a reasonable trade-off for efficient liquidation pricing.

去中心化

Auction ensures that the liquidator receives a constant, non-proportional profit

Socialization of Bad Debt

Unliquidated loans are collectively known as bad debt. Sometimes they are grouped together into a single easily usable value, such as sin in MakerDAO.

Bad debt is dangerous because it indicates that the lender is unable to fulfill all of its commitments, whether it is returning the collateral entrusted to it or providing profits to users who provide liquidity to the lenders. Since this could result in the users themselves bearing all the losses as a last resort for the lenders, it is usually a race to exit and results in disastrous outcomes.

Typically, this hole in the balance sheet is filled by those who manage the lenders’ treasuries. However, socializing bad debt among all or some of the protocol users immediately seems like a better idea. This avoids a self-reinforcing cycle.

A Completely Different Approach

I recently came across Instadapp building a completely different approach called Fluid. The code is not yet available, but it suggests integration with a Uniswap v3-style DEX and their statements about liquidation allow us to infer possible designs.

In Uniswap v3, liquidity providers act as options traders within certain price ranges. When the price in the pool crosses their provided range, their assets are traded. Let’s extend this idea to the lending domain, but with some differences.

When a borrower provides collateral, that collateral is used as liquidity in the relevant DEX, in a pool where the collateral trades against the assets the user borrowed. The debt is secured not by the collateral itself, but by the position providing the liquidity.

If the collateral’s value relative to the borrowed asset decreases, the price changes through the relevant liquidity position in the DEX. The result is the collateral being immediately exchanged for the borrowed asset at market price.

From the lender’s perspective, the loan is always collateralized. From the user’s perspective, the value of their collateral depends on the market, and if the market moves against them, they may receive less collateral than what they deposited.

This approach requires deep integration with a Uniswap v3-style DEX, but it has undeniable advantages:

  • No dedicated liquidators, regular activity in the DEX performs liquidations.

  • Users do not pay any bonuses to liquidators, meaning their liquidation penalties are small.

  • Market liquidity is a non-issue as borrowers provide liquidity upon issuing loans.

Conclusion

Liquidation mechanisms are crucial for DeFi lending, but people rarely understand them. Users are interested in their investment returns rather than the stability of the lenders. No one thinks they will be liquidated, so they only care about how much they lose during liquidation.

On the other hand, the designers of lenders should be aware that poorly designed liquidation mechanisms will be a fundamental problem. Even if avoiding a complete disaster, disgruntled liquidated users will voice their concerns.

The best liquidation mechanism is the one that minimizes the risk of bad debt at the lowest possible cost to users. However, users subject to liquidation must bear a certain cost to convince the liquidators to liquidate them.

In this article, we discussed solvency and health status. We have discussed collateral ratios, liquidation bonuses, liquidation factors, liquidation costs, and market restrictions. We have also discussed auctions as a means to achieve optimal liquidation. Finally, we have hinted at market integration, which could render the current liquidation mechanism obsolete.

Now it’s your turn to take all this information and apply it. Happy liquidating!

Decentralization

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Roger Ver "in the move", was sued by CSW for a video

Bitcoin.com CEO and Bitcoin Jesus Roger Ver, who was sued by CW (Craig Wright) yesterday, said he was a liar in a vid...

Blockchain

BTC chain data perspective: 78% of the whale address has no expenditure, the daily address increases 40% in half a year

After a short period of half a bear market, this year, BTC opened the cryptocurrency Mavericks market with a rising a...

Blockchain

BTC turned into the triangle shock zone, and the market began to stabilize.

Author | Hash sent analysis team Avara: The New Face of DeFi, Inviting the Masses to the Web3 Extravaganza!Aave v3 lo...

Blockchain

More and more panic! Has Bitcoin really become "gold" in the shadow of the epidemic?

Author: Joyce Source: Blockchain Outpost Although the central bank issued an announcement on February 2 stating that ...

Blockchain

Dry goods | Programming Xiaobai simulates a simple bitcoin system, with you writing a wave

Source of this article: Blockchain Base Camp Author: VV smileヽ If there is a p2p demo, how can we apply it to ...

Blockchain

CME executives' proposal to expand the group's business to the bitcoin mining sector, is it good for the crypto industry?

The cryptocurrency space is always full of surprises. The latest unexpected news came from the CME Group's elect...