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

  • Saudi Arabia Depletes 86% of Patriot Missile Stockpile

    According to British media reports, within the first 38 days after the outbreak of the war, Saudi Arabia launched approximately 2,400 PAC-3 (Patriot-3) interceptor missiles, accounting for about 86% of the country's total stockpile of 2,800 missiles. By April of last year, Saudi Arabia had only about 400 interceptor missiles remaining. Other Gulf Arab states also consumed missile reserves on a similar scale, highlighting the military crisis facing the region. (Jin Shi)

  • Experts: The Strait of Hormuz 'Will Never' Return to Pre-War Status

    Ali Akbar Dareini, a researcher at the Iranian Strategic Studies Center, stated that Iran and Oman are about to reach an agreement on the future management of the Strait of Hormuz, with the main obstacle being U.S. pressure on Oman to adopt a position more aligned with Washington. Dareini emphasized that Iran considers future control of the strait crucial for its national security. In recent months, the U.S. has conducted strikes against Iran, which Iran claims were launched from bases in the region. Dareini noted that the ongoing negotiations between Iran and Oman present the U.S. with a 'good opportunity to extricate itself from this quagmire' by recognizing Iran and Oman as the countries that will determine the 'future' of the Strait of Hormuz. 'However, the Strait of Hormuz will never return to its pre-war status,' he continued. 'The geopolitical landscape of the region has changed.'

  • Iran: Negotiations with Oman Unrelated to Reopening of Strait of Hormuz

    On August 8, a spokesperson for the Islamic Revolutionary Guard Corps of Iran stated that the reopening of the Strait of Hormuz is unrelated to negotiations between Iran and Oman, but rather depends on whether the United States fully accepts Iran's conditions and ceases interference in regional negotiations. "Once the United States accepts Iran's conditions, the Strait will undoubtedly reopen." (CCTV News)

  • Whale Shorting $102 Million in Bitcoin Faces Partial Liquidation, Remaining Liquidation Price Around $65,300

    On August 8, TheDataNerd reported that a whale using 40x leverage to short $102 million in Bitcoin recently faced partial liquidation, incurring a loss of $1.46 million over the past week. Currently, the margin call has reduced the short position to approximately $60 million, with an opening price of $64,212.5 and a liquidation price of $65,310.2.

  • BTC Falls Below $65,000

    Market data shows BTC has fallen below $65,000, currently reported at $64,999.23, with a 24-hour increase of 1.01%. Market volatility is high, please exercise risk control.

  • Hedge Fund AISituational Awareness's Mysterious $400 Million Investment Targets Chip Startup Source Foundry

    On August 8, sources revealed that the hedge fund Situational Awareness, managed by former OpenAI researcher Leopold Aschenbrenner, made a mysterious $400 million investment in the chip manufacturing startup Source Foundry just days after facing imminent collapse. Previously, Bloomberg reported that the hedge fund invested in a private company backed by Sequoia Capital, but did not disclose the name of the specific company. The Wall Street Journal had earlier reported that the recipient of the investment was Source Foundry, unveiling the target of this mysterious funding deployment by Situational Awareness.

  • US Spot Bitcoin ETF Sees $101.79M Net Inflow Yesterday

    On August 8, according to Trader T's monitoring, US spot bitcoin ETFs saw a net inflow of $101.79 million yesterday.

  • US Official: Ukraine Agrees to Avoid Strikes on Non-Russian Tankers and Black Sea Oil Facilities

    On August 8, according to a US official, Ukraine has agreed not to target certain non-Russian tankers and Black Sea infrastructure vital to Kazakhstan's crude oil exports. This follows ship attacks last month that caused loading disruptions. The US official said Ukraine has set up contact points so commercial shipping companies can communicate information and ensure safe passage. The commitment was reached after meetings between senior US government leaders and Ukrainian leadership, marking a potentially significant step toward increasing regional oil shipments. Previously, activity in the region had cooled significantly due to several recent attacks near the Caspian Pipeline Consortium terminal in Russia's Novorossiysk. (Jin Shi)

  • U.S. July Nonfarm Payrolls Fall by 23,000, Missing Market Expectations

    On August 7, U.S. nonfarm payrolls decreased by 23,000 in July, compared with market expectations of an increase of 80,000, and the previous value was an increase of 57,000.

  • US May and June Nonfarm Payroll Additions Revised Down by 103,000 Combined

    On August 7, the US Bureau of Labor Statistics: May nonfarm payroll additions were revised down from 129,000 to 63,000; June nonfarm payroll additions were revised down from 57,000 to 20,000. After the revisions, the combined additions for May and June were 103,000 lower than previously reported.