Liquidation Auctions
Liquidations are performed via an auction system where a percentage of all assets in the subaccount (cash, collateral, perpetuals and options) are available to bidders. When a user falls beneath their maintenance margin requirements (i.e. maintenance margin becomes negative), any user can call the functionliquidate()on said account. The auction process then begins; the user is prohibited from conducting any transactions using the flagged account.
A note on portfolio margined accounts: To avoid excess computation done on chain, when a portfolio margined subaccount is flagged for liquidation, the flagger also submits what they believe to be the worst case scenario (say, spot down 14%, IV up). This scenario, along with the static vol/spot and forward loss scenarios, is used to compute the margin requirements of the portfolio, as well as the buffer margin (explained below). As the auction proceeds (or if the flagger is incorrect), this scenario may no longer be the “worst” scenario. Consequently, liquidators (or any user) are able to submit what they believe to be the “correct” “worst” scenario. This new scenario is accepted if it decreases (makes more negative) the maintenance margin requirement of the subaccount in question.
Buffer Margin
When liquidating an account, it is important that the resulting account has sufficiently more collateral than its maintenance margin requires. Otherwise, a small move in price against it will result in it being liquidated again. Consequently, we define the buffer margin as:Formula
MtM Valueis the mark-to-market value of the account. This is the sum of all credits (cash and collateral for all accounts, long options for portfolio margin) and debits (short options for all accounts, borrowed collateral). Note that the unrealized profit and loss of perpetuals is accounted for in the cash asset due to continuous settlement.Maintenance Marginis defined for standard and portfolio margin accounts.BUFFER_SCALE = 1.2
Buffer Margin = Maintenance Margin + 0.2 * (Maintenance Margin - MtM Value) — it sits a fifth of the margin requirement below the maintenance margin.
The Buffer Margin represents how much of the cash asset needs to be added to the account in order to terminate the liquidation. For instance, a buffer margin of -1000 means at least $1000 needs to be added in order to stop the liquidation.
📘 At the end of a liquidation, we want the liquidated account’s buffer margin to be 0 to ensure that a small price move doesn’t liquidate the account again.
Charging the Liquidation Fee
When an account is flagged for liquidation, a small fee is charged. The fee is the liquidation fee percentage applied to the fraction of the account that would be liquidatable at zero discount:Formula
LIQ_FEE_PERCENT = 2%. The fraction is rounded up to the nearest 1% before the fee is computed, so the rounding flows into the fee.
Solvent Auction
After the liquidation fee is charged, the account is put up for a solvent auction. Liquidators can take on a percentage of the entire subaccount at a discount to the mark-to-market value. The auction quotes a price factord, the fraction of mark-to-market value a bidder pays. It starts at INITIAL_DISCOUNT_FACTOR = 0.98 — a 2% discount — and falls linearly to THRESHOLD_DISCOUNT_FACTOR = 0.80 — a 20% discount — over the fast phase of SHORT_DURATION = 100 seconds:
Formula
0.80 to 0 over LONG_DURATION = 14,400 seconds (4 hours):
Formula
d reaches zero the portfolio can be taken for free, and the insolvent auction begins.
When a liquidator wishes to liquidate the subaccount, they are able to take on any percentage of the subaccount up to a cap:
Formula
dis the current price factor.MtM Valueis the mark-to-market value of the entire portfolio defined above.Reserved Fundsis the amount of cash received by the portfolio from all previous liquidations during the auction. It is necessary to ensure liquidators liquidating at the same price pay the same price.Buffer Marginis the buffer margin of the current subaccount (including reserved funds).
Max Percentage is rounded up to the nearest 1%, and is capped at 100%. If a liquidator requests more than the cap, they are floored at Max Percentage and the liquidation terminates.
Otherwise, the liquidator receives their requested percentage of the current portfolio and pays
Formula
Termination
Because the market moves while the auction runs, the auction is re-checked at every bid. A bid does not clear, and the auction terminates, if either of the following holds:Buffer Margin >= 0— the account is back above water, either because enough of the portfolio has been liquidated or because the market moved in the trader’s favour.Max Percentageis clamped to 0 in this state.Reserved Funds >= MtM Value— the bid price(MtM - Reserved Funds) * dis no longer positive, i.e. the remaining portfolio is worth no more than the cash already paid into it.
Insolvent Auction
At the insolvent auction, offers start at the mark-to-market value of the portfolio and move overINSOLVENT_DURATION = 100 seconds towards the current Maintenance Margin of the liquidated portfolio.
Specifically, the current offer at a given time t is
Formula
mtmis the mark-to-market value of the portfolio
- All of the portfolio has been liquidated
Maintenance Margin >= 0
Security Module
Every risk universe has its own Security Module: a dedicated subaccount holding the universe’s cash asset. It pays liquidators to take on insolvent accounts in that universe, and in return it receives a variety of fees, including a share of all interest paid on borrowed cash. Because the SM is per universe, an insolvency in one universe cannot draw on another universe’s backstop, and cannot reach another universe’s users. In the event of a large insolvency, a universe’s SM could be depleted, triggering socialized losses within that universe.Socialized Losses
When the Security Module cannot cover an insolvent bid in full, the uncovered part is socialized.📘 [New!] V2 socialized losses through a temporary withdrawal fee charged to everyone withdrawing from the protocol. V3 instead debits each solvent account in the affected universe once, up front, in proportion to its value, and then phases the maintenance margin impact of that debit in over a short window so the debit itself cannot trigger further liquidations.Trigger. During an insolvent auction, the SM’s cash is drained to zero to pay the bidder. Any remaining payout is minted to the bidder and recorded as a socialization event on the universe. The socialized amount
H is exactly bidder payout − available SM cash; the SM bears everything up to its balance.
Snapshot and freeze. The event freezes the shortfall H, the oracle feeds, the timestamp, and the set of subaccounts in scope. While the event is pending, every balance operation in that universe is rejected. The only permitted operations are the realization steps, which sweep all subaccounts in ascending order in bounded chunks. When the sweep completes, the universe unfreezes. Chunking is invisible: any number of chunks produces the same final state.
Per-account share. Each account with a positive mark-to-market value at the frozen feeds is debited
Formula
mtm_iis the account’s mark-to-market value at the frozen feeds, including collateral.total_spot_valueis the universe’s total spot value: the sum over its spot assets of(total supply - total borrow) x spot price, less crystallized-but-unsettled cash.
where
Formula
DT_WRITE_DOWN_SECONDS. This gives a solvent account a window to top up or de-risk before the debit can make it liquidatable, without ever letting it escape the debit.
An account already under auction receives no such credit: its liquidation margin sees the full debit immediately.
Cash conservation. The amount minted to the bidder and the amount burned across the sweep net to zero, so the total cash in the universe is unchanged by a socialization.
Liquidator Requirements
To liquidate an account, the liquidator must have an account consisting only of the cash asset. The liquidator is required to possess a minimum amount of cash. During the solvent auction, the liquidator is required to have sufficient cash so that their buffer margin (after taking on the portfolio) is 0. Specifically:Formula
fis the percentage of the current portfolio the liquidator has taken ondis the current price factorMtM Valueis the mark-to-market value of the portfolioResFundsis the total reserved funds for the portfolio undergoing solvent liquidationBuffer Marginis the buffer margin of the account.
Formula
cashReceived is the cash received by the liquidator for taking on the portfolio.
Note: A liquidator is required to have a subaccount using the same manager as the liquidated account and therefore in the same risk universe. I.e. if Bob is liquidating Alice who is using the Prime standard manager, then the subaccount Bob is liquidating Alice with must also subscribe to said manager.
Example (Solvent Auction)
Consider Alice’s portfolio in the Prime universe, consisting of:- $400,000 of USDC
- 10 short ETH perpetuals
- 30 short ETH calls
Formula
Formula
Formula
Formula
Formula
- 400,000 of USDC (320,000 remaining)
- 10 short ETH perpetuals (8 remaining)
- 30 short ETH calls (24 remaining)
Formula
Formula
Formula
- 320,000 of USDC (note: the 17,796.80 of reserved funds are not included!)
- 8 short ETH perpetuals
- 24 short ETH calls
Formula
Example (Insolvent Auction)
Alice’s portfolio becomes insolvent and the insolvent auction begins. Suppose that 10 seconds into the insolvent auction, Bob wants to liquidate. At this point in time, her portfolio hasMark to Market = -$4,000Maintenance Margin = -$15,000
Formula
Formula
Formula
