Synthetix: Derivatives On The Blocks. | Xord
Intro To Synthetix
Synthetix is a protocol that allows for the issuance of synthetic assets on Ethereum. These synthetic assets are backed or collateralized by the Synthetix Network Token (SNX) which needs to be locked into the protocol’s contracts to enable the issuance of synthetic assets (Synths).
In a way, Synthetix is similar to MakerDAO. A user must lock Synthetix Network Tokens (SNX) in a contract to create synthetic USD (sUSD) in the form of ERC-20 tokens. By holding SNX tokens, users can earn trading and staking rewards from the platform.
This article aims to give the readers an idea about Synthetix’s financial product, its value generation for network participants and its functioning mechanism.
Background
Synthetic is a financial security that is made up of one or more derivatives. A derivative as the name suggests derives its value from an underlying asset or group of assets such as an index. The derivative is a contractual agreement between two parties and its price is derived from fluctuations in the actual asset. The Synthetix protocol is essentially a derivatives platform that provides a way to take exposure of assets on a blockchain without having to own them.
Source: https://www.investopedia.com/terms/d/derivative.asp
The most common forms of derivatives are stocks, bonds, currencies, interest rates, commodities and market indexes. Derivatives depending on the contract type are called forwards, futures, options, and swaps.
There are many advantages of derivatives such as hedging a position or speculating on the price movement of an underlying asset.
In the case of Defi, users can employ hedging to offset potential loss such as impermanent loss, which can happen while providing liquidity to an AMM such as Uniswap in case the price of one of the tokens used for liquidity provisioning or yield farming loses its value in relation to another token. With a volatile crypto market, derivatives also allow investors to hedge their risk to different cryptocurrencies.
The other popular benefit of derivatives is speculation. Speculation contributes to a significant proportion of traded volume on exchanges. Derivatives allow for taking exposure to particular assets that may be hard to access otherwise, for example, trading oil futures instead of actual barrels of oil. They can also make leverage easier e.g. a trader who is trading options, only needs to provide enough funds to cover the option premium and gain exposure to a significant amount of the underlying asset.
Market Size
The total derivatives market size is estimated to be around $1 quadrillion. This size completely outweighs other markets including the bond or stock markets and the relatively tiny crypto market that just recently reached the $1 trillion market capitalization.
The Problem
One problem that persists in current financial systems is for users who cannot gain exposure to certain assets due to regulatory or other access challenges. This problem is more pertinent to the defi space as users are only able to spot trade the assets through various AMMs or trade in limited derivatives with a few centralized exchanges. Another problem that exists even with DEXs within blockchain space is slippage and liquidity. This limits the options for a strategic trader who wants to take higher exposure in asset trading.
In many countries, it is also very difficult for people to find a reliable platform for trading real-world assets due to various reasons, including regulatory challenges. KYC is also a problem that certain users face when it comes to accessing financial services.
The Synthetix Solution
Synthetix makes it possible for users to gain exposure to assets that they wouldn’t have been able to otherwise. For instance, users who cannot buy Google shares in their region can instead go to Synthetix and can buy (long) Synth Google (sGOOG). Synthetix also allows for taking short positions on assets via Inverse Synths such as iBTC. Since Synthetix is a DeFi protocol, anyone in the world who has an internet connection and SNX tokens can create synths of assets and trade with them.
Further, many users may prefer trading on Synthetix as it doesn’t require a user to complete the KYC process to trade, allowing for more privacy compared to traditional platforms.
Synthetic assets are collateralized by the Synthetix Network Tokens (SNX) which need to be locked in a smart contract to enable the issuance of Synths. This pooled collateral model enables users to perform conversions between Synths directly with the smart contract, avoiding the need for counterparties This results in solving the liquidity and slippage issues experienced by DEX’s such as Uniswap. This is because there are no real assets being bought or sold to affect the demand and supply of a particular asset in a pool.
Synthetix User Interaction
Synths are minted by staking Synthetix Network Token (SNX) as collateral using Mintr, a decentralized application for interacting with Synthetix contracts. The collateralization ratio is set by community governance mechanisms and at present, this ratio is set to be at 400%. Once SNX are staked, synthetic USD (sUSD) are minted as per the current collateralization ratio. The minted sUSD can then be traded for any available synth on the Synthetix exchange Kwenta.
It must be kept in mind though that whenever users stake SNX and mint sUSD, they are also taking on a portion of the protocol’s debt (represented by the market value of all synths in circulation). If the total debt increases, users will suffer loss as their collateral ratio may not be maintained and they may not be able to claim rewards while at the same time they may not be able to unlock their staked SNX unless they burn more sUSD than they originally minted.
Assume a scenario in which a staker uses SNX to mint sUSD and then trade it for a stable coin sDai, whereas most other users on the platform are holding sBTC. If Bitcoin has a huge upward swing, the user holding sDai could incur loss as they now end up owing more money because the total debt value of the system has increased due to the increase in price of BTC. Conversely, the sDai holder stands to gain profit if the price of BTC drops and most others on the platform are holding sBTC. This is characterized in the diagram below.
Source: https://www.cryptoeq.io/corereports/synthetix-abridged
The below examples further illustrate how the value of debt changes for a user given the upward price movement of an asset (BTC), when they have a long position via sBTC in contrast to when they have a short position via an inverse synth iBTC.
Also, learn about Balancer v1 in this publication.
Value Generation From Synthetix
The value generated for the users (stakers and traders) from participating and using the platform is discussed below.
Value For Traders:
In comparison to trading “real” assets, trading on Synths provides certain key advantages.
As mentioned above, Synths provide exposure to an asset without holding the actual assets. This reduces the friction when switching between different assets (e.g. from sTesla shares to sGold) allowing for permissionless on-chain trading.
Synths track their respective exchange rate through price feeds supplied by an oracle (explained later on), and can be traded easily using Synthetix’s exchange Kwenta. This provides infinite liquidity up to the total amount of collateral in the system, which essentially means that higher volume trades won’t lead to price slippage, as is common on typical exchanges. Also, synthetic assets don’t require a counterparty as traders are trading against the global debt pool because when a trader exchanges sUSD for sBTC, no real BTC is exchanged. However, it must be kept in mind that as Synthetix scales, the “infinite” characteristic would be not applicable, because trade volume size is limited to the total supply of sUSD in existence, which is capped in turn by the market cap of SNX tokens.
Value For Stakers:
SNX holders are given two types of rewards. Stakers are paid a proportion of the fees generated through trading activity on the Synthetix exchange. Fees generated from every trade is sent to the fee pool in the form of sUSD. This fee is between 10–100 basis points (0.1% — 1%, though typically 0.3%). The larger the share of the debt pool a user has, the higher proportion of fees they will receive. The total value of the debt pool equals the sUSD value of all Synths.
The second reward for SNX holders comes from the protocol’s inflationary policy which means that the total supply of SNX tokens is periodically increased by minting new SNX per week. These newly issued SNX tokens are provided as rewards to the stakers in proportion to their share in the debt pool during the weekly reward period. The total SNX supply will increase from 100,000,000 to 260,263,816 from March 2019 to August 2023, with a weekly decay rate of 1.25% (from December 2019). However, from September 2023, there will be an annual 2.5% terminal inflation for perpetuity. The inflationary reward component can only be spent after a year and is added to an escrow on behalf of a staker.
In order to claim rewards, stakers’ collateralization ratio must not fall below the current target threshold referred to as issuance ratio (the base ratio all stakers must be at or above in order to claim SNX). The stakers must claim rewards manually in one transaction every fee period (once a week). Rewards that are not claimed are added back into the fee pool to be distributed in the next period.
System Architecture
The Synthetix system consists of specific core contracts and several constituent contracts that work together to perform various activities of the platform. The high-level diagram below gives an overview of the architecture.
Source: https://docs.synthetix.io/contracts/
The core of Synthetix smart contracts consists of Synthetix, Synths, Inflationary Supply, and Fee Pool elements. Each of these contracts may utilize several constituent contracts to deliver a particular functionality. The Synthetix contract performs important tasks such as issuing synths, burning synths, and exchanging synths. The Synths contract implements synth tokens. Many instances of synth token contracts are deployed one for each type of synth and its inverse version. The Inflationary Supply contract deals with defining the schedule for inflationary token generation and distributing the inflationary rewards as per protocol specification. The Fee Pool, among other things, defines the boundaries of the fee period and computes fee entitlements.
The arbitrage and depot contracts are supporting elements of the system. The Depot contract is there to ensure the USD/sUSD peg stays at 1:1. The contract allows anyone with sUSD to deposit their sUSD and others to exchange ETH for sUSD. User deposits are sold on a FIFO (First in First out) basis. When users deposit sUSD in Depot, they get added to a queue, which then gets fulfilled in order. The depositor will receive ETH at the ETH rate at the time of the exchange. Because the contract assumes that sUSD is always worth exactly US$1, there’s a profit opportunity if the sUSD is off its peg.
The Arbitrage contract allows the exchange of ETH for SNX in order to support the sETH/ETH price peg (1:1) on the Uniswap pool. Each week 5% of the inflationary SNX supply (approx. 72k SNX) is allocated to the arbitrage contract and can only be bought via the sETH pool. When the ratio of sETH to ETH falls below 0.99, users can send ETH to this contract which will first swap ETH for sETH in the Uniswap pool and then convert the sETH to SNX. Since Uniswap’s constant product model forces the price of sETH higher when the relative demand is higher, this multi-step transaction serves to bolster the peg. For users the advantage is, they get more sETH for ETH when the ratio is below 0.99, meaning they end up getting more SNX in the end.
It is important to highlight that Synthetix uses a proxy system so that any upgrades to the system will not be disruptive to the functionality of the contract. Below is a list of key user actions that utilize the above contracts along with the relevant smart contract code.
Minting Synths
The Synthetix contract, which is an instance of BaseSynthetix contract uses the function issueSynths,which then calls theissueSynthsfunction in the Issuer contract to mint sUSD. This function calls an internal function _issueSynths which checks the number of synths that can be issued given the current collateralization ratio, adds thedebt (value of minted sUSD) to the debt register using the _addToDebtRegister function, and calls the sUSD contract to issue the new amount. This newly minted amount is added to the total supply and sent to the user’s wallet.
Source: https://github.com/Synthetixio/synthetix/blob/v2.45.3/contracts/BaseSynthetix.sol#L339
A high-level diagram representing the above function is shown below.
Exchanging Synths
The function to make a trade resides in the BaseSynthetix contract and is called exchange as shown below. This function invokes another function called exchange in the Exchanger contract, which in turn executes the trade.
Source: https://github.com/Synthetixio/synthetix/blob/develop/contracts/BaseSynthetix.sol
An example of trading synths using the exchange function from sUSD to sBTC, would involve several internal calls. The exchange rate for the trade is calculated and a fee (approx 0.3%) is deducted from the converted amount. Then the user’s sUSD balance is burned and the total supply of sUSD is updated. sBTC worth the remaining 99.7% are issued by the destination Synth (sBTC) contract and the user’s balance is updated while the total supply of sBTC is increased. Lastly, the deducted fee is sent as sUSD to the fee pool.
A high-level diagram representing the above function is shown below.
Claiming Fees
When users claim their fees, the claimFees function in the FeesPool contract is initialized.
Source: https://github.com/Synthetixio/synthetix/blob/develop/contracts/FeePool.sol
The _claimFees runs various internal functions to transfer incentives into user accounts. These include the _feesClaimable function which checks whether a user is eligible for fees and inflationary rewards as per the collateralization ratio requirements. The feesAvailable function then calculates the fees and rewards owed.
User’s share of fees generated through trading on the exchange is paid into their address in the specified currency via _payFees, while the staking rewards in the form of SNX are escrowed on behalf of the claiming address in the RewardEscrow contract for one year using the _payRewards function.
Burning Synths
If a user wants to exit the platform or reduce their debt size, they must pay back their debt in order to unlock staked SNX. The process to achieve this via smart contracts is shown below.
Source: https://github.com/Synthetixio/synthetix/blob/develop/contracts/BaseSynthetix.sol
The Synthetix contract uses the function burnSynths in the Issuer contract to burn sUSD. This function calls an internal function _voluntaryburnSynths, which determines users’ debt balance using _debtbalanceof and removes them from the Debt Register using the _removeFromDebtRegister function, and then calls the sUSD contract to burn the required amount. The total supply of sUSD is updated along with the sUSD balance in the user’s wallet whereas their SNX balance becomes transferrable.
A high-level diagram representing the above process is shown below.
The Debt Pool
Both the total debt of the protocol in the debt pool and each staker’s individual debt is updated whenever minting or burning occurs. This is done by updating the Cumulative Debt Delta Ratio. It measures the SNX staker’s percentage of the debt pool at the time they last minted or burned synths, as well as change in debt as a result of other stakers entering or leaving the protocol. The formulas for calculating a user’s debt percentage and Cumulative Debt Delta at the time of minting or burning is given below.
user debt percentage at minting = (New Debt + Existing Debt) / (Previous Debt Pool + New Debt) delta at minting = new debt minted / ( Total Existing Debt + New Debt) user’s debt percentage at burning = (existing debt — debt to be burned) / (debt pool — debt to be burned) delta at burning = debt to be burned / (debt pool -debt to be burned)
Updating the Cumulative Debt Delta Ratio calculates the % change the new debt introduces against the debt pool using the formula above and appends it to the Debt Register and tracks every staker’s share of the debt. For reference, the application of delta within the _addToDebtRegister function is shown in the code below.
Source: https://github.com/Synthetixio/synthetix/blob/develop/contracts/Issuer.sol
In the case of calculating delta for _addToDebtRegister, we subtract the debt percentage because adding SNX stake means there are now more debtors to share the debt, hence the individual debt share of each staker is reduced. The opposite is true for _removeFromDebtRegister, as removing stake would increase the debt share of the remaining debt pool participants
At any point, if we want to calculate the total debt of the system or the current debt pool, it can be done by multiplying the number of tokens in each Synth contract by the current exchange rates.
totalDebtIssued = totalIssuedSynths
Synthetix uses the services of Chainlink oracles to get the most up-to-date market prices for all synths on the system. Since integrating Chainlink, synths have maintained accurate valuations in accordance with the real-world market price of their underlying assets, even during times of high volatility, providing assurance to the traders that the prices they receive are up to date.
Integrating Synthetix:
Developers can integrate synths for a variety of use cases such as trading, staking, data analytics, and more.
For trading, developers can utilize a suite of synthetic assets to enable traders to access fiat currencies like USD, real-world assets like Gold, short positions on popular assets like BTC, indexes of assets from industries like DeFi, and much more. Staking can be integrated to enable users to stake SNX, mint and burn Synths, and monitor their collateralization levels with the Synthetix Staking system.
Synthetix opens up a playground for tools and apps that can be built on top of the protocol without the need for real assets. For interested developers, Synthetix gives access to rich data to create dashboards and trading tools. There are examples of projects who have integrated Synthetix. SNX Link is a tool that simplifies the management of the recurring tasks required by Synthetix such as the claim of fees and the fix of C-Ratio. Zapper, another platform, which aims to be a dashboard to track all defi assets or liabilities has also integrated with Synthetix.
More information regarding integration along with code snippets for integration can be found on the link.
Risks And Shortcomings
Staking SNX is very different from staking in other protocols such as Compound, where interest is collected passively. In the case of SNX, in addition to staking tokens, a user is also taking a bet on the price movement of synths being issued (up or down) when staking. This introduces additional risk which may not be appropriate for the average user. There is also a concurrent risk in the system as the price of SNX could fluctuate in correlation to Bitcoin or Ethereum. Therefore, in order to exit the system, a staker may need to burn more Synths than they originally minted due to price volatility.
Synthetix may also face competition from other protocols built on other chains. Terra-based protocol named Mirror has already been gaining momentum. However, this is also true that Ethereum offers network effects that may be tough to break in the near future.
Synthetix has adopted Optimism (OE) as a L2 solution. However, if any other solution becomes the preferred scaling choice, it could leave Synthetix fragmented from the rest of the DeFi space. Additionally, the switch to OE introduces considerable technical risk due to the billions under management as well as the complexities of multi-asset trading and staking incentives as both are underpinned by different economic incentives and architecture.
Synthetix collateralization ratio, as common with other Defi projects, is quite high which results in capital inefficiency. Also, the staking rewards can only be redeemed after one year which may be considered a disadvantage by some users.
Compared to other Defi protocols, SNX staking requires additional oversight from users because of the changing value of the debt pool. Also, the Synthetix system is slightly complicated to understand and this may discourage some users from coming on board.
Since Synthetix plans to reduce its inflationary supply rewards in the future, this would mean that the stakers’ incentive to take the risk also drops. In such a scenario, to attract stakers, the trading fee may have to be hiked. This may, however, deter traders from using the system. One way to counter this may be to drop the staking ratio by a few percentage points, making the inflationary rewards and trading fee sufficient for stakers to continue staking.
References:
- Team, S. (n.d.). Litepaper¶. Retrieved from https://docs.synthetix.io/litepaper/
- Team, S. (n.d.). Smart Contract Architecture¶. Retrieved from https://docs.synthetix.io/contracts/
- Team, S. (n.d.). Integrations Overview¶. Retrieved from https://docs.synthetix.io/integrations/
- Fernando, J. (2021, July 06). Derivative. Retrieved from https://www.investopedia.com/terms/d/derivative.asp
- Vaidya, A. B., Nigam, A. B., By, A., Nigam, R., Vaidya, R. B., By, R., & Vaidya, D. (2021, July 17). Underlying Asset. Retrieved from https://www.wallstreetmojo.com/underlying-asset/
- Jakub, & Jakub. (n.d.). Derivatives in DeFi Explained. Retrieved from https://finematics.com/derivatives-in-defi-explained/
- Roy, G. (2021, May 27). Investing in Synthetix (SNX) — Everything You Need to Know. Retrieved from https://www.securities.io/investing-in-synthetix-snx-everything-you-need-to-know/
- Synthetix SNX Staking & sUSD Minting Tutorial — Earn SNX Rewards! (2021, June 01). Retrieved from https://defirate.com/snx-staking-tutorial/
- Clark, B. (2021, April 21). Retrieved from https://www.cryptoeq.io/corereports/synthetix-abridged
- Tech, I. O. (2021, June 08). DeFi Deep Dive — What is Synthetix? Retrieved from https://academy.ivanontech.com/blog/defi-deep-dive-what-is-synthetix
Also read Uniswap v3: Power To Liquidity Providers.
Originally published at https://xord.com on July 27, 2021.