Decentralized Swap Protocol on Ethereum

22 Sep 2020

I. How does Uniswap work?

Uniswap is a 100% decentralized and permissionless protocol, based on the formula:

x * y = k

In which:

x is the number of tokens A.

y is the number of tokens B.

k is the total value of pool A/B.

When k changes, if the values of tokens A and B remain the same, x and y will change.

When x and y change, but k does not change, the values of tokens A and B must change.

For k to change, x and y will need to be changed by the liquidity providers or LPs.

In order for x and y to change, it will need influence from traders through swaps.

For example:

Let's say the pool is created named ETH/DAI with 10 ETH and 1000 DAI.

We will have:

x * y = k ⇔ 10*1000 = 10,000.

Price of 1 ETH = 100 DAI and Price of 1 DAI = 0.01 ETH.