# Is DEX stablecoin mining really lossless?

**Abstract：**

DEX is the most important infrastructure of Defi. Among them, Curve has always been known as the “stablecoin version of Uniswap”, and has become the preferred platform for trading stablecoin due to its low slippage characteristics, attracting a large number of liquidity providers to pledge mining. However, liquidity providers often find that the returns are less than expected.

Based on this, this article first analyzes the core mechanism of Curve operation-the StableSwap model, which combines the constant sum formula and the constant product formula to form a curve between constant sum and constant product, so that users can trade within certain areas with the relatively stable price, avoiding slippage problems, and greatly reducing the risk of impermanent losses for the liquidity provider (LP), thus leaving the user with the impression of “low wear”.

However, by checking the code, we found that there is a potential loss when users deposit and withdraw coins in Curve. This is also an important reason why the user’s income is less than expected. Therefore, the second chapter of this article discusses the source of losses and avoidance measures as a liquidity provider in Curve based on the aforementioned Curve market-making mechanism, which provides a reference for LP operations. Specifically, losses will mainly occur in three scenarios. (1) Unlike Uniswap, LP must provide liquidity based on the ratio of the two currencies in the liquidity pool at the time. Curve allows LP to perform unilateral deposit and withdrawal, but users are depositing There may be a proportional loss of coin voucher and penalty fees when coining. (2) If the liquidity pool is filled to an unbalanced state, it will also provide opportunities for arbitrageurs. (3) If the liquidity pool deviates from the equilibrium state when withdrawing coins, it will withdraw tokens that are less than the proportional destroyed vouchers, and also face the loss of penalties. The size of the loss is related to the state of the current liquidity pool and the degree of imbalance caused by the deposit and withdrawal. Of course, if the liquidity pool is pushed back to a balanced state during the deposit and withdrawal process, it will also receive certain rewards.

Based on the above discussion, we recommend that LP, whether depositing or withdrawing, try to return the liquidity pool to a balanced state. If the number of deposits and withdrawals is small, it will not have a big impact, but if the amount of funds is large, it is recommended that the LP first make a calculation and weigh the losses, or fill or withdraw funds in batches, and continue to operate after the liquidity pool returns to stability.

**Author**

【Huobi Research】Tong Xu, Wenqi Zhao, Yuming Yuan

**Author contact**

Huobi Research: [email protected]

# 1. What Does the Curve While Paper Say?

# 1.1 Background

Dex is the most important infrastructure that has emerged in the Defi this year. For ordinary users, in addition to decentralized wallets, the most familiar decentralized product should be Dex. For the whole year of 2019, Dex’s transaction volume was less than 3 billion[1], but this year, the transaction volume in September and October were about 9 times and 7 times of this number, respectively. Among them, Uniswap, Sushiswap, and Curve, which have long occupied the top three trading volumes in the past three months, are all automatic market-making Dex.

Figure 1 Comparison of Monthly Trading Volume of Dex in 2019 and 2020

Data Source：Dune Analytics

Curve has always been known as the “stable coin version of Uniswap” and has become the preferred platform for trading stable coins due to its low slippage characteristics. The peak balance of its liquidity pool once exceeded 1.6 billion U.S. dollars, and its monthly trading volume has remained above 1 billion U.S. dollars for a long time. On the aggregate trading platform 1inch, Curve’s monthly transaction proportion reached a peak of 26.84% and weekly transactions accounted for a peak of 45.5%.

[1] Data Source：https://duneanalytics.com/hagaetc/dex-metrics

Figure 2 Curve Monthly Transaction Volume

Data Source：Dune Analytics

Figure 3 Curve Liquidity Pool Balance

Data Source：Dune Analytics

It is worth noting that, compared with Uniswap’s theoretically unlimited number of trading pairs, Curve has only 19 trading pools so far. Such a small trading pool can attract so much asset precipitation and trading volume. The reason is that its market-making model gives traders the impression of “low slippage” and at the same time brings liquidity providers the impression of “low wear and tear”. It has caused large funds with unpaid losses and long slippage to flood into it. But is the fact really consistent with everyone’s impression?

