Decentralized Finance (DeFi) is experiencing rapid growth across multiple blockchain networks. Ethereum, BNB Chain, Polygon, Avalanche, Arbitrum, and Optimism all host thousands of DeFi applications. At the center of this phenomenon is the Automated Market Maker (AMM) — a revolutionary technology that has completely changed how third parties buy and sell digital assets. At the core of this technology is the AMM formula, which has opened new levels of accessibility and transparency in the world of decentralized trading.
What is the AMM formula and why is it important?
An Automated Market Maker is a smart contract-supported system that eliminates the need for intermediaries in traditional markets. We have moved past the days when only large institutions knew how to provide liquidity. Today, anyone can become a market maker. The AMM formula makes this democratization possible.
Imagine a smart contract holding two or more digital assets, which are designated as a liquidity pool. A trader interacts directly with this pool, trading at prices determined by algorithms, with other buyers and sellers. This is the magic of AMM — each transaction is handled precisely through the formula.
The constant product formula: x*y=k explanation
The most well-known AMM formula is called the “Constant Product Formula,” first used by Uniswap. It looks like this:
x * y = k
Where x and y are the reserves of two tokens in the liquidity pool, and k is a constant value. This means that the product of x and y always remains the same.
Let’s clarify this practically. Suppose the pool has 1000 ETH and 2,000,000 USDC. Here, x = 1000, y = 2,000,000, so k = 2,000,000,000. If a trader sells 100 ETH, the reserves become 1100 ETH. To maintain the formula, the new USDC reserve must be approximately 1,818,182 USDC (2,000,000,000 / 1100). This means the trader receives about 181,818 USDC. The price adjusts automatically based on the trade volume.
The AMM formula automatically handles price determination. There’s no need for a third party to set the price — it all happens mathematically.
Liquidity pools — practical application of the AMM formula
A liquidity pool is the heart that keeps the AMM formula alive. Liquidity providers (LPs) deposit equal values of two tokens into the pool. For example, ETH worth $500 and USDC worth $500.
The pool becomes a place where manual traders perform swaps. The protocol charges a fee on each swap — on Uniswap v3, this can be 0.01%, 0.05%, 0.30%, or 1%, depending on the chosen liquidity level. These fees are distributed to LPs based on their share of the total liquidity.
The deeper the liquidity in the pool, the less price slippage traders will experience. Smaller pools are more sensitive to price changes because the formula adjusts prices more significantly for large trades.
Different AMM formulas: Uniswap, Curve, and others
Did Uniswap v3 abandon the constant product formula? No — it enhanced it. Uniswap v3 offers “concentrated liquidity,” meaning LPs can allocate their entire capital within specific price ranges. This increases capital efficiency.
Curve took a different approach. The protocol uses a specialized AMM formula optimized for assets with similar prices, such as stablecoins. Curve’s formula results in lower slippage during trades because users often swap stablecoins with minimal price differences.
PancakeSwap successfully implemented the Uniswap AMM model on BNB Chain, making it accessible to millions with lower fees.
Impermanent loss and other risks
LPs earn good fees by providing deep liquidity, but they face the risk called “impermanent loss.” This occurs when token prices diverge significantly during the LP’s position. For example, if you provide ETH-USDC liquidity and ETH’s price drops by 50%, the value of your liquidity position is affected.
If you halve your funds due to price changes, the loss becomes permanent. Sometimes, fees can offset this loss, but not always.
Another risk is that smart contracts have inherent vulnerabilities. Pools with shallow liquidity are often more susceptible to losses. MEV (Maximum Extractable Value) attacks occur when bots or miners manipulate transactions to prioritize their own, causing traders to lose out.
Practical adoption and recent growth
Despite these risks, AMM formulas have truly revolutionized DeFi. Before AMM formulas, decentralized trading had very low liquidity, with only big players participating in pools.
If you want to start with AMMs, platforms like Uniswap, Curve, or PancakeSwap offer simple interfaces. Choose two tokens, enter an amount, and confirm. Your capital is directly deposited into the pool, and you start earning fees.
Conclusion
The AMM formula has demonstrated that, historically, a fully automated model was possible. Liquidity providers, manual traders, impermanent loss — all these challenges have been addressed through technological advancements and continuous development.
Today, the AMM formula continues to evolve. Innovations like concentrated liquidity and stable pools show significant ongoing progress. Currently, the blockchain industry is laying the foundation for a revolutionary era in DeFi.
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
Automated Market Maker: AMM Formula and How It Works
Decentralized Finance (DeFi) is experiencing rapid growth across multiple blockchain networks. Ethereum, BNB Chain, Polygon, Avalanche, Arbitrum, and Optimism all host thousands of DeFi applications. At the center of this phenomenon is the Automated Market Maker (AMM) — a revolutionary technology that has completely changed how third parties buy and sell digital assets. At the core of this technology is the AMM formula, which has opened new levels of accessibility and transparency in the world of decentralized trading.
What is the AMM formula and why is it important?
An Automated Market Maker is a smart contract-supported system that eliminates the need for intermediaries in traditional markets. We have moved past the days when only large institutions knew how to provide liquidity. Today, anyone can become a market maker. The AMM formula makes this democratization possible.
Imagine a smart contract holding two or more digital assets, which are designated as a liquidity pool. A trader interacts directly with this pool, trading at prices determined by algorithms, with other buyers and sellers. This is the magic of AMM — each transaction is handled precisely through the formula.
The constant product formula: x*y=k explanation
The most well-known AMM formula is called the “Constant Product Formula,” first used by Uniswap. It looks like this:
x * y = k
Where x and y are the reserves of two tokens in the liquidity pool, and k is a constant value. This means that the product of x and y always remains the same.
Let’s clarify this practically. Suppose the pool has 1000 ETH and 2,000,000 USDC. Here, x = 1000, y = 2,000,000, so k = 2,000,000,000. If a trader sells 100 ETH, the reserves become 1100 ETH. To maintain the formula, the new USDC reserve must be approximately 1,818,182 USDC (2,000,000,000 / 1100). This means the trader receives about 181,818 USDC. The price adjusts automatically based on the trade volume.
The AMM formula automatically handles price determination. There’s no need for a third party to set the price — it all happens mathematically.
Liquidity pools — practical application of the AMM formula
A liquidity pool is the heart that keeps the AMM formula alive. Liquidity providers (LPs) deposit equal values of two tokens into the pool. For example, ETH worth $500 and USDC worth $500.
The pool becomes a place where manual traders perform swaps. The protocol charges a fee on each swap — on Uniswap v3, this can be 0.01%, 0.05%, 0.30%, or 1%, depending on the chosen liquidity level. These fees are distributed to LPs based on their share of the total liquidity.
The deeper the liquidity in the pool, the less price slippage traders will experience. Smaller pools are more sensitive to price changes because the formula adjusts prices more significantly for large trades.
Different AMM formulas: Uniswap, Curve, and others
Did Uniswap v3 abandon the constant product formula? No — it enhanced it. Uniswap v3 offers “concentrated liquidity,” meaning LPs can allocate their entire capital within specific price ranges. This increases capital efficiency.
Curve took a different approach. The protocol uses a specialized AMM formula optimized for assets with similar prices, such as stablecoins. Curve’s formula results in lower slippage during trades because users often swap stablecoins with minimal price differences.
PancakeSwap successfully implemented the Uniswap AMM model on BNB Chain, making it accessible to millions with lower fees.
Impermanent loss and other risks
LPs earn good fees by providing deep liquidity, but they face the risk called “impermanent loss.” This occurs when token prices diverge significantly during the LP’s position. For example, if you provide ETH-USDC liquidity and ETH’s price drops by 50%, the value of your liquidity position is affected.
If you halve your funds due to price changes, the loss becomes permanent. Sometimes, fees can offset this loss, but not always.
Another risk is that smart contracts have inherent vulnerabilities. Pools with shallow liquidity are often more susceptible to losses. MEV (Maximum Extractable Value) attacks occur when bots or miners manipulate transactions to prioritize their own, causing traders to lose out.
Practical adoption and recent growth
Despite these risks, AMM formulas have truly revolutionized DeFi. Before AMM formulas, decentralized trading had very low liquidity, with only big players participating in pools.
If you want to start with AMMs, platforms like Uniswap, Curve, or PancakeSwap offer simple interfaces. Choose two tokens, enter an amount, and confirm. Your capital is directly deposited into the pool, and you start earning fees.
Conclusion
The AMM formula has demonstrated that, historically, a fully automated model was possible. Liquidity providers, manual traders, impermanent loss — all these challenges have been addressed through technological advancements and continuous development.
Today, the AMM formula continues to evolve. Innovations like concentrated liquidity and stable pools show significant ongoing progress. Currently, the blockchain industry is laying the foundation for a revolutionary era in DeFi.