Automatic market maker(AMM) is one of the key components of the decentralized exchange(DEX) platform. Traditional exchanges and centralized digital exchanges rely on the order book to facilitate trading between buyers and sellers. In contrast, DEX employs an AMM algorithm that allows automated trading using a mathematical formula that determines the price of the tokens in a liquidity pool. In fact, AMM is a smart contract that is embedded in the liquidity pool of a decentralized exchange ecosystem.
Different DeFi protocols use different formulas in their AMM algorithms. Uniswap uses the formula x*y=k, where x is the amount of token X and y is the amount of token Y in the liquidity pool, and k is a constant. The equation implies that x and y will move inversely proportional to each other on a hyperbolic curve.
Let us examine the following example:
Assuming Uniswap has a pool comprising the ETH/USDT pair. Let say at a particular time the pool has 10000 ETH and the price of ETH was 1500 USDT, hence the total value of ETH was 15,000,000 USDT. As the ratio is 50:50, the total amount of USDT should be 15,000,000.
Based on the formula x*y=k, k=10000*15,000,000=150,000,000,000
Next, assuming now the amount of ETH has reduced to 8000, using the above equation;
the amount of USDT should increase to 150,000,000,000/000=18,750,000
Uniswap is the first truly decentralized AMM as it allows anyone to create a liquidity pool. Besides that, it allows anyone to provide liquidity to an existing pool
Another popular DEX that employs AMM is Kyber Swap. However, it is not truly decentralized as it does not allow anyone to create a liquidity pool or provide liquidity to a pool. Kyber swap liquidity pools are deployed by professional market makers.
Other popular DEX that employed AMM are Balancer, Curve, Sushiswap and more.