Trading (or swapping) cryptocurrencies is one of the most common transaction types that contributes to the overall activity in the decentralized finance (DeFi) ecosystem.
The beauty of DeFi is that when conducting a token swap on a decentralized crypto exchange (DEX), users never need a specific counterparty or intermediary. Automated systems called smart contracts manage things end-to-end.
DEXs rely on a special kind of system called automated market makers (AMMs) to facilitate trades in the absence of counterparties or intermediaries.
But what exactly are AMMs?
This article explains what automated market makers are, how they work, and why they are critical to the DeFi ecosystem.
What is an automated market maker (AMM)?
An automated market maker (AMM) is an autonomous protocol that decentralized crypto exchanges (DEXs) use to facilitate crypto trades on a blockchain. Instead of trading with a counterparty, AMMs allow users to trade their digital assets against liquidity stored in smart contracts, called liquidity pools.
Conversely, centralized exchanges (CEXs) use an order book to match a buyer with a seller to execute a cryptocurrency trade at a mutually agreed exchange price.
AMMs introduce two fundamental changes to crypto trading:
1) No waiting time
Traders don’t need to wait for a counterparty when using an AMM. Instead, they interact with smart contracts to buy, sell, or trade assets. These smart contracts use the asset liquidity contributed by liquidity providers to execute trades.
2) Algorithmically determined exchange prices
The supply-demand ratio of cryptocurrency trading pairs determines their exchange rates. For example, if a token's liquidity supply exceeds demand in the liquidity pool, it will lead to a fall in its prices, and vice versa.
The evolution of AMMs: a timeline
2017: Idea first discussed in Ethereum co-founder Vitalik Buterin's blog post about on-chain market makers; Bancor launches the first on-chain AMM, introducing the constant product formula and LP tokens.
2018: Uniswap launches and popularizes CPMMs for Ethereum-based tokens, making anyone a liquidity provider.
2020: Curve and Balancer launch; Curve specializes in low-slippage stablecoin swaps, while Balancer introduces multi-token pools and portfolio AMMs.
2021: V3 Uniswap pioneers concentrated liquidity and dynamic fees.
2025: Uniswap v4 launches, cutting network costs and adding hooks for custom AMM features, more fee tiers, and deeper liquidity customization.
How do automated market makers work?
AMMs work by replacing the traditional order book model with mathematical formulas and logic wrapped in smart contracts.
To further understand how AMMs work, let’s take a look at the key components that make up an AMM and how they function.
Liquidity pools and liquidity providers
A liquidity pool refers to a digital pool of crypto assets present within a smart contract on a blockchain. These pools typically have two tokens, but in some instances, they may have more than two tokens.
Liquidity providers deposit two or more tokens in a liquidity pool such that the proportion of the tokens has a 1:1 price ratio.
For example, in an ETH/USDC liquidity pool, if 1 ETH is worth 2000 USDC at the time of deposit, a liquidity provider must deposit both ETH and USDC in the proportion of 1:2000.
In DeFi protocols like an automated market maker, any person can create liquidity pools and add liquidity to trading pairs. Liquidity providers then receive LP tokens against their deposits which represent their share in the liquidity pool. These tokens are redeemable when the liquidity provider exits the pool.
DEXs reward users with a portion of transaction fees and, at times, additional governance tokens for providing liquidity.
Acting as a liquidity provider comes with risks too.
Liquidity providers take on the risk of impermanent loss, a potential loss that they might incur if the value of the underlying token pair drastically changes in either direction. If the loss is greater than the gain obtained through collecting trading fees, the liquidity provider would have been better off just HODLing the tokens.
Now that you know how liquidity pools work, let's understand the nature of pricing algorithms.
Pricing Algorithm
With centralized exchanges, a buyer can see all the asks, such as the prices at which sellers are willing to sell a given cryptocurrency. While this offers more options for a buyer to purchase crypto assets, the waiting time for a perfect match may be too long for their liking.
Other disadvantages of CEXs include front-running bots and the absence of enough sellers.
However, in an AMM, there is a certain price which is ‘a take-it or leave-it’ offer made by the smart contract that runs the liquidity pool. This offer is based on a mathematical formula ‘x*y=k’, where,
x: quantity of Asset A,
y: quantity of Asset B,
k: is a constant and a product of x and y.
Now, how does this equation turn into a pricing algorithm?
AMM transaction process
Imagine a BTC/USDT liquidity pool, and the initial exchange ratio is set at 1 BTC = 25,000 USDT.
The pool consists of an initial 10 BTC and 250,000 USDT. So, trades in this liquidity pool can either be:
- Add USDT to receive a corresponding quantity of BTC from the pool, or
- Add BTC to receive a corresponding quantity of USDT.
Now, let's say Bob wants to add 50,000 USDT to the pool. How much BTC will he receive?
Note: This example uses the formula (x * y = k) of a Constant product market maker (CPMM), a popular type of automated market maker that is also the basis on which other AMM variants evolved. We'll cover CPMMs and some popular types of AMMs below.
Previous state of the pool:
- Reserves: x: 10 BTC | y: 250,000 USDT
- Value: k: 2,500,000
In dollar terms, 1 BTC = $25000, and 1 USDT = $1.
Now, Bob’s transaction adds 50,000 USDT.
Current state of the pool
- Reserves: x: ? BTC | y: 300,000 USDT
- Value: k: 2,500,000 (constant)
Since there is more USDT now than before in the pool, this means there is more demand for BTC, making it more valuable. This is where market supply and demand act to change the initial exchange price of BTC, which was equal to 25,000 USDT.
So, how much BTC does Bob receive?
To get that number, we must solve for “x * y = k”
x * 300,000 = 2,500,000
x = 2,500,000 / 300,000 = 8.33
By this constant equation, the BTC quantity (x) in the pool should be 8.33 and not 10 as in the first place. That means, on adding 50,000 USDT to the pool, Bob would receive 1.67 BTC (10 - 8.33).
Post-Bob’s transaction state of the pool:
- Reserves: x: 8.33 | y: 300,000 USDT
- Value: k: 2,500,000 (constant)
This is how an AMM transaction works and also the way an AMM acts as both liquidity provider and pricing system. Due to the versatility of AMMs, some of the most popular DEXs like Curve, Uniswap, and Bancor use a similar mechanism to operate.
Now, let’s look at the different types of AMMs currently in action.
What are the different types of AMM models?
Constant product market maker (CPMM)
Constant product market makers (CPMMs) are the first type of automated market maker (AMM), introduced by Bancor in 2017. A year later, the launch of Uniswap made the CPMM model even more popular.
CPMMs function on both the logic and equation we discussed above (x * y = k).
As per the formula, if the supply of one token (x) increases, the supply of the other token (y) must decrease, and vice versa, to uphold the constant value (k).
Constant sum market maker (CSMM)
Constant sum market makers (CSMMs) are an AMM variant that use the sum of two tokens as the basis, unlike CPMM which uses the product.
The equation behind this is x + y = k. Accordingly, when one token's supply increases, the other token's supply decreases proportionally to uphold the constant sum (k).
The risk of slippage is pretty low in a CSMM model compared to other types. This is because the trade size doesn’t affect the exchange price present in the liquidity pool.
Despite this, CSMMs are rarely used as a standalone market maker, due to liquidity concerns about handling large trades.
Constant mean market maker (CMMM)
Constant mean market makers (CMMMs) introduce liquidity pools with more than 2 tokens within a pool. The equation for CMMM is (x*y*z) ⅓ = k where the geometric mean of each reserve is the constant (k).
This type of AMM also allows for locking tokens in a proportion that is not always fixed at 50:50. In a way, CMMMs democratize AMMs by removing restrictions like two-token pools, equal distribution, etc.
Balancer made CMMM popular by pooling its liquidity into one CMMM pool rather than multiple unrelated liquidity pools. CMMMs stand out with some interesting use cases such as one-tap portfolio services and index investing.
Popular examples of AMMs
These first-generation AMM variants are powering some of the most reliable AMM-based DEXs in the current DeFi ecosystem. Here are some of the most popular ones by volume and market cap:
Uniswap
Uniswap is an Ethereum-based decentralized exchange that leverages AMMs to offer a liquidity-rich DEX for traders.
The DEX started with the popular x * y = k AMM model, though it has consistently evolved to provide better service to users. After a new update in January 2025, it's currently running its 4th version: Uniswap V4.
Every Uniswap version aims to improve the user experience. For instance, Uniswap V2 offered traders the ability to create liquidity for ERC-20 token trading pairs. And V3 offers concentrated liquidity, a feature that lets liquidity providers earn similar trading fees at lower risk, since not all their capital is at stake.
With V4, Uniswap further reduces network costs and introduces "hooks", enabling developers to add custom AMM features and offering enhanced flexibility for liquidity providers. This allows for pools with dynamic features, such as time-weighted average market makers (TWAMMs), custom fee structures, or auto-compounding LP rewards.
The competitive advantage of Uniswap lies in its peerless high liquidity, financial incentives in UNI rewards, and technological evolution.
Did you know? Uniswap is a market maker giant with nearly $5 billion total value locked (TVL), and commands 35% of overall DEX volume, trailing only Pancakeswap.
Curve
Curve Finance is an automated market maker-based DEX with a unique positioning of being a dominating stablecoin exchange. This enables Curve to be a reliable DEX with low slippage since prices of stablecoins are usually less volatile than many other cryptocurrencies (usually within a price band of $0.95 - $1.05).
Additionally, Curve offers multiple passive income opportunities like factory pools, metapools, and lending pools for liquidity providers (LPs). Each of these earns variable amounts of yield for LPs against their associated risks. Besides earning a share of transaction fees, users that provide liquidity will also earn additional CRV tokens that carry voting rights.
By prioritizing pegged assets, Curve is a reliable market maker for large trades, opening up specific use cases like crypto ETFs.
Did you know? Curve Finance executed a $2.5 million sUSD-USDC trade that cost less than $2 in gas fees.
Balancer
Balancer is an AMM-based decentralized exchange that launched in 2020. It uses the CMMM model to take AMM offerings a step further. Balancer offers multi-asset pools to increase exposure to different crypto assets and deepen liquidity.
To refine this further, the platform offers customizable weights for the assets in a single pool. This provides a granular level of control for traders to adjust where their digital assets are deployed, rather than a generic 50:50 ratio.
Through this feature, Balancer has a competitive advantage of higher gas efficiency and deeper liquidity compared to many of its peers. However, the complexity of the platform may somewhat hinder its growth potential and ease-of-use for beginners.
Uniswap, Curve, and Balancer are prominent first-generation automated market makers, but they are not without their defects.
Risks of first-gen automated market makers
Impermanent loss
Impermanent loss occurs when the price ratio of pooled assets deviates from the tokens' initial values. Liquidity providers automatically incur losses if and only when they withdraw funds during a period of such fluctuation.
The greater the price shift, the more significant the loss, particularly in pools with volatile digital assets. However, this loss will not occur if asset prices normalize before withdrawal, hence the term 'impermanent.' To put it another way, impermanent loss is the opportunity cost that LPs take on by providing liquidity instead of just holding their digital assets.

