SIP-194: Fix Liquidations on L2

Author
StatusImplemented
TypeGovernance
NetworkOptimism
ImplementorJustin J. Moses (@justinjmoses)
ReleaseTBD
ProposalLoading status...
Created2021-12-07

Simple Summary

Ensure the Synthetix contract on L2 can facilitate liquidations.

Abstract

The version of Synthetix on L2 - MintableSynthetix - needs to forward requests from the public to the Issuer contract in order for liquidations to work as intended on L2.

Motivation

During the Menkalinan release, the Issuer contract was updated on L2 to align with L1, such that it could generate liquidations. However, the function in question Issuer.liquidateDelinquentAccount() can only be invoked by Synthetix (in the case of L2 - MintableSynthetix) and this contract needed updating such that it can be publicly callable on L2.

Specification

Overview

Move the liquidateDelinquentAccount logic from Synthetix to BaseSynthetix along with the AccountLiquidated event definition.

Rationale

As liquidations is supported on both layers, the logic belongs in the shared base contract of both L1 (Synthetix) and L2 (MintableSynthetix), hence it will go into BaseSynthetix.

Technical Specification

ISynthetix interface is unchanged, however after the upgrade, ISynthetix.liquidateDelinquentAccount() will no longer always revert with the unimplemented revert reason ("Cannot be run on this layer").

Test Cases

  • Given an account has been flagged for liquidation on L2, and given the delay has elapsed since flagging, and given its cratio is still below the threshold, and given the user has sufficient sUSD to liquidate the account, when a user invokes liquidation on the account, then it succeeds

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.