In order to answer this question, the first chapter of this article will open Curve’s white paper with readers to introduce the core mechanism of Curve operation; Chapter 2 will explain the source of loss as a liquidity provider in Curve based on this mechanism; Chapter 3 summarizes the losses and explains how to avoid them. It ishoped that through this article, we can reveal where the “unexplainable” loss of funds has gone, and analyze how to avoid losses reasonably.

# 1.2 Brief Introduction of Curve’s Market-making Mechanism

The core idea of Curve’s market-making mechanism is **to ensure that the pool can provide liquidity at any price while reducing transaction slippage.** In order to achieve this goal, Curve proposed the StableSwap[1] model in the white paper, which combines constant sum and constant product market making. For ease of understanding, although StableSwap supports multiple market making, the dual market making model is mainly used in the process of this chapter, but the principles are the same.

Figure 4 Constant Sum and Constant Product Models

Image Source: Huobi Research

Constant summation market-making formula, such as x+y=const. Because the slope of the curve is constant, zero slippage transactions can be realized. Users canalways exchange the same amount of y with a certain amount of x, the ratio of injecting and exchanging out assets will not change with changes in the injection volume. However, this kind of market-making model will encounter the problem of liquidity exhaustion. Either x or y may be cleared at a low cost. As shown in the x+y=10 curve in Figure 4, it only takes up to 10 x to clear y.

The constant product market-making formula, such as xy=const, **does not have the problem of liquidity exhaustion**. Its curve extends infinitely along the coordinate axis, which means that users can always exchange for another asset after injecting assets. However, this mode will cause **slippage problems**. Any exchange between x and y will cause the point (x, y) to move along the curve, and the slope of the curve has been changing constantly, which means that the price has been changing, making it impossible for users to complete all exchanges at the current price, and bringing slippage. In addition, for liquidity providers, under this market-making model, they will face the risk of impermanent losses, because the price changes continuously along the curve, causing the liquidity provider to bear the non-optimal dealing prices in the changing process.

Figure 5 Combining Constant Summation and Constant Product Models

Image Source: Huobi Research

Curve’s StableSwap combines the two. For ease of understanding, it can be simply regarded as a weighted summation of constant sum and constant product to form a form of α(x+y)+β(xy)=const. As shown in Figure 5, a curve between constant sum and constant product is formed, similar to a two-dimensional projection of a “**pan**”.

**When users trade in the “flat bottom” area, the price is relatively stable to avoid slippage problems.** But price stability also means that this market-making model is** not suitable for assets with relatively large price fluctuations**. We can also notice that the same pool of Curve contains assets with relatively stable prices, such as various stable currency pools and pools anchoring BTC. For liquidity providers, this model also **greatly reduces the risk of impermanent loss**. As long as the price does not sway out of the “flat bottom” area, the impermanent loss will be much smaller than the constant product market making, even if the price is shaken to the edge of the pot. “, it will also be quickly returned to the “flat bottom” area by arbitrageurs.

**At the same time, the “pot edge” extends infinitely to avoid the problem of liquidity exhaustion.** At any price, no asset will be emptied, but the slippage may be very high.

# 1.3 Further Understand the Curve Market-making Model

The previous section briefly introduced Curve’s market-making mechanism. In order to facilitate readers to understand the content of the subsequent chapters, this section will further introduce Curve’s market-making model from a mathematical perspective.

First of all, from a general point of view, for the constant summation market-making mechanism, the market-making is based on the following invariant, that is, the sum of the number of tokens in the pool is a constant:

For the constant product market-making mechanism, the market-making basis is based on the following invariant. Each token in the pool is exponentiated according to its weight and the product is obtained as a constant:

The invariants actually used in Curve are slightly simplified, and the two basic invariants are:

and

Where D represents the total number of tokens in the pool when the price (or quantity) of each token in the pool is equal.

