What Is an Automated Market Maker (AMM)?

What Is an Automated Market Maker (AMM)?

Automated market makers (AMMs) make it easy to trade digital assets without needing permission or traditional buyers and sellers. Instead of relying on people offering different prices, AMMs use liquidity pools. Here’s how it works:

On regular exchange platforms, buyers and sellers list prices for assets like stocks, gold, or real estate. When someone likes the price, they make a trade, and that price becomes the market price. But AMMs take a different approach.

AMMs are special tools used mainly on Ethereum and in decentralized finance (DeFi). This technology is decentralized, meaning it’s always available for trading and doesn’t need traditional buyers and sellers to work.

This new way of trading fits perfectly with the ideals of Ethereum, crypto, and blockchain technology: no single person or entity controls the system, and anyone can create new solutions and take part in trading. This makes the process open, fair, and accessible to everyone.

How do AMMs work?

Automated market makers (AMMs) represent a paradigm shift in the world of decentralized exchanges (DEXs), offering a unique mechanism for trading pairs, like ETH/DAI, without the need for a traditional counterparty. Unlike centralized exchanges that match buyers and sellers based on an order book, AMMs operate on a peer-to-contract (P2C) basis, where trades are executed between users and smart contracts, simplifying the process and eliminating the need for order types.

At the core of AMMs are liquidity pools, maintained by liquidity providers (LPs) who "lock" equal amounts of tokens into a smart contract. This model contrasts with traditional exchanges, where liquidity is typically sourced from the exchange's reserves or individual market makers. AMMs use pre-programmed mathematical formulas, like the constant product market maker model, to adjust prices based on supply and ensure balanced asset ratios in the pools.

A prominent example of an AMM is Uniswap, built on Ethereum, offering a vast array of ERC-20 trading pairs and exemplifying the AMM model's success. Users contribute to liquidity pools and are incentivized through a share of the trading fees, proportional to their contribution.

In AMMs, trading pairs exist as individual liquidity pools. Anyone can provide liquidity by depositing both assets in a predetermined ratio. To maintain balanced asset ratios, AMMs like Uniswap use simple equations such as x*y=k, where x and y represent the value of two different assets in the pool, and k is a constant. This formula ensures that the multiplication of the prices of Asset A and Asset B always equals the same number, maintaining market equilibrium.

Large orders in AMMs can create price discrepancies between the pool and the market, leading to arbitrage opportunities. Traders exploit these differences, buying assets at lower prices in pools and selling them at higher prices on other exchanges, thus gradually aligning the pool prices with the market rates. Different AMMs use various mathematical formulas, with some like Balancer allowing for multiple assets in a single pool and Curve focusing on pairing similar assets like stablecoins.

What are the advantages of using AMMs?

Blockchain-Powered Decentralized Trading

AMMs are innovations from the blockchain world, creating a trading environment where middlemen aren't necessary. Users can trade without registering, sharing personal information, or trusting a third party to handle their funds. All they need is a self-custody wallet, which gives them better security and control over their assets.

Enhanced Liquidity Access

AMMs offer traders access to a wide variety of trading pairs, including some that might not be available on traditional exchanges. They also provide liquidity pools that can handle multiple assets at once, enabling more complex and diverse trading strategies.

Reduced Trading Fees

Compared to centralized exchanges that often charge high fees, AMMs usually have much lower costs. For instance, Uniswap, a popular AMM, charges just a 0.3% fee on each trade. This lower fee structure makes trading more affordable and efficient.

Algorithmic Pricing

AMMs use algorithms to set asset prices, reducing some risks found in centralized exchanges. One such risk is frontrunning, where traders take advantage of knowing about upcoming trades. The algorithm-based pricing in AMMs helps create a fairer and more stable trading environment.

Flexibility and Integration

AMMs are open-source, meaning they can integrate into various DeFi protocols beyond just trading. They can be used in lending and borrowing, showing their adaptability and enriching the DeFi ecosystem with a range of financial services and innovations.

Continuous Liquidity

AMMs can provide continuous liquidity for a wide range of assets, making it easier to trade less popular cryptocurrencies. This constant availability of liquidity helps users trade anytime without worrying about finding a counterparty.

Accessibility

Anyone can become a liquidity provider for AMMs and participate in trading, often with lower fees than traditional exchanges. This inclusivity allows more people to get involved in the crypto trading world.

Decentralization

AMMs often work without centralized intermediaries, giving users greater autonomy and control. This decentralization aligns with the broader goals of blockchain and crypto, promoting a more open and accessible financial system.

Challenges and Limitations of AMMs

While Automated Market Makers (AMMs) offer many benefits, they also come with certain challenges and limitations. Here are some key concerns:

Impermanent Loss

