What is an Automated Market Maker (AMM)? A Complete Guide

By Olayiwola Dolapo
23 Min Read

The cryptocurrency trading market operates 24/7, allowing people to trade their tokens and other digital assets across cryptocurrency exchanges non-stop. Liquidity is an essential element to keep the market moving regardless of the time or day.

An automated market maker (AMM) is a type of decentralized exchange that enables buyers and sellers to trade their assets automatically through algorithms rather than having to find a direct price match between buyers and sellers as in traditional exchanges. This is made possible with the assistance of liquidity providers and liquidity pools. More on this will be explored in the article.

Read this comprehensive guide by DroomDroom to learn all you need to know about decentralized exchange. 

AMM remains one of the most effective technologies introduced to the DeFi space that has brought about significant changes. This article explains everything you need to know about automated market maker exchanges and how they operate.

Find out more about decentralized finance in this step by step guide by DroomDroom. 

Understanding Automated Market Maker (AMM)

Traditional and centralized exchanges rely on an order book that executes transactions when a bid price — buy orders — matches an ask price — sell orders. If a buy order is placed at or above the lowest ask, it is executed, and vice versa. While this system is effective, it has a notable issue: in cases of limited liquidity — when there are not enough bids or asks — transactions may not be executed.

To counter this problem, centralized exchanges rely on market makers, which are usually institutional traders or financial institutions, to provide liquidity by creating multiple bid and ask prices. This helps facilitate transactions for pairs of cryptocurrencies.

The approach differs in the case of a decentralized automated market maker exchange; for trades to occur successfully, there must be constant liquidity. These exchanges rely on what are known as liquidity pools and liquidity providers. These two elements form the critical backbone of the success of decentralized exchanges. Let’s explore what they entail.

Liquidity Pool And Their Role in Automated Market Maker (AMM) 

While centralized exchanges rely solely on institutional traders or financial institutions to ensure the successful matching of orders, AMMs depend on liquidity pools that are controlled by smart contracts, which execute transactions based on predetermined rules.

A liquidity pool is a collection of funds — specifically, cryptocurrencies — used to facilitate trading and stored in smart contracts. This means that trades occur between buyers and sellers; or to put it another way, trades are conducted between a trader and a smart contract. 

To learn more about smart contracts, read this this comprehensive guide by DroomDroom. 

Crypto assets in the liquidity pool are provided by liquidity providers, who are incentivized by receiving a portion of the transaction fees from trading the assets within the pool. These fees are typically distributed in the form of LP tokens, also known as liquidity provider tokens.

Liquidity pools usually consist of two crypto assets that act similarly to trading pairs; for instance, they can be composed of ETH/USDT or ETH/DAI. The ratio of each token within the pool varies depending on the model or type of the liquidity pool; however, in most instances, the contributed assets are in a 50:50 ratio. That is, 50% of token A and 50% of token B. With adequate liquidity in the pools, issues such as slippage can arise.

LP tokens allow liquidity providers to participate in other passive income-generating activities known as yield farming. These tokens can be staked or lent in various protocols to earn additional returns. The value of the LP tokens you receive corresponds to your share of the crypto assets in the pool. So, if you own 10% of the total assets in the pool, you will receive LP tokens representing that same 10%.

In contrast to order books used by traditional exchanges, which require counterparties with large funds to provide liquidity, liquidity pools are permissionless and enable those with smaller funds to become liquidity providers.

Now that we understand what liquidity pools are and how they function, it’s time to go into the details of how automated market makers operate.

How Automated Market Maker (AMM) Works

Automated market makers rely on funds within the liquidity pool to execute user trades. This process is controlled algorithmically through smart contracts. The liquidity provided by the LPs enables trades to be executed automatically and with ease.

Since the crypto assets are locked in the liquidity pool and are managed by smart contracts (and because trade does not occur directly between counterparties as it does with an order book), the question arises: what then determines the prices of assets in the pool?

