The decentralized finance (DeFi) landscape boasts a range of decentralized applications (dApps), automated market makers (AMMs), and decentralized exchanges (DEXs). Many DeFi protocols rely on the automated market maker model, which is now an essential tool for many crypto traders. Instead of the traditional order book model used by centralized exchanges (CEXs), an AMM uses liquidity pools, liquidity providers, and smart contracts. Also, AMMs facilitate non-custodial token swaps and offer users the chance to earn trading fees by becoming a liquidity provider (LP). However, this does come with risks, such as impermanent loss. However, there are now several blockchains that host a variety of different automated market maker platforms. But, what are automated market makers (AMMs)?

In this article, we’re going to look at how AMMs work and why they are so popular. Also, we’ll look at liquidity providers (LPs), liquidity pools, and impermanent loss! Plus, we’ll discuss why AMMs are such a vital component of the crypto space.

To learn about the fundamental value propositions of blockchain and crypto, check out the Bitcoin Monetary Revolution course at Ivan on Tech Academy! Then, take a look at the Blockchain & Bitcoin 101 and Ethereum 101 courses to see how this technology works on a technical level!

Also, if you’re yet to invest in crypto, be sure to see our Crypto for Beginners course! Here, we teach you how to set up a crypto exchange account and safely buy, sell, and trade crypto. Ivan on Tech Academy has courses to suit all levels of knowledge and experience. Join our community of over 30,000 passionate students today, at Ivan on Tech Academy!

What are Automated Market Makers (AMMs)?

Automated market makers (AMMs) are a type of decentralized exchange (DEX) protocol for trading digital assets using algorithms instead of order books. Also, AMMs facilitate permissionless token swaps without intermediaries. Instead, AMMs use smart contracts, oracles, liquidity providers (LPs), and liquidity pools. Furthermore, AMMs are now an essential part of the decentralized finance (DeFi) ecosystem and are changing how buyers and sellers interact. 

blog AMM 1

In traditional markets such as stocks, bonds, gold, and crypto, there are usually at least three parties involved. First, there is the exchange, or market maker. In the case of centralized crypto exchanges, the order book matches buyers and sellers to execute trades using a centralized order book. Buyers can decide how much they want to pay for an asset, and sellers can set a price for the sale of assets. When a buyer and a seller match together, the trade can take place. 

However, automated market makers (AMMs) work without intermediaries. Instead, buyers and sellers interact directly through smart contracts. Algorithms determine the rules for AMMs, and asset prices rely on a mathematical formula. Though these formulas vary between protocols, the formula used by Uniswap is an excellent example of how many AMMs work.

How do AMMs Work?

The mathematical formula that Uniswap and countless other AMMs use is “x * y = k”. In this formula, “x” represents the quantity of one token in a pool, and “y” represents the other token. The “k” in this formula represents a fixed constant, so that the total liquidity within a pool always remains the same. There are several adaptations and variations of this formula for specific use cases. However, what makes them alike is that they all determine asset prices algorithmically.

blog automated market maker

Traditionally, market makers assist in finding the best prices for traders with the lowest bid-ask spread on centralized order books. The bid-ask spread is the difference between the highest price a buyer wants to pay and the lowest price a seller will accept. This method generally involves complex strategies and can require a lot of resources to maintain long-term.

This is where automated market makers (AMMs) come in. AMMs decentralize this entire process by replacing order books and counterparties with smart contracts. Just like an order book exchange, AMMs still use trading pairs. The difference is that smart contracts “make” the market instead of humans or centralized exchanges.

Some decentralized exchanges (DEXs) facilitate trades directly between users and wallets. You can think of these types of trades as peer-to-peer (P2P) transactions between buyers and sellers. However, DEXs that execute transactions using AMMs are effectively peer-to-contract (P2C) transactions. These transactions occur without traditional order books or counterparties. Instead, smart contracts establish asset prices.

Still, the smart contracts used in AMMs need liquidity in order to function. This is where liquidity pools and liquidity providers (LPs) come in.

Liquidity Providers and Liquidity Pools

