Synthetic Futures Primer
This post will cover a number of areas relating to the upcoming launch of synthetic futures. It will provide a high level overview of the current proposed design of futures detailed in SIP-80. It will also provide background on the difference between the Synthetix futures contracts and other perpetual futures implementations. Finally it will outline the plan for launch, including a testnet trading competition to shakedown the mechanism ahead of mainnet launch.
Some brief background on futures markets to provide a point of comparison. The primary purpose of a futures contract was originally to enable a producer of a commodity to lay off their price risk by selling today something which they would otherwise not have until a future date. As futures markets matured speculators entered the market with no intention to produce or take delivery of the underlying assets. This had the impact of significantly increasing liquidity in these markets, but there is complexity for a trader who never wants to take delivery. In order to keep exposure to the underlying asset they must roll over to the next contract ahead of the delivery date.
Bitmex solved this problem with its bitcoin perpetual swaps contracts, which do not settle. The issue with this perpetual mechanism is that there is nothing in principle that ensures the spot price of the underlying asset does not deviate from the future price. With traditional futures the settlement process ensures that the future price and the spot price eventually converge at settlement. To correct for this a funding rate was introduced to act as a dampener to these price deviations. This funding rate ensures that if there is a positive skew in price the long side of the market is paying the short side, effectively tamping down the long bias. Now a trader can hold a position longer term without needing to roll contracts or deal with settlement complexity.
Perpetuals also enable a trader to get leveraged exposure to the underlying asset. This adds complexity to position management, particularly when the margin currency is itself a volatile asset like BTC or ETH. In order to access leverage a trader posts initial capital, or margin, and is able to open a position that is up to 100x larger than their initial capital outlay.
Perpetual Futures Comparison
The primary difference between the Synthetix perpetual futures and other implementations is the purpose of the funding rate, because Synthetix prices come from Chainlink oracles there is no need to ensure the price of the spot market and the futures market do not diverge. Instead we are using funding to ensure the market skew and therefore risk to the debt pool is not too high. However, both of these funding rate mechanisms rely on market forces to establish a cost in the form of a daily funding rate for maintaining a position in a directional market where more participants are biased long than short or vice versa. With most perpetual futures there must be a buyer and a seller of each contract, so there can be no actual market skew, longs always balance shorts. However the price a long is willing to pay may be significantly higher than the spot rate to induce a short to take the opposite position. In this case the cost of keeping this long position open increases as the price diverges from the spot rate. This ensures futures prices stay closely aligned with the underlying asset price. With Synthetix it is possible for the market to become skewed as there is no need for a trader to wait for a counterparty to match their order, they are trading against the SNX debt pool. So the purpose of a funding rate is to ensure demand for a directional trade is being captured by the debt pool, as well as to ensure that countervailing positions are induced into the debt pool through the funding mechanism. One of the interesting consequences of this is that when the skew is high the funding rate paid to the opposite side of the market is significantly higher than would be the case in another futures market. This is due to the fact that the number of contracts on each side of the market is not necessarily balanced in Synthetix, so there can be $100k of longs paying $10k of shorts. In this case the funding rate would be high but the excess funding not paid to shorts is captured by the debt pool as compensation for absorbing the risk of this skew. This means longs and shorts will always pay and receive the same % of funding, with the excess funding paid by the heavier side of the market captured directly by SNX stakers.
Synthetix Futures Implementation
There are a number of high level components required for the implementation of synthetic perpetual futures on Synthetix, they are outlined below:
- Contract and Market Parameters
- Position Modification Fees
- Aggregate Debt Calculation
- Liquidations and Keepers
- Continuous funding rate
- Next price fulfilment
Contract and Market Parameters
These parameters define the structure of each market and each position within the market. The specific parameters can be found below in the user flow section, more detailed definitions and formulae are available in the SIP. Each market refers to an underlying asset price defined by a Chainlink oracle, a trader can open a long or short notional position in the market defined by their chosen leverage and their initial margin.
Each market has a specified maximum leverage amount. For each market it is possible to determine the market skew and market size, which is used for calculating the funding rate at any given point. The market skew is the difference between the total open positions long - short, while the market size is the sum of both sides of the market.
Leveraged trading allows a trader to open a larger notional position than their available margin, this simultaneously increases risks and potential ROI of the position. Due to the thresholds of the oracle the maximum functional leverage on L1 is likely to be 25x. Once we migrate to L2 with Optimism this can be reviewed and potentially increased. Due to these constraints the L1 launch leverage will likely be constrained to 5-10x with increases possible via SCCP.
When a trader opens a trade they are only charged a fee when they increase the skew of the market. So if there is $100k in long interest and $50k in short interest on the ETH market, if a trader opens a short position they will not be charged a fee as they are decreasing the market skew. However, if the same trader opened a long position they would be increasing the market skew and would be charged a fee. If a trader reduces the size of their position no fees are charged, this is to ensure that arbitrage on funding is efficient. Because a trader who is capturing funding does not pay a fee to open their position their expected outcome in capturing funding and reducing market skew is always positive, ignoring gas fees and assuming they close any positions before the skew shifted in the opposite direction. Additionally if a trader shifts a market from skewed long to skewed short, they are only charged a fee on the portion of the position that skewed the market rather than the entire position.
Aggregate Debt Calculation
Synthetic futures are part of the overall debt pool, hence it is critical the value of the debt in the contracts is accessible for minting and burning operations to be accurate. The role of keepers (discussed in another section below) is to ensure liquidations and other maintenance functions happen in a timely fashion. The mechanism for measuring the debt in each market is to track the initial margin each position adds which is represented by the sUSD burned to create the position, and then calculate the difference between the entry notional skew and the current notional skew. The entry notional skew is a variable that is updated on every position modification in that market.
Liquidations and Keepers
Synthetic futures utilise a look back function to maintain the state of each market, this means that if the price threshold for a liquidation is crossed for a given position the position will still be open from the perspective of the protocol until a keeper submits a transaction to liquidate the position. The issue with this as mentioned in the previous section is that this introduces some indeterminism in the state of the debt pool, so keepers are incentivised to liquidate each position as quickly as possible. In order for this look back function to work a historical record is kept of each price update, and it is sufficient for a keeper to demonstrate that at any time in the past a position crossed the liquidation threshold. Importantly if a trader attempts to close a position that has previously crossed the liquidation threshold it will also be liquidated, so it is not possible to bypass liquidation, however, to incentivise users to close liquidated positions in a future version they will be given the ability to liquidate themselves and keep the liquidation fee.
Continuous funding rate
As discussed above in the overview, the purpose of the funding rate is to ensure the market skew is minimised, reducing the risk to the debt pool. The formula for calculating the funding rate has three inputs, the maximum daily funding rate of 10%, the market skew and the total market size. The funding rate is calculated proportionally to the market skew relative to the total market size. A simple example would be a market size of $100m with a skew of $200k, in that case the funding rate would be 20 basis points per day. Compare this with funding rates from other markets which are typically 30-100 basis points on average. To illustrate, an extreme example: if the market is 100% skewed, e.g. there is $100k in longs and $0 shorts, the proportional skew is 100% multiplied by the maximum daily funding rate of 10%, so the longs would be paying 10% in funding per day. This is of course an extreme scenario and would likely not last long as funding rate arbitrage would see traders open up positions in other markets as hedges and then take the short side of the market to farm the funding rate.
Funding for each position accrues continually by tracking each change in funding flow per base unit across the entire market. So for any position modification it is possible to inspect the cumulative changes to funding flow since the last position modification and calculate the accrued funding. To ensure that funding rates do not experience high volatility there is a clamping factor applied to each change in funding rate so that funding rate changes are smoothed over time. For more details of the specific calculation of continuous funding please see the SIP.
This continuous funding is far more efficient than the funding methodology of centralised exchanges where there are periodic snapshots for funding, introducing market distortions around these snapshots. By charging continuous funding, the funding rate mechanism is both more efficient and ensure that no funding rate induced distortions occur periodically.
Next price fulfilment
The protocol currently implements an anti-frontrunning measure called fee reclamation. This mechanism determines whether the price of the asset has changed within a window of time after the trade has confirmed. If the price shifts a rebate or a reclaim is applied to the trade, this must be settled before the trader can trade again or transfer the asset. This mechanism ensures that oracle latency on layer1 cannot be exploited to generate risk free profit.
Given the risk of oracle exploitation due to the addition of leverage on trades, a modification to this scheme is planned that ensures a trader only ever gets filled at the price following their trade but does not rely on a specific time window. This reduces the attack surface of oracle latency exploitation significantly. There is a trade-off to this though, which is a lack of determinism as to when an order will be filled, once an intent to open or modify a position has been confirmed on-chain, the trade is locked in until a price update occurs and a keeper finalises the trade. One way of reducing the impact of this on traders is to lower the deviation threshold for the oracle. This improvement is currently planned for the migration to Chainlink during the Pollux release. This will ensure more frequent oracle updates and reduce the impact of next price fulfilment.
Now that we understand the differences between existing futures implementations let’s review a specific example of a user opening a position and being liquidated. Alice wants price exposure to Bitcoin on Ethereum, she goes to the dex aggregator 1inch and trades $1,000 of USDC for sUSD. She then navigates to Synthetix.Exchange and opens the futures interface. She chooses the BTC perpetual market, and is presented with an order form. The inputs required are:
Initial margin (Alice uses her full margin of $1,000)
Market direction, long or short (Alice selects long)
Leverage (Alice selects 10x)
The interface calculates notional value of the position as $10,000 USD (0.8 BTC)
The market skew is also displayed as well as the estimated funding rate (50bps per day)
Trade fee is 30bps (because the market is skewed long currently)
Additionally Alice selects the gas price to broadcast the trade.
Alice is satisfied with the above position and hits confirm trade. The trade is sent to the network, it confirms in the next block. The UI updates to show that the open trade transaction has been confirmed and that the next oracle update is pending.
Once the next oracle price update is confirmed the entry price of the position is finalised by a keeper.
The UI now displays all of the information on the open position and the overall market:
- The oracle rate for BTC ($12,000)
- Open interest ($3,500,000)
- Market skew (+$350,000/10%)
- Daily Funding rate (+1%)
- Max daily funding rate (10%)
Alice’s Position information
- Contract size in BTC (0.8BTC)
- Contract direction (Long)
- Notional Value ($10,000)
- Accrued funding ($0)
- Profit/Loss ($0)
- Remaining margin ($999.7 after fees)
- Position status (open)
Alice leaves the position open and returns to Synthetix.Exchange the next day, and finds the price of BTC has dropped to $8,000 overnight. During that time her margin of $1,000 was insufficient to maintain her position so a keeper executed a liquidation on the position. The keeper retained the liquidation fee of $20 and the remaining margin was sent to the fee pool, $980. It is important to note in this example that the margin is simply transferred to the fee pool and distributed to SNX stakers, so there is no need to liquidate the margin on market. This represents a significant improvement over other markets collateralised by volatile collateral like BTC or ETH.
Given the complexity of the synthetic futures mechanism and the risk of leverage to the debt pool we believe an incentivised testnet trading competition on the Ropsten testnet is prudent before deploying to mainnet. The recent OVM testnet trading competition uncovered a number of potential attack vectors in the implementation with respect to oracle latency, data sources and L2 block times. This demonstrated it is possible to simulate mainnet user behaviour through trading incentives and prizes. This trading competition will run for two weeks and depending on the outcomes may be followed by a second competition following any required upgrades or modifications. A similar approach is planned for this trading competition to the OVM demo, a user will tweet a request for Ropsten sUSD and ETH, a faucet will send the tokens to their address. The top traders by closing sUSD value will win a share of a pool of SNX, details to be published closer to launch.
A further consideration is that we are in the process of migrating Synthetix.exchange to kwenta.io, however, supporting futures is outside the launch scope of this Kwenta rebrand, so the futures testnet will likely run within a modified instance of the current Synthetic.Exchange dApp.
Launch markets are another consideration. As with any Synth it is critical that liquidity is present in the underlying spot market, so the proposed plan is to roll out with only three markets initially expanding to other markets via SIP. The initial markets proposed in the SIP are BTC, ETH and LINK.
The final consideration is the timeline, we are targeting testnet launch for mid September, with mainnet the following month pending any feedback or findings from audits and the testnet period.
Potential Mechanism Improvements
During the design phase for synthetic futures we have uncovered a number of potential improvements and extensions to the mechanism. Many of these handle potential edge cases and add significant complexity to the mechanism, we have therefore decided to opt for simplicity wherever possible, to observe the empirical data post launch before implementing any of the following changes.
Open Interest Caps
There is an implicit open interest cap present in the supply of sUSD available for trading, in addition to this the funding rate scales to a level where opening a large unbalanced position is extremely punitive even for small periods. At the extremes the funding rate per minute is ~7 basis points. It is possible after observing the incentivised testnet that we may opt to introduce such caps, but for now we believe they can be avoided.
Position Scaling Through Funding
As funding is paid continuously it is possible to enable auto position scaling as funding accrues. This would enable a trader to get maximum exposure through maintaining a fixed leverage ratio and increasing margin through funding.
Skew Reduction Factor
The current design pays the lighter side the same interest rate as paid by the heavier side of the market, this is optimal in terms of capturing value for the fee pool, but it does not optimise skew reduction. It is possible to add a skew factor that would divert less of the excess funding to the fee pool, this would have the impact of increasing the APY of the lighter side of the market ensuring skew correction incentives were even more powerful.
It is no secret that the synthetic futures is one of the most anticipated launches within the Synthetix community. While refreshing and redesigning the spec ahead of the implementation we uncovered the original synthetic positions system design… dating back to february 2019. There is no denying futures have taken longer to deliver than anticipated. However, having gone through three wholesale redesigns we are confident this iteration is far more robust than the previous designs. Even more importantly the protocol itself is in the best position it has ever been, with SNX and Synth liquidity at all time highs, not to mention demand. The upcoming migration to Chainlink as well as a number of other improvements should ensure the initial launch of leverage on Synthetix is as smooth as possible. Synthetic futures provide one of the best sets of trade-offs for traders in the market and we expect to see significant volume once on mainnet.