Price determination in AMMs is governed by a mathematical formula, which varies across different exchanges. However, a common formula used is X*Y = K. This formula is used by several popular decentralized exchanges, such as Uniswap, which was one of the first to introduce it.

In this formula, X and Y represent the reserves of tokens A and B in the liquidity pool, respectively, and K is a constant value. This means that the product of the reserves of both tokens A and B remains constant, regardless of trading activity in the liquidity pool.

Here’s a practical example of how this works

Let’s assume the two assets in the pool are ETH and DAI. If a user wants to acquire ETH, they will go to the pool and deposit DAI in exchange for ETH. This injection of DAI increases its supply in the pool, causing its value to decrease, while the value of ETH increases due to its now reduced supply. The price adjusts accordingly to maintain the constant K value of the pool.

If it were the other way around, meaning ETH was added to the pool in exchange for DAI, the price of ETH in the pool would drop, and consequently, the price of DAI would increase to maintain the balance. This straightforward mechanism is what keeps an AMM running smoothly. Additionally, a transaction fee is incurred every time a transaction is made within the pool. This fee varies depending on the decentralized exchange; for example, Uniswap charges 0.3% per transaction, which is then distributed to the liquidity providers.

Not all AMM exchanges use a liquidity pool containing just two crypto assets; some include three crypto assets in their pool. In these cases, the formula used is (x*y*z)^(⅓)=k; we will delve more into this as we explore the different types of automated market makers in the DeFi space.

More Profit-Making Opportunities: Yield Farming

Beyond the passive earning opportunity associated with trading on an AMM through yield farming, there is also the potential for profit through arbitrage trading.

Arbitrage opportunities arise when a significant amount of a particular token is either added to or withdrawn from the pool. Taking the ETH/DAI example again, if a large order of ETH is added to the pool, and as a result, ETH is valued at $2,000 in the pool compared to $2,100 on other exchanges, arbitrage traders are presented with the opportunity to purchase ETH at a lower price and sell it at a higher price on other exchanges. The profit for arbitrage traders comes from this price discrepancy.

This arbitrage process continues until the price of ETH in the pool reaches an equilibrium with the general market price.

Advantage of Automated Market Maker 

There are several advantages to trading with an Automated Market Maker (AMM) on a decentralized exchange.

Permissionless Participation And Decentralization

Automated market maker exchanges allow traders to become active liquidity providers within the pools, expanding their earning potential.

Enhanced Security Through Decentralization

One of the most significant benefits of using an automated market maker exchange is that users are not reliant on centralized entities or intermediaries to manage critical details like their private keys. Automated market maker exchanges do not request users’ private keys and cannot access users’ funds without explicit permission. All that is needed to access AMM exchanges is a self-custodial wallet.

In this comprehensive guide by DroomDroom, you’ll learn all there’s to know about cryptocurrency wallets and how they work. 

Constant Liquidity

At its core, automated market makers exist to solve liquidity issues that may arise in the cryptocurrency market. As long as there is liquidity in a pool, users can trade, regardless of the order book’s depth, which eliminates the possibility of trade delays.

Earning Potential

Automated market maker exchanges offer several passive earning opportunities not available on traditional exchanges. By providing liquidity, users can earn a share of the trading fees, offering a potential source of passive income. Arbitrage trading is another method to earn through AMMs.

Disadvantages of Automated Market Maker (AMM) 

While AMMs can potentially increase users’ earnings and provide constant liquidity, there are also disadvantages to consider.

Impermanent Loss

This is a significant disadvantage for liquidity providers using an AMM. It occurs when the price of the deposited crypto assets deviates from their original price. The greater the price change, the more substantial the loss.

Impermanent loss is typically associated with volatile cryptocurrency assets, such as Ether (ETH); therefore, it is sometimes recommended that liquidity providers opt for stablecoins like Wrapped Bitcoin (WBTC) and Tether (USDT), which are less volatile.