Liquidity providers (LPs) are an essential component of AMMs. To ensure that assets are readily available at any time, liquidity providers deposit funds into liquidity pools. These funds often come in pairs or “token pairs”, meaning that an LP would provide an equal value of two different asset types to a liquidity pool. Though this is not always the case, this is how many popular DEXs and AMMs work, including the number one DEX on Ethereum, Uniswap. 

blog liquidity pools

Liquidity pools combine the funds deposited by LPs for users of AMMs to trade against. For example, let’s say that one ETH is worth $3,000. An LP could provide one ETH to a Uniswap liquidity pool, along with £3,000 worth of the USDC stablecoin. LPs earn a portion of transaction fees when AMM users swap ETH or USDC from that liquidity pool. This can be a great way to earn a passive income with DeFi. However, it is not uncommon for LPs to experience “impermanent loss” when the prices of assets fluctuate. We’ll discuss impermanent loss in more detail later in this article.

Slippage

AMMs rely on liquidity providers to reduce slippage. Slippage is the difference between the expected price of a trade and the actual price following the execution of the trade. This often occurs when traders place large orders on illiquid assets. When a trader places a large buy order on an illiquid token, the price can increase dramatically. Naturally, the same could happen in reverse when a trader executes a large sell order, pushing the price down. So, to avoid slippage, AMMs need to attract liquidity. The more liquidity an AMM has, the less slippage users experience, which in turn attracts more liquidity.

Furthermore, this mechanism prevents buyers from completely draining liquidity pools as doing so would cause prices to increase exponentially. Moreover, if both assets in a liquidity pool using the “x * y = k” formula were reduced to zero, the formula would no longer make sense.

Impermanent Loss

When liquidity providers (LPs) deposit token pairs into liquidity pools, they generally deposit an equal ratio of each asset. As in the previous example, when providing liquidity to a Uniswap liquidity pool, LPs provide an equal ratio of two different assets. But, if you deposit one ETH worth $3,000 along with 3,000 USDC, there’s no guarantee that this ratio will be the same when you withdraw your liquidity. In fact, LPs can end up worse off if these fluctuations are drastic and asset prices change substantially. This is called impermanent loss.

blog AMM impermanent loss

Impermanent loss is a serious risk for LPs. But, LPs can minimize this risk by using token pairs of a similar value and market cap. Plus, the transaction fees accrued when providing liquidity can often offset impermanent loss if the change in the price ratio of token deposits is relatively small.

However, the term “impermanent loss” can be somewhat misleading. When the prices of assets deposited to liquidity pools fall and the ratio of the token pairs is unfavorable, there is no way to reverse this. As such, when trading fees do not offset these losses, they are indeed permanent.

Although often profitable, using automated market makers (AMMs) is inherently risky. Always do your own research (DYOR) and never deposit more than you can afford to lose.

Automated Market Maker Platforms

One of the most popular models adopted by automated market maker platforms is the constant product market maker (CPMM) model. This model is at the heart of one of the most popular AMMs, Uniswap. Below we look at a selection of the most popular AMMs and some of the key differences between them.

Uniswap

One of the most widely used automated market maker platforms is Uniswap. Built on Ethereum, the Uniswap decentralized exchange (DEX) has catalyzed the AMM space attracting colossal amounts of liquidity. Also, many consider Uniswap to be the flagship Ethereum-based AMM. Since launching, numerous clones and forks of the Uniswap protocol have emerged. As the protocol uses open-source code, this makes copying and cloning relatively simple. 

blog AMM Uniswap

Although the cloning of protocols is somewhat controversial, there are several clones of Uniswap available on multiple blockchains. Each has slightly different features and often its own utility token.

SushiSwap

A great example of a controversial Uniswap clone is SushiSwap. SushiSwap was initially a fork of Uniswap. The SushiSwap team launched what is known as a “vampire attack”, whereby a protocol attempts to steal LPs from a competitor by offering better rates and rewards. SushiSwap managed to lure Uniswap LPs to the new SushiSwap protocol by offering SUSHI token rewards on top of attractive trading fees.

