Aggregated Amplified Price Curves
In general, KyberSwap Classic can be represented as follows:
- alpha is the amplification factor
- L is the liquidity
- p_max, p_min will be the price max, min that KyberSwap Classic can support.
The current price p_r can be calculated as follows:
From the price min, max and liquidity, we can represent the invariant equations of two reserves x,y in a KyberSwap Classic pool as follows:
Hence, the representation of KyberSwap Classic can be transformed from the original:
to a new one:
The following figure illustrates an example of the KyberSwap Classic curve:
KyberSwap Classic Curve
In the early version, KyberSwap Classic allows people to add liquidity in a specific price range. However, this approach has a drawback: the liquidity provider has to add liquidity to a pre-defined range in a pool or create a pool with high gas cost. In KyberSwap Elastic, we want to aggregate different KyberSwap Classic pools into one single pool. In general, two KyberSwap Classic pools can be represented as:
If the two price ranges do not have any overlap range, the combined reserves curve includes two parts. Otherwise, in the overlap price range, the liquidity equal is the sum of liquidity in two positions. Let's take an example when we have:
The liquidity in different price ranges are:
The following figure illustrates how we aggregate liquidity in the three price ranges, where the blue line show the overlap price range, where the liquidity is the sum of liquidity in two positions.