Want to see your actual permanent loss from trading? Try using a free permanent loss calculator such as CoinGecko or Daily DeFi
Slippage risks
A slippage risk in AMMs refers to the potential change in the price of an asset between the time a trade order is submitted and when it's actually executed. Large trades relative to the pool size can have a significant impact, causing the final execution price to deviate from the market price from when the trade was initiated.
This price change is referred to as the 'slippage.' Given that AMM pricing algorithms rely on asset ratios within a pool, they can be susceptible to such slippage.
Currently, developers are building newer iterations of AMMs to overcome drawbacks like slippage and impermanent loss, as well as others like security, smart contract vulnerability, and low capital efficiency.
How can the current AMM model be improved? The future of AMM DeFi trading
DeFi is a rapidly evolving space, even by cryptocurrency standards. As such, automated market makers (AMMs) are constantly being improved to tackle pain points such as capital inefficiency, slippage, and risk.
Here are some of the most promising innovations shaping the next generation of AMMs:
Hybrid AMM models
This suggested improvement stems from the belief that a standalone AMM model may not suffice to address all challenges.
Standalone AMM models (like CPMM or CSMM) have limitations, especially regarding large trades or diverse asset pools. Hybrid AMMs can combine features from multiple models to serve different market needs. For example, Curve Finance blends CPMM and CSMM mechanics to provide capital-efficient swaps for pegged assets, while Balancer enables multi-asset pools and flexible weighting.
Integration of external price sources
AMMs can use off-chain data through price oracles such as Chainlink to improve price discovery, making on-chain trading more efficient and in line with broader market rates. By referencing external prices, DEXs can set more accurate swap rates, concentrate liquidity more effectively, and reduce slippage.
DODO is an example of a decentralized trading protocol that uses external price feeds for its AMM. To date, DODO has facilitated a trading volume of more than $199 billion.
Synthetic assets and virtual AMMs
Synthetic assets allow users to trade derivatives or virtual tokens (like vDAI for DAI, vETH for ETH) whose value mimics real assets, while their actual holdings remain safely locked in smart contracts. This approach unlocks new DeFi products, such as decentralized futures, options, and prediction markets, all while helping mitigate risks like impermanent loss and slippage through smarter, more dynamic mechanisms.
Trading futures and options carries inherent risk, as these products can be complex and highly volatile. Always do your own research, understand the platform and market mechanics, and never risk more than you can afford to lose.
Dynamic fees and concentrated liquidity
Innovation like Uniswap V3’s concentrated liquidity lets liquidity providers focus their capital in specific price ranges, boosting their earning power and minimizing slippage for traders. Dynamic fee models automatically adjust trading fees based on real-time volatility or pool usage, creating a more responsive and capital-efficient market.
AMM FAQs
How do AMMs set token prices?
Automated formulas (like x*y=k explained above) determine prices based on the ratio of assets in the liquidity pool.
What is concentrated liquidity?
Concentrated liquidity is when LPs (liquidity providers) choose a custom price range for their funds, earning more fees with less capital. This feature was introduced by Uniswap V3.
Can you lose money in an AMM pool even if prices return?
Yes, this can happen due to impermanent loss. For instance, even if you withdraw when prices have changed, your end balance can be lower than simply “HODLing”.
Do AMMs work on every blockchain?
While automated market makers originated on Ethereum, their models also exist on blockchains like Solana, BNB Chain, Polygon, and even NFT trading platforms.
Are AMMs safe to use?
AMMs make DeFi more accessible, but they aren’t risk-free. Here’s how you can help protect yourself:
- Smart contract risk: Only use DEXs and AMMs that have undergone reputable security audits, and check for recent security reports before committing your funds to the platform.
- Platform reputation: Look up the AMM project online and see what the crypto community is saying. Favor platforms with a strong, transparent track record.
- Beware of exploits: Stay informed about recent hacks or bugs (like the major Curve liquidity pool hack in 2023). Avoid providing liquidity to new, unaudited, or lesser-known platforms.
Pro tip: Always start with small amounts when trying a new AMM or liquidity pool, and consider using a hardware wallet for added security.
Begin your DeFi journey
Ready to try DeFi for yourself? Start with leading AMMs like Uniswap or Curve, test out a trade or simulation first, and always understand your risks before providing liquidity or funds. You can also
If you need to top up your crypto wallet, simply buy cryptocurrency via MoonPay using your credit card or any other preferred payment method.
MoonPay also makes it easy to sell crypto when you decide it's time to cash out of DeFi. Simply enter the amount of the token you'd like to sell and enter the details where you want to receive your funds.