blog AMM Sushi

In response to this, Uniswap created the UNI token, airdropping it to Uniswap LPs. Now, the UNI token is a top 10 cryptocurrency by market cap, according to CoinGecko. Nonetheless, SushiSwap has become legitimized and is one of the most popular automated market maker platforms that continues to attract large amounts of liquidity. You can read more about the crazy SushiSwap story in our Weird DeFi article!

Balancer

The Balancer AMM uses a Constant Mean Market Maker (CMMM) model, which enables liquidity pools to hold up to eight assets. There are three types of Balancer liquidity pools. Firstly, Private Pools require only a sole LP to operate. 

Secondly, Shared Pools allow anybody to provide liquidity and use the Balancer Pool Token (BPT) to track the ownership of the pool. Then, there are Smart Pools. Smart Pools also use the BPT token and can accept liquidity from any LP. However, Smart Pools can readjust the weighting and balances of assets, as well as trading fees. 

PancakeSwap

Another example of an automated market maker (AMM) is PancakeSwap, the number one AMM on Binance Smart Chain (BSC). PancakeSwap and Uniswap are very similar. However, PancakeSwap boasts various features, including a lottery, non-fungible tokens (NFTs), and a predictions market.

blog pancake

Furthermore, PancakeSwap also offers a clone script to create and launch ready-to-go decentralized exchanges and automated market maker platforms! Moreover, because fees on BSC are relatively small compared to Ethereum, PancakeSwap has seen massive adoption, at one point attracting higher 24-hour trading volume than the entire Ethereum network!

If you want to up your trading game, check out the Technical Analysis 101 course at Ivan on Tech Academy. Here, we teach you how to read chart patterns and trade using probabilities rather than gut feeling. Also, our Algorithmic Trading course teaches you how to create trading strategies, backtest them, and put them to work using trading bots!

Why Use AMMs?

Due to mounting regulatory scrutiny, centralized exchanges (CEXs) are becoming increasingly prone to censorship and account freezing. Also, CEXs have a single-point-of-failure, leaving them prone to attacks and hacks. That is not to say that AMMs cannot be compromised. However, a centralized exchange can be shut down if a CEO or keyholder dies, disappears, or loses their private keys. Worse still, users can lose access to funds or lose funds altogether when an exchange holds custody of their assets.

blog robot

However, decentralized exchanges (DEXs) and automated market makers (AMMs) are non-custodial. Not only does this mean that users have control of their assets, but it also means that assets cannot be seized, frozen, or restricted in the same way that they can be with CEXs. 

The increase in popularity of DEXs and AMMs is disrupting the traditional exchange listing process and order book model. Furthermore, the increase in liquidity and total value locked (TVL) in DEXs and AMMs suggests that non-custodial algorithmic protocols could soon steal a great deal of market share from traditional exchanges. This has prompted several centralized exchanges to venture into the world of DeFi by offering non-custodial trading platforms. 

What are Automated Market Makers (AMMs)? Summary

In summary, automated market makers (AMMs) and decentralized exchanges (DEXs) provide a permissionless, non-custodial alternative to centralized trading platforms. Replacing order books with liquidity pools, AMMs enable liquidity providers to earn a passive income with crypto and make fast token swaps without intermediaries.

There is now a wide range of AMMs available on several blockchains. Each works in a similar way, but many have unique features or value propositions. 

To learn more about AMMs and DEXs, check out the DeFi 101 course at Ivan on Tech Academy! This course teaches you how to install and use the most popular Web3 wallet, MetaMask. Then, we show you how to interact with popular AMMs, including Compound, Aave, Curve, and more! 

Then, why not check out our DeFi 201 course? This course takes a deeper look into the DeFi ecosystem, exploring crypto hedge funds, yield farming, and crypto arbitrage! Start your DeFi journey today with Ivan on Tech Academy!

Also, don’t forget to follow us on Twitter @Academy_IOT! We’d love to hear your thoughts about this “What are Automated Market Makers (AMMs)?” article!