White Paper

Case Study: Benqi - 2023-10-03 Benqi BTC.b Liquidity Loss

October 3, 2023

Benqi is a Compound v2 fork and the leading lending protocol on Avalanche Blockchain.

On Sep-27-2023 08:26:35 AM +UTC there was a $14M temporary loss of liquidity. At the time this large transfer went un-noticed. It was not a hack or the act of a malicious user. The root cause appeared to be a large whale moving liquidity between accounts with incomplete knowledge of the cheapest and simplest way to transfer LP tokens on the platform. Given the anonymity of the ledger this could theoretically be two different users, but the probability is, in our opinion, low.

In early August of 2023, the Benqi team lost a large volume of concentrated liquidity in their qiBUSD pool, eventually causing cascading liquidations. The event resulted in a 94% loss in BUSD liquidity ($530k). The pool has not rebounded.

Detailed Findings

A key area of risk monitoring is around concentration. Given the architecture of Decentralized Exchanges and Lending protocols, large shifts in liquidity can create drastic price impact or, in the worst case, protocol collapse.

On many protocols, including this one, withdraw limiting is non-existent, allowing single-transaction liquidity changes without limitations. This creates the need for immediate notification, insight, and a plan of action to react to risk.

To account for that, we ingest balance data for platform users as they change. Once ingested we can easily visualize liquidity concentration in a given pool.

During incidents the ability to increase/decrease your granularity and reshape data is extremely important as most rarely can predict the exact time-range, interval(granularity), and presentation for any and all future issues.

At the surface, this appeared to be a user transferring liquidity(to another account), but the reality was the liquidity disappeared for 7 minutes. You can easily tease this out by reducing the interval, thus exposing the removal of liquidity.

By stacking user actions on top of key visualizations(e.g. Pool Concentration) you can also confirm how exactly the liquidity loss occurred. The image below shows corresponding redeemUnderlying (withdraw) and mint (deposit) events directly on the protocol. This is one of many indicators that the withdraw was intentional and not a protocol breach.

For context, here are the transactions in order surrounding the event:

  1. 0x219 redeemUnderlying (a.k.a withdraw). This transfers $14m worth of BTC.b from the qiBTC.b Pool to 0x219 in exchange for an LP Token (symbol qiBTC.b)
  2. 0x219 transfers $14m worth of BTC.b to 0xb21.
  3. 0xb21 mints (a.k.a deposit). This transfers $14m BTC.b back to the Benqi qiBTC.b pool

If healthy pools are defined as large diversified pools, unhealthy pools are identified as small in size and/or high in lended asset concentration.

Fortunately, the qiBTC.b pool was large and underutilized enough to handle a $14M withdraw. Below you can see the relationship between Utilization ratio and Total Supply. Under different circumstances, this could have created a catastrophic scenario for the protocol.

As a point of reference, you can step outside our system to validate the impact we are describing. On September 27th DefiLama recorded the Total Value Locked on Benqi as $91M. $14M is roughly a 15% drop in liquidity. Even though the protocol could mathematically survive, they would want to immediately begin marketing and biz dev initiatives to backfill liquidity before reputational damage had an opportunity to transpire.

For a lending protocol this could also mean accepting additional risk by adjusting lending parameters such as Collateral Factor, Reserve Factor, and Borrower Cap. The ability to calculate these values on demand, fast, and efficiently allows protocol leadership to make data- driven decisions in times of potential crisis.

Large shifts in liquidity can also be detrimental to the ecosystem. If for example the user was planning an exit from Avalanche to another ecosystem (say Ethereum) this would affect available liquidity in the entire ecosystem, potentially changing protocol lending parameters. Given the relationships that exist between every protocol, everyone at some level will need to adjust or be made aware of liquidity shifts. You can see the volume shift by using floating bars. Negative bars represent an accounts loss of liquidity, while positive bars represent gains in liquidity. Below is the visualization for all on-chain transfers during the Benqi event. The large bars were the result of the BTC.b transfers on the Benqi pool.

Abnormal shifts in liquidity on tokens proper (like BTC.b) is yet another layer of risk management all DeFi protocols need to have implemented. A simple alert on anomalies could save hours allowing you to build a comprehensive picture of what is happening and design/execute a well thought through plan.

Solutions

Our recommendation for lending pools are as follows:

  1. Flexible time series visualizations around liquidity pools
  2. Low latency alerts on liquidity change events
  3. Low latency alerts on pool log events
  4. On demand Collateral Factor calculation
  5. On demand Reserve Factor calculation
  6. On demand Borrower Cap calculation
  7. Better education & user interface; the lender could have simply transferred their qiBUSD to their second account instead of redeeming for BUSD, transferring to another account, and then redepositing

Other options

  1. Withdraw Limiting

Conclusion

Managing risk requires a comprehensive mature process combined with tooling optimized for the domain. Experienced Integrated risk management partners can be the difference between thriving, surviving, and dying.