Cointime

Download App
iOS & Android

What is an Automated Market Maker?

Validated Venture

AMM systems are widely used in the DeFi industry, particularly on DEXs such as Uniswap, Balancer, Bancor, and Curve.

AMM uses liquidity in cryptocurrency public pools of multiple tokens locked in special smart contracts to create decentralized markets.

How did АММ emerge?

The Automated Market Maker (AMM) is an autonomous trading mechanism used by most of DeFi trading protocols. It facilitates the movement of capital and the execution of users’ exchange transactions on available crypto-asset markets.

Alan Liu, a member of the Gnosis project team, was the first prominent developer to discuss implementing AMM.

His ideas were outlined by Ethereum founder Vitalik Buterin on Reddit in 2016 and in his personal blog in July 2017.

This concept formed the basis of the Uniswap platform protocol, which received its first grant of $100,000 from the Ethereum Foundation. Vitalik Buterin also consulted with the Uniswap developers.

As a result of Uniswap, AMM gained widespread recognition. Simultaneously, one of the first successful AMM implementations is the Bancor Network platform, which raised $140 million through an ICO in June 2017.

How are liquidity pools related to AMM?

A liquidity pool — a type of storage of crypto-assets in the form of a smart contract — is required for AMM to function. A liquidity pool is typically made up of two crypto-assets that together form a market, similar to a trading pair on a centralized exchange.

Some pool participants invest their funds in order to earn money from exchange fees. These users are referred to as liquidity providers.

Another group is direct users of the decentralized exchange, who use one of the pools to exchange cryptocurrencies in the protocol (such transactions are known as “swaps”).

Consider what led to the formation of liquidity pools to gain a better understanding of them.

The first DEX exchanges were built on Ethereum and traded using the standard order book found on centralized exchanges. To be effective, such a trading mechanism must have extremely fast transaction processing speeds. Because transactions on a decentralized exchange are confirmed using a blockchain, the actual speed and capabilities of such a DEX were extremely limited. AMM enabled us to find a solution to this problem.

Thus, AMM is a fundamentally different way to create an asset market, as it is a formula or set of rules by which the protocol interacts with bids to buy or sell as well as user reserves.

How do liquidity pools work?

Pools can be made up of two or more assets. The Uniswap exchange, for example, can set up pools for paired tokens. You can create pools for three or more tokens on the Balancer platform. The Curve protocol is also intended for pools based on similar assets, such as ETH and wrapped token WETH or USDC and DAI. These pools’ operations are governed by AMMs.

To interact with liquidity pools, each of these AMM-DEXs may use its own formulas and rules. For example, the Uniswap protocol uses the following formula: x * y = k

In the equation, x and y represent the number of tokens available in the liquidity pool; k is a constant, called an invariant. In the case of Curve, the formulas x * y = k and x + y = k are used.

The formula x * y = k is also used by the SushiSwap and PancakeSwap projects, which are the most common type of AMM-DEX.

How is the pricing of an asset in the liquidity pool determined?

When liquidity is blocked in a pool, the pool’s provider receives special LP-tokens that confirm their participation in the pool. They can be represented by a promissory note, possession of which grants the right to receive commissions on exchange transactions and return their share of the pool.

LP-tokens are transferable crypto-assets that can be traded on the open market and invested in third-party DeFi applications.

A swap is the process of exchanging one asset for another via a liquidity pool. The process’s essence is to add only one asset to the pool, rather than two as in the case of LP. The pool charges a small fee for swaps, which is comparable to the fee for a deal at a centralized exchange, which is 0.1–0.3%. The commissions are divided among the liquidity providers in proportion to their participation in the pool.

Example

Let’s create a conditional liquidity pool for the ETH/USDC pair. At a price of 1 ETH equal to 2,000 USDC, it will be necessary to simultaneously lock in a smart contract any number of these two coins at a ratio of 1:2,000. At that price, there could be 100 ETH and 200,000 USDC in the pool.

The balance of assets in the pool is determined by their price. When a user decides to exchange 10 ETH using the pool described above, he will put his coins into a smart contract in a regular transaction. In exchange for his 10 ETH he will receive 20,000 USDC (not including exchange fees).

After that exchange, the pool balance will already be 110 ETH and 180,000 USDC. Consequently, the price of ETH in this particular pool will be about 1636 USDC instead of 2000 USDC in other markets. This situation attracts arbitrage traders, who profit from the imbalance by adding USDC to the pool until the market price reaches 2,000 USDC per ETH.

What are the АММ drawbacks?

Although AMM has been a game changer in trading and DeFi, it has a number of significant drawbacks. First, when making swaps with AMM, there is a high risk of price slippage. As a result, LPs face the risk of volatile losses, while regular users face the risk of Miner Extracted Value (MEV).

Other types of AMMs, such as the CowSwap project, which combines the development of AMM-Balancer and the Gnosis protocol, are being developed to mitigate such risks.

Second, unlike centralized exchanges, AMM allows you to place only one type of order. Limit orders and other types of orders, such as Stop Loss, are not permitted to be traded.

What is Impermanent Loss?

Impermanent Loss (IL) is a temporary or unrealized loss when using AMM-DEX to hold assets in the liquidity pool. The difference in price between the time the tokens are locked in the pool and the actual price at the time of holding is referred to as an IL. Unrealized losses are so-called because they are not fixed until liquidity is withdrawn from the pool.

