Euler’s innovative liquidation engine
- Existing liquidation structures are wasteful, liquidating large positions and contributing to gas wars. New developments must occur in the liquidation engine space to reduce bad debt in DeFi, which sits at ~2.5% on mainnet.
- Euler mitigates gas usage and constrains MEV bots by offering sliding discounts to liquidators, and multiplying the discounts for liquidators with deposits in Euler. This forms a dutch auction.
- Euler’s liquidators can perform a “soft liquidation”, in which only enough collateral and debt is transferred from the user undergoing liquidation to return to a health score of 1.25.
Euler Finance’s liquidation engine presents many optimisations over existing liquidation infrastructure currently employed by incumbent lending and borrowing protocols. This article will explain how liquidations occur in major DeFi protocols, and then will discuss Euler’s approach to liquidations, and the benefits that this brings.
For those unfamiliar with liquidations, do not feel discouraged by this article! At the bottom an appendix can be found which will explain them with examples. Please start there and return here after.
In addition, a degree of familiarity with how Euler tokenises borrow / supply positions into debt tokens (dTokens) and supply tokens (eTokens) will be useful- imagine them as redeemable receipts. For more info, see here.
DeFi’s liquidation landscape
Different protocols handle liquidations in different ways. Leading and borrowing protocols currently handle liquidations in a static way, whereby accounts come into health factor violations and then anyone is capable of liquidating. While open and simple, this method of liquidating can lead to gas spikes and is very susceptible to MEV attack. It is therefore inefficient.
Other lending and borrowing protocols offer a fixed discount to liquidators when buying collateral, which is useful in incentivising decentralisation and ensures that anyone may participate. Some even go as far as to offer reimbursements for gas used in liquidating. This has a few drawbacks as highlighted in an audit which noted “counterproductive incentives”. In addition, this favours DeFi users with rich technical skill at their disposal, leading to in one instance one liquidator earning 20% of all rewards. Centralisation is best avoided.
Maker has updated their liquidation module to allow for bids on collateral to be placed in a “dutch auction” (start at a high price and decrease in price until a bid is made), which goes some distance improving over the original liquidation engine, but this too has some issues with it.
Do liquidations in DeFi function as intended?
If the aim of a liquidation strategy is to prevent a protocol accruing bad debt, then the bad debt dashboard created by RiskDAO is a good indicator of success. While other factors (such as collateral asset selection) must be considered, liquidations are ultimately the tool that is going to act as a last defence.
Do liquidations work? Generally speaking, yes, they do! With in excess of ~$11B in TVL locked over various lending and borrowing protocols in Ethereum DeFi, some ~$4.43B is lent out. Of that, the total amount of bad debt is roughly $110M (that is tracked, there is likely more not tracked by this dashboard). ~2.5%** of all debt in DeFi has gone bad (i.e. has nothing backing it). While this could be far worse, if DeFi is supposed to be a replacement for the existing financial system, DeFi protocols need to get this percentage far lower.
By contrast, the amount of sovereign debt in the world in default is estimated to be 0.3% (p4). Enterprise debt defaults in 2023 are expected to hover anywhere between 2%-5% this year, but this value is lower compared to sovereign debt. As such, we can fairly deduce that defaulted debt in DeFi sits higher proportionately compared to “TradFi”, given the size of sovereign debt. Note the limitations in comparing fundamentally different types of debt.
If we look at some of the protocols with larger amounts of bad debt, they often suffer oracle attacks. In offering users the ability to collateralise assets that are relatively concentrated (i.e. long tail assets), protocols are subject to relatively straightforward attack. This is done by firstly raising the price of an asset with a weak oracle (see Euler’s oracle attack simulator for a demonstration) then borrowing against it with no intention of repaying (the debt is worth more than the fair market value of the asset you pumped). Alternatively, you could manipulate the price of an asset downwards allowing you to borrow more than you otherwise should be able to.
Countless examples of this have happened over the past few years, but the Mango Markets exploit stands out as a prime example. Existing liquidation mechanisms in these circumstances have largely struggled to prevent bad debt occuring.
It is thus clear that while protocols do a relatively good job at preventing bad debt, there is room for improvement. Enter Euler.
**correct at time of writing
What makes Euler’s liquidation system unique?
Euler handles liquidations in a unique manner. Like other DeFi protocols, each user has a health score. Euler calculates health scores using risk-adjusted metrics for collateralised / borrowed assets by adjusting them against their market value to a more conservative risk-adjusted one. The health score is derived from this risk-adjusted value.
Once the user’s health score is flagged for liquidation (at a health score of 1), anyone may press the “liquidate” button (this is actually operated via bots) and transfer dTokens and eTokens to their own account (buying both their collateral and debt). This has the aim of returning the account in violation back to a healthier 1.25, which is what is known in Euler as a “soft liquidation”.
Should an account not undergo a “soft liquidation” and the account health go below 1, an auction begins. For each additional % point decrease in health factor, the liquidator gets an additional % decrease in the cost to buy their collateral and debt (eTokens and dTokens). This has the effect of creating a dutch auction: as the health score slowly decreases, the discount (and therefore incentive) to liquidate increases!
Finally, Euler provides a further discount for liquidators with a deposit position (held for a period of time) in the Euler protocol, which can stack as a multiplier on the aforementioned liquidation discount. For example, if a liquidator has a position in Euler that qualifies them for a discount bonus, they will get the 2.5% liquidation bonus. If an account with a health score of 0.97 gets liquidated, there is a final total discount of 5.5%. It is important to remember that with each liquidation a small premium is paid into the reserve and that this discount is capped at 20%.
In using this unique liquidation system, Euler mitigates pitfalls typically suffered by existing lending and borrowing protocols:
- In enabling soft-liquidating, Euler helps accounts only lose as much collateral as is required to return to a safe health score. On other protocols, a small account health violation will lead to complete loss of the position. This is punitive and avoidable.
- By integrating with Euler’s eToken / dToken architecture, these auctions can allow for liquidators to operate without capital. By using liquidity deferrals, users may liquidate, swap collateral tokens to debt tokens, repay the debt and keep the difference (with a small fee for the reserve). This is known as a “flash liquidation”. While other protocols can rely on external flashloans, Euler users can do this without leaving Euler architecture.
- This dutch auction is inherently MEV resistant. In allowing liquidators to choose what level of discount is acceptable to them, there is not a single moment in which 50 different liquidators all attempt to liquidate the same position. This reduces gas spikes / MEV.
- This MEV resistance is then entrenched with the multipliers Euler offers to liquidators with deposits in their account. This enables liquidators that are more closely aligned with Euler to beat liquidators with no interest in Euler beyond liquidating. It acts as effective sybil resistance / MEV protection in this area.
Euler is thus clearly a step ahead of other lending and borrowing protocols in ensuring that liquidations are handled in a more perfect way. There is still yet more work to be done in this area, but Euler is moving down the right path and the proof is evident and can be monitored liquidations in real time with this twitter account.
The proof is clearly in the pudding here: liquidations occur on the protocol with $0.50 liquidator bonuses. There is a strong appetite for low reward liquidations.
What is a liquidation (appendix)
Lending and borrowing is complicated. This is especially so in crypto and DeFi, where the value of assets fluctuates considerably more than in traditional finance. Liquidations are a necessary part to ensuring that the protocol still functions.
In short, a liquidation is when a DeFi user buys your collateral (at a slight discount) when the value of the asset you borrowed exceeds a predetermined value relative to the asset you deposited as collateral. This helps to prevent protocols accruing bad debt, which is a definite possibility in DeFi.
Let’s work this through with an imaginary example whereby liquidators do not exist:
Given USDC is worth exactly $1 and ETH is worth $1200:
You supply 1500 USDC and borrow 0.5 ETH, meaning your deposits are substantially more valuable than your borrows. See the diagram below as an example.
All of a sudden, the price of ETH rises to $4000. The value of your borrowed ETH rises from $600 to $2000, but the USDC remains at just $1500.
This means that the ETH debt is not adequately collateralised and you, as a user, have no interest in repaying the 0.5 ETH loan because your loan is worth more than the assets you borrowed against.
You’d then go and sell the ETH and laugh all the way to the bank because you’ve used your ETH loan as a way to take from the protocol more than the smart contract would otherwise allow for.
That is, you would if your collateral (and debt) wasn’t transferred to a liquidator in advance of the value of the loan becoming larger than the value of the asset you supplied as collateral. Enter the liquidators: DeFi users who will buy your USDC (at a slight discount) and pay the ETH debt before the value of the asset you borrowed becomes greater than the value of the asset you supplied.
At roughly the point just before your ETH borrow becomes more valuable than your USDC deposit, a liquidator will step in and buy your collateral while repaying your debt. Lending and borrowing protocols incentivise these liquidators to buy your collateral (1500 USDC / $1500) by offering it at a slight discount (in this case $1490) and the protocol will take a small cut for its troubles. Using this mechanism, lending and borrowing protocols ensure that no bad debt is accrued. With a few exceptions, this works generally quite well.
Now, equipped with this information, please return to the top of this article to see why Euler is better than other protocols at liquidations!
This content is brought to you by Euler Labs, which wants you to know a few important things.
This content is provided by Euler Labs, Ltd., for informational purposes only and should not be interpreted as investment, tax, legal, insurance, or business advice. Euler Labs, Ltd, is an independent software development company.
Neither Euler Labs, Ltd. nor any of its owners, members, directors, officers, employees, agents, independent contractors or affiliates are registered as an investment advisor, broker-dealer, futures commission merchant or commodity trading advisor or are members of any self-regulatory organization.
The information provided herein is not intended to be, and should not be construed in any manner whatsoever, as personalized advice or advice tailored to the needs of any specific person. Nothing on the Website should be construed as an offer to sell, a solicitation of an offer to buy, or a recommendation for any asset or transaction.
Euler Labs Ltd, does not represent or speak for on or behalf of Euler Finance or the users of Euler Finance. The commentary and opinions provided by Euler Labs Ltd., are for general informational purposes only, are provided “AS IS,” and without any warranty of any kind. To the best of our knowledge and belief, all information contained herein is accurate and reliable, and has been obtained from public sources we believe to be accurate and reliable at the time of publication.
All content provided is presented only as of the date published or indicated, and may be superseded by subsequent events or for other reasons. As events markets change continuously, previously published information and data may not be current and should not be relied upon.