On the basis of the above two formulas, StableSwap introduces χ as the weight of constant summation. When χ=0, the invariant becomes a constant product; when χ→∞, the invariant becomes a constant sum; when χ belongs to a certain value in the middle, it is the synthesis of the two invariants of constant product and approved summation that StableSwap expects. In addition, in order to also reflect the influence of the total number of tokens in the constant summation, StableSwap multiplies both sides of the constant sum invariant by χD^(n-1) and then sums it with the constant product invariant to obtain its invariant of market making:

On this basis, in order to allow χ to be adjusted to the situation where the ideal price deviates from the relative price of 1, StableSwap introduces a constant A and a variable (∏x_i )/(D⁄n)^n ，let

It can be seen from the above formula that χ can be regarded as the product of A and (∏x_i )/(D⁄n)^n, (∏x_i )/(D⁄n)^n can be understood as the symmetry of the pool. When the distribution of each token in the pool is completely balanced,(∏x_i )/(D⁄n)^n=1, ; When the distribution of tokens in the pool is extremely uneven,(∏x_i )/(D⁄n)^n is approaching zero, is approaching zero, The market-making formula degenerates into a constant-product market-making formula. Because the market-making formula of constant summation is suitable for scenarios where the relative price has no fluctuation and is 1, when the number of tokens in the pool is extremely unbalanced, it means that the relative price deviates greatly from 1, and the constant summation formula is not applicable at this time. Substituting χ into the market-making formula can get the final invariant for market-making as follows:

Figure 6 The Change of Is Shown As Follow:

Image Source: Huobi Research

When making a market according to the above formula, the transaction of tokens will affect the value of x_i, take 3pool’s (DAI, USDC, USDT) as an example, assuming that the quantities before the transaction are (x_1,x_2,x_3 )，when charging x_1^’-x_1 DAI in exchange for USDT，the value of x_1 will become x_1^’，substitute x_1^’ into the above formula to calculate a new x_3^’， x_3^’-x_3 is the number of USDT exchanged. Neither A nor D will change during this process. From a graphical point of view, the transaction will move the state of the pool along the pink curve in Figure 5 (for the convenience of visualization, bivariate scenarios are used for drawing in this chapter).

But A and D will not remain the same. For D, when the liquidity provider fills or proposes liquidity into the pool, D will change accordingly. According to the aforementioned market-making invariant, when the deposit and withdrawal action occurs, the D value in the current state will be recalculated according to the new value. D will become larger when deposited, and smaller when withdrew. As shown in Figure 6, when A remains unchanged,** it can be seen that an increase in D will cause the curve to move outward, and the “flat bottom” area will also be enlarged, and vice versa.**

Figure 7 The Change of is Shown As Follow

Image Source: Huobi Research

A is a parameter that can be adjusted. In Curve, the A of each pool can be modified through proposals and voting[2]. When D is unchanged, it can be clearly seen from Figure7 that the change of A has an impact on the market-making curve.** The larger the A, the closer the curve is to the constant sum market-making curve, and the larger the “flat bottom” area. On the contrary, the closer to the constant sum curve, the smaller the “flat bottom” area.**

In Figure 7, although the change of A will brings about the change of curvature, these curves will pass through the point q, which is the intersection point between them and x=y, because D has not changed at this time. But under special circumstances, the change of A will links to the change of D. As shown in Figure 8, suppose the original market-making curve is on the curve of A=100, D=10, and the number of tokens in the pool is at q(5,5). At this time, a transaction occurs, and the number of tokens in the pool is transferred to p(2.50,7.51) . If the community voted to change 𝐴 from 100 to 1, and the number of tokens in the pool remains unchanged (no new transaction occurs, and there is no deposit or withdrawal behavior), in order to make the market-making invariant still hold, 𝐷 will passively change, new The curve will still pass through the point 𝑝, and finally push the curve to 𝐴=1, 𝐷=9.52. This is the situation where 𝐴 and 𝐷 change at the same time. In the process of this transformation, the attacker can arbitrage through the spread [2], but this arbitrage vulnerability has been fixed in Curve [3].

