Automatic Market Maker: Definition and Function

An Automated Market Maker (AMM) is a type of software algorithm that is designed to manage liquidity and set pricing for crypto assets on decentralized exchanges. These systems have become increasingly popular in the world of Decentralized Finance (DeFi), and are often used on decentralized exchanges like Uniswap, Balancer, Bancor, and Curve.

Rather than relying on a traditional order book like centralized exchanges, AMM utilizes liquidity from public cryptocurrency pools containing multiple tokens, which are locked in specialized smart contracts. This decentralized approach allows for the creation of new markets that can be accessed by anyone, anywhere in the world, without the need for an intermediary.

The Origins of Automated Market Makers

The Automated Market Maker has emerged as a critical component of many decentralized finance trading platforms, powering the movement of capital and facilitating the execution of exchange operations for users in a wide range of crypto asset markets.

While there have been many individuals and teams involved in the development of AMM technology, one of the earliest mentions of the concept came from Alan Liu, a member of the Gnosis project team. Liu’s ideas were first discussed publicly by Ethereum founder Vitalik Buterin in 2016, and were later elaborated upon in a personal blog post in July 2017. These early discussions laid the groundwork for the creation of the Uniswap protocol, which went on to become one of the most popular and influential AMM-based platforms in the world of DeFi.

The Uniswap protocol was initially supported by a $100,000 grant from the Ethereum Foundation, and received significant guidance and feedback from Buterin himself. Over time, the platform has become a critical component of the DeFi ecosystem, enabling users to trade a wide range of assets with minimal friction and at a lower cost than traditional centralized exchanges.

While Uniswap has undoubtedly played a major role in popularizing AMM technology, it is worth noting that there have been other successful implementations of this approach as well. One notable example is the Bancor Network platform, which raised an impressive $140 million through an ICO in June 2017. As the DeFi ecosystem continues to evolve and expand, it is likely that we will see even more innovative uses of AMM technology emerge in the years to come.

Relationship Between Automated Market Makers and Liquidity Pools

Automated Market Makers rely on liquidity pools, which serve as a storage mechanism for crypto assets in the form of a smart contract. Typically, these pools contain two different crypto assets and function as a market, much like a trading pair on a centralized exchange.

Some pool members choose to block their funds in order to generate income through exchange fees. These users are known as liquidity providers. Another category of users includes those who directly use the decentralized exchange to exchange cryptocurrencies via one of the available pools. This process is referred to as a “swap”.

To better understand the purpose of liquidity pools, it’s important to consider the context that led to their creation. The earliest decentralized exchanges (DEXs) used a standard order book, much like those seen on centralized exchanges. However, this trading mechanism required an extremely high transaction processing speed to be effective. Since transactions on decentralized exchanges are confirmed through the blockchain, the real speed and capabilities of these DEXs were severely limited. AMM technology offered a solution to this problem.

By implementing a formula or set of rules for managing orders to buy or sell assets, as well as user reserves, AMM created a fundamentally different way to generate asset markets. This has proven to be a key component of the DeFi ecosystem, allowing for more efficient and cost-effective trading of crypto assets in a decentralized manner.

How do liquidity pools work?

Liquidity pools can contain two or more crypto assets, depending on the platform. For instance, Uniswap allows paired token pools, while Balancer permits pools with three or more tokens. Meanwhile, Curve is designed for pools that contain assets with similar values, such as ETH and a wrapped WETH token or USDC and DAI. Regardless of the composition of the pool, the Automated Market Maker ensures its smooth operation.

Different AMM-based DEXs can use various formulas and rules to govern their interaction with liquidity pools. For example, Uniswap utilizes the x * y = k formula, where x and y represent the number of tokens in the liquidity pool, and k is the invariant constant. Meanwhile, Curve uses both x * y = k and x + y = k formulas.

SushiSwap and PancakeSwap also employ the x * y = k formula, which is the most commonly used type of AMM-DEX.

Asset pricing within liquidity pools

In a liquidity pool, providers receive LP tokens as confirmation of their share in the pool when they block liquidity. These tokens are similar to IOUs and allow providers to receive commissions from exchange transactions and return their share from the pool. LP tokens are transferable assets that can be sold, exchanged, or invested in DeFi applications.

