Automated Market Makers (AMMs) are foundational to decentralized finance (DeFi) and decentralized exchanges (DEXs). But how do they actually work? What different types of AMMs exist, and why are they so critical to the DeFi ecosystem? This guide breaks down everything you need to know.
The Pre-AMM Era
Before the rise of AMMs, decentralized trading was far from user-friendly. Early protocols attempted to replicate centralized order book models, similar to what platforms like EtherDelta offered in 2017.
However, high transaction fees, low user adoption, and insufficient market maker participation led to illiquid markets and limited functionality. It was from these challenges that the first Automated Market Makers emerged—algorithmic solutions designed to replace traditional market makers and bring true innovation to DeFi.
What Is an Automated Market Maker?
An Automated Market Maker (AMM) is a piece of code—an algorithm—that enables trustless trading between two different cryptocurrencies without intermediaries.
AMMs operate via smart contracts and enable fully decentralized trade execution. This represents a major shift in DeFi: instead of trusting a central entity, users trust the code.
In practice, AMMs use liquidity pools instead of order books. These pools are funded by liquidity providers (LPs), who earn fees generated from swaps occurring within the pool.
In short, an AMM uses mathematical formulas to determine asset prices based on available liquidity and trade size.
Types of AMMs in DeFi
There are several types of AMMs, each with unique mechanics and use cases. Below are the most common models.
Constant Function Market Makers (CFMMs)
CFMMs are the most common type of AMM in decentralized finance. They rely on a predefined mathematical function to set prices between two or more assets based on their available quantities.
While traditional exchanges use order books, most DEXs use CFMMs and liquidity pools. The "constant function" refers to the fact that any trade will change the reserves in the pool, but the product of those reserves remains constant.
CFMMs typically involve three types of participants:
- Traders: Users swapping one cryptocurrency for another.
- Liquidity Providers (LPs): Users who deposit assets into pools and earn fees.
- Arbitrageurs: Participants who correct price imbalances between pools and different exchanges, earning profits from small discrepancies.
Constant Product Market Makers (CPMMs)
The first widely adopted AMM was the Constant Product Market Maker, popularized by Uniswap V1 and Bancor V1. This model relies on the formula: x * y = k
Here, x and y are the reserves of two tokens in a pool, and k is a constant. This equation ensures the product of the reserves remains unchanged after any trade, facilitating price discovery.
Hybrid Function Market Makers
Some AMMs use hybrid functions that combine elements of multiple pricing models. These are designed to address specific issues, such as high slippage or inefficient capital use.
One well-known example is Curve Finance, which uses a hybrid AMM model optimized for stablecoin pairs. It offers low slippage for small trades but adjusts for larger transactions. Other platforms, like Shell Protocol, also use hybrid variations.
Constant Mean Market Makers (CMMMs)
Introduced by Balancer, Constant Mean Market Makers generalize the CPMM model to support more than two assets with customizable weightings. For example, a three-asset pool with equal weighting would use: (x * y * z)^(1/3) = k
This allows for more flexible and diverse liquidity pool structures.
Concentrated Liquidity Market Makers (CLMMs)
The latest generation of AMMs, Concentrated Liquidity Market Makers, allow LPs to allocate liquidity within specific price ranges. This improves capital efficiency and reduces impermanent loss.
Unlike traditional AMMs where liquidity is spread across all prices, CLMMs let LPs concentrate their funds where most trading activity occurs. Uniswap V3, Crema Finance, and KyberSwap are examples of protocols using this model.
Advantages of Using AMMs
Decentralization and Trustlessness
AMMs operate via smart contracts on blockchains, removing the need for centralized intermediaries. This allows anyone, anywhere, to trade or provide liquidity without permission.
Speed and Automation
Trades on AMMs are executed automatically by smart contracts, making them faster than traditional market-making processes, which require manual order placement and matching.
Yield Farming Opportunities
Liquidity providers can earn passive income through yield farming. By depositing assets into a liquidity pool, LPs earn a share of the trading fees. Some platforms also allow LPs to stake LP tokens in other protocols to maximize returns.
👉 Explore advanced yield farming strategies
Challenges and Drawbacks of AMMs
Slippage
Slippage occurs when a trade is executed at a different price than expected. This is common in AMMs, especially in pools with low liquidity. Most platforms allow users to set a maximum slippage tolerance to minimize this risk.
Impermanent Loss
Impermanent loss happens when the value of assets in a liquidity pool changes compared to simply holding them. LPs may end up with more of the depreciating asset and less of the appreciating one, resulting in a temporary loss. If the assets return to their original ratio, the loss is reversed.
Fees
- Transaction Fees: Users must pay blockchain gas fees for each trade.
- Trading Fees: AMMs charge a small fee on each swap, which is distributed to LPs and the protocol.
- Withdrawal Fees: Some protocols charge fees when LPs remove their liquidity.
Frequently Asked Questions
What is the main purpose of an AMM?
AMMs enable decentralized trading without order books or intermediaries. They use liquidity pools and mathematical formulas to set prices and execute swaps automatically.
How do liquidity providers earn on AMMs?
LPs earn a share of the trading fees generated by the pool proportional to their contributed liquidity. Some protocols also offer additional token rewards.
Is impermanent loss avoidable?
Impermanent loss is a inherent risk in AMM liquidity provision. However, it can be mitigated by choosing stable pairs or using concentrated liquidity models.
Can AMMs be used for large trades?
Large trades can cause significant slippage in low-liquidity pools. It’s often better to use platforms designed for high-volume trading or break large trades into smaller ones.
Are AMMs secure?
Most well-known AMMs use audited smart contracts, but risks remain. Users should stick to reputable platforms and understand smart contract risks.
What’s the difference between an AMM and a traditional exchange?
Traditional exchanges use order books managed by market makers, while AMMs use algorithmic pricing and liquidity pools. AMMs offer full decentralization and permissionless access.
Conclusion
Automated Market Makers are algorithmic systems that power decentralized trading by:
- Allowing liquidity providers to supply assets and earn fees.
- Enabling traders to swap tokens without intermediaries.
Continuous innovation in AMM design is making DeFi more efficient, accessible, and secure. As the space evolves, we can expect even more capital-efficient and user-friendly models to emerge.
AMMs are a powerful example of how blockchain technology and decentralized finance are reshaping modern finance.