[2]For example, proposal 29 adjusts the A of the renBTC/wBTC pool from 125 to 200:https://dao.curve.fi/vote/parameter/8

Figure 8 Special Changes

Image Source: Huobi Research

All in all, through an in-depth understanding of the Curve mechanism, it can be seen that it is indeed designed to achieve low slippage, and because the trading pairs it supports are relatively stable in price, it also reduces impermanence losses to a certain extent. Therefore, Curve leaves users with a very strong impression of “low transaction wear and low market making wear”. But if the user unscrupulously operates in Curve based on this impression, he/she may face unexpected losses. In the next chapter we will analyze the source of the loss in detail.

# 1. Source of Loss

Curve market making is different from Uniswap. In Uniswap, LP must provide liquidity according to the ratio of the two currencies in the liquidity pool at that time, while Curve allows LP to recharge non-proportionally, or even unilaterally. In the previous research of Huobi Research, “AMM Market-Making Impermanence Loss Hedging Analysis Series (1)-Profit and Loss Model Construction”, we have discussed that under the AMM mechanism, the imbalance of the currency ratio in the pool will bring losses to LPs, which is mainly impermanent loss. So for Curve’s LPs, will this liquidity supply mechanism bring other losses besides impermanent loss? By checking the code of Curve 3Pool, we found a lot of details that were not mentioned in the white paper. There are potential losses in depositing and withdrawing coins, including causing the currency imbalance in the pool to provide opportunities for arbitrageurs. This is also the reason that caused LP mining revenue to be less than expected.

The following will analyze the possible losses in the process according to the entire LP supply chain process. For the convenience of explanation, this chapter discusses the use of dual market making as an example to simplify 3Pool to 2Pool.

# 2.1 Depositing the Tokens

**a. Loss of Casting Certificate-Unilateral Deposit**

We know that after the LP fills the tokens into the liquidity pool, the platform will cast a certain amount of vouchers and return them to the LP. The dividends of the transaction fees, the distribution of the governance tokens, and the final withdrawal will all be determined by the proportion of vouchers to the total voucher in the liquidity pool. How to determine the number of vouchers casted? We mentioned the D value in the Curve market-making formula. Assuming that the D value of 2Pool was . The total number of vouchers issued by the platform is . The value of D becomes . The number of vouchers obtained by the new liquidity provider is:

Due to the nature of the Curve market-making formula, when new tokens are depositing, the value of D will be correspondingly enlarged, but it is not proportionally enlarged according to the number of deposits. Assuming the total amount of tokens in the liquidity pool is constant, the value of D is the largest only when the numbers of two tokens are equal. The greater the difference, the smaller the value of D, and the LP will obtain a voucher that is not proportional to the value of the token. Let’s make a diagram below.

Assuming that there are two tokens in 2Pool, USDC and USDT, the reasonable price ratio of the two is 1:1, the initial liquidity pool is in a perfect balance state, the quantity of both tokens is 10,000,000, and the initial liquidity pool quantity is . If LP chooses to deposit coins unilaterally, the relationship between the amount of flushing and the loss ratio of the number of certificates is as follows:

Figure 9 Proportion of Loss in the Number of Vouchers-Unilateral Deposit

Image Source: Huobi Research

The abscissa x in the figure represents the log value of the number of tokens deposited in relative to the number of initial tokens, that is, the number of tokens is . The ordinate represents the difference between the ratio of number of tokens deposited by LP to the total number of tokens and the ratio of newly casted vouchers to the total vouchers. It can be seen that if the liquidity pool has been in a balanced state before, unilateral deposits will cause the loss of the number of vouchers, and as the number of deposits increases, the loss of the number of vouchers will gradually shrink after reaching the extreme value, because the proportion it occupied in the pool is big enough to gradually regain the “right to speak.” In addition, a larger value of A can smooth out a part of the loss, and enlarge the range of reaching the extreme value.

