
On 23th of february, the @Compound protocolgained (estimations range between 500k and 3 million) bad debt.
Let's break down the series of events andmechanisms that led to this situation in a manner that's both engaging and easyto understand.
At the heart of CompoundV2's strategy forensuring accurate and reliable price information is its dual use of Chainlink'soracle service along with Uniswap's Time-Weighted Average Price (TWAP) as anadditional safeguard. Typically, Chainlink provides real-time price feeds thatare crucial for the platform's operations, such as lending and borrowingactivities. The TWAP, on the other hand, serves as a failsafe mechanism. Unlikeinstant price snapshots, TWAP calculates the average price over a designated period,aiming to mitigate the impact of price manipulation or faulty oracle prices
The plot thickens with a governanceproposal within the Uniswap community to activate the fee switch:
https://crypto.news/uniswap-governance-upgrade-proposal/…
This decision had a dramatic effect on thevaluation of the Uniswap token (UNI), propelling it from $7.2 to over $11 in avery short period. Such a sharp increase is not uncommon in the crypto worldbut posed a unique challenge for CompoundV2.

Herein lies the crux of the problem: Whilethe real market valued UNI at $11, CompoundV2's system lagged, still pegging itat $7.2 due to the TWAP mechanism's failsafe. This discrepancy didn't gounnoticed.
MEV bots, which are programmed to exploitprice inefficiencies across DeFi platforms abused this price discrepancy.
By borrowing UNI tokens at the outdatedprice of $7.2, despite their actual market value being $11, these bots wereable to game the system.
A user could deposit 100 USDC as collateraland borrow 10 UNI, which CompoundV2 valued at $72, yet in reality, the marketvalued the same UNI at $110.
This can be further amplified by sellingthe UNI, redepositing USDC and then again borrowing UNI.
This discrepancy introduced bad debt intothe protocol, as the actual value received far exceeded the system's valuation.
This situation didn't only affect newtransactions. Existing positions that should have been liquidated under normalcircumstances remained untouched due to the rapid price jump, a larger borrowthan collateral value moreover removed the incentive to pay back the loan. Themechanism designed to protect against price manipulation inadvertently opened awindow for exploitation, highlighting a critical risk inherent to lendingprotocols.
This incident with CompoundV2 underscoresthe complexity and challenges of managing lending protocols. It serves as apotent reminder of the delicate balance between security mechanisms and theneed for timely, accurate data in a market known for its volatility.
Not-so-fun-fact:
The price-lag lasted up to 18 minutes.