It is crucial to note that impermanent loss is not real until the liquidity provider decides to sell their assets in the pool at a different price than the deposit price. Furthermore, the term ‘impermanent’ suggests that the loss is reversible if the asset’s price returns to its original deposit price. Sometimes, impermanent losses are negligible if the incentives from the pool’s trading fees compensate for the potential loss. Thorough research is essential before engaging in liquidity provision.

This comprehensive guide by DroomDroom provide me you with all there is to know about Impermanent losses in cryptocurrency. 

Slippage

One of the potential risks associated with AMMs is slippage. This occurs when there is a discrepancy between the expected price at the initiation of a transaction and the price at which the transaction is ultimately executed. Slippage is particularly noticeable when a large order is placed relative to the size of the liquidity pool, significantly affecting the balance of assets within it. The larger the order, the greater the price movement, leading to increased slippage. Factors such as the volatile nature of the assets in the pool and network congestion also contribute to this phenomenon. Although slippage can create arbitrage opportunities within AMMs, it also has downsides, such as unfavorable rates and the possibility of failed transactions.

Smart Contract Vulnerability

As with any DeFi protocol, there is a risk associated with smart contract bugs or vulnerabilities that could be exploited, potentially leading to a loss of funds. One of the best ways to mitigate this risk is to engage with well-audited DeFi protocols that have established a track record of security and reliability. The tweet below shows an AMM, Beluga got exploited to the tune of 59 ETH.

Types of Automated Market Maker (AMM)

There are two primary categories of automated market makers. The first category includes the initial set of AMMs, which are subdivided into three types: Constant Product Market Makers (CPMM), Constant Sum Market Makers (CSMM), and Constant Mean Market Makers (CMMM). These initial AMMs are collectively classified as Constant Function Market Makers (CFMMs).

The other types is the advanced hybrid version of AMMs, sometimes referred to as the latest generation: Dynamic Automated Market Maker (DAMM), Proactive Market Maker (PMM), Virtual Automated Market Makers (vAMM), Concentrated Liquidity Market Maker (CLMM). This group of AMM are referred to as Hybrid CFMMs. 

Constant Product market makers (CFMM)

The CPMM is one of the most prevalent types of AMMs. In this model, the pricing formula is X * Y = K, meaning that the prices of tokens within the pool are determined by their availability — governed by supply and demand — and must always equate to the constant K. Exchanges such as Uniswap (V2) and SushiSwap utilize this model.

Constant Sum Market Maker

The Constant Sum Market Maker operates differently from the CPMM. Decentralized exchanges like Bancor use this AMM type, where the sum of the assets in the pool remains constant, adhering to the formula X + Y = K. The primary drawback of this model is its susceptibility to becoming ineffective when one of the assets depletes its liquidity. This usually occurs when the price of an asset in the pool does not maintain a 1:1 ratio with its external market price — the price on exchanges outside the AMM — which can lead to arbitrageurs exploiting the discrepancy until the liquidity of one asset is drained.

Constant Mean Market Maker

This AMM model is designed to facilitate pools with more than two types of tokens. It achieves this by using the geometric mean of the assets in the pool, with the specific formula varying based on the number of assets. For instance, with three assets, the formula would be (X * Y * Z)^(1/3) = K. If a pool contains eight different tokens, similar to what Balancer offers, then the formula adjusts to (X * Y * Z * A * B * C * D * E)^(1/8) = K.

Dynamic Automated Market Maker (DAMM)

This AMM is known for adaptability, the DAMM adjusts pool parameters in response to external conditions like market volatility, enhancing capital efficiency by modifying liquidity concentration accordingly to address issues such as impermanent loss. Sigmadex is a platform that uses this approach, also known as an Adaptive Automated Market Maker.

Concentrated Liquidity Market Maker (CLMM)