Figure 10 shows the voucher loss in the absolute amount of the deposit. It is still assumed that the two stable coins in the liquidity pool before the deposit are both 10,000,000, which is also in line with the order of magnitude of most current liquidity pool pledges. When the amount of depositing funds is small, the loss changes more rapidly. Let’s zoom in on the part with the lower amount of funds, as shown in Figure 11, to see the changes in the loss more clearly when the amount of funds is small.

Figure 10 Proportion of the Loss of Vouchers Quantity

Image Source: Huobi Research

Figure 11 Proportion of The Loss of Vouchers Quantity

Image Source: Huobi Research

Let’s look another perspective — skewness. The Curve project team puts forward the concept of skewness, which is used to measure the balance of each token in the liquidity pool. The calculation method is as follows:

Among them,x_i represents the number of each token, and 𝑛 is the type of token.

The variation range of skewness is [0, 1]. When it approaches 1, that is, the relative quantity ratio of each token approaches 1, indicating that the pool is relatively balanced. When it approaches 0, that is, the relative amount of each token varies greatly, the pool is not balanced. When the skewness of the liquidity pool reaches the preset minimum value, a reasonable increase of A through community voting can be used to enlarge the “flat bottom” area to prevent large slippage during the transaction. The corresponding voucher loss under different skewness is shown in the figure (the same as the previous deposit amount assumption):

Figure 12 Skewness Corresponds to Voucher Loss

Image Source: Huobi Research

As long as it deviates from the perfect balance, there will always be a certain percentage of losses in the newly cast vouchers.

**b. Loss of Casting Vouchers-Bilateral Deposit**

What about dual coin deposit? It is also assumed that the liquidity pool was in the balance state before, and the amount of newly deposited dual coin is the same as the total amount in the previous pool, but the ratio is different.

Figure 13 Proportion of Loss of Vouchers Quantity-Bilateral Deposit

Image Source: Huobi Research

The abscissa in the figure is the ratio of one of the coins (assumed to be USDT) to the number of deposits. It can be seen that as long as it deviates from the balance of 1:1, it will bring about the loss of the number of newly casted vouchers, and the greater the degree of deviation, the greater the loss.

What if the flow pool was not in the balance state before? It is also assumed that the amount of newly deposited dual coin is the same as the total amount in the previous pool, but the previous amount of USDT and USDC in the pool is different. The figure below shows the loss of the number of casted vouchers under different proportions.

Figure 14 The proportion of Deposits Corresponds to the Loss of the Number of Vouchers

Image Source: Huobi Research

Compared with the previous situation that when the number of the two is 1:1, as long as the tokens are not deposited according to the proportion, there will be losses. When the tokens with a lower share are provided, within a certain range, not only there is no loss, but also deposit rewards can be obtained. The liquidity pool is complemented to a 1:1 state, and the rewards are the most. This is consistent with the nature of the D value discussed above, that is, the total amount is fixed, and the closer the amounts of two coins are, the greater the D value. Consider a scenario where the liquidity pool was in a 1:1 state before, and after the first liquidity provider LP1 does not deposit the coins in the optimal ratio, the new liquidity provider LP2 fills up the liquidity pool again, and the proportion of vouchers obtained by the previous LP1 will face twice discounts. Firstly, because the liquidity pool is charged and left the balance state to obtain a voucher lower than the proportion of the provided funds, and then because LP2 pulls the liquidity pool back to the balance state, a certain reward is obtained, making the proportion of vouchers of LP1 is lower.

**c. Penalty Fee**

When we checked the Curve code, we noticed that when LP provides liquidity, if he/she does not deposit the tokens according to the ideal value, the platform will deduct a management fee. How is the ideal value defined?