The process of exchanging one asset for another through a liquidity pool is called a swap. The pool charges a small commission for conducting swaps, which is distributed among liquidity providers based on their share in the pool. The commission is typically around 0.1-0.3%, similar to the commission charged by centralized exchanges.

For example, consider a liquidity pool for the ETH/USDC pair, where the price of 1 ETH equals 2000 USDC. If a user exchanges 10 ETH, they will deposit their coins into the smart contract and receive 20,000 USDC in exchange, excluding exchange fees. After the exchange, the pool balance will have 110 ETH and 180,000 USDC, and the price of ETH in this pool will be around 1636 USDC instead of 2000 USDC in other markets. Arbitrage traders can take advantage of this price imbalance by adding USDC to the pool until the price reaches the market price of 2,000 USDC per 1 ETH.

What are the disadvantages of AMM?

The use of AMM in trading and DeFi has been revolutionary, but it also has a number of clear drawbacks. One of the primary disadvantages is the high risk of price slippage when performing swaps using AMM, which in turn can lead to intermittent losses for LPs and MEV for regular users. To address such risks, alternative forms of AMM are being developed, such as the CowSwap project, which combines the features of AMM-Balancer and the Gnosis protocol.

 Another disadvantage of AMM is that unlike centralized exchanges, only one type of order can be placed when trading through AMM, and other types such as limit orders or stop-loss orders cannot be executed.

What is Impermanent Loss?

“Intermittent losses” (also known as “Impermanent Loss” or “IL”) are a common issue when using Automated Market Maker Decentralized Exchanges (AMM-DEX). These are temporary or unrealized losses that occur when holding assets in the liquidity pool. This affects liquidity providers (LPs) and refers to the difference between the price of tokens at the time they were locked into the pool and the actual price when they are held. These losses are not fixed until the liquidity is withdrawn from the pool.

For instance, on Uniswap, a classic AMM-DEX, the liquidity pool follows the formula x * y = k.

Suppose an LP locks 1 ETH and 2000 DAI, and their share in the pool is 10%.

 If the pool contains 10 ETH and 20,000 DAI in total, and the pool balance did not change, then the LP’s share remains 10%. If the market price of ETH changes to 4000 DAI and arbitrage traders take advantage of the situation by changing the ratio in the pool, the LP may decide to withdraw their share from the pool, which results in an unrealized loss or gain when using AMM-DEX.

 In this case, the LP withdraws 0.5 ETH and 2000 DAI, although they initially added 1 ETH and 2000 DAI to the pool. This means that their initial asset value was 4000 DAI, but at the time of withdrawal, it remained the same despite the market price changes. If they held onto their assets, their value would have been 6,000 DAI, resulting in a loss when using AMM-DEX.

As a reward for providing liquidity, the LP receives a portion of all pool fees proportional to their stake in the pool. However, this reward may be reduced due to taxes or other fees deducted by the project developers or treasury for future development.

The example given is based on a sharp 50% increase in the price of one asset, without accounting for the many transactions of arbitrage traders and the time required to equalize the price inside the pool. In a “calm” market flow, other factors come into play, adding to the calculation of intermittent losses.

Predictive calculations, as described by StarkNet developer Pēterisa Erins in his blog, estimate that the value of Impermanent Loss for a two-fold movement in asset price will be around 5.7%. However, these are only forecasts and the potential “losses” are challenging to predict.

How to reduce risks when trading with AMM?

To ensure a successful and profitable liquidity provision, it is crucial to conduct a comprehensive analysis of the possible fees involved in depositing and withdrawing assets from a liquidity pool. Anticipating the price fluctuations of the assets in both directions is equally important.

 One of the potential issues that may arise is the intermittent loss risk, which can be calculated beforehand. It is recommended to familiarize oneself with the nature of IL before utilizing a liquidity pool, and utilize one of the various online intermittent loss calculators available to make more accurate predictions.

Facebook
Twitter
LinkedIn
WhatsApp
Telegram
Reddit

More to explore

accept bitcoin payment

Spot Bitcoin ETFs: What You Need to Know

In recent years, the discussion around spot Bitcoin Exchange Traded Funds (ETFs) has been heating up, particularly in the crypto community. ETFs,

Get on the VIP list!

Get company and PTPWallet updates and news sent straight to your inbox. No spam. Unsubscribe at any time. 


Get on the VIP list!

Get company and PTPWallet updates and news sent straight to your inbox. No spam. Unsubscribe at any time.