# KAYENSWAP V2

### Dual AMM

KayenSwap's Dual AMM is based on UniV2 constant formula, with a custom implementation of a Curve-esque logic for stables. The KayenSwap AMM is the core of our ecosystem-oriented approach, designed with the following principles in mind:

1. A high degree of fluidity to tailor each protocol / market participant's needs&#x20;
2. Capital efficiency with highly effective trading efficiency.
3. De-risking Chiliz native protocols from mercenary liquidity and adapting to their needs

Dual AMM is a dual-liquidity model for both volatile and stable assets with <mark style="color:red;">**Swap Referral**</mark> for partnering protocols

1. **Constant Product**

First introduced by Vitalik’s [On Path Independence](https://vitalik.ca/general/2017/06/22/marketmakers.html), Automated Market Makers (AMM) became the steering pillars for DeFi. Uniswap utilizes the constant product formula (CPAMM), x \* y = k, where x is the quantity of token X, y is the quantity of token Y and k is a constant. Each token pool is only comprised of two assets X and Y and this formula ensures the ratio of both are equal.

<figure><img src="https://content.gitbook.com/content/HYAEXjb7COsO4dFqH5tt/blobs/ufUbian8SXjfNq01IiL9/image.png" alt="" width="188"><figcaption><p>The graphical representation of the CPAMM</p></figcaption></figure>

$$
x \* y = k
$$

2. **Constant Sum**

CPAMM has been time-tested with exchanging long tail assets, but has been inefficient for stablecoins due to high price impact. Michael Egorov’s [StableSwap - efficient mechanism for Stablecoin liquidity](https://berkeley-defi.github.io/assets/material/StableSwap.pdf) dawns the constant sum formula (CSAMM), x + y = k. The underlying invariant that empowers Curve with a minimal price slippage.

<figure><img src="https://content.gitbook.com/content/HYAEXjb7COsO4dFqH5tt/blobs/L0OiI8oa3FIa0e6hOLbS/image.png" alt="" width="188"><figcaption><p>The graphical representation of the CSAMM</p></figcaption></figure>

Embodying both CPAMM and CSAMM, each KayenSwap can configure its own type, depending on the expected price correlation level between the two tokens of the pair. For **volatile pairs,** composed of uncorrelated assets, based on the UniV2 model (CPAMM), the pool uses the standard constant product formula. For **stable pairs of** correlated assets, designed to maintain a 1:1 transfer ratio, the pool uses BasePool model (CSAMM).

Stable pairs are used for correlated assets, and will try to maintain a 1:1 transfer ratio as much as possible. The formula is based on the well-known Solidly curve:

$$
x^3y + xy^3 = k
$$

### <mark style="color:red;">Referral</mark>

The swap referral in design will be available for everyone. Every KayenSwap referral partner can add its referral address to each transaction made on KayenSwap through its dApp, and subsequently receives a part of their users' generated swap fees. We envision a Win/Win scenario in which **all KayenSwap actors are adequately rewarded**, thereby fostering a **fair and sustainable ecosystem**.