Assuming that the number of dual coins in 2Pool was [x_1,x_2 ]，the value of D is ，LP’s newly provided dual coins number is [x_1^’,x_2^’ ]，when the number of dual coins in the pool is [x_1+x_1^’,x_2+ x_2^’ ]，the corresponding D value is , then the default dual coins ideal number of the liquidity pool is [x_1×D_1/D_0 ,x_2×D_1/D_0 ]，the absolute value of the difference part, that is [|x_1×(D_1-D_0)/D_0 -x_1^’ |,|x_2×(D_1-D_0)/D_0 — x_2^’ |] A certain amount of tokens are deducted at the rate. Still assuming that the number of newly deposited dual coins is the same as the total number in the previous pool, which is 20,000,000, then the previous USDT: USDC is 4:6, 5:5, 6:4, corresponding to different deposit ratios, The number of tokens deducted by the platform after the deposit is as follows:

Figure 15 Management Fee for Depositing Coins (in terms of the number of tokens)

Image Source: Huobi Research

Different from the previous encouragement to push the liquidity pool to a balance state when the vouchers were casted, when the proportion of new deposits is different from the initial proportion, fees will be incurred. From the perspective of cost, the default optimal state of the liquidity pool is to scale up the number of tokens, the fee charged at this time is the least, which is 0.

Let’s look at the loss of the number of casted vouchers and the loss of fees together. The assumption here is that the total amount of tokens provided by LP is the same as the total amount of tokens in the liquidity pool before. The overall deposit loss is shown in the following two figures.

Figure 16 Deposit Loss (the liquidity pool was in a balance state before)

Image Source: Huobi Research

Figure 17 Deposit Loss (the liquidity pool was in an unbalanced state before)

Image Source: Huobi Research

The ordinate here represents the loss between the number of tokens in the liquidity pool corresponding to the voucher obtained after the LP provides liquidity compared to the number of tokens provided. Under the two states of balance and imbalance liquidity pool, the results are slightly different. In the balance state, as long as the deposit is not based on 1:1, it will cause a loss, and if the liquidity pool is imbalanced before, as shown in Figure 13, under the condition of USDT: USDC=4:6, the minimum fee is 4:6 while the minimum point of the casting vouchers loss is at 6:4. Taken together, the minimum overall loss position is between [0.5, 0.6], and within a certain range. There is no loss in the overall effect. The specific position and the capital volume is also related, and no detailed calculations will be made here.

# 2.2 Arbitrage

As we discussed in the first part, Curve changes the range of the “flat bottom” area by adjusting the A parameter. In this area, the slippage of transactions is very low, making the exchange between stable coins within a reasonable price, but from Figure 5, it can be seen that once the deposit makes it deviates from the area beyond the inflection point, the slippage is even greater than Uniswap’s market-making formula, which will provide arbitrageurs with a lot of space. If the number of coins in the previous liquidity pool is small, and the new LP provider unilaterally recharges a large amount of funds, even when the value of A is large, it may break the inflection point, making the price of the token on Curve and other exchanges quite different, thereby providing opportunities for arbitrageurs. The following figure shows the average price of arbitrage corresponding to unilateral deposits under different A value conditions and the balanced state that the arbitrageur puts the liquid pool back to.

Figure 18 Arbitrage price

Image source: Huobi Research

In the transaction process, the value of D is constant. Due to the nature of the Curve market-making formula, when D is constant, the closer the two tokens are, the smaller the total token. Therefore, after the arbitrageur completes the arbitrage, he exchanges a smaller amount of funds for the higher share of the tokens in the pool, and the overall number of tokens decreases, so the corresponding LP will face the loss of the reduced tokens. After arbitrage occurs under different capital sizes, the proportion of the number of tokens reduced in the pool is shown in the figure below.

Figure 19 Proportion of Token Loss

Image source: Huobi Research

In real scenarios, arbitrageurs will not return to the most balanced position. In the cases that have occurred, we have seen that some arbitrageurs use flash loans for risk-free arbitrage. They use pre-written arbitrage robots to continuously monitor market prices to find arbitrage opportunities. When a vulnerable transaction is scanned, a loan is made without any collateral, and the loan, arbitrage, and repayment are all completed in one block. Taking into account the cost of borrowing and the small difference in the prices of the two stable coins in the pool, the equilibrium point is not the lowest slippage of the market-making curve.