One of the main issues for liquidity providers is impermanent loss. This happens when the price of an asset in the liquidity pool changes compared to its market price. If the asset prices have changed significantly since the provider added their funds, they might experience losses when withdrawing from the pool.

Slippage and Price Impact

AMMs can suffer from slippage and price impact, especially during large trades. Slippage is the difference between the expected trade price and the actual executed price. Since AMMs use mathematical formulas to set prices, large trades can cause significant price changes, leading to higher slippage. To minimize this, traders and liquidity providers need to consider the liquidity and depth of the pool.

Bugs and Glitches

Because AMMs operate automatically without human oversight, they can encounter bugs and glitches in their smart contracts. These issues can cause incorrect pricing or failed transactions. Although developers work hard to identify and fix these problems, they can still happen, causing inconvenience and potential losses for users.

Understanding these challenges is crucial for anyone participating in AMMs, whether as a trader or a liquidity provider, to navigate the DeFi ecosystem effectively.

Liquidity Pools and Liquidity Providers

Liquidity is how easily you can swap one asset for another, usually cash, without changing its price too much. Before AMMs, decentralized exchanges (DEXs) on Ethereum struggled with liquidity. This new technology was complicated, and there weren’t enough buyers and sellers, making it hard to trade regularly.

How AMMs Solve Liquidity Problems

AMMs solve this by using liquidity pools. A liquidity pool is a big pot of tokens provided by users. Instead of trading directly with other buyers or sellers, you trade with the pool. The price of tokens in the pool is set by a mathematical formula, which can be adjusted for different needs. The more tokens in the pool, the easier it is to trade.

How Do Liquidity Pools Work?

On AMM platforms, trading happens with liquidity pools. Here’s a simple breakdown:

  • Users add their tokens to a shared pool.
  • The pool uses a formula to determine token prices.
  • Traders swap their tokens with the pool, not with individual buyers or sellers.

Can Anyone Become An AMM?

In centralized exchanges, market-making roles are typically reserved for established companies, institutions, or individuals with significant wealth. However, in the realm of Automated Market Makers (AMMs), virtually anyone can become a liquidity provider, given they fulfill certain criteria.

The specific requirements to be a liquidity provider vary across different liquidity pools. Generally, a substantial initial investment is necessary. This usually involves depositing a set amount of popular tokens like Ether, Bitcoin, or Binance Coin into the smart contract governing the liquidity pool.

As a reward for contributing liquidity to the AMM, providers are entitled to earn a portion of the network fees generated from trading activities within their pool. This arrangement presents an opportunity for crypto investors to generate passive income from their cryptocurrency holdings. It's important to note that liquidity providers accumulate their share of transaction fees over time and can only access these earnings when they decide to withdraw their investment from the pool. Until that withdrawal, their earnings continue to grow, adding to their initial deposit.

What Are the Different Automated Market Maker (AMM) Models? 

Automated Market Makers (AMMs) come in various models, each using different mathematical formulas to maintain balance and provide liquidity. These models are part of a class known as Constant Function Market Makers (CFMMs), which include constant product, constant sum, and constant mean market makers. Protocols like Bancor, Curve, and Uniswap have popularized these first-generation AMMs.

Constant Product Market Maker (CPMM)

The constant product market maker (CPMM) was the first type of CFMM and gained popularity through Bancor, the first AMM-based decentralized exchange (DEX). The CPMM uses the formula x×y=kx \times y = kx×y=k, where xxx and yyy represent the quantities of two tokens, and kkk is a constant. This formula ensures that when the supply of one token increases, the supply of the other must decrease to maintain the constant product kkk. This results in a hyperbolic curve, meaning liquidity is always available, but prices rise significantly at the extremes.

Constant Sum Market Maker (CSMM)

The constant sum market maker (CSMM) uses the formula x+y=kx + y = kx+y=k, which creates a straight line when plotted. This model is ideal for trades with no price impact, but it doesn't provide infinite liquidity. If the price between two tokens deviates from 1:1, arbitrageurs can drain one of the reserves, leaving the liquidity pool with only one asset and no liquidity for further trades. Due to this limitation, CSMMs are rarely used.

Constant Mean Market Maker (CMMM)

The constant mean market maker (CMMM) allows for more than two tokens and weights them outside the typical 50/50 distribution. The formula for a pool with three assets is (x×y×z)1/3=k(x \times y \times z)^{1/3} = k(x×y×z)1/3=k, where xxx, yyy, and zzz are the quantities of each asset, and kkk is a constant. This model allows for varying exposure to different assets within the pool and enables swaps between any of the assets, making it more flexible.

Which are the popular AMMs?

