Synthetics Assets for Ethereum and RSK

A few weeks ago, preparing for a talk on DeFi and also discussing at a remote work meeting, I came across the Synthetix project. I find it interesting to try to implement those ideas, and as usual in my personal projects, trying to follow an incremental and simple path.

What that project does is bring the derivatives market to Ethereum DeFi (Decentralized Finance).

I read on How to DeFi:

A derivative is a contract whose value is derived from another underlying
asset such as stocks, commodities, currencies, indexes, bonds, or interest
rates. There are several types of derivatives such as futures, options, and
swaps. Each type of derivative serves a different purpose and different
investors buy or sell them for different reasons.

Some of the reasons investors trade derivatives are: to hedge themself
against the volatility of the underlying asset, speculate on the directional
movement of the underlying asset or leverage their holdings. Derivatives
are extremely risky in nature and one must be equipped with strong
financial knowledge and strategies when trading them...Some of the
major DeFi derivatives Protocols are Synthetix and bZx.

About Synthetix:

Synthetix is exactly as the name sounds, a protocol for Synthetic Assets
(called Synths) on Ethereum. There are two parts to Synthetix — Synthetic
Assets (Synths) and its exchange, Synthetix.Exchange. Synthetix allows
for the issuance and trading of Synths.

What are Synthetic Assets (Synths)?

Synths are assets or a mixture of assets that have the same value or effect
as another asset. Synths track the value of underlying assets and allow
exposure to the assets without the need to hold the actual asset.
There are currently two different types of Synths — Normal Synths and
Inverse Synths. Normal Synths are positively correlated with the
underlying assets while Inverse Synths are negatively correlated to the
underlying assets.

My (work in progress) personal project is here. It could run on Ethereum or on RSK networks.

Implementation

There is a smart contract, called Synthex, that acts as a vault for collateral. The collateral is a designated ERC20 token. Users could deposit such token into the Synthex smart contract, and then, they can start to issue (to create) Synth assets. The first Synth (an ERC20 token) to mint is sUSD, with one to one parity with US dollar:

First steps: collateral deposit and issue sUSD synths

The steps:

1- A user (or another smart contract) deposits the designated ERC20 token to be used as collateral into Synthex smart contract.

2- The user instructs the Synthex to lock the collateral in order to mint synths (the first synth to mine is sUSD, linked to dollar).

3- Synthex mints the sUSD synths, according to the collateral locked by the user in the second step. There is a conversion ratio between the designated ERC20 collateral token and sUSD.

There are predefined Synths in the system, like sUSD, sBTC, or others. They are derivatives: assets that are the “shadow” of other asset. Their prices are informed by oracles. Minting synths, the user creates a debt, in sUSD, that should be cancelled in the future to release the locked collateral.

Now, the user, having sUSD, could decide to change some of those tokens into other synths.

Seconds steps: transforming synths into other synths

The new smart contract is SynthexExchange: it has the hability to transform some synths into other synths of other kind, taking into account their prices, informed by oracles. The prices are the ones the REAL assets has. So, trading synths is similar to trade the original assets, but as derivatives. The steps:

1- The user use the SynthexExchange to transform X sUSD tokens into sBTC. The number of sBTC to get depends of the relative prices of sUSD (1 dollar, fixed) and sBTC (a Bitcoin in dollars).

2- The SynthexExchange burns the X sUSD tokens provided by the user

3- The SynthexExchange mints X sBTC tokens and assign then to the user

So, if you exchange sUSD by sBTC, in someway, you are long on BTC (bet on its price rise). There are also other synths that are “the inverse” of the original asset, like iBTC, that raise in value when the original asset price drops. Obtaining such kind of synthetic assets is like to be short on that asset.

The user could trade also his/her synths in other exchanges, as normal ERC20 tokens.

At the end, the user should cancel its debt (created by minting the initial sUSDs):

Paying the debt, unlocking the collateral

The steps:

1- The user, having sUSD tokens, calls Synthex, giving those tokens to cancel the debt he/she has with the system.

2- Synthex then burns those tokens, and unlock the corresponding collateral.

Now, the user can redeem the collateral at any moment.

Pending Work

I should implement the inverse synth tokens. And also, the lock/unlock of collateral, the calculus of the user debt, etc. The original project, Synthetix, has many ways to incentive the user to provide collateral, but by now, it is not in the scope of this project. Another thing that could be nice to have is to use Ether or RBTC as collateral, instead of a designated ERC20 token.

Angel “Java” Lopez