Skip to main content
what is an amm
DeFi

What is an AMM?

Explore What is an AMM - key concepts, limitations, and risks.

Archived article · Original source date: 2024-07-13

This article is preserved from the previous Solana Bulls site as a historical archive. It reflects its original context; references to products, people, market conditions, eligibility, or rules may no longer be current.


Editorial note: This article is educational and is not financial, investment, legal, or tax advice. Products, protocols, yields, fees, liquidity, regulations, and tax treatment can change; verify current primary sources and evaluate the specific risks before acting.

In this post, we'll break down the basics of AMMs and explore their role in enabling decentralized trading on blockchains like Solana.

Automated Market Makers Explained

AMM stands for "Automated Market Maker". At its core, an AMM is a type of decentralized exchange (DEX) protocol that relies on a mathematical formula to price assets. This is in contrast to traditional order book-based exchanges, which match buyers and sellers based on a list of buy and sell requests.

Here's how an AMM works in a nutshell:

  • Liquidity providers (LPs) deposit an equivalent value of two tokens into a liquidity pool smart contract. For example, an LP could deposit $50 worth of Token A and $50 worth of Token B.
  • The AMM protocol uses a formula, often the constant product formula x * y = k, to determine the price of the assets in the pool based on the ratio of tokens.
  • Traders can then buy or sell tokens from the liquidity pool at the price determined by the formula. If a trader buys Token A with Token B, the balance of A decreases while B increases, changing the price according to the formula.
  • LPs earn trading fees from trades that happen in their pool. This incentivizes people to provide liquidity.

The key innovation of AMMs is that they enable permissionless and automated trading, without the need for an order book or centralized party to match trades. Anyone can be a liquidity provider or a trader.

The Role of AMMs in DeFi

AMMs have become a cornerstone of the DeFi ecosystem, with protocols like Uniswap, Curve, and Balancer seeing billions in trading volume. On Solana, AMMs like Raydium and Orca have gained significant traction.

The rise of AMMs has been driven by a few key factors:

  • Ease of use: AMMs provide a simple, intuitive interface for users to swap tokens without needing to understand the complexities of order books.
  • Liquidity: By incentivizing LPs with trading fees, AMMs can attract deep liquidity, enabling larger trades with less slippage.
  • Composability: AMMs are built on open smart contract standards, meaning they can easily integrate with and be built upon by other DeFi protocols. This composability is a key feature of DeFi.
  • Decentralization: AMMs are controlled by smart contract code rather than any single centralized party. This reduces the risk of downtime, censorship, or foul play.

Challenges and Risks

While AMMs have seen remarkable growth, they are not without their challenges and risks. Some key issues include:

  • Impermanent loss: When the price of tokens in a liquidity pool changes compared to when an LP deposited, the LP can end up with less dollar value than if they had simply held the tokens. This is known as impermanent loss and is a key risk for LPs.
  • Slippage: For large trades relative to the pool size, the constant product formula can lead to significant price slippage. Some more advanced AMMs are aiming to solve this.
  • Smart contract risk: As with any smart contract, there is an inherent risk of bugs or exploits. AMM code is complex and must be carefully audited.

Despite these challenges, AMMs have established themselves as an essential primitive in DeFi. As the ecosystem matures, we can expect to see further innovations that build on and improve the AMM model.

Conclusion

AMMs are a crucial building block in the DeFi ecosystem, enabling decentralized, permissionless trading of tokens. By understanding how AMMs work and their role in the broader DeFi landscape, you can better navigate and take advantage of the opportunities they present. As always, though, it's important to be aware of the risks and challenges as you dive into the world of AMMs and DeFi.