# 2.3 Withdrawal

**a. Unilateral extraction in unbalanced state**

Assuming that the liquidity pool is initially in an unbalanced state, LP will cause the tokens whose flow pool deviates from the equilibrium state to be withdrawn.

Figure 20 Unilateral extraction loss in unbalanced state

Image source: Huobi Research

The abscissa x in the figure represents the log value of the number of tokens withdrawn relative to the number of initial tokens, that is, the number of tokens withdrawn is N_0×〖10〗^x，After the proposal, the liquidity pool returns to a perfect balance. The ordinate y represents the ratio of the loss after withdrawal compared to the token provided by the LP at the beginning. We can see that, unlike the coin deposit process, the loss is first large and then small. The higher the initial deviation of the pool, the smaller the loss after it is taken out. After reaching a certain order of magnitude, the loss is basically maintained at 0.02%, with only the fee loss. This is because when the platform calculates the amount of coins that should be withdrawn, it first determines the current value of D according to the market-making formula, and then calculates the new value of D based on the number of withdrawal certificates.

Assuming that the D value of 2 Pool before the withdrawal is , the total number of certificates issued by the platform is Token Amount,Then the value of D_1 becomes:

After that, is substituted into the market-making formula to obtain the number of two tokens in the liquidity pool, and the difference between the initial number of tokens is the number of tokens that is taken out. If a relatively excessive amount of currencies in the liquidity pool is taken out, the platform will have a certain compensation effect, as shown in the figure below.

Figure 21 Unilateral extraction loss ratio in unbalanced state

Image source: Huobi Research

**b. Unilateral extraction** **in equilibrium**

If the flow cell itself is in equilibrium, what impact will unilateral extraction have?

Figure 22 Unilateral withdrawal loss in equilibrium

Image source: Huobi Research

Here, the abscissa x represents the ratio of the withdrawal voucher to the total issued voucher, and the ordinate y represents the loss of the number of coins withdrawn. The calculation method is the difference between the ratio of the withdrawal quantity to the total quantity and the ratio of the withdrawal voucher to the total issued voucher. Different A values have no effect on this, as the unilateral extraction ratio increases, the loss will gradually increase.

**c. Penalty fee**

It is also similar to the deposit process. When LP withdraws, if the withdrawal is not based on the ideal value, the platform will also deduct a fee. The calculation process is the same as the deposit process.

# 2.4 3Pool instance

Let’s take the real data of 3Pool as an example. As of writing, the number of 3Pool stablecoins DAI, USDC, and USDT are 79,947,203.64 (24.58%), 134,425,652.93 (41.32%), 110,925,927.58 (34.10%), and the total number of tokens in the liquid pool is 325,298,784.15, The handling fee rate is 0.04%, the management fee rate is 0.02%, and the A value is 200.

Figure 23 Unilateral, bilateral, and trilateral deposit losses

Image source: Huobi Research

The abscissa x represents the log value of the number of tokens added relative to the total number of tokens in the liquidity pool, The figure above shows the proportion of losses caused by unilateral, bilateral, and trilateral deposits. Here, bilateral deposit refers to depositing USDT and USDC, and unilateral deposit refers to depositing USDT. We noticed that in the pool, DAI is insufficient relative to the amount of USDT and USDC. If the currency type of the unilateral deposit is DAI, the liquid pool will reward LP within a certain amount of deposits, as shown in the figure below.

Figure 24 Unilateral currency loss (DAI vs USDT)

Image source: Huobi Research

What about unilateral withdrawals? The figure below shows the loss of LP when DAI, USDC and USDT are withdrawn unilaterally. The abscissa represents the ratio of the amount of unilateral withdrawal to the total amount of the currency in the liquidity pool. Since DAI is a minority in the pool, the loss increases faster than USDT and USDC when withdrawing coins.

