SIP-252: Liquidation of SNX Escrow

Author
StatusImplemented
TypeGovernance
NetworkEthereum & Optimism
ImplementorMEB (@barrasso)
ReleaseTBD
ProposalLoading status...
Created2022-06-17

Simple Summary

Update the snx liquidation functionality, laid out in SIP-148, to allow SNX escrow entries to be liquidated as well in case of forced liquidation (but not self-liquidation).

Abstract

The updated mechanism should allow both SNX tokens held in an account as well as escrow entries to be liquidated until the target issuance ratio of a snx staker is restored. In case an account does not hold enough snx to restore back to the target issuance ratio, then the stakers' account is closed with debt cleared and all the snx in the account is sent for other stakers to claim. If the self-liquidate method is called, a user's account is liquidated with only the snx available in his account (escrow cannot be utilized to repay debt with the self-liquidation method).

Motivation

The reasoning behind this SIP, is that accounts can circumvent the intention of SIP-148 by not vesting their escrow entries, and therefore have a free open-ended put option on their debt. Allowing for escrow entries to be liquidated helps restore network collateralization ratio, as the debt would shift to other stakers, who acquire the escrowed entries at a discount and take on the delinquent debt. There is currently around 2.8m$ worth of debt between optimism and ethereum, backed by 1.4m worth of escrowed SNX, which can't be liquidated because of restrictions on liquidations of escrowed entries. With the changes proposed in this sip, that debt would be wiped clean allowing the protocol to be more resilient and better capitalized in the long run.

Specification

Overview

The main workflow of the liquidation contract is as follows:

  1. Flag and Liquidation Mechanism is as in SIP-148.
  2. Liquidation Workflow, describing the liquidation mechanism with the different scenarios that could arise.

An important change in this sip is that HAV token sale rewards, which had been previously been allowed to be used for staking would not longer be after this SIP is implemented. The reason behing this is that these legacy contracts are not upgradeable and therefore liquidating accounts that have snx stored in these contracts would not be possible. There is no significant impact from this change, as the accounts that hold legacy Hav rewards that have not claimed mostly do not hold any debt as well as can be seen in this file.

Flag and Liquidation Mechanism

The flag/liquidation incentive scheme is mostly identical to the one specified in SIP-148, with the followings change:

  • Escrowed and pending liquidator rewards SNX will be counted towards the SNX available for flagger and liquidator rewards during the liquidation check.
  • A flagged account that self-liquidates sucessfully, will not have his flag removed automatically. The account will still be able to remove the flag, by burning to target (to ensure his cratio is restored to health).
Liquidation Workflow
Self-Liquidation

A user can call the self-liquidation functionality at any time his account drops below the collateralization ratio. The following situation can arise upon self-liquidation call:

  1. The user holds enough snx (not escrowed snx) to restore the target issuance ratio. The user calls self-liquidates and the snx available in his account is used along with penalty imposed to restore the collateralization ratio to the target issuance ratio (equation 1 in calculation methodology section).
  2. The user does not hold enough snx in his account to restore the target issuance ratio, but holds some snx. Upon calling self-liquidate, all the snx available in his account is used to repay as much debt as possible, taking into account the self-liquidation penalty (equation 2).
  3. The user does not hold any snx in his account (but has escrow entries) and calls the self-liquidate functionality. The transaction reverts.
  4. The user is above the target issuance ratio and calls the self-liquidate. The transaction reverts.

Note that if a user doesn't not hold enough collateral to restore to health, meaning if collateral / debt < (1+snxLiquidationPenalty), then the account would not be able to call self-liquidate. The main intuition behind this requirement is to allow accounts to be removed from the system, in the event the value of their collateral is below the amount necessary to retore to health with forced liquidation which is more stringent in penalty than self-liquidation.

Liquidation

