We are building dynamic vaults that aim to improve the profit potential of swaps and deposited capital. Each vault will have several key components. The vault itself, which acts as the automated market maker for swaps, the yield programs which run the strategy for the vault, as well as the dynamic fee and DAO programs, which will coordinate between all the various vaults.
The key design principles of vaults include:
Composability: Ability to collaborate with other projects for benefits to user
Liquidity: Providing a high level of liquidity accessible for both swaps and deployment
Secure: Keeping capital secure, while catering to various risk profiles
Each Mercurial market making vaults implements a highly efficient, multi-token market maker with dynamic fees optimized for pegged assets, but generalizable for any token pair. Mercurial provides up to 100X better slippage for pegged assets swaps compared with traditional AMMs.
We are also implementing new pricing models that are generalized for non 1:1 token sets, including x:y pegs, as well as for assets that move within a given range, like forex sets.
In this category, while the different assets in the vault are stables in their own right, and their exchange rates can fluctuate around a narrow range for example USD/EUR etc.
We will in turn utilize an amplified price curve to concentrate liquidity in the desired range. Users who trade when the exchange rate is out of range will get less supported liquidity. Assuming that we want to support two coins x1,x2, whose exchange rate fluctuates in the range p1, p2, so constant-products in each case are:
By adding an amplification coefficient a, we form a formula for Stable swap in this case as:
In which a is amplification coefficient and d represents for liquidity
If a is “close” to infinity, all liquidity are concentrated in the price range p1- p2
If a is “close” to 0, the formula becomes constant-product. Hence the supported price range is [0-infinity]
All the vaults in Mercurial share the same dynamic fees program. The program will store the market volume, and volatility data, and update the LP fees accordingly.
The core algo of the fee programs runs with these goals:
High market volatility: Higher LP fees, reducing IL and capturing higher profits
Low market volatility: Lower LP fees to encourage trading
For our first implementations, we will use 2 volume measurements in a long window and short window to determine the fee. We use Exponential Moving Average (EMA) because it is quicker to react to volume changes than SMA (Simple Moving Average), and also easier to program than other more complex options.
Vo, V1, … , Vn are on-chain volumes of the a pair, which are recorded in a predetermined epoch
represents the degree of weighting decrease
v is base fee variant , so our dynamically fee can be calculated as the formula
feedynamic = feebase + v
30*z represents for max variant
r0 is cut-off ratio
g, f, l, a, b, c are constants, which are chosen the make the curve of v
By implementing as a standalone program, the fee program can be upgradable to cater for data points as we learn about the effectiveness, without having to update the core vaults in any way.
Yield programs will be used to manage the dynamic allocation of assets from each vault to external platforms via on-chain algorithms. This management also includes interest and yield collection, exiting certain platforms, liquidation of earned assets.
These yield programs will need to be approved by the DAO before they can deploy capital in the vault to external platforms. The % of deployable assets will also be determined by the DAO for each vault.
Deployment to external platforms includes flash loans, collateral for lending platforms, leveraged stable lending or even external vaults. Platforms will be selected based on the returns, risk profiles, and ease of retrieving liquidity.
Yield programs make the market making pools highly extensible - new programs can be added to existing vaults to improve the earnings of the base capital. This is one of the most exciting aspects.
Deployment of yield programs will depend largely on the evolution of the space in general, as well as some of the key technical ecosystem developments, including which programs are available to be leveraged.
The DAO will decide key decisions and parameters for the vaults. These include:
Base fees and commissions: From the swap and vault operations
Usage of the fees: Whether the fees will be burnt or distributed
Deployment destinations: Where capital can be deployed to
Approve yield programs: Approve the yield programs that can access vault capital
Max loan to liquidity ratio: The maximum amount of capital that can be externally deployed per vault