As an example, let’s take the liquidity pool on the Uniswap exchange, which works according to the classic formula x * y = k:

  • Liquidity provider blocked 1 ETH and 2,000 DAI. His share in the pool was 10%.
  • The pool has a total of 10 ETH and 20,000 DAI — the equivalent of 40,000 DAI.
  • The balance of the pool remained unchanged because there were no new liquidity providers.
  • Let’s assume that the market price of ETH changed to 4,000 DAI.
  • The arbitrage traders then took advantage of the situation, changing the pool’s ratio to 5 ETH on one side and 20,000 DAI on the other. At the same time, the pool’s total size remained unchanged at 40,000 DAI.
  • At this point, the liquidity provider decided to withdraw his share from the pool — it is 10%.
  • Given the current pool balance, he withdraws 0.5 ETH and 2000 DAI, although he originally added 1 ETH and 2000 DAI.
  • The original value of his share was 4,000 DAI (1 ETH plus 2,000 DAI) in terms of stabelcoins. The value of the assets at the time of withdrawal was the same 4000 DAI (0.5 ETH plus 2000 DAI)
  • However, if the user had simply kept his 1 ETH and 2000 DAI, the value of his assets would have been 6000 DAI. This is the unrealized loss or gain when using AMM-DEX.
  • As a liquidity reward, the user will also receive 10% of all pool commissions (in proportion to their share of the pool). The reward may be reduced due to taxes deducted from the developers or the project treasury for future development, for example.

This is a conditional example of a dramatic 50% increase in the price of a single asset, without taking into account the many trades by arbitrage traders and the time it takes to equalize the price

the price of the asset within the pool with the price at the centralized exchanges, where changes occur instantly.

When the market is “calm”, variable movements are added to the calculation of volatile losses, as described by StarkNet developer Peteris Erins in his blog. As a result of these forecast calculations, the Impermanent Loss value on a two-fold movement of the asset price will be about 5.7%. But this is only a projected value — potential “losses” are very difficult to predict.

How to reduce risks when trading with AMM?

Before you use a liquidity pool, you should calculate all of the possible commissions you will have to pay at the time of asset entry and withdrawal.

You must take into account the possibility of asset price movements in both directions. Some potential issues, such as non-permanent loss (IL) risk, can be predicted.

To calculate IL, you need to understand the nature of its origin. You can also use one of the non-permanent loss calculators available on the Internet.

Comments

All Comments

Recommended for you

  • The US spot Ethereum ETF saw a net outflow of $51.26 million yesterday.

     according to Trader T monitoring, the US spot Ethereum ETF had a net outflow of $51.26 million yesterday.

  • BTC breaks through $68,000

    market shows BTC breaks through $68,000, currently at $68,005.59, 24-hour increase reaches 0.36%, market volatility is high, please manage risk properly.

  • The Israeli military says it has dropped more than 6,500 munitions in its strikes against Iran.

    Israeli military stated that since the outbreak of the war, the Israeli Air Force has dropped more than 6,500 munitions in strikes against Iran. The Israel Defense Forces said that Air Force fighter jets have carried out a total of 2,500 combat missions and launched 150 separate strike waves. The military said that as the war enters a new phase, it is currently intensifying strikes on Iranian regime targets within Tehran and increasing attacks on weapons production facilities across Iran — including those used to manufacture missiles and launch devices. Military officials stated that the Israel Defense Forces plan to continue operations within Iran in the coming weeks, and if necessary, the operations will last longer.

  • BTC falls below $68,000

     market shows BTC has fallen below 68,000 USD, currently at 67,797.17 USD, a 24-hour decline of 4.35%, with significant market fluctuations, please manage risk accordingly.

  • Iran claims a U.S. oil tanker was attacked near the Kuwaiti border.

    according to CCTV News, a spokesperson for the Central Command of Iran's Armed Forces Hatem al-Anbiya stated that a US oil tanker was attacked in waters near the Kuwait border and is currently burning. The US and Kuwait have not responded to this so far. (Jin10)

  • Mitsubishi UFJ Financial Group, in conjunction with Mizuho Bank and Sumitomo Mitsui Banking Corporation, is jointly advancing a Proof-of-Concept (PoC) for a yen-pegged stablecoin.

    according to the latest disclosure, Japan's Mitsubishi UFJ Financial Group (MUFG), with assets totaling $3 trillion, announced two strategic advancements:

  • ETH falls below $2100

    the market shows ETH fell below $2100, currently at $2099.94, with a 24-hour increase of 4.78%. The market is highly volatile, please manage your risk accordingly.

  • BTC breaks through $69,000

     the market shows BTC breaking through $69,000, currently at $69,021.49, with a 24-hour increase of 1.15%. The market is highly volatile, please manage your risk accordingly.

  • Spanish Foreign Minister: Not worried about any consequences of refusing US access to military bases

     on March 3 local time, Spanish Foreign Minister Alvarez defended the Spanish government's refusal to provide the Rota and Moron military bases to the United States for participation in attacks on Iran. Alvarez stated that the operation initiated by the United States and Israel is not supported by the United Nations and is not part of the bilateral agreements allowing the use of the aforementioned Spanish sovereign military bases. Alvarez also said that the Spanish government is not concerned that this stance will have any consequences. Alvarez stated: "The position of the Spanish government represents the will of the vast majority of the Spanish people as well as the vast majority of people worldwide, which is to defend the UN Charter, respect international law, and believe that cooperation is always more powerful than confrontation."

  • Spot gold plunges nearly $100 in the short term.

     spot gold plunged nearly 100 dollars in a short time, spot gold fell below 5170 dollars/ounce, with a daily decline of 2.94%.