top of page

All you need to know about automated market maker(AMM)

What is automated market maker?

What is automated market maker?

An automated market maker (AMM) is a type of decentralized exchange protocol that facilitates the trading of digital assets without relying on traditional order books. It provides a mechanism for liquidity provision and enables users to trade assets directly against a liquidity pool rather than relying on buyers and sellers to create individual trades.

The key concept behind an AMM is the use of liquidity pools, which are pools of funds provided by liquidity providers (LPs). LPs deposit pairs of assets into the pool, and the pool's smart contract automatically determines the exchange rate between the assets based on the relative supply and demand.

AMMs typically follow a mathematical formula, such as the constant product formula (used by Uniswap), which states that the product of the quantities of two assets in a pool remains constant. As a result, when one asset is bought, the supply of that asset decreases, causing the price to increase according to the formula.

Benefits of automated market makers include:

Liquidity Provision

AMMs enable anyone to become a liquidity provider by depositing assets into the liquidity pool, allowing for continuous liquidity availability for traders.


AMMs operate on decentralized networks, eliminating the need for intermediaries and providing users with full control over their assets.

Lower Barriers to Entry

AMMs often have lower entry barriers compared to traditional exchanges, allowing for broader participation and accessibility.

Market Efficiency

AMMs can provide efficient price discovery, as the pricing is determined based on the assets' relative supply and demand in the liquidity pool.

Token Swaps

AMMs allow for direct token-to-token swaps, enabling users to trade between different assets without the need for an intermediary asset.

Some popular AMM protocols include Uniswap, SushiSwap, Balancer, and Curve Finance. These protocols have played a significant role in driving the growth of decentralized finance (DeFi) by providing decentralized and efficient trading mechanisms on blockchain networks.

list of automated market makers

Here are some notable automated market makers (AMMs) in the decentralized finance (DeFi) space:

list of automated market makers

Uniswap is one of the pioneering and widely used AMM protocols. It operates on the Ethereum blockchain and facilitates token-to-token swaps using liquidity pools.

SushiSwap is a decentralized exchange platform built on top of the Uniswap protocol. It offers additional features such as yield farming and staking.

Balancer is an AMM protocol that allows for the creation of customizable liquidity pools with multiple tokens and different weights. It enables users to provide liquidity with varied asset allocations.

Curve Finance is an AMM protocol designed specifically for stablecoin trading. It provides low slippage and low fee trading for stablecoin pairs.

PancakeSwap is an AMM protocol built on the Binance Smart Chain (BSC). It offers a range of features similar to Uniswap, including token swaps and liquidity provision.

1inch is an aggregator and AMM protocol that combines liquidity from various decentralized exchanges to provide users with the best possible prices for their trades.

Kyber Network is an on-chain liquidity protocol that enables decentralized token swaps and provides liquidity aggregation across various AMMs.

QuickSwap is an AMM protocol built on the Polygon (formerly Matic) network. It provides fast and low-cost token swaps using the liquidity pools on the Polygon network.

automated market maker vs order book

Automated Market Maker (AMM) and order book are two different mechanisms used in trading platforms. Here's a comparison between the two:

Automated Market Maker (AMM)

- AMMs are decentralized exchange protocols that facilitate trading by using liquidity pools.

- Liquidity providers deposit assets into the pools, and the AMM algorithm determines the asset prices based on predefined mathematical formulas.

- AMMs provide continuous liquidity for traders by allowing direct token-to-token swaps without relying on traditional order books.

- Popular AMM protocols include Uniswap, SushiSwap, and Balancer.

Order Book

- An order book is a centralized or decentralized mechanism used in traditional exchanges where buyers and sellers place orders to buy or sell assets.

- Orders are displayed in the order book, showing the quantity, price, and type (buy or sell) of each order.

- Traders can submit limit orders, specifying the desired price and quantity, or market orders, which execute at the best available price in the order book.

- The order book matches buy and sell orders based on price and time priority.

- Popular centralized exchanges like Binance, Coinbase, and Bitstamp use order books.

Key differences

1. Liquidity Provision: AMMs use liquidity pools provided by users, while order books rely on buyers and sellers placing orders.

2. Decentralization: AMMs are typically decentralized, operating on blockchain networks, while order books can be centralized or decentralized.

3. Price Determination: AMMs use mathematical formulas to determine asset prices based on supply and demand within the liquidity pool, while order books match orders based on the prices set by traders.

4. Continuous Liquidity: AMMs provide continuous liquidity, while order books require matching buy and sell orders to execute trades.

5. Transparency: AMMs often provide transparency by recording transactions on the blockchain, while the transparency of order books can vary depending on the platform.

AMMs and order books each have their advantages and use cases. AMMs excel in providing continuous liquidity and simplicity of trading, while order books offer more control over prices and access to advanced trading functionalities.

automated market maker algorithm

automated market maker algorithm

The automated market maker (AMM) algorithm is a mathematical formula used in AMM protocols to determine asset prices and facilitate token swaps within liquidity pools. The most well-known AMM algorithm is the constant product formula, which is used by protocols like Uniswap. Here's an overview of the algorithm:

Constant Product Formula (Uniswap V2):

The constant product formula states that the product of the quantities of two assets in a liquidity pool remains constant. The equation is expressed as follows:

x * y = k


- x and y represent the quantities of the two assets in the liquidity pool.

- k is the constant product, which remains unchanged.

When a user initiates a token swap in an AMM protocol using the constant product formula, the algorithm adjusts the asset prices based on the relative changes in supply. Here's a simplified example:

1. Suppose there's a liquidity pool with assets A and B, initially having quantities x and y, respectively, and their product k.

2. A user wants to swap a certain quantity of asset A for asset B.

3. The algorithm calculates the new quantities of A and B based on the constant product formula, adjusting for the change in supply.

4. After the swap, the new quantities become x + Δx and y - Δy, respectively, where Δx and Δy represent the changes in supply.

5. The constant product k remains the same, so x * y = (x + Δx) * (y - Δy).

The algorithm calculates the specific amounts of assets received and the resulting price impact based on the initial and final quantities of assets.

This formula ensures that the relative pricing of assets adjusts according to the demand and supply within the liquidity pool. When more users trade in the pool, the asset prices change dynamically to maintain the constant product relationship.

It's important to note that different AMM protocols may use variations or enhancements to the constant product formula, introducing additional parameters or mechanisms to optimize price accuracy, reduce impermanent loss, or handle other specific requirements.

automated market maker code

Here's a simplified code example of an automated market maker (AMM) contract using the constant product formula in Solidity:

automated market maker code

In this example, we have a simple AMM contract that allows swapping between two assets (A and B) using the constant product formula. The contract initializes with an initial supply of both assets in the reserves.

The getReserves() function returns the current values of the reserves.

The calculateAmountOut() function calculates the amount of the output asset based on the input amount, the reserves, and the constant product formula.

The swapTokens() function performs the swap by calling calculateAmountOut() and updating the reserves accordingly.

The swapAToB() and swapBToA() functions are external entry points for users to initiate swaps from asset A to asset B and vice versa.

Note that this is a simplified example for illustrative purposes. In real-world scenarios, additional checks, security measures, and considerations would be required to make the AMM contract secure and efficient.

4 views0 comments

Recent Posts

See All


bottom of page