SIP-317: Spot Markets (V3)
|Network||Ethereum & Optimism|
|Implementor||Sunny Vempati (@sunnyvempati)|
This SIP proposes a spot market implementation, issuing ERC-20 tokens that can be exchanged for snxUSD at a rate determined by a price feed plus or minus fees.
The spot market implementation outlined below will allow the creation of synthetic assets by specifying a price feed and other configurable settings.
Rather than consolidating all spot synth exchange functionality into a single system, the V3 architecture allows us to encapsulate logic for markets into seperate systems. This modular architecture allows for more rapid experimentation and iteration for configurable aspects of particular assets (like fee structures) while still being able to re-use core logic across all spot markets.
The proposed implementation involves a variety of order types, configurable fees, and some additional configuration.
The proposed system generates synths (ERC-20 tokens) and markets that exchange them with stablecoins generated by the core protocol at a price determined by the oracle manager or verified on-chain after applying fees.
To execute orders, the markets withdraw or deposit stablecoins with Synthetix (negatively or positively impacting the position of liquidity providers to the market, respectively). The market also reports the total supply of the synths multiplied by their current price to Synthetix as debt, such that the synths are collateralized by liquidity providers in Synthetix.
Atomic orders allow users to exchange stablecoins for synths in a single transaction. The amount provided in the exchange is determined by an oracle manager node ID after applying fees. Users can set a "minimum amount received" to protect against slippage. A default fixed fee can be set for this type of order, as well as custom rates for specific addresses.
Asyncronous orders involve two transactions: a commitment and a settlement. This reduces composability, but allows for front-running mitigation such that lower fees can be offered to traders. Asynchronous orders may be cancelled after the settlement window has passed. Users can set a "minimum amount received" to protect against slippage. A default fixed fee can be set for this type of order, as well as custom rates for specific addresses.
Each market that allows this type of order can configure an array of settlement strategies. There are two types of settlement strategies:
- On-chain: This uses the price provided by the oracle manager upon settlement
- Pyth: This uses Pyth-verifiable price data related to the settlement time
Markets which are able to provide collateral directly to Synthetix can issue synths of equivalent value after applying fees. Users can set a "minimum amount received" to protect against slippage. A fixed fee (positive or negative) can be set seperately for wrapping and unwrapping.
Utilization Rate Fee
A supply target fee helps limit liquidity providers' exposure to price fluctuations of the asset in situations where demand becomes very high. The amount of liquidity provided to a market implies a supply target. This is the ideal maximum amount of synths that the market would issue, where all of the credit capacity provided to the market were being utilized. This could expressed as a utilization rate of 100%.
If the utilization rate exceeds 100%, the market can apply a supply target fee on buy orders for atomic and asyncronous orders. The fee rate (configured as a percentage by the market owner) is taken of the percentage by which the utilization rate exceeds 100% and applied to the order.
For instance, if a buy order would move the utilization rate from 90% to 120%, only utilization above 100% incurs fee, so the fee rate here would be (100% + 120% / 2) = 110%. Based on this calculation, we apply the configured feeRate to the average utilization above 100%, which in this case is 110%. If the fee rate is set to 0.1%, we would multiple 10 (percentage points above utilization) * 0.1% = 1%.
An auto-rebalancing skew fee allows a market to use wrapping functionality in such a way that reduces protocol risk. A (positive or negative) fee can be applied to buy and sell orders as a function of market skew, defined as the total supply of synths minus the amount of wrapped collateral. This creates an arbitrage opportunity that should reduce the skew.
The market owner can set the skew scale. The skew scale is the amount we divide the current market skew by to determine the fee rate. For example, if a synthetic ETH market has issued 100 sETH and wrapped 110 ETH, the current skew would be -10 ETH. If the skew scale were set to 1,000 ETH, the skew fee would be -1% for a buy and 1% for a sell. This would incentivize users to buy more of the synth, reducing the skew.
The owner of a market can set an interest rate (denominated as an annual percentage with 18 decimal places) for the synths issued by their market. This is implemented by making the synth a rebase token, where the total supply (and holders' individual balances) automatically decay at the specified rate.
Though synth decay may complicate composability, this incentivizes liquidity providers to back synths that tend to be held over long periods of time rather than actively exchanged.
Fees that are collected by markets may be distributed in three ways:
- By default, fees are deposited to the core system, reducing the debt of those backing the market pro-rata.
- Fees may be captured and distributed by a custom fee collector contract, which can be configured by the market owner.
- Traders may specify a referrer address when executing a trade. If this address appears in a market-configurable mapping of addresses to fee share amounts, the specified share of the fees are automatically sent to the specified address.
Relevant tests will be developed during implementation.
Configurable Values (Via SCCP)
Refer to the (README)[https://github.com/Synthetixio/synthetix-v3/blob/main/markets/spot-market/README.md] for additional information on the configurable values for each market.
Copyright and related rights waived via CC0.