SIP 30: Deprecate ERC223 from SNX and all Synths. Source

AuthorClinton Ennis
Discussions-To(https://discordapp.com/invite/CDTvjHY)
StatusApproved
Created2019-11-26

Simple Summary

Deprecate ERC223 from SNX and all Synths to save gas on dex exchanges and no transaction errors.

Motivation

The UX for Mintr drove the implementation of ERC223 to reduce the number of transactions a user(minter) had to execute to deposit their sUSD into the Depot FIFO queue to be sold for ETH from 2 to 1 by only eliminating the ERC20 approve transaction prior to calling a ERC20 transferFrom. While this has been a nice UX for mintr users with the Depot the benefits of ERC223 transfer have not outweighed the cons on contract to contract transfers;

There is a lot of Dex activity happening now with SNX on uniswap, Kyber, sUSD uniswap, Kyber and sETH uniswap. The ERC223 implementation is causing a significant cumulative gas loss trading these tokens. We aim to reduce the total gas lost / consumed trading Synthetix tokens.

This will also enable better (cheaper) composability as teams integrate Synths to build Defi products.

Specification

  • Removing all ERC223 is a simple code change to ExternStateToken.sol which is inherited by Synthetix.sol and Synth.sol
  • It will require all Synths & SNX to be redeployed but no proxy addresses will change keeping all existing token addresses.
  • The current Depot will no longer be able to accept sUSD deposits effectivly putting it to its end of life.
  • A new Depot will be required which will go back to using the original ERC20 approve, transferFrom workflow. This could be an opportunity to makes some additional improvements to the Depot such as making it upgradable. Putting it behind a proxy and giving it an external state contract so its logic can be upgraded.

Rationale

  • Removing ERC223 will no longer show the transfer errors in contract to contract transfers. Uniswap sETH exchange
  • This will also save 200K gas per contract to contract transfer. github code reference
  • Reclaim byte code space for SNX contract deployment by removing the ERC223 implementation in ExternStateToken.sol.

Implementation

  • The current Depot will no longer be able to accept sUSD deposits but withdrawals and buying sUSD with ETH will still work as expected. It could stay until it is drained of sUSD supply.
  • A new Depot version will need to be deployed to allow sUSD deposits. The Dapps will need to switch over to using this Depot for sUSD purchases with ETH when the FiFo queue is drained.
  • Mintr will need to be updated to include an approve transaction for the Depot to call transferFrom to transfer the minters sUSD from their wallet to itself and create a deposit entry.

Copyright and related rights waived via CC0.