This type of AMM gives liquidity providers the ability to specify the price ranges where their liquidity will be active or deployed, enabling more capital efficiency by concentrating liquidity around the current market price. However, it introduces added complexity for the liquidity providers, which some dApps, like ReHold, aim to simplify by automating the process. Uniswap (V3) was the first to introduce this concept to the market.

Read this comprehensive guide by DroomDroom to learn everything about decentralized applications in DeFi. 

Proactive Market Maker (PMM)

The mechanism behind PMM is to actively adjust prices of assets in a liquidity pool based on external data. DODO, a decentralized application, uses this model. This model proactively automates price adjustment. 

The main difference between PMM and traditional AMM is that PMM automates the process for price adjustment rather than depending on the ratio of assets in the pool. This reduces the possibility of liquidity providers suffering from impermanent losses. 

Virtual Automated Market Makers (vAMM)

vAMM has a unique approach to providing more efficiency. vAMM utilizes the same formula as the constant product market maker with its rule X * Y = K. The difference here is vAMM doesn’t rely on liquidity in the pools but collateral deposited into its smart contract. 

The goal of vAMM is to introduce trading of perpetual contracts which isn’t available on AMM. vAMMs allow the creation of synthetic assets or derivatives without requiring full collateralization of the underlying assets. They operate with a virtual balance to simulate deep liquidity, allowing for trading without the need for a counterparty. Perpetual Protocol is an dApp that utilizing the vAMM model. 

Conclusion 

Automated Market Maker has revolutionized the entire DeFi industry with the possibility of doing more and adding more efficiency into the financial system. 

While AMM provides a unique solution to the cryptocurrency industry, it’s still in its infancy, and as time passes several variations will sprout as we’ve seen. These variations will provide more efficiency to AMM and beyond that serve as a gateway to more financial possibilities. As a DeFi participant, it’s important to understand how the several models of AMM works and how to take advantage of them.

Frequently Asked Questions

What is The Key Difference Between AMMs and Traditional Exchanges?

AMM focuses on smart contracts and liquidity in facilitating trades to buy or sell crypto assets, but the order book relies solely on matching a buyer’s and a seller’s order. Essentially, AMM eliminates the need for counterparty. 

How do Constant Product AMMs Handle Price Determination?

Constant product AMMs like Uniswap use a formula: X × Y = K, where X and Y represent the quantity of each token in the pool, and K is a constant. When a trade occurs, the product of X and Y remains constant, but their individual values change, resulting in a new price.

How Do Liquidity Providers Earn Money in AMMs?

Liquidity providers earn money from fees collected when a trade is executed in a liquidity pool, that is buy or sell. The few earned are equivalent to their share of funds in the liquidity pool. These fees can be small but eventually add up to a lot. 

What is Impermanent Loss And How Does it Affect Liquidity Providers?

Impermemant loss occurs when the value of an asset in the liquidity pool significantly changes in value to the deposited price. What this means is that the liquidity provider would potentially have made more if they held the asset then depositing it into the pool. The larger the price change, the greater the impermanent loss. On this, the loss becomes permanent when the crypto assets are sold off at a price outside the deposited price. 

What Are Examples of Different Types of AMMs?

There are several types of AMMs, there’s constant product AMMs like Uniswap, constant liquidity market makers like Uniswap V3, and innovative models like proactive market makers (PMM) and virtual automated market makers (vAMM).

What is Slippage And Why is it Important in AMMs?

Slippage occurs when there’s a significant difference in the expected price of an asset and the price of the asset after executeion. In AMMs, due to their algorithmic pricing, large trades can significantly move prices, resulting in higher slippage. It’s crucial for users to pay attention to potential slippage, especially in pools with low liquidity.

After losing his DOGE tokens due to a limited understanding of blockchain technology, Dolapo made a pledge to explore its vast potential. Now, as a dedicated writer, he sheds light on the intricacies of this innovative technology for others. Dolapo distinguishes himself with his expertise in marketing.