If you’re as redacted as me, then the word liquidation is something you’re probably all too familiar with.
The fact is that while liquidations are something most of us degens dread, they play an important role in any margin DEX. A good liquidation engine is instrumental to the well-being of the overall system because if there are any issues with it, it could eventually lead to total collapse.
For perp DEXs, liquidation engines are amongst the biggest points of differentiation. How a protocol handles and clears bad debt is instrumental to the health and overall success of the system.
So before we get into how liquidations work on Unstoppable, let’s look at some of the current liquidation mechanisms for on-chain perps.
How do protocols currently conduct liquidations?
GMX has a fairly straightforward method to conduct liquidations. When a user’s collateral minus unrealized loss & borrow fees goes below 1% of the open positions size, a liquidation is triggered. Whatever funds remain after the liquidation process are returned to the users’ wallet.
Perpetual Protocol is an OG player in this space and has a slightly more complex liquidation method.
The liquidation is triggered when a position’s margin ratio is below 6.25%. This margin ratio is calculated using the 7-minute TWAP of the index price. Positions under $100 will be subject to full liquidations and positions higher than that will be subject to partial liquidation.
When the price goes through your liquidation price, there are liquidators who execute this liquidation. The liquidators are keeper bots that can be set up and run by anyone. These liquidators receive a bonus after successfully liquidating a position and this bonus is paid for from the collateral that was liquidated.
Similar to Perp Protocol, dYdX also allows anyone to run their own liquidation bot to execute liquidations.
When a trader executes a margin or leverage trade, the platform expects them to maintain 115% collateral of their borrowed assets.
Suppose you have $115 of collateral and borrow $100, but the price goes down and now your collateral worth is only $112. A liquidator can come in, pay you the $100 borrowed amount and take $105 of your collateral for example. This can only happen if your account is undercollateralized.
Most of the other players have a fairly straightforward liquidation mechanism wherein once a trade reaches its liquidation price, the protocol typically has an off-chain engine that processes the liquidations.
Now that you know how liquidation for the other players in the space works, let’s come to the topic of today. Unstoppable and their liquidation engine.
The Unstoppable Liquidation Engine
You see, Unstoppable had the advantage of being able to learn from the other players seeing that they are newer to this field. The main takeaway from their competitors is that you can never be too safe in DeFi. Even your backups need backups.
Therefore, Unstoppable is coming to market with a 4-layer liquidation system. These 4 layers are referred to as redundancy layers.
Layer1 – The Unstoppable Liquidation Engine
This is an off-chain liquidation engine that monitors all positions on the exchange. If the leverage of a position starts to exceed the maximum leverage allowed for that position’s market, then it is automatically liquidated.
To better understand how this works, let’s understand how maximum leverage is computed.
Their engine has a predetermined modifier for the maximum allowable leverage and this modifier determines separate parameters for each individual market. Let’s take a look at a simple example to better understand it.
Suppose you initiate a $100 order using 10x leverage, your total position value is $1K. Now imagine the market moves against you reducing your position’s value to $950, your leverage will naturally increase.
So initially your 10x leverage consisted of $100 and $900 borrowed. Now with the market shift, your equity dropped $50 but the borrowed amount remained $900. The new leverage is calculated as total value divided by your equity which in this case will be ($50 + $900)/$50 = 19. So the new leverage is now 19x.
This means that the reduction in your position’s value increases our leverage, and this increase brings you closer to your liquidation point.
Besides this, the engine analyzes available liquidity, trade activity, and price impacts to find a healthy balance between offering enough leverage for traders while ensuring safety of LP funds.
In this first line of defence, the priority is to protect LPs. However, in case this first line of defence fails, the second line is engaged.
Layer2 – External Liquidation Engine
This is where third parties, i.e. anyone who decides to create a liquidation bot, can liquidate the position for the exchange.
The actual liquidation engine itself is spread out globally across various servers to ensure that there is 100% uptime. However, just to add that extra layer of security, Unstoppable will also provide the liquidation engine in an open-source format so everyone can run their own bot.
It serves as an extra redundancy layer for users to either protect their liquidity position or their UND stake.
Layer3 – Chainlink Smart Contract Automation
After Chainlink extends their automation capabilities, Unstoppable will integrate it into its Chainlink Automation to create an even higher-performance environment for it. It also further decentralizes the engine via the Chainlink nodes.
Chainlink is said to be working on further improvements to this system which will only further enhance the security of the liquidation engine.
Layer4 – Safety Module
In our previous article which you can read here, we spoke about the safety module.
It is essentially a last resort of sorts which allows LPs to safeguard the protocol in a worst-case scenario.
If all the aforementioned layers fail for some reason, then the safety module steps in to absorb the bad debt.
When providing liquidity, all liquidity providers (LPs) are liable via the safety module in the worst-case scenario.
However, when providing liquidity, the LPs are given an option between a low-risk or high-risk tranche. In the event that the safety module needs to be tapped into to absorb any bad debt, the high-risk LPs will be affected first. In return for taking this risk, they get a higher share of fees and high yield in comparison to low-risk LPs.
The main advantage of this 4 layer system is sustainability. DeFi is no stranger to freak events and accumulating bad debt quickly is one major example of a detrimental event for a protocol. Having multiple layers to ensure this doesn’t happen means that over the long run, the protocol will be healthier and therefore much more sustainable.
The other advantage is the openness. Allowing anyone to quickly and easily make their own liquidation bot means that users have another avenue to profit through Unstoppable while also ensuring that the protocol stays healthy. A win-win situation.
Unstoppable continues to push on toward its goal of replacing CEXs. In a previous article, we covered every other aspect of Unstoppable and that should be more than enough to show you how serious this team is.
Liquidations however are amongst the most important things to get right. A good UX/UI, a smooth trading experience, and a bunch of cool features mean nothing if the protocol cannot process liquidations properly. Unstoppable took notes from other players in the space and has gone ahead and built one of the most robust liquidation engines.
Keep your eye on this space though because we have more articles coming on Unstoppable covering some of their other lesser-known features. Stay tuned.
- This article was written by Emiri, a writer & researcher who has been exploring the depths of crypto since early 2021. He’s a long-time contributor to blocmates and now also drives technical editing across the board to ensure that our viewers consistently receive the high-quality content they are used to.