banner
Ming202

Ming202

email
x

Web3 Popular Science | What is an Automated Market Maker (AMM)

A2C91B36-BE05-4610-9BDB-B2AD25EA0D09

An Automated Market Maker (AMM) is an algorithm protocol used by decentralized exchanges (DEX) to determine asset prices through algorithms (such as constant product) and automatically adjust prices based on supply and demand without the need for traditional order books to provide liquidity and determine asset prices.

In simple terms, those who want to provide liquidity will deposit two types of assets in a certain proportion into a pool of assets (which is actually a set of smart contracts), allowing other traders to trade directly with the assets in the pool. The asset pool uses an algorithm based on the ratio of asset supply and demand to automatically determine asset prices, which is AMM.

Operation Process and Core Mechanism of AMM#

Creating Liquidity Pools
Liquidity pools are the core components of AMM, consisting of funds from multiple users deposited in the form of encrypted assets to provide liquidity for decentralized exchanges.
Liquidity providers (LP) deposit their assets into the liquidity pool in exchange for liquidity tokens (LP Tokens), which represent their share in the pool.
Pricing Mechanism
AMM uses specific algorithms to determine the prices of assets in the pool. The most common pricing formula is the constant product formula, where x * y = k, where:
x and y represent the quantities of the two assets in the pool.
k is a constant value representing total liquidity.
For example, in Uniswap, the ETH/DAI pool uses the formula ETH quantity * DAI quantity = constant value k. This formula ensures that when the quantity of assets in the pool changes, the asset prices will automatically adjust.
Trading Process
When users make transactions (e.g., exchanging ETH for DAI), AMM recalculates the prices of assets in the pool based on the constant product formula. The trading process may incur slippage, which is the difference between the actual execution price and the expected price, depending on the trade size and the depth of the liquidity pool.
Trading steps:

  1. User initiates a transaction request.
  2. AMM recalculates the prices of assets in the pool based on the current quantities.
  3. The transaction is executed, with the user receiving the target asset from the pool while adding another asset to the pool.
  4. The quantities and prices of assets in the pool are readjusted to maintain the constant product.
    Slippage
    Refers to the difference between the expected price and the actual execution price during a transaction. Higher liquidity leads to smaller slippage and lower transaction costs.
    For example, if you place an order to buy one Bitcoin at $50, but before your order is executed, the price rises to $52, you may incur a slippage loss of $2 per Bitcoin. This means your actual purchase price will be $52 instead of the expected $50.
    Rewards for Liquidity Providers
    Liquidity providers receive rewards in two ways:
    Transaction fees: Each transaction generates fees, which are proportionally distributed among all liquidity providers.
    Liquidity mining rewards: Some platforms offer additional rewards in platform tokens to liquidity providers to incentivize more users to provide liquidity.
    Through these mechanisms, AMM effectively simplifies the trading process, provides a decentralized, trustless trading environment, and greatly promotes the development of the DeFi ecosystem.
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.