Automated Market Maker (AMM)

Why Trust Techopedia

What Is an Automated Market Maker (AMM)?

An automated market maker (AMM) is a decentralized exchange (DEX) that uses smart contracts to facilitate trades.

Advertisements

To understand the definition of the automated market maker and how it works, we first have to learn how centralized exchanges (CEX) function. When you trade cryptocurrencies on a CEX, the exchange matches your buy/sell orders with another trader’s sell/buy orders. The CEX may also act as a liquidity provider (LP) to ensure the trades are facilitated smoothly and efficiently. Here, the CEX is the market maker, and the process is known as order book marketing making.

Automated market maker explained

In decentralized finance (DeFi), the trading of assets occurs without intermediary matching orders and providing liquidity. This is where AMMs come in. 

Traders swap tokens directly with one another via smart contracts. The liquidity in a DEX can be provided by anyone. Liquidity providers are incentivized to contribute their cryptocurrencies into liquidity pools. LPs are rewarded with a share of the trading fees.

AMMs have emerged as groundbreaking innovations that could potentially disrupt how stock exchanges operate. By using AMMs, we can now trade assets peer-to-peer (P2P) without an intermediary.

AMM Explained: DEX vs CEX

Below are the main differences between AMMs used on DEXs and order books used on CEXs.

Table comparing DEXs and CEXs

How Do Automated Market Makers Work?

There are three different ways how an AMM works. 

1. Constant Product Market Maker Model (CPMM)

CPMM is the most popular AMM model, which is based on the mathematical formula x*y=k.

In the formula, X is the balance of token A, and Y is the balance of token B in an A-B liquidity pool. The formula states that the product K must not change. 

For example, in an ETH-UNI pool, every time a trader buys ETH in exchange for UNI, the price of ETH will go up slightly as there will be less ETH left in the pool. Meanwhile, the price of UNI will go down slightly, ensuring that product K is constant. The ETH-UNI pool will maintain a constant balance as the value of ETH will always be equal to the value of UNI in the pool.

Arbitrageurs are incentivized to step in if the price of ETH-UNI in an AMM moves away from prices on other exchanges. 

2. Constant Sum Market Model (CSMM)

CSMM is based on the mathematical formula x+y=k. This model is known for facilitating zero-slippage trades however it does not allow infinite liquidity. The CSMM model is vulnerable to arbitrageurs draining one of the reserves if there are price discrepancies.

The CSMM model is rarely used.

3. Constant Mean Market Maker (CMMM)

CMMM was introduced by Balancer. This model allows liquidity pools of more than two assets and allows asset weights to be outside the 1:1 ratio.

An Example of How AMMs Work: Uniswap

Let’s see how trading occurs on a popular multi-chain AMM –  Uniswap.

  1. You want to buy a stablecoin DAI. You have ETH in your wallet.
  2. You enter the amount of ETH you want to swap for DAI in the ‘Swap’ interface on Uniswap.
  3. Uniswap will automatically show the amount of DAI you will receive for your ETH.
  4. Uniswap will indicate the amount of gas fees needed to facilitate the trade. It will also indicate the slippage percentage, minimum output, and expected output from the trade.
  5. Once you sign on the trade, the AMM will match your buy order with a sell order in the market.

 You can also become an LP on Uniswap:

  1. As an LP, you will have to deploy your tokens in pairs. On Uniswap, you will find liquidity pools of any ERC-20 token pair. You can also create your own pool of ERC-20 tokens if you don’t find the token pair.
  2. You can review the fee you will earn on a given pair. There are 3 fee tiers on Uniswap. LPs earn 0.05% on stablecoin-stablecoin pairs, 0.3% on popular token pairs, and 1% on exotic pairs.
  3. Let’s say you want to supply liquidity to the ETH-DAI liquidity pool. You will have to deposit equal U.S. dollar values of ETH and DAI.
  4. Uniswap v3 also allows LP to select a price range for their token pair. 

Disadvantages of AMM Models

Impermanent loss

Impermanent loss refers to the loss in the market value of tokens deposited in a liquidity pool versus holding them in a wallet.

Impermanent loss can occur when the price of two tokens in a pair diverges from each other i.e. when the price of a token increases/decreases at a faster rate than the other.

The loss is called impermanent because the LP will only realize the loss when they withdraw their tokens from the pool.

Inefficient markets

Providing liquidity to an AMM doesn’t always result in making a profit. If there is not enough liquidity in pools, trade volumes on AMMs will be low, resulting in meager trading fees earned.

Low liquidity can also lead to higher slippage, especially in large-order trades.

The Bottom Line

AMMs have transformed how we trade cryptocurrencies. With time, this model has the potential to enter the traditional finance world.

There are trade-offs when it comes to AMMs, as decentralization is prioritized over capital efficiencies. The good news is that AMMs are still developing and are only going to become more efficient with technical upgrades and wider participation from the masses.

Advertisements
Mensholong Lepcha
Crypto & Blockchain Writer
Mensholong Lepcha
Crypto & Blockchain Writer

Mensholong is an experienced crypto and blockchain journalist, now a full-time writer at Techopedia. He has previously contributed news coverage and in-depth market analysis to Capital.com, StockTwits, XBO, and other publications. He started his writing career at Reuters in 2017, covering global equity markets. In his free time, Mensholong loves watching football, finding new music, and buying BTC and ETH for his crypto portfolio.