Figure 25 Unilateral withdrawal loss

Image source: Huobi Research

# 3. How to avoid losses

We previously discussed the potential losses that may be caused by the pool status and the deposit and withdrawal ratio in the LP deposit, arbitrage transaction and withdrawal link of the liquidity pool. The summary is as follows:

For LP, how is the operation more reasonable?

The most ideal state is to return the liquidity pool to a balanced state as much as possible whether it is depositing or withdrawing coins, that is, make up coins with small amount when depositing and withdraw coins with big amount when withdrawing.

However, LP may not have coins with small amount in the liquidity pool. If the amount of deposit and withdrawal is not large, the overall loss will not be large. If the amount of deposit and withdrawal is large, it is recommended that LP do a calculation first to see if the liquidity pool will be pushed to the inflection point and weigh the possible losses, or deposit the funds in batches and deposit the next sum after the liquidity pool is stabilized. The same is true when withdrawing coins.

# References

[1] Curve white paper: StableSwap — efficient mechanism for Stablecoin liquidity, https://www.curve.fi/stableswap-paper.pdf

[2] Curve Vulnerability Report: https://medium.com/@peter_4205/curve-vulnerability-report-a1d7630140ec

[3] Curve proposal fixes potential arbitrage loopholes: https://dao.curve.fi/vote/ownership/22

[4] Curve code: https://github.com/curvefi/curve-contract/tree/master/contracts

**About Huobi Research**

The Huobi Blockchain Application Research Institute (referred to as ‘Huobi Research’) was established in April 2016. Since March 2018, it has been committed to comprehensively expanding research and exploration in various fields of blockchain. The research institute takes the pan-blockchain field as the research object, aimed to accelerate the research and development of blockchain technology, promote the application of the blockchain industry, and promote the ecological optimization of the blockchain industry. The main research content of the institute includes industry trends, technology paths, application innovation, and model exploration in the field of blockchain. In line with the principles of public welfare, rigor and innovation, Huobi Research Institute will carry out extensive and in-depth cooperation with government, enterprises, universities and other institutions through various forms. We are building a research platform covering the complete industrial chain of the blockchain, providing a solid theoretical basis and trend judgment for the blockchain industry professionals, and promoting the healthy and sustainable development of the entire blockchain industry.

**Contact us:**

**Inquiry email:**

**Official website:**

**WeChat public account:**

HuobiCN

**Jianshu:**

https://www.jianshu.com/u/a234cae11e43

**Sina Weibo:**

https://www.weibo.com/u/6690456123

**Twitter:**

@Huobi_Research

**Medium:**

Huobi Research

https://medium.com/@huobiresearch

Welcome to join our learning communication group

Scan QR code to add WeChat

**Disclaimer**

1. Huobi Research has no relationship with other third parties involved in this report that affects the objectivity, independence, and impartiality of the report.

2. The materials and data cited in this report are from compliance channels. The sources of the materials and data are considered reliable by the Huobi Research and the authenticity, accuracy and completeness of the materials have been verified as necessary, but Huobi Research does not make any guarantees regarding authenticity, accuracy or completeness.

3. The contents of the report are for reference only. The facts and opinions in the report do not constitute any business, investment suggestions. Huobi Research does not assume any responsibility for losses caused using the contents of this report, unless clearly stipulated by laws and regulations. Readers should not make business and investment decisions solely based on this report, nor should they lose the ability to make independent judgments based on this report.

4. The information, opinions and speculations contained in this report only reflect the judgment of the researchers on the day of finalization of this report. In the future, based on industry changes and data information updates, there is a possibility of updating opinions and judgments.

5. The copyright of this report is solely owned by Huobi Research. If you need to quote the content of this report, please indicate the source. If you need a large quote, please inform in advance and use it to the extent permitted. Under no circumstances should this report be quoted, abridged or modified against its original intention.Huobi Research

We know Blockchain.Huobi Research: At this stage, Sushiswap is very similar to the incentive layer of UniswapFollow