Comment on page
Virtual Balances
Liquidity Safety Conditions
To guarantee the safety of the pool, there are some conditions which need to be fulfilled when adding liquidity to KyberSwap Classic pools:
- 1.After LP contributions, the token price remains unchanged.
- 2.andare also unchanged after LP contributions.
In KyberSwap, the pool for pair X-Y needs to maintain 4 parameters:
- 1.The initial amount of tokenthat is used for amplification, denoted by
- 2.The initial amount of tokenthat is used for amplification, denoted by
- 3.The change in tokenamount after trading activities, denoted by
- 4.The change in tokenamount after trading activities, denoted by
Therefore, the real balances and virtual balances of the reserves are:
Real Balances
Virtual Balances
The constant product
. Note that
and
at this time are:
The current price:
Liquidity Providers have to contribute in the same proportion for all 4 amount types. We denote the contribution ratio to be
. LPs have to contribute
in which:
The real balances and virtual balances of the reserve after contribution are:
Real Balances
Virtual Balances
The constant product, after the LP contribution, becomes:
and
at this time are:
The current price is updated to be
We see that after LP contributes, the current price,
and
are unchanged. It is similar in the case of LPs withdrawals, where the ratio
is negative.
- Initially, the first LP put 100and 100to the reserve, we have:.
- A user trades 20for 15, so we have the updated parameters:.
- Suppose an LP wants to contribute 20% of the current token amounts in the pool, so he should deposit:
ie. deposit 24X and 17Y tokens.
The parameters are then updated to be:
.
Last modified 8mo ago