SIP-117: Support Synth Exchanging on L2 with Optimism

Author
StatusImplemented
TypeGovernance
NetworkOptimism
ImplementorTBD
ReleaseTBD
Created2020-02-23

Simple Summary

Enable synth exchanging on L2 via Optimism

Abstract

After a multi-phase, incentivised testnet trial, Synthetix went live on the Optimistic Ethereum (OΞ) mainnet. However, this was an intitial soft launch, i.e. L2 users could only stake SNX and issue or burn sUSD. The implementation of this SIP enables actual synth exchanging on L2.

Motivation

As described in The Optimistic Ethereum Transition, Phase 0 enabled users to lock SNX, and mint an equivalent amount via a Syntehtix to Optimism bridge. However, the L2 functionality is limited to staking SNX, issuing sUSD and claiming weekly rewards. Additionally, both SNX and sUSD are not transferable, due to an initial security related restriction imposed by OΞ.

Now that this limitation is about to be lifted, and with the upcoming support of Chainlink oracles, all the necessary conditions are met for enabling synth exchanging and making the transition to Phase 1.

Specification

Overview

No new contracts were developed. The OΞ Synthetix instance, namely MintableSynthetix was enhanced with exchanging functionality. The basic Synthetix functionality that is supoorted on both layers is implemented on a parent contract (BaseSynthetix) which is inherited by the L1 (Synthetix) and the l2 (MintableSynthetix) instances.

Note: A BaseDebtCahce contract was introduced in order to state the shared functionality between DebtCache and RealtimedebtCache more explicitly.

The following functions are to be activated on L2 Synthetix:

  1. exchange()
  2. exchangeOnBehalf()
  3. exchangeWithTracking()
  4. exchangeOnBehalfWithTracking()
  5. settle()

Rationale

The polymorphic approach adopted during the L2 integration (check SIP-102 for further details) proved to be very efficient. For basic exchanging functionality the functions that needed to be added are the following: exchange(), exchangeOnBehalf(),settle(). Additionally, even though in Phase 1 it will not be of any use, we propose to also enable exchange partner volume tracking functionality (SIP-63) i.e. exchangeWithTracking(),exchangeOnBehalfWithTracking(), so it will be already available when more projects move to OE. Their implementation is moved from Synthetix to BaseSynthetix since they are going to be available on both layers.

Technical Specification

N/A

Test Cases

TBD

Configurable Values (Via SCCP)

Copyright and related rights waived via CC0.