The landscape of decentralized exchanges (DEXs) is diverse, yet many of the most prominent platforms utilize similar Automated Market Maker (AMM) models. These exchanges, each with its unique features and tokenomics, have become pivotal in the DeFi ecosystem.

  • Uniswap: Launched in 2018 and built on Ethereum, Uniswap stands as a leading DEX known for its extensive liquidity. Its open-source nature has led to numerous adaptations and iterations. Uniswap's liquidity pools typically comprise two different tokens, offering a straightforward and user-friendly trading experience.
  • SushiSwap: Emerging as a fork of Uniswap, SushiSwap retains most of the parent protocol's functionalities but introduces the SUSHI token. This token serves as an additional incentive for liquidity providers, enhancing the rewards and potentially attracting more participants to its ecosystem.
  • PancakeSwap: While similar to Uniswap in its foundational structure, PancakeSwap diverges by catering to altcoins on the Binance Smart Chain (BSC). This focus on BSC tokens provides advantages like lower transaction fees and reduced delays, especially relevant given Ethereum's network congestion issues.
  • Balancer: Although smaller in comparison to its counterparts, Balancer offers unique features in its AMM protocol. It supports liquidity pools with up to eight different tokens, contributing to more stable pricing dynamics. Unlike other DEXs where trading fees are platform-determined, Balancer allows liquidity pool creators to set their own fees. This feature spurs competition among pools and offers users the flexibility to create private liquidity pools with selective participation.

These platforms reflect the evolving nature of DeFi, where innovation and user-centric features drive growth and user adoption. As the DeFi space continues to expand, these AMMs play a critical role in shaping the future of decentralized trading, offering diverse, efficient, and increasingly sophisticated trading mechanisms.

Risks of first-gen automated market makers

Impermanent Loss

Impermanent loss happens when the price ratio of assets in a liquidity pool changes from their initial values. Liquidity providers (LPs) face losses if they withdraw their funds during these fluctuations. The bigger the price change, the more significant the loss, especially in pools with volatile assets. However, if prices return to their original state before withdrawal, this loss disappears, hence the term 'impermanent.'

In simpler terms, impermanent loss is the potential profit LPs miss out on by providing liquidity instead of just holding onto their assets.

Slippage Risks

Slippage in AMMs refers to the difference in an asset's price between when a trade is placed and when it's executed. For large trades relative to the pool size, this can cause a significant deviation from the expected price. AMM pricing algorithms, which depend on the ratio of assets in the pool, are particularly prone to slippage.

Developers are working on newer AMM models to address issues like slippage, impermanent loss, security vulnerabilities, and low capital efficiency. These improvements aim to make AMMs more robust and efficient for users.

Understanding these risks is crucial for anyone involved in AMMs to make informed decisions and minimize potential losses.

How can the current AMM model be improved?

DeFi is constantly evolving, with groundbreaking changes happening regularly. Here are some ways AMMs might improve in the future:

Hybrid AMM Models

A single AMM model may not address all challenges effectively. Hybrid models can combine the strengths of different AMM models to achieve better results.

For instance, a hybrid model could merge the CSMM variant's ability to reduce the impact of large trades with the CMMM variant's capability to support multi-asset liquidity pools. The challenge lies in integrating these elements into a reliable and robust AMM system. An example is Curve Finance, which combines CPMM and CSMM models to create a capital-efficient platform for exchanging pegged assets.

External Price Sources

AMMs can use off-chain sources like price oracles to improve price discovery and capital efficiency. By using data from external price oracles such as Chainlink, AMMs can align their prices with the current market prices of the assets involved.

This allows AMMs to adjust their prices more accurately and concentrate liquidity within relevant price ranges, reducing the risk of slippage. DEXs like DODO utilize external price feeds for their AMMs, facilitating over $120 billion in trading volume to date.

Synthetic Assets

Synthetic assets enable AMMs to use smart contracts to create virtual versions of the AMM, enhancing composability. Virtual AMMs (vAMMs) allow market participants to trade using synthetic tokens (like vDAI for DAI or vETH for ETH) while the actual assets remain locked in a smart contract.

This approach increases security since the underlying assets are untouched during trading. It also helps with risk management by allowing dynamic adjustments based on external market conditions, mitigating risks of impermanent loss and slippage. Synthetic assets enable a variety of financial products in DeFi, including futures, options, and prediction markets.

Implementing these improvements can make AMMs more efficient, secure, and user-friendly, driving further innovation in the DeFi space.

Please note that Plisio also offers you:

Create Crypto Invoices in 2 Clicks and Accept Crypto Donations

12 integrations

6 libraries for the most popular programming languages

19 cryptocurrencies and 12 blockchains

Ready to Get Started?

Create an account and start accepting payments – no contracts or KYC required. Or, contact us to design a custom package for your business.

Make first step

Always know what you pay

Integrated per-transaction pricing with no hidden fees

Start your integration

Set up Plisio swiftly in just 10 minutes.