As mentioned in SIP-148, a liquidation method can be called after the minLiquidationDelay runs out, the below scenarios can arise:

  1. The user holds enough snx to restore the target issuance ratio. The user is liquidated, with the snx available in his account and a liquidation penalty is imposed (equation 1) after paying flagger and liquidator.
  2. The user does not hold enough snx to restore the target issuance ratio, but holds enough snx + escrowed entries to restore to the target issuance ratio and pay the flagger liquidator. The user is liquidated, with the snx available in his account utilized to repay debt after paying liquidator and flagger, the remainder is obtained by immediately vesting the first available in order of iteration (usually the oldest, though not guaranteed to be oldest in case of merged escrow accounts) entries available, restoring the collateralization ratio to the target issuance ratio. If the entries vested hold more snx than required to repay debt, then a new entry with the excess snx and is added to the account with the same vesting period as the future-most entry used for liquidation.
  3. The user does not hold enough snx in his account or in escrow to restore his collateralization ratio to the target issuance ratio but holds enough snx (or escrow snx) to pay the flag and liquidation rewards. Upon liquidation call, the debt is cleared and all the snx in the account are immediately vested and paid to stakers, after paying the flagger/liquidator.
  4. The user does not hold enough snx or escrow snx to pay the flag and liquidation rewards. The transaction reverts on liquidation.
  5. The user is above the target issuance ratio and liquidate is called. The transaction reverts.
  6. The liquidationDelay has not run out and liquidation method is called. The transaction reverts.
Calculation Methodology

The below variables are used to describe the components of the liquidation computations:

  • V = Value of SNX and Escrow Entries in USD terms
  • D = Debt Balance
  • t = Target Collateral Ratio
  • S = Amount of debt to settle
  • P = Liquidation Penalty %
  • L = Value of SNX liquidated in USD terms
  1. Account holds enough SNX to restore to the target staking ratio, the following is used to compute the debt to be settled, specified in SIP-15:

\[ S = \frac{t * D - V}{t - (1 + P)} \]

\[ L = S * (1+P) \]

  1. Account does not hold enough SNX to restore to the target staking ratio, the following is used upon self-liquidation call, specified in SIP-240:

\[ S = V/(1 + P) \]

Rationale

The following points are points are worth mentioning pertaining to the implementation:

  • The fundamental reason behind not allowing for self-liquidation of escrow funds, is that it provides a way to sell escrowed snx immediately for debt relief. The penalty imposed in such a case might not compensate stakers for the uncertainty around SNX price and the time horizon required for liquidation rewards to vest (essentially allows early unlock at 20% discount if abused).
  • Upon liquidation / self-liquidation, the SNX relinquished by the delinquent account can be claimable by SNX stakers with the same duration as liquidated transferrable SNX ('liquidationEscrowDuration', currently 1 year).
  • Similar to the implementation in SIP-148, SNX is claimable by the stakers on the same chain where the liquidation event took place. Stakers on the other chain are compensated for the liquidation with pDAO receiving the snx needed to compensate the other chain from the weekly inflation rewards and adding escrow entries to stakers that were staking at the time of the liquidation event.
  • Only in the event of a staker is above the target issuance ratio, is the liquidation flag removed. In other words, calling self-liquidate when an account is flagged does not remove the flag if the staker is not back to the target issuance ratio.

Technical Specification

Below are the modified interfaces in IIssuer.sol

    function liquidationAmounts(address account, bool isSelfLiquidation)
        external
        view
        returns (
            uint totalRedeemed,
            uint debtToRemove,
            uint escrowToLiquidate,
            uint initialDebtBalance
        );
    function liquidateAccount(address account, bool isSelfLiquidation)
        external
        returns (
            uint totalRedeemed,
            uint debtRemoved,
            uint escrowToLiquidate
        );

Below are the modified interfaces in ISynthetix.sol

    function liquidateDelinquentAccountEscrowIndex(address account, uint escrowStartIndex) external returns (bool);

Below are the modified interfaces in ILiquidator.sol

    function liquidationAmounts(address account, bool isSelfLiquidation)
        external
        view
        returns (
            uint totalRedeemed,
            uint debtToRemove,
            uint escrowToLiquidate,
            uint initialDebtBalance
        );

Test Cases

