How does decentralized exchange work?

3KM’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.

Automated market maker(AMM)

3KM / Klay & 3KM / USDT & 3KM / USDC
Where x and y represent the reserve of the Asset A, B, and k is a constant.
3KM 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:
(x+dx)(ydy)=k(x+dx)(y-dy) = k
The amount of B token you can receive dy is satisfied:
dy=ykx+dxdy=y-{k \over x+dx}
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:
dy=ykx+dx(1f/100)dy=y-{k \over x+dx(1-f /100)}
Some swap fees are sent for liquidity providers and added to the liquidity pool.
kafter=(x+dx(1f/100)+α)(ydy)k_{after}=(x+dx(1-f /100)+α)(y-dy)
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.
kafterkbefore=x+dx(1f/100)+αx+dx(1f/100)>1{k_{after} \over k_{before}}={x+dx(1-f /100)+α \over x+dx(1-f /100)}>1


  • Every time a swap occurs, 0.3% goes into a fee pool contract.
  • The trading fee can only be changed by DAO Governance (UPCOMING).
  • Trading Fee can be changed between 0.25% to 0.35%.

Swap Fee

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 3KM Evolution Team
  • 0.05% - Buyback 3KM in DEX or CEX
Last modified 1yr ago