# 🔗Swap

Last updated

Last updated

**KlayDAO**’s decentralized exchange implement a mechanism called the Automated Market Maker used by Uniswap. It solves many of the problems of the traditional order book method and offers many other benefits. In order to exchange cryptocurrency in the existing traditional financial market, A token was exchanged for fiat and then fiat was exchanged for B token at a centralized exchange. With AMM, traders do not need a third party to trade cryptocurrency and can trade directly through the liquidity pool.

▶ **KlayDAO / Klay & KlayDAO / USDT & KlayDAO / USDC**

Where x and y represent the reserve of the Asset A, B, and k is a constant.

**KlayDAO** uses * x*y=k* equation to set the mathematical relationship between the particular assets in the liquidity pools. In other words, the liquidity pool always remains equal to the product of the reserve of asset A multiplied by the reserve of B.

In other words, ∆x amount X for ∆y amount Y during the trading(P→Q), the following formula must be satisfied:

The amount of B token you can receive *dy* is satisfied:

This causes the amount of B in the pool to decrease and the B token price to increase in order to fulfill of x*y=k equation.

Swap Fee

3KM includes a fee of f% , the fee f is set by 0.3. In the previous case, the formula including the fee is as follows:

Some swap fees are sent for liquidity providers and added to the liquidity pool.

In other words, since the fee is added when a swap is successful, the invariant increases with every trade, making the system profitable for liquidity providers.

Every time a swap occurs, 0.3% goes into a fee pool contract.

The trading fee can only be changed by DAO Governance.

Trading Fee can be changed between 0.25% to 0.35%.

If a token swap transaction is made on the exchange, a transaction fee of 0.3% is paid, which is classified as follows.

**0.15%**- Allocation for compensation to Liquidity Providers**0.1%**- Allocation for**KlayDAO**Team**0.05%**- Buyback**KlayDAO**in DEX or CEX

$(x+dx)(y-dy) = k$

$dy=y-{k \over x+dx}$

$dy=y-{k \over x+dx(1-f /100)}$

$k_{after}=(x+dx(1-f /100)+α)(y-dy)$

${k_{after} \over k_{before}}={x+dx(1-f /100)+α \over x+dx(1-f /100)}>1$