Self Liquidation

  • Given that the snx price is at 1$, the liquidation ratio is at 150%, target staking ratio of 300%, the self-liquidation penalty is 30%, the liquidationPenalty at 40%
    • When an account attempts to self-liquidate while have a collateralization ratio above 300%
      • ❌ Then transaction reverts, as the address is above the target staking ratio
    • When an account attempts to self-liquidate with 100$ worth of debt and 200 worth of escrowed snx in his account
      • ❌ Then transaction reverts, as the address doesn't have any snx in the account
    • When an account attempts to self-liquidate with 100$ worth of debt and 26 snx in his account and 144 snx in escrow
      • ✅ Then it succeeds and the following take place:
        • 26 snx goes to stakers
        • 20 sUSD worth of debt is forgiven
    • When an account attempts to self-liquidate with 100$ worth of debt and 141 snx in his account
      • ✅ Then it succeeds and the following take place:
        • 93.529$ worth of debt is forgiven
        • 121.58$ worth of snx is liquidated and sent to stakers
        • the now self-liquidated account is left with 18.41$ worth of snx
    • When an account attempts to self-liquidate with 100$ worth of debt and 139 snx in his account
      • ❌ Then transaction reverts, as the address doesn't have enough snx to restore to health with forced liquidation

Liquidation

  • Given that the snx price is at 1$, the liquidation ratio is at 150%, target staking ratio of 300%, the liquidation penalty is 40%, the flagReward is 3 snx liquidationReward is 5 snx
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 148 snx in his account
      • ✅ Then it succeeds and the following take place:
        • the liquidator receives 5 snx reward
        • the flagger receives 3 snx reward
        • the debt is cleared
        • 140 snx is sent to stakers
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 149 snx in his account
      • ✅ Then it succeeds and the following take place:
        • the liquidator receives 5 snx reward
        • the flagger receives 3 snx reward
        • 99.375$ worth of debt is repaid and the staker is left is 0.625$ of debt
        • 139.125 snx is sent as liquidation rewards and the delinquent account is left with 1.875 snx in his account
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 8 snx in his account
      • ✅ Then it succeeds and the following take place:
        • the liquidator receives 5 snx reward
        • the flagger receives 3 snx reward
        • The debt is cleared and the account is closed
        • 0 snx is sent as liquidation rewards
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 148 of escrow snx in his account
      • ✅ Then it succeeds and the following take place:
        • the liquidator receives 5 snx reward
        • the flagger receives 3 snx reward
        • the debt is cleared
        • 140 snx is sent as liquidation rewards
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 149 escrow snx in his account
      • ✅ Then it succeeds and the following take place:
        • the liquidator receives 5 snx reward
        • the flagger receives 3 snx reward
        • 99.375$ worth of debt is repaid and the staker is left is 0.625$ of debt
        • 139.125 snx is sent as liquidation rewards and the delinquent account is left with 1.875 escrow snx in his account
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 8 escrow snx in his account
      • ✅ Then it succeeds and the following take place:
        • the liquidator receives 5 snx reward
        • the flagger receives 3 snx reward
        • The debt is cleared and the account is closed
        • 0 snx is sent as liquidation rewards
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt, 40 snx in his account and two entries of 50 snx and 59 snx which vest in 10 days and 30 days.
      • ✅ Then it succeeds and the following take place:
        • the liquidator receives 5 snx reward
        • the flagger receives 3 snx reward
        • 99.375$ worth of debt is repaid and the staker is left is 0.625$ of debt
        • 139.125 snx is sent as liquidation rewards and the delinquent account is left with 1.875 snx with 30 days vesting
    • When an account attempts to liquidate a staker that is flagged but hasn't crossed the minLiquidationDelay and is below the target staking ratio
      • ❌ Then transaction reverts, due to the account not being open for liquidation
    • When an account attempts to liquidate a staker that is not flagged
      • ❌ Then transaction reverts, due to the address not being flagged
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 7 snx in his account
      • ❌ Then transaction reverts, as the staker does not own enough snx to pay for flagging / liquidation
    • When an account attempts to liquidate a staker who is flagged with 100$ worth of debt and 500 snx in escrow
      • ❌ Then transaction reverts, due to address being above the target staking ratio

Configurable Values (Via SCCP)

The same configurable values laid out in SIP-148 and SIP-251 are configurable via SCCP.

Copyright and related rights waived via CC0.