SIP-237: Debt Migration

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

Simple Summary

This SIP introduces a mechanism to allow stakers to migrate their debt position from Ethereum to Optimism without the need to burn their debt.

Abstract

The current staking migration process was designed to allow stakers to migrate their vested SNX from Ethereum to Optimism, however, it required stakers to burn all debt due to limitations in the debt register design. The implementation of debt shares has allowed for staking positions to be migrated without the need for debt to be burned. This SIP introduces a mechanism to allow stakers to do this to reduce the impact of migrations on L1 sUSD liquidity.

Motivation

As we finalise the last V2x SIPs and prepare for V3 we must migrate SNX staking from Ethereum to Optimism. This will allow for the new V3 staking system to be deployed only to Optimism initially, reducing the overhead of the migration, and then rolled out subsequently to other networks as needed.

Specification

Overview

The introduction of debt shares allows for a new mechanism to be created that migrates a debt position and vested SNX from Ethereum to Optimism without the need for the debt to be cleared first. This works by transferring the vesting entries and SNX collateral as well as the debt shares for the position from L1 to L2 with the Chainlink debt pool oracle then reflecting this change on the subsequent update.

Rationale

While it is possible to create significant incentive to migrate stakers to Optimism by diverting 100% of SNX inflation to Optimism this would likely create short term issues for the sUSD peg that can be avoided by allowing stakers to migrate their entire position and then only bridge the amount of sUSD they require to manage their ratio as needed.

Technical Specification

The SIP will add a new DebtMigrator contract for each network:

  • On L1: DebtMigratorOnEthereum
  • On L2: DebtMigratorOnOptimism

These contracts grant stakers on L1 the ability to migrate all of their SNX balances (including their debt position) to L2. This is a one-way migration and does not allow for a migration in the opposite direction (L2 -> L1).

To begin the migration, a user will invoke the function migrateDebt(account) for a given account. This function must be invoked by the owner of the account on L1. The account must not be flagged or open for liquidation.

This also requires DebtMigratorOnEthereum.initiationActive to be true, which can only be set by the owner (similar to how the SynthetixBridge works). The value is initially set to false.

When an account is migrated, it will:

  • Transfer all of their debt shares (SDS) from L1 to L2
  • Transfer all of their unstaked balance (SNX) from L1 to L2
  • Revoke all escrowed SNX on L1 and create ten distinct escrow entries on L2 totaling the full amount. These migrated entries will vest each month over the course of 1 year.

Additional Changes

  • In Issuer, add a function modifyDebtSharesForMigration that will mint or burn debt shares depending on the layer.

    • Adds a onlyTrustedMigrators modifier that will only allow the DebtMigrator contracts to invoke this function.
    • Note: the debt share transfer needs to be accounted for in the total debt share supply reported by Chainlink.
  • In BaseSynthetix, add a function migrateAccountBalances that will revoke and transfer all liquid and escrowed SNX to the migrator contract on L1 to perform the migration.

Test Cases

Unit Tests

  • DebtMigratorOnEthereum
    • migrateDebt()
      • Check only callable by account owner
      • Add check for initiationActive
      • Add check for is flagged or liquidation open
      • Add check that Issuer.modifyDebtSharesForMigration is called
      • Add check that Synthetix.migrateAccountBalances is called
      • Require zeroed balances on L1 on completion
    • setMinimumEscrowDuration()
      • Check only callable by owner
    • resumeInitiation()
      • Check only callable by owner
    • suspendInitiation()
      • Check only callable by owner
  • DebtMigratorOnOptimism
    • finalizeDebtMigration()
      • Check only callable by OP messenger
      • Check cross domain sender is L1 DebtMigrator

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.