New cognition about AMM solving the problems of slippage and impermanence loss
Summary
In finance, risk usually cannot be eliminated, it can only be transferred. This is the same in the DeFi field. For the DEX of the AMM protocol, the design of different mechanisms is actually a trade-off between the interests of different participants (LP and traders). The current AMM agreement project does not eliminate risk. Uniswap's AMM mechanism is simple and elegant. For Uniswap, slippage is essentially to protect the interests of LPs at the expense of traders' experience; while impermanent loss is to protect the interests of traders at the expense of LPs. This is a natural risk for AMM. At present, the projects on the market cannot eliminate these risks, but only make some trade-offs.
Foreword:
Foreword:
Under the automatic market maker (AMM) mechanism, the market-making threshold is lowered, and the participation of ordinary users is greatly improved, so the accumulation of liquidity is also easier. But at the same time, compared with the trading platform of the order book model, problems such as high slippage and impermanent loss are the aspects that make AMM criticized. As liquidity mining led to the outbreak of AMMs in the third quarter, the industry began to pay more attention to the shortcomings of existing AMMs, and new AMMs focused on solving problems such as high slippage and impermanent losses.
1. What is slippage and impermanent loss
Slippage and impermanent loss, as widely mentioned concepts in the DeFi ecosystem, have brought a lot of risks to AMM users. In both concepts, slippage refers to the difference between the expected transaction price and the actual transaction price. Slippage is not a new concept after the emergence of AMM, but a problem existing in the traditional trading market. For exchanges with traditional order book models, the higher the liquidity, the better the order depth and the lower the slippage. Simply put, the more assets you sell, the lower the price; the more assets you buy, the higher the price.
[1]Uniswap: A Good Deal for Liquidity Providers? https://pintail.medium.com/uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2
The concept of impermanent loss (Impermanent Loss) was first proposed after the emergence of AMM [1], which means that in the operating environment of AMM, when the liquidity provider (LP) provides liquidity to the AMM fund pool, due to the external asset market Losses due to price fluctuations. The impermanent loss only exists in the AMM mode and may disappear after the asset price recovers. But in most cases, since the asset price cannot return to its original position, the impermanence loss is actually permanent (Permanent), so it is called the difference loss (Divergence Loss).
1.1 Slippage
Different from the traditional order book form, AMM uses the capital pool model to make the market. The asset price in the fund pool is determined by the function, which means that the price of the trading pair in the AMM is directly related to the reserve (Reserve) of its trading assets in the fund pool. Therefore, once a transaction occurs, resulting in a change in the reserve of the transaction asset in the fund pool, the actual transaction execution price of the asset will change, resulting in slippage. Therefore, the larger the transaction and the deeper the damage to the liquidity reserve of the fund pool, the higher the slippage.
In order to prevent the liquidity of the fund pool from drying up, transactions must be punished in the form of slippage. Take Uniswap, which adopts a constant product market maker system (X*Y=K), and Curve, which mixes constant sum and constant product market making, as examples. The function curves are shown in the dotted and solid curves in the figure below, respectively. It is known that the slippage is 0 for the straight line shown in the figure below, so the slippage is smaller when the curve fits the straight line more closely. Curve makes it possible to reduce slippage because it focuses on stablecoin and asset price 1:1 trading pairs, but at the same time, this mechanism cannot be applied to trading pairs with violent price fluctuations, otherwise the cost of arbitrage is low under low slippage, Easily lead to liquidity depletion.
image description
Different market-making function curves; source: Curve white paper
In addition, because the AMM fund pool must use a large amount of liquidity and idle capital to ensure that the asset transaction price is still competitive after the slippage occurs, the low utilization rate of funds has become another major problem for AMM, and because LP's income comes from The transaction costs incurred by the actual transaction capital, this problem directly affects the income of LP. Reducing slippage can not only bring better prices to traders, but also bring more transaction fee income to LP.
1.2 Impermanence Loss
In the original definition, impermanent loss was only detected as a Uniswap risk. Under the Uniswap mechanism, LP losses due to asset price deviations in the external market are typical. Specifically, on the one hand, because Uniswap’s asset pricing is related to the reserve of the fund pool, price discovery is done on the chain and is not linked to external market prices. Therefore, when asset prices in the external market fluctuate, Uniswap needs to rely on arbitrageurs (Arbitrageurs) to correct the price on the chain to make it consistent with the external market price.
On the other hand, after providing liquidity to the fund pool, LP obtains partial ownership of the fund pool, that is, the "shares" of the fund pool assets. In the process of correcting the price on the chain, the profit obtained by the arbitrageur is the loss of the fund pool, which makes LP suffer losses compared with passive holding assets. Excluding transaction fees and slippage, the specific steps of impermanent loss are as follows:
① Assume that the ETH/DAI fund pool has 10 ETH and 5,000 DAI, the internal price 1ETH=500DAI, and the initial market price 1ETH=500DAI. The internal price of the fund pool is equal to the market price, and the fund pool is balanced;
② Suppose LP Alice provides 1ETH/500DAI for the above-mentioned fund pool, then Alice owns 10% of the above-mentioned fund pool "shares";
③ The external market price of ETH rises, 1ETH=700DAI, while the internal price of the fund pool is still 1ETH=500DAI, creating room for arbitrage.
④ The arbitrageur Bob buys 1 ETH from the fund pool at a price of 500DAI, and the remaining 9ETH and 5500DAI in the fund pool, the fund pool is out of balance, the ETH reserve decreases and the price of ETH inside the fund pool rises, and the arbitrage space continues to exist until the internal price of ETH rises to 700DAI (external market price);
⑤ Alice wants to withdraw funds when the fund pool is 9ETH/5500DAI, and Alice actually withdraws 10% 9ETH/5500DAI, which is 0.9ETH/550DAI. Alice's asset value at this time is 0.9700+550=1180DAI;
From the above logic of impermanence loss, it can be seen that the size of impermanence loss is positively correlated with the volatility of asset prices, and all AMMs that use capital reserves to price assets and rely on arbitrageurs to adjust asset price models on the chain must have impermanence losses. Depending on the size of the external price fluctuations of assets, the impermanent losses incurred by LP may be compensated by transaction fees and liquidity mining income. At the same time, derived from the mathematical formula, the shape of the function curve of impermanence loss is shown in the figure below:
image description
Impermanence loss function curve; source: TokenInsight
1.3 Other risks
In addition to the risk of slippage and impermanent loss, the utilization rate of funds analyzed above is also an aspect that AMM is considered insufficient. In addition, when the AMM fund pool requires users to mortgage more than one asset and provide evidence in the form of "shares" in the transaction pair fund pool as the liquidity for LPs to cash out earnings, LPs that only hold one asset will be forced to bear Exposure to multiple assets.
Overall, according to the above analysis, the risks and shortcomings of the AMM mechanism mainly include the following aspects:
Slippage: high slippage, especially unfriendly for large transactions;
Low utilization rate of funds: high degree of idle capital hinders LP fee income;
Impermanent loss: when the asset price fluctuates and deviates from the internal asset price of the fund pool, it will cause LP loss;
Multi-asset exposure: Liquidity providers may be forced to take multi-asset exposure.
2. Problem optimization plan
The shortcomings and risks of the AMM mechanism and the reasons for the shortcomings and risks are analyzed above. From the above reasons, it can be seen that for the problems of slippage and capital utilization, optimization solutions that can be adopted include changing the market-making function curve and using oracle machines to feed prices of trading assets. However, since slippage can also prevent capital loss in the fund pool and protect the liquidity of assets in the fund pool, the market-making curve that fits 0 slippage only has good application scenarios for trading pairs with asset prices of 1:1.
For the problem of impermanent loss, the optimization plan also includes the introduction of oracle machine feed price, so that the price in the fund pool is consistent with the external market price, and does not rely on arbitrageurs to correct the price in the pool; at the same time, the risks caused by impermanent loss and asset price fluctuations can also be Managed by way of hedging. For the problem of multi-asset risk exposure, LP can only undertake a single risk exposure by giving LP a single asset pool of "shares".
Overall, effective optimization schemes are as follows:
Change the market-making function curve, narrow down the trading application scenarios, and only provide transactions of assets with relatively stable prices, such as stable currency transactions including Curve;
Introduce the oracle machine to feed the price of the internal assets of the fund pool. This solution is adopted by many projects, such as Bancor V2, DODO, and CoFix;
Introducing risk hedging strategies such as CoFix;
Allows exposure to a single asset, such as DODO, Bancor V2
The introduction of oracle machines has become a solution for new AMMs (such as DODO, Cofix) and AMM upgrades (such as Bancor V2) because they can effectively improve slippage and impermanent losses.
3. Risks that still exist after the introduction of oracles
The introduction of the oracle machine can improve both slippage and the risk caused by asset price fluctuations. However, after the introduction of the oracle machine, does AMM bring new risks while improving the existing problems? First of all, as a third-party price feeding tool, the oracle machine itself has certain risks: oracle machine attacks are common, causing a lot of losses in the DeFi ecosystem.
In addition, the principle of the AMM mechanism represented by Uniswap seems simple, but the design is exquisite, and there is a rationality for its successful operation. The overall mechanism design affects the whole body. Any optimization or even elimination of slippage and impermanent losses often requires at the cost of other sacrifices.
3.1 DODO
The following is a specific analysis of AMMs that introduce oracle machines to reduce risks and improve deficiencies, represented by newly entered AMMs DODO and Cofix.
First of all, the transaction price of DODO assets does not change due to the asset reserves of the fund pool. Instead, it is actively adjusted according to the feed price of the oracle machine, so it can reduce slippage and eliminate impermanent losses caused by external price fluctuations and unbalanced capital pools in a narrow sense. At the same time, in order to balance the imbalance of capital pool reserves caused by transactions, DODO still needs to allow the existence of arbitrageurs; The price of B will be adjusted below the market price to encourage arbitrageurs to buy B from the pool. Therefore, this model requires constant, rapid, and accurate adjustments to the price in the pool, which is a test for the price feeding ability of the oracle machine. Once the market price cannot be tracked in time, the fund pool will not be able to be effectively balanced, resulting in LP losses.
image description
TokenInsight has observed the fund pools of 7 trading pairs of DODO, as shown in the figure below, when the Y-axis value is 1, it corresponds to the dotted line positions of B and Q in the figure above; theoretically speaking, the fund pool should keep one side greater than 1 and one side The state is less than 1. However, only WBTCUSDC among the 7 fund pools has maintained this state well:
image description
DODO fund pool balance; source: DODO Pool Tracker
Reliance on the oracle machine also creates the risk of front-running - arbitrageurs can look for arbitrage opportunities by monitoring the price of the oracle machine. When the difference between the two quotations of the oracle machine is greater than the transaction fee required for arbitrage, the arbitrageur can earn the price difference and cause LP to suffer losses. This loss DODO is called arbitrage loss.
At the same time, DODO allows a single risk exposure, that is, allows LP to provide liquidity of a single asset, and distributes income to LP in the form of liquidity "shares" of the asset (not trading pairs). Still taking the above picture as an example, when the B reserve rises, it is necessary to sacrifice the interests of the Q pool LP to encourage arbitrageurs to buy B. When the fund pools on both sides are less than 1 (the status quo of most DODO fund pools), it means that both LPs have suffered losses.
In addition, DODO gathers liquidity near the market price to reduce slippage. Therefore, as the transaction volume increases, there will be a surge in slippage. Compared with Uniswap, DODO is more suitable for small transactions.
3.2 CoFix
Overall, the advantages and risks of DODO can be summarized as follows:
In CoFix mode, slippage can be eliminated. However, without slippage as the protection of the liquidity of the fund pool, there will be a risk that the assets on the transaction side of the fund pool will be consumed and the fund pool will be exhausted. As shown in the figure below, the total locked value of CoFix continues to decline:
image description
CoFix total locked value; source: DeBank
CoFix's method to deal with this problem is to introduce "shock cost", that is, when the amount of a single transaction is large enough, the shock cost is triggered to increase the price of the transaction. However, after impact costs are touched, the difference between the increased transaction price and the normal transaction price is very small (compared to other AMMs), so the protection effect on the liquidity of the fund pool is also limited.
On the other hand, since the internal price of the fund pool is consistent with the market price, there will be no risk of impermanent loss, but this does not mean that LPs provide liquidity without risk.
Although CoFix allows LPs to deposit in a single asset class, the calculation of LP's income is still based on the transaction pair fund pool, that is, it does not provide risk exposure of a single asset, and LP still needs to bear multi-asset risk exposure. However, due to the complete decoupling of asset prices and asset reserves in the fund pool, the price cannot be used as an adjustment factor to balance reserves as in the DODO model; in order to ensure that LP will not bear all losses when the unilateral asset reserve declines, CoFix must make LP Bear the risk exposure on both sides of the capital pool. Dual asset exposure is somewhat of a protection for LPs.
Overall, the advantages and risks of Cofix can be summarized as follows:
image description
COFIX slippage difference; source: COFIX official website
3.3 Comprehensive comparison
Based on the above analysis, TokenInsight made a multi-dimensional summary of Uniswap V2, DODO, CoFix, and Bancor V2, and calculated data such as capital utilization rate and slippage.
Consistent with the analysis of TokenInsight, DODO has a better price in small transactions. In the case of liquidity far lower than Uniswap, the price of small transactions is still better than Uniswap; the capital utilization rate is also higher. CoFix has no slippage, which is beneficial to traders, so the transaction volume performed better; but at the same time, its lock-up value has continued to decline since its launch, and the transaction volume has far exceeded its lock-up value. Although Uniswap is questioned by slippage and impermanent loss in terms of mechanism design, it is still the most liquid DEX, and because of its sufficient liquidity, the slippage problem is relatively not serious. At the same time, although Bancor V2 also introduced oracles, it does not have a strong price advantage, so the transaction volume is relatively low.
The information and data details of each DEXs are shown in the table below (data deadline is November 24, 2020):
summary:
summary:
Risks in the financial sector usually cannot be eliminated, only transferred. This is the same in the DeFi field. For the DEX of the AMM protocol, the design of different mechanisms is actually more of a trade-off between the interests of different participants (LP and traders). The current AMM agreement project does not eliminate risk. Uniswap's AMM mechanism is simple and elegant. For Uniswap, slippage is essentially to protect the interests of LPs at the expense of traders' experience; while impermanent loss is to protect the interests of traders at the expense of LPs. This is a natural risk for AMM. At present, the projects on the market cannot eliminate these risks, but only make some trade-offs.
Uniswap: A Good Deal for Liquidity Providers? https://pintail.medium.com/
Impermanent Loss Explained:https://academy.binance.com/en/articles/impermanent-loss-explained
How to Bring More Capital and Less Risk to Automated Market Maker DEXs:https://blog.chain.link/
Information reference:https://dodoex.github.io/cn/docs/
DODO white paper:https://cofix.io/doc/CoFiX_White_Paper.pdf
To prevent illegal fund-raising activities under the banner of "blockchain" and "virtual currency" by various financial platforms, TokenInsight will strictly abide by national laws and regulatory regulations, and resolutely resist the use of blockchain for illegal fund-raising, network pyramid schemes, 1C0 and other Variations, dissemination of bad information and other illegal acts.https://www.curve.fi/stableswap-paper.pdf
risk warning
To prevent illegal fund-raising activities under the banner of "blockchain" and "virtual currency" by various financial platforms, TokenInsight will strictly abide by national laws and regulatory regulations, and resolutely resist the use of blockchain for illegal fund-raising, network pyramid schemes, 1C0 and other Variations, dissemination of bad information and other illegal acts.
If you find that the content contains sensitive information, please contact us in the background, and we will deal with it in time.


