SIP-89: Virtual Synths

Author
StatusImplemented
TypeGovernance
ImplementorTBD
ReleaseTBD
Discussions-Tohttps://research.synthetix.io/t/virtual-synths-sip/202
Created2020-10-06

Simple Summary

Allow the proceeds of unsettled exchanges to be transferrable by tokenizing them into virtual synths.

Abstract

Create a virtual synth (vSynth) token representing a claim on an unsettled synth exchange. This vSynth will be represented by an ERC20 that represents a claim on the proceeds from the exchange. Once the exchange is settled, any holder of a vSynth can withdraw their portion of the proceeds and have the underlying synth transferred to them.

Motivation

Currently, when an exchange occurs between a src and dest synth, that dest synth is in an unsettled state for N minutes (waitingPeriodSecs) where it cannot be transferred (see Fee Reclamation SIP-37). This breaks composibility as a IERC20.transfer() on the dest synth cannot follow a Synthetix.exchange() in the same transaction.

Specification

Overview

In order to alleviate this problem of composition, this SIP proposes the issuance of a new ERC20 token for every exchange that represents a claim on the dest synth. This contract, an instance of VirtualSynth, will receive the destinationAmount of dest synths and will issue that same number of vSynth tokens to the exchanger atomically following an exchange, which themselves are immediately transferable.

Once settlement is ready, anyone can invoke settle() on this ERC20 contract and the contract's dest synths will be transferrable. Then, any holder of the vSynth token can invoke withdraw() to have their vSynth tokens burned and their proportion of the dest synths sent to them.

Rationale

By creating a unique ERC20 contract instance for each exchange, we can ensure the reclaim risk of each exchange is separated from the others, yet still allows for fungibility within the size of the trade itself.

Technical Specification

Exchanging needs to be amended (or complemented) by the creation of a new ERC20 contract instance (vSynth). This contract will receive the dest synths in place of the user initiating the exchange, and the user will receive these vSynths instead.

interface IVirtualSynth is IERC20 {

    // the synth token this virtual synth represents
    function synth() external view returns (IERC20);

    // show the balance of the underlying synth that the given address has, given
    // their proportion of totalSupply and
    function balanceOfUnderlying(address account) external view returns (uint);

    function secsLeftInWaitingPeriod() external view returns (uint);

    function readyToSettle() external view returns (bool);

    // Perform settlement of the underlying exchange if required,
    // then burn the accounts vSynths and transfer them their owed balanceOfUnderlying
    function settle(address account) external;
}

Test Cases

TBD.

Configurable Values (Via SCCP)

Please list all values configurable via SCCP under this implementation.

Copyright and related rights waived via CC0.