A deep dive into DeFi liquidations

DeFi Security Summit 2024 · 8 Nov 2024 · 10:55

Viktor Yurov, a smart contract auditor at MixBytes, explains how liquidation logic behaves in flash crashes, where cascading liquidations, thin liquidity and gas spikes can leave lending protocols with bad debt. He compares the approach of Aave, with per-position liquidations and partial closes, against Curve's soft-liquidation design. The talk also covers protection measures such as flexible thresholds, collateral buffers and multiple price oracles, including off-chain signed price feeds.

Speakers

Topics

From DeFi Security Summit 2024, hosted by DeFi Security Summit.

Transcript

yeah can you hear me yeah hi everyone uh my name is Victor uru and I'm a senior smart contract auditor and security researcher at mix bites uh let me give you a brief uh overview of mix bites before we start um our uh at mix bites our primary uh focus is on uh security Audits and research uh since 2017 we have conducted over 250 audits for more than 60 clients uh around 90% of them uh come back to us with code

updates and uh new protocol versions here are some of our key clients uh today I would like to elaborate on the logic behind liquidations and different defi protocols uh a flush crash is a good test for liquidation logic uh as you know flash crashes the sharp rapid drops in asset prices uh often caused by negative news large sell orders or low liquidity so what usually happens during flash crashes sharp price drops are typically the trigger

went uh as positions uh become under calized automatic liquidations occur leading to uh more forced sales and further accelerating price declines um when collateral is sold off during liquidations um a look of liquidity can cause um uh sharp declines in asset prices triggering cascading liquidation uh as Market crashes and liquidations grow uh uh Traders uh rush to sell off their assets to avoid further losses

exacerbating the price decline uh liquidity dries up as market makers and Traders withdraw uh insufficient liquidity can cause their formation of bad debts uh gas research makes transactions more expensive uh slowing down the liquidation process Network congestion and volatility my delay Oracle price updates leading to inacurate liquidation triggers uh this chart demonstrate the impact of uh Cascadian Liquidation on the cryptocurrency Market in

2021 uh so what can increase defy protocol resilience to uh flash crashes uh gas fee optimized architecture is designed to liquidate multiple user positions um uh in a single transaction rather than individually um this reduces gas costs and um improves uh efficiency partial liquidations start early by liquidating only uh a a portion of under calized uh position at the time um this helps prevent uh from large

sou sofs reducing Market impact and um making liquidation more manageable for users uh by implementing flexible liquidation thresholds um and collateral buffers the protocol can uh adjust in real time based on Market volatility uh this gives more flexibility to maintain system stability during uh turbulent periods uh by implementing multiple price oracles that provide realtime Rel

realtime reliable data from various sources uh the protocol can react faster to price changes also using of chain aggregation with signature verification uh can reduce costs and delays in updating prices especially when the network is congested uh for instance the peace network is one of the new of chain Oracle approaches um that leverages uh of chain signatures it allows a higher frequency of price updates and uh ability for protocols to access uh price data

without updating the smart contract State uh I guess you guys are familiar with a and um all similar traditional uh lending protocols um where liquidation logic use um where liquidation logic works with uh each pos position individually AA has successfully navigated through uh several flash crashes demonstrating the resilience of its uh liquidation mechanism and protocol stability during periods of extreme Market volatility the advantages of AA it's I

Simplicity and transparency support of multiple collateral types are partial liquidations at ability for to select debt and collateral for Liquidations in third version uh however during periods of uh Network I and volatility and numerous user liquidations execution costs can become uh extremely high in terms of gas fees um this makes it economically unfeasible to liquidate smaller user positions uh also uh liquidation may not

occur quickly enough um leading uh to the accumulation of bad debt so let's move on to other Solutions uh in curd uh liquidation liquidation use in IMM style mechanism llama uh where un under culturalized debt for multiple users is gradually um repayed by swapping um collateral for cure USD uh this approach minimizes Market impact and uh maintains

stability uh llama enables uh soft liquidations Arbitrage opportunities and collateral rebalancing uh it breaks down the collateral into separate bands uh each uh band represents a a different price segment uh users can choose the number of bands uh the C the collateral is uh divided into uh uh soft liquidations require U lower gas fees due to the efficient processing of positions through shares and band-based liquidation

um this make them more cost effective uh however curve USD supports only isolated markets uh yeah fluid fluid is another interesting solution instead of uh assessing and liquidating each position individually uh as in traditional Landing protocols uh fluid groups multiple positions together within a HTI represent separate price range for collateral AET

um if the when um when the collateral price moves out of the tis range uh fluid um evaluates um the this all positions within the ti for liquidation if the combin at collateral with the atig uh drops below necessary collateralization ratio uh fluid initiates uh liquidation process for all positions within the tick in addition to that fluid has a logic for absorbing bad debts uh if the current uh price uh drops below a threshold and

liquidations is not profitable anymore uh fluid liquidates um unprofitable ticks absorb bad debts by liquidating unprofitable TS and prevents uh Liquidators from doing unprofitable liquidation uh there multiple assets within the same Market are not supported uh which can create inefficiencies for Capital utilization and uh at this space continues to grow improving the efficiency of liquidations U and reducing the impact on users will main uh key priorities thank you very much guys if you have any questions feel free

to reach out to me anytime uh visit our blog uh this is my contact info thank you [Applause]