Risk Management
Managing and Mitigating Risks to create sustainable Markets.
Price Protection Mechanisms
Several price protection mechanisms have been implemented in the off-chain and on-chain infrastructure to ensure robust, tamperproof, fair and transparent pricing for all the end-users. Some of them have been mentioned below:
Price Manipulation Protection
There have been cases where a few market participants have manipulated the price and generated profits[1]. On the other hand, there have been several oracle attacks across DeFi each year resulting in loss of millions of dollars of users' assets.
To address such issues, Virtue will use a black box function to ensure tamper-proof pseudo-deterministic price for fair trade execution. This function takes a real world source as seed which is consistently changing and generates a random number using Mersenne Twister, a pseudo-random number generator.
Price Source Deviation Check
The prices of all the real-world and decentralized sources are checked for deviations as defined in the asset manager for the asset, and such factor is called Deviation Factor, which can be unique for each asset.
Let be the number of the real-world sources with prices, and be the price from a decentralized source such as Chainlink or Pyth, then if
then price source is valid and acceptable and will be considered for final price computation.
Sample Price Feed for BTC/USD:
Binance: 45125.89, OKX: 45100.45, Coinbase: 45156.34, MEXC: 45900.90, Kucoin: 45146.22, Bybit: 45116.78, Chainlink: 45110.45, Pyth: 45111.23
In this sample, MEXC's BTC price is out of acceptable deviation (>1.5%) as compared to decentralized sources, hence will be rejected.
Price Source Outlier Check
Once all the real-world sources pass the deviation check, the off-chain infrastructure checks all the prices from these sources for outliers to ensure fair pricing for all.
In order to process this, we can define deviations of price feed against other sources, as
Hence, the deviation of price feed against others can be written as and similarly for price feed, we can define and so on.
Then we compute variance of this dataset to fine-tune the sources, as
The maximum acceptable value of is defined in the Asset Manager for an asset. If the is not under acceptable value, the dataset is sorted in ascending order and the first and last element is removed. This process is continued until V is under acceptable value. One must note that with each elimination, the underlying price feed is also eliminated and not considered from final computation.
In the previous example, if MEXC's price feed by any chance passes the deviation check, it will fail in the outlier check since the deviations of MEXC's price feed will be highest amongst other feeds.
Price Feed Fault Check
Since FTX Saga and several API incidents [2], it is important to implement fault checks for the price feed sources.
Virtue deploys an additional check of the price feed sources to monitor their uptime. Let a price feed report price, at time then the off-chain infrastructure computes, , relative price difference as
If , the price feed is considered faulty, invalid or dead, and hence will not be included to compute final off-chain price.
Market Pool Protection Mechanism
Since pool-based derivatives have unique set of risks, several protection mechanisms for the pool have been implemented considering LPs act as passive market makers. Some of them can be found below:
Pool Weight Factor
Each collateral asset in the Market has its own target weight, defined by the market creator. This enables proper functioning of the pool rebalancing mechanism which ensures there is an even and surplus distribution of liquidity across different collaterals and hence availability of open interest across the market.
This is defined in percentage notation.
Example:
Let's assume a market was created with collateral assets: BTC, ETH and USDC, and the target weights assigned were 35:25:40.
Now, let's say that the market has an imbalance where the weights are 25:50:25. In this case, the actions which will move the current weights towards the respective target weights will have a discount and actions will move the current weights against their target weights will have premium or will be taxed.
Discounted Actions: Long Position with BTC or USDC collateral, Swap BTC for ETH, Swap USDC for ETH, Add Liquidity with USDC or BTC.
Premium or Taxed Actions: Long with ETH, Swap ETH for USDC or BTC, Add Liquidity with ETH.
Pool Buffer Factor
All asset listed as collateral in the Market have a buffer amount to prevent swap actions under the buffer amount to prevent premature draining of the collaterals from the pool. This is to ensure sufficient liquidity for removing liquidity, managing reserves of the active positions and preventing systematic risk to the Market.
This is defined in USD notation.
Example:
In the previous example, let's assign the Buffer Factor for BTC, ETH and USDC as 1,000,000 each.
Now, let's assume after some time the Market Pool has 2,000,000 USD worth of the each collateral asset: BTC, ETH and USDC.
In this case, if there is no active open interest using any pool reserves, then
Forbidden Swap Action: Swap Action > 1,000,000 worth of any of the collateral asset.
Allowed Swap Action: Swap Action < 1,000,000 worth of any of the collateral asset until the available reserve amount for that asset > 1,000,000 (Buffer Factor of the Asset)
However, one must note internal swap to increase, decrease or adjustment of active open interest will still be allowed. Example: Under ETH's Buffer Factor, any user can supply BTC to long ETH, which will be swapped internally to ETH to execute ETH long since there is no net imbalance for the buffer amount.
Pool Maximum Asset Reserve Amount
In order to have sustainable market mechanics, each market has a maximum liquidity reserve amount for each of the whitelisted assets which is the maximum USD value of the collateral asset allowed to be added as liquidity. This is to ensure no market has more collateral in the wrong direction or heavy skew in favor of one asset.
This is defined in USD notation.
Example:
In the previous example, let's assign the Maximum Asset Reserve Amount to BTC, ETH, USDC as 50,000,000 each. Now once the liquidity reserve amount of any of the assets (BTC, ETH or USDC) reaches 50,000,000, no further liquidity can be added using the asset. However, all the other actions in the market will function as intended. Once the reserve amount goes below the maximum limit, an addition of liquidity will be available.
Pool Reserve Factors
Any market allowing one or several actions namely: Swap, Futures and Liquidity by default has a liquidity reserve factor for its collateral assets. This is divided into 3 parts:
Futures Reserve Factor: Maximum liquidity reserved for Open Interest/Futures Trading Actions.
Swap Reserve Factor: Maximum liquidity reserved for Swap Actions.
Liquidity Reserve Factor: Minimum liquidity reserved for Withdrawal/Removal Liquidity Actions.
These are defined in USD notation and have to be maintained actively by the market creator.
Example:
In the previous buffer factor example, we considered that the market now has 2,000,000 worth reserves for each asset. Now let us define reserve factors as:
Futures:Swap:Liquidity = 1,000,000:500,000:500,000
Now, at this stage, following actions are allowed: Opening Trades upto $1M, Swaps upto $500K, withdraw liquidity worth of $500K. One must note that if there are no open interest, no swap actions then LPs can withdraw the entire liquidity without issues.