Liquidation Parameter Updates

This proposal is to increase the liquidation bonus for the ADA, DJED and SHEN markets to better account for DEX fees, slippage and the events when a liquidation may occur significantly under the 1.0 health factor. Specifically DJED and SHEN markets when minting and burning constraints on the DJED protocol can significantly affect slippage on DEXs, at the same time borrow health factors are approaching 1.0.

Currently the liquidation bonuses are set to 10% for the ADA and DJED markets and 12% for the SHEN market. The following data from a liquidation bot operator who successfully completed 4 DJED market liquidations in the past few days highlights the need to update these values:

The liquidation bot operators starting balances were:

  • DJED: 3642
  • ADA: 15

The four loans as they appeared on the liquidation panel before being processed:

After the 4 liquidations, the balance of the wallet was (not including the 4 liquidation tokens):

  • ₳ 12,179484
  • qSHEN 18395045989
  • qADA 450671424711
  • DJED 26,466573

The liquidation bot operator observed the bot processing the liquidations live as he viewed the 4 positions ready to be liquidated on the loans page in the app (Liqwid App).

**Important points to note points that can affect the timing/introduce delays for when underwater loans are processed:

  1. A parameterization issue caused three bots pointing to the ADA market, instead of being one for each market.
  2. Exception being thrown (possibly older version of the code).

Tips to liquidation bot operators for timely liquidations to be processed: 1. ensure you have one bot pointing to each market (instead of pointing them all to the same market) and 2. ensure you are running the latest version of the liquidation bots which can always be found on the GitHub container at: https://github.com/Liqwid-Labs/liqwid-liquidation-bot/pkgs/container/liqwid-liquidation-bot

The liquidation bot operator quickly fixed the above issues and restarted the bots and once the DJED market bot came back online it started working through the loans, largest to smallest, one at the time.

Once liquidations were completed, the bot operator opted to collect the liquidation bonus and restore the bot’s DJED balance so that it would continue normal liquidation operations.

First the bot operator used the Liqwid app to redeem the qToken collateral for the underlying assets:

  • qSHEN 18395045989 → SHEN 367.965995
  • qADA 450671424711 → ADA 9105,7

They next converted SHEN to ADA on Minswap at 1 SHEN = 1.093577 ADA:

  • SHEN 367.965995 → ADA 404

Their bot’s final total balance was:

  • ADA ~ 9522
  • DJED 26,466573

Given the initial 15 ADA in the bot wallet used for liquidation operations, ADA balance available for DJED to restore the bot’s balance was 9507 ADA.

In order to restore the original DJED balance and realize the liquidation bonus earnings they needed to purchase ~3616 DJED.

At the time (around midnight of April 22nd Irish Summer Time) of the liquidations, ADA to dollar conversion rate were:

  • CEX 1 ADA = $0.361
  • DEX (Minswap) = 1 ADA = 0.375644 DJED (DJED collateral ratio was under 400%, possibly causing a drift from CEX value)

Doing some quick maths:

  • On Minswap, converting 3616 ADA at 1 ADA = 0.375644 DJED, it would cost 9626 ADA and lead to a ~120 ADA loss.
  • On CEX, converting 3616 ADA at 1 ADA = $0.361 it would cost 9367 ADA and lead to a ~140 ADA profit (no conversion fees taken into account).

Some considerations from this liquidation event:

  • Health factor value was significantly under 1.0 when the bot processed the liquidations (intuitively this translates to the reward being smaller than if the liquidations were promptly processed as soon as the loans were under 1.0).
  • DJED collateral ratio was under 400%, this means less liquidity, and hence a possible higher price on DEXs.
  • Multiple DEXs were attempted and Minswap had the lowest price impact (~1% at the end of the swap).
  • Given the small amount the bot operator did not bother optimizing the SHEN to DJED conversion, but rather swapped SHEN for ADA first (given they had additional ADA to convert into DJED in subsequent transactions). Conversion price and fees were okay here.
  • The CEX conversion example does not account for any transaction fees, but shows how the ideal swap would have looked like, while the DEX transaction is the actual conversion rate the swaps were executed at to restore the liquidation bot’s operating balance.

