Skip to content
First Access Exchange

Insurance funds and deleveraging

The funds

FundFed byCovers
A market's own fund, insurance_fund:{perpetual id}Liquidation fees on that market; for a company perpetual, an insurance seed at listingLosses beyond a liquidated position's collateral on that market
The cross insurance funddYdX's cross markets' fees, and isolated funds swept into itCross markets; the company perpetual's settlement deficits after its own fund

Every chain market is isolated, so each has its own fund, as dYdX's isolated markets do.

  • Company perpetual. The fund is seeded at listing from the community treasury (insurance_seed_quantums in MsgCreateCompany) and fed by liquidation fees. It is kept through the halt, so it can cover a settlement deficit, and swept into the cross insurance fund once the perpetual is settled. Its address and balance are in /dydxprotocol/binary/company_index/{company_id} (insurance_fund_address, insurance_fund_balance).
  • Binaries and options. A market's own fund (its liquidation fees, which only short calls pay) is swept into the cross insurance fund when its books halt, as for any isolated market.

Deleveraging

When a liquidation can't close a position against the book and the market's insurance fund can't cover the loss, the position is deleveraged: closed against positions on the other side of the same market, at its bankruptcy price, as upstream does.

  • Company perpetual: against either side, while the book is active.
  • Calls: a short call against long calls on the same strike; before the halt, the loss falls on the longs that deleveraging picks.
  • Binaries and puts: never; they are fully backed.
  • Once a market is halted, nothing is liquidated or deleveraged: what a position can't pay is handled by settlement.

Deleveraging shows in the indexer as fills and trades of type DELEVERAGED.

At settlement

  • Company perpetual: a payer that can't pay is a haircut on the payees; deficits are covered from the perpetual's own fund, then the cross insurance fund, never the cross collateral pool. What the funds can't cover is withheld from the perpetual's own holders, pro rata by contracts (settlement).
  • Options: a shortfall from call writers is a pro-rata haircut on the winning longs. If bankrupt writers' debts exceed everything the other writers paid (settlement_pool_deficit), the gap is covered from the insurance fund, then from the cross collateral pool.

Withdrawals while the pool is short

dYdX blocks withdrawals and transfers out of a collateral pool while a subaccount in it has negative net collateral that hasn't been dealt with, or while the chain has been down; builder fees are waived then too. /dydxprotocol/subaccounts/withdrawals_and_transfers_blocked_info/{perpetual_id} says whether the block is on for a market.