What are Automated Market Makers (AMMs)?

A guide on what AMMs are and why they’re important to DeFi

Tagged

Edward Wilson

Post Date

Quick summary

Automated Market Makers (or AMMs) keep the DeFi ecosystem liquid 24/7 as they rely on a decentralized community of liquidity pools and liquidity providers, replacing traditional order books. This article will explain what AMMs are.

What are Automated Market Makers?

An Automated Market Maker (AMM) is a fully decentralized exchange that relies on liquidity pools and liquidity providers, not buyers and sellers like traditional financial exchanges. The tokens in the liquidity pools are priced by an algorithm that automates price changes depending on market demand while also reducing slippage. AMMs operate 24/7.

What are liquidity pools?

Automated market makers use liquidity pools (LPs). LPs are two unique tokens locked into a smart contract to provide traders with liquidity. The tokens in the LP will need to be of equivalent total value - for example, 50% DAI and 50% ETH in the DAI/ETH pool. That is because AMMs rely on a simple mathematical formula to price the assets within LPs.

An example liquidity pool on Uniswap showing the DAI-ETH pair

How do liquidity pools work?

The above may sound overwhelming, but it’s actually simple. The most common formula that Uniswap and other AMMs use is x*y=k, where x and y represent unique tokens, and k remains constant. When the balances of x and y changes, they will need to adjust to maintain k. Otherwise, this will create an arbitrage opportunity. Arbitrage is when the price of an asset is different between two or more markets. By trading between markets, you can profit from the price differences.

When a trade happens in a LP, you are increasing the supply of one token to exchange for another. If, for example, you are buying 1 ETH(x) from the Uniswap DAI/ETH pool, the amount of ETH in the pool is reduced, increasing DAI(y). So, to keep k constant, ETH will become marginally more expensive in DAI so the LP is rebalanced.

If the example involved more ETH, then the LP would need to adjust even more. That is why liquidity pools rely on liquidity providers to strengthen the trading pair, as more liquidity in the LP means less slippage.

What is a liquidity provider?

A liquidity provider can be anyone who wants to supply their tokens to a liquidity pool. In return, they will receive liquidity pool tokens that represent their share of the pool. Every time a trade happens in a liquidity pool, traders pay a small fee for access. That fee then gets distributed to liquidity providers according to their share of the liquidity pool as a reward.

What is impermanent loss?

Providing liquidity to an AMM exposes you to “impermanent loss”. This means you lose money when you withdraw your assets relative to what you put in. Impermanent loss stems from the price of the assets in the pool changing. The more they change, the higher the loss you are exposed to.

The loss is impermanent as the distribution of tokens within the LP can change back to what they were. The loss becomes permanent though if you withdraw at a moment when one token has significantly changed in value compared to when you entered.

How do you redeem your liquidity pool tokens?

If a liquidity provider wants the underlying assets in the LP, they will need to burn (remove) their LP tokens to get the underlying assets that may have changed.

Examples of AMMs

Here is a list of some AMMs beyond Uniswap:

  • Curve - an AMM aimed at trading tokens with a similar value, for example, ETH and wrapped ETH, by using a different formula to Uniswap
  • Balancer - a self-weighted portfolio AMM, as users can create their own liquidity pools with up to 8 tokens with unequal weighting
  • Kyber - allows anyone to swap tokens without needing to use an exchange

A full list of AMMs can be found on CoinGecko.  

How can you use AMMs with Argent?

At Argent, we have partnered with ParaSwap so that users get the best exchange rate for each trade. To do this, go to the invest tab and go onto the token exchange. From there, you can search for any ERC-20 token and make your trade knowing you’ll get the best price.

With an Argent wallet, you can also connect to any AMM that is compatible with WalletConnect. You may want to do this for the benefits of using a specific exchange at the time.

With most AMMs, you will need to pay gas with each transaction, which will impact the overall price. (See our guide to what is gas).  

Further resources

An interview about SushiSwap with 0xMaki and its creation by The Defiant

Interview of Michael Egorov, founder of Curve Finance by The Delphi Podcast

Interview of Fernando Martinelli, co-founder of Balancer by The DeFi Download