Given the above data points, the following changes are being proposed to liquidation parameters:

  1. Increase the liquidation bonus to 30% from 10% for the ADA and DJED markets (and from 12% for the SHEN market), this will ensure that even during adverse market conditions liquidators still earn an attractive liquidation bonus before any DEX fees or slippage is accounted for.

  2. Decrease the ADA and DJED markets LiquidationThreshold0 from 80% to 76.5% (in most CDP protocols there is no buffer meaning once you hit the maxLTV (or minimum collateral ratio, these are the same) you are instantly liquidated. In Liqwid there’s a built in liquidity buffer to protect borrowers and allow them to repay a loan or increase collateral even once they reach the maxLTV and can no longer borrow more. This decreases the maximum liquidation bonus we can apply and the 5% current buffer setting is too large when the LiquidationThreshold is 80% for the ADA and DJED markets).

  3. Allow 100% of the loan to be liquidated at LiquidationThreshold0. Currently the protocol allows only 75% of a loan to be liquidated at LiquidationThreshold0 and 100% of the loan to be liquidated at LiquidationThreshold1 a few percentage points above the LiquidationThreshold0 LTV of 80% for the ADA and DJED markets. This will allow liquidators to fully close out unhealthy borrow positions in a single liquidation transaction, protecting the protocol especially during adverse market conditions.

Do you support these updates to the liquidation parameters to incentivize liquidation bot operators?

  • Yes
  • No
0 voters

Wouldn’t it also make sense to use a real oracle to determine the Djed price instead of hardcoding it to $1?

I figure this had an impact and caused the health factor to drop below 1.0 later than it should have.

2 Likes

Some quick math. The bot paid off 3616 DJED and should have received ADA collateral at 10% discount. The market price for ADA was $0.361. With the 10% discount the effective price should have been $0.325. This would yield 11130 ADA. Why did the bot only get 9507 ADA?

1 Like

I agree with the parameter update but maybe it shouldn’t be so drastic, let’s move it to 15 or 20% and see if that’s enough and if it’s not then we’ll increase it again. Another thing in general would be maybe one parameter per vote not many changes all together. Just my 2 drops :slight_smile:

1 Like

Hi, thanks for the reply.

It was actually me the operator executing the liquidations.

I’m not sure I can follow your math, so I’m going to add some clarifications on the original post.

The bot spent operator’s DJED to liquidate the position and got qADA and qSHEN as rewards. This amount should account for the 10% bonus too.

As stated in the original reply, after converting qADA and qSHEN in ADA, the amount collected was about 9510 $ada.

9510 $ada is amount of money that I, the operator of the bot, received in exchange for providing 3616 Djed during the liquidation.

In order to materialise my earnings and restore the balance in the bot account, I had to exchange back the 9510 $ada into DJED.

Before continuing it worth to mention I made a little price mistake. In the original article I state that the market price of ada was 0.361, while it was instead 0.382. On MinSwap, because of slippage and commissions, the djed price was actually considerably higher: 0.375.

At market price 3616 Djed a 0.382 would have costed 9465 $ada, leading to a 45 $ada earning.

Unfortunately, MinSwap, the only DEX w/ enough liquidity to allow the swap, had a much higher price. 3616 Djed at 0.375 costed 9642 $ada, leading to a 132 $ada loss.

Slippage of about 1%, and commissions, consumed basically all the earnings.

Hope this clarifies things. Happy to answer more questions.

1 Like

You received 9510 ADA for 3626 DJED. That works out to a price of 0.38, which per your post was the market price at the time. Why didn’t you get the 10% discount?
Also, I don’t know why DC kept the collateral out of the picture. Just the loan for 3139 DJED held 10,049 ADA as collateral. The problem is not that the loans were not profitable to liquidate. The problem is that you did not receive the expected 10,602 ADA (I’m using 0.9*0.38=0.342 as the DJED price that you should have been given). The fix is to fix the bot, not change protocol parameters.

Good point, but I think that maybe the reason he received less than the 10,602 ADA is due to the incorrect Djed price of $1 used for the liquidation, when Djed was somewhat depegged at that time.

2 Likes

To the point of killing partial liquidation. Originally the loan was over-collateralized by 20% and 10% went to the LBO, leaving 10% of the collateral to improve loan health after partial liquidation.
With a 30% price discount and 76.5% liquidation threshold the buffer to improve loan health is gone (1.3*0.765=0.9945).