May 12, 2023

May 12, 2023

May 12, 2023

A Guide to Understanding AMM

A Guide to Understanding AMM

A Guide to Understanding AMM

A guide to understanding AMM - Velar Blog
A guide to understanding AMM - Velar Blog
A guide to understanding AMM - Velar Blog

Introduction

Automated Market Makers (AMMs) are an important part of the DeFi offering, and rightly so. They represent everything that programmable blockchain technology typifies—decentralization, automation, and full-time end-user participation. Yet, one wonders how AMMs came to be.

Cryptocurrencies, like every financial instrument, have a market powered by exchanges. While centralized options like Binance and Coinbase are popular, decentralized exchanges are equally important, especially to players in the DeFi sector.

DEXs have evolved throughout the years, going beyond offering token swaps and peer-to-peer exchanges to allowing users to trade futures contracts and other instruments. In the early days, DEXs required market makers who matched buyers to sellers and maintained liquidity on the exchange.

It didn't take too long for market makers to attract criticism and allegations bordering on market manipulation. These problems opened up a vacuum for an innovation to fill—a decentralized exchange that required zero human input, where users could trade their coins at the best market prices seamlessly.

Enter AMMs.

An automated market maker is a DEX protocol that depends on algorithmic formulas and smart contracts. AMMs use mathematical formulas to price assets, thanks to their liquidity pool feature that allows two assets to pair with one another. When an average trader buys assets using an AMM, they interact with a smart contract instead of another trader. Thus, you can say AMMs operate with a peer-to-contract (P2C) model.

Importance of AMMs in DeFi

AMMs facilitate on-chain trade without intermediaries. Thus, they embody all that DeFi represents. Automated market makers are important to DeFi as their emergence has helped fashion several opportunities for traders and developers alike and helped the DeFi sector to grow exponentially.

For one, AMMs have increased user participation, as regular coin holders provide liquidity for trading, commit tokens towards yield farming, and participate in protocol governance. Also, through automated market makers, DeFi has moved beyond order book DEXs which are highly susceptible to human manipulation and less decentralized. Finally, AMMs have lowered the entry barrier for token exchanges, allowing anyone to create liquidity pools to facilitate trading.

How do AMMs Work?

The average AMM protocol involves three main sets of participants: traders, liquidity providers, and the protocol's team. While the latter is responsible for designing and developing the AMM protocol, traders create orders and pay swap fees while LPs lock in their assets to a liquidity pool to make trading possible.

Smart contracts are responsible for executing orders, while the price of the risk asset against the base asset or vice versa is automatically determined by the underlying formula of the AMM and the balance of assets in the corresponding liquidity pool.

AMM vs. Order Book Models

Here's how AMMs compare to order book DEXs:

All AMMs leverage a mathematical formula for pricing, critical to how they function. A liquidity pool is a basket of single, double, or multiple assets that make trading possible. When a trader places an order on an AMM, the smart contract reaches into the corresponding liquidity pool for the traded pair and executes the order.

Most liquidity pools pair one asset, e.g., BTC, against another, e.g., USDT, forming a BTC/USDT trading pair. Some AMMs support single-asset pools, while others have liquidity pools with more than two assets.

The first-generation AMMs utilized a constant function model. Constant function market makers utilized liquidity pools such that the value of one asset in the pair remained in constant proportion to that of the other asset. Some popular AMM formulas include:

  • A * B = K where A and B are liquidity pool assets, and K is constant. If A is 5 and B is 10, then K = 5 * 10 = 50. If more users sell A to buy B, the amount of B in the pool will reduce while A will increase. But because K = 50, the pool will balance itself such that, regardless of value changes, A * B will always be 50 (K).

  • Another AMM formula is A + B = K. If A = 5 and B = 10, then K = A + B = 15. No matter how the pendulum swings towards any asset in the pool, the sum of A and B must be 15.

  • (ABC)^(⅓) is another popular AMM formula. Protocols that adopt three-asset liquidity pools use it to balance the ratio of assets in the pool and determine the best possible price for each token. In this case, K is the cube root of ABC.

Types of AMMs

Although AMMs are evolving, this article will cover three main types of AMMs, which are:

Constant Product AMM (CPMM)

This type of AMM is one of the most popular among the first-generation automated market makers. It uses the A * B = K formula, meaning that the product of both assets in the liquidity pool must remain constant. Uniswap is a popular AMM protocol that is a CPMM. The first formula above explains how CPMMs work.

CPMMs suffer high slippage and impermanent loss/gain issues due to high volatility and overdependence on rebalancing from arbitrage activity.

Constant Sum AMM (CSMM)

Another constant function model, the constant sum market maker, uses the A + B = K formula in managing its liquidity pool balance and asset pricing. One major drawdown of this approach is its inability to provide infinite pools. Traders will eventually empty one asset reserve, sending it to zero. The second formula above explains how CSMMs work.

Hybrid AMM

This approach leverages the CPMM and CSMM models to produce a unique formula to help reduce price impact for traders and adjust the risk exposure for liquidity providers. Curve Finance is a prominent example of an AMM that uses the hybrid model. With this approach, traders can access deeper liquidity due to reduced price impact and enjoy favorable exchange rates for a large portion of the price curve.

Advantages of AMMs

  • Liquidity provision: AMMs allow the average crypto user to participate in the exchange process and earn a potential yield on their holdings by providing liquidity to facilitate trading. Without sufficient liquidity, trading is nigh impossible due to the high price impact. Liquidity providers earn a portion of the swap fees that traders pay when they interact with a pool.

  • No need for intermediaries: AMMs eliminate middlemen activity using smart contracts and automated functions, reducing the risk of market manipulation and encouraging true decentralization.

  • Low fees: AMMs keep fees low since they do not use order books, which require a high maintenance cost that translates to high fees. Also, by incentivizing liquidity providers, AMMs attract deep liquidity, which in turn reduces slippage and results in low fees. Finally, AMMs use a fixed fee model that keeps fees stable and low.

Limitations of AMM Models

Impermanent Loss/Profit

This particular phenomenon is one of the most misunderstood in DeFi. Impermanent loss or gain is a floating value difference that liquidity providers experience on their assets due to price action. While impermanent gains are possible, losses are more likely to occur due to the price curve. Current AMM models do not do enough to protect LPs from impermanent loss.

Let's say Trader A provides $500k worth of ETH and $500k in USDC to an ETH/USDC pool on Uniswap at 1 ETH = 1,800 USDC. This LP is exposed to losses or gains from the price shifts in the pool. If 1 ETH falls to 1,600 USDC, Trader A will be in a losing position. Most times, LP fees are not sufficient to cover the impermanent loss.

Limited Control Over Price

Unlike traditional market makers who can choose which price points at which they want to buy or sell, liquidity providers on AMMs do not enjoy such a privilege. Thus, they have limited control over price, resulting in limited capital efficiency and high price impacts, especially when liquidity is low. Order book setups offer better capital efficiency in this regard since market makers have some control over price.

Conclusion

While AMMs are a giant step towards a truly decentralized economy, they remain a work in progress. Different iterations of AMMs have emerged recently to address the problems of high slippage, low capital efficiency (lazy liquidity), and impermanent loss, synonymous with first-generation AMMs. As automated market maker protocols evolve, they will streamline DeFi adoption and help drive the crypto space towards true decentralization.

Introduction

Automated Market Makers (AMMs) are an important part of the DeFi offering, and rightly so. They represent everything that programmable blockchain technology typifies—decentralization, automation, and full-time end-user participation. Yet, one wonders how AMMs came to be.

Cryptocurrencies, like every financial instrument, have a market powered by exchanges. While centralized options like Binance and Coinbase are popular, decentralized exchanges are equally important, especially to players in the DeFi sector.

DEXs have evolved throughout the years, going beyond offering token swaps and peer-to-peer exchanges to allowing users to trade futures contracts and other instruments. In the early days, DEXs required market makers who matched buyers to sellers and maintained liquidity on the exchange.

It didn't take too long for market makers to attract criticism and allegations bordering on market manipulation. These problems opened up a vacuum for an innovation to fill—a decentralized exchange that required zero human input, where users could trade their coins at the best market prices seamlessly.

Enter AMMs.

An automated market maker is a DEX protocol that depends on algorithmic formulas and smart contracts. AMMs use mathematical formulas to price assets, thanks to their liquidity pool feature that allows two assets to pair with one another. When an average trader buys assets using an AMM, they interact with a smart contract instead of another trader. Thus, you can say AMMs operate with a peer-to-contract (P2C) model.

Importance of AMMs in DeFi

AMMs facilitate on-chain trade without intermediaries. Thus, they embody all that DeFi represents. Automated market makers are important to DeFi as their emergence has helped fashion several opportunities for traders and developers alike and helped the DeFi sector to grow exponentially.

For one, AMMs have increased user participation, as regular coin holders provide liquidity for trading, commit tokens towards yield farming, and participate in protocol governance. Also, through automated market makers, DeFi has moved beyond order book DEXs which are highly susceptible to human manipulation and less decentralized. Finally, AMMs have lowered the entry barrier for token exchanges, allowing anyone to create liquidity pools to facilitate trading.

How do AMMs Work?

The average AMM protocol involves three main sets of participants: traders, liquidity providers, and the protocol's team. While the latter is responsible for designing and developing the AMM protocol, traders create orders and pay swap fees while LPs lock in their assets to a liquidity pool to make trading possible.

Smart contracts are responsible for executing orders, while the price of the risk asset against the base asset or vice versa is automatically determined by the underlying formula of the AMM and the balance of assets in the corresponding liquidity pool.

AMM vs. Order Book Models

Here's how AMMs compare to order book DEXs:

All AMMs leverage a mathematical formula for pricing, critical to how they function. A liquidity pool is a basket of single, double, or multiple assets that make trading possible. When a trader places an order on an AMM, the smart contract reaches into the corresponding liquidity pool for the traded pair and executes the order.

Most liquidity pools pair one asset, e.g., BTC, against another, e.g., USDT, forming a BTC/USDT trading pair. Some AMMs support single-asset pools, while others have liquidity pools with more than two assets.

The first-generation AMMs utilized a constant function model. Constant function market makers utilized liquidity pools such that the value of one asset in the pair remained in constant proportion to that of the other asset. Some popular AMM formulas include:

  • A * B = K where A and B are liquidity pool assets, and K is constant. If A is 5 and B is 10, then K = 5 * 10 = 50. If more users sell A to buy B, the amount of B in the pool will reduce while A will increase. But because K = 50, the pool will balance itself such that, regardless of value changes, A * B will always be 50 (K).

  • Another AMM formula is A + B = K. If A = 5 and B = 10, then K = A + B = 15. No matter how the pendulum swings towards any asset in the pool, the sum of A and B must be 15.

  • (ABC)^(⅓) is another popular AMM formula. Protocols that adopt three-asset liquidity pools use it to balance the ratio of assets in the pool and determine the best possible price for each token. In this case, K is the cube root of ABC.

Types of AMMs

Although AMMs are evolving, this article will cover three main types of AMMs, which are:

Constant Product AMM (CPMM)

This type of AMM is one of the most popular among the first-generation automated market makers. It uses the A * B = K formula, meaning that the product of both assets in the liquidity pool must remain constant. Uniswap is a popular AMM protocol that is a CPMM. The first formula above explains how CPMMs work.

CPMMs suffer high slippage and impermanent loss/gain issues due to high volatility and overdependence on rebalancing from arbitrage activity.

Constant Sum AMM (CSMM)

Another constant function model, the constant sum market maker, uses the A + B = K formula in managing its liquidity pool balance and asset pricing. One major drawdown of this approach is its inability to provide infinite pools. Traders will eventually empty one asset reserve, sending it to zero. The second formula above explains how CSMMs work.

Hybrid AMM

This approach leverages the CPMM and CSMM models to produce a unique formula to help reduce price impact for traders and adjust the risk exposure for liquidity providers. Curve Finance is a prominent example of an AMM that uses the hybrid model. With this approach, traders can access deeper liquidity due to reduced price impact and enjoy favorable exchange rates for a large portion of the price curve.

Advantages of AMMs

  • Liquidity provision: AMMs allow the average crypto user to participate in the exchange process and earn a potential yield on their holdings by providing liquidity to facilitate trading. Without sufficient liquidity, trading is nigh impossible due to the high price impact. Liquidity providers earn a portion of the swap fees that traders pay when they interact with a pool.

  • No need for intermediaries: AMMs eliminate middlemen activity using smart contracts and automated functions, reducing the risk of market manipulation and encouraging true decentralization.

  • Low fees: AMMs keep fees low since they do not use order books, which require a high maintenance cost that translates to high fees. Also, by incentivizing liquidity providers, AMMs attract deep liquidity, which in turn reduces slippage and results in low fees. Finally, AMMs use a fixed fee model that keeps fees stable and low.

Limitations of AMM Models

Impermanent Loss/Profit

This particular phenomenon is one of the most misunderstood in DeFi. Impermanent loss or gain is a floating value difference that liquidity providers experience on their assets due to price action. While impermanent gains are possible, losses are more likely to occur due to the price curve. Current AMM models do not do enough to protect LPs from impermanent loss.

Let's say Trader A provides $500k worth of ETH and $500k in USDC to an ETH/USDC pool on Uniswap at 1 ETH = 1,800 USDC. This LP is exposed to losses or gains from the price shifts in the pool. If 1 ETH falls to 1,600 USDC, Trader A will be in a losing position. Most times, LP fees are not sufficient to cover the impermanent loss.

Limited Control Over Price

Unlike traditional market makers who can choose which price points at which they want to buy or sell, liquidity providers on AMMs do not enjoy such a privilege. Thus, they have limited control over price, resulting in limited capital efficiency and high price impacts, especially when liquidity is low. Order book setups offer better capital efficiency in this regard since market makers have some control over price.

Conclusion

While AMMs are a giant step towards a truly decentralized economy, they remain a work in progress. Different iterations of AMMs have emerged recently to address the problems of high slippage, low capital efficiency (lazy liquidity), and impermanent loss, synonymous with first-generation AMMs. As automated market maker protocols evolve, they will streamline DeFi adoption and help drive the crypto space towards true decentralization.

Introduction

Automated Market Makers (AMMs) are an important part of the DeFi offering, and rightly so. They represent everything that programmable blockchain technology typifies—decentralization, automation, and full-time end-user participation. Yet, one wonders how AMMs came to be.

Cryptocurrencies, like every financial instrument, have a market powered by exchanges. While centralized options like Binance and Coinbase are popular, decentralized exchanges are equally important, especially to players in the DeFi sector.

DEXs have evolved throughout the years, going beyond offering token swaps and peer-to-peer exchanges to allowing users to trade futures contracts and other instruments. In the early days, DEXs required market makers who matched buyers to sellers and maintained liquidity on the exchange.

It didn't take too long for market makers to attract criticism and allegations bordering on market manipulation. These problems opened up a vacuum for an innovation to fill—a decentralized exchange that required zero human input, where users could trade their coins at the best market prices seamlessly.

Enter AMMs.

An automated market maker is a DEX protocol that depends on algorithmic formulas and smart contracts. AMMs use mathematical formulas to price assets, thanks to their liquidity pool feature that allows two assets to pair with one another. When an average trader buys assets using an AMM, they interact with a smart contract instead of another trader. Thus, you can say AMMs operate with a peer-to-contract (P2C) model.

Importance of AMMs in DeFi

AMMs facilitate on-chain trade without intermediaries. Thus, they embody all that DeFi represents. Automated market makers are important to DeFi as their emergence has helped fashion several opportunities for traders and developers alike and helped the DeFi sector to grow exponentially.

For one, AMMs have increased user participation, as regular coin holders provide liquidity for trading, commit tokens towards yield farming, and participate in protocol governance. Also, through automated market makers, DeFi has moved beyond order book DEXs which are highly susceptible to human manipulation and less decentralized. Finally, AMMs have lowered the entry barrier for token exchanges, allowing anyone to create liquidity pools to facilitate trading.

How do AMMs Work?

The average AMM protocol involves three main sets of participants: traders, liquidity providers, and the protocol's team. While the latter is responsible for designing and developing the AMM protocol, traders create orders and pay swap fees while LPs lock in their assets to a liquidity pool to make trading possible.

Smart contracts are responsible for executing orders, while the price of the risk asset against the base asset or vice versa is automatically determined by the underlying formula of the AMM and the balance of assets in the corresponding liquidity pool.

AMM vs. Order Book Models

Here's how AMMs compare to order book DEXs:

All AMMs leverage a mathematical formula for pricing, critical to how they function. A liquidity pool is a basket of single, double, or multiple assets that make trading possible. When a trader places an order on an AMM, the smart contract reaches into the corresponding liquidity pool for the traded pair and executes the order.

Most liquidity pools pair one asset, e.g., BTC, against another, e.g., USDT, forming a BTC/USDT trading pair. Some AMMs support single-asset pools, while others have liquidity pools with more than two assets.

The first-generation AMMs utilized a constant function model. Constant function market makers utilized liquidity pools such that the value of one asset in the pair remained in constant proportion to that of the other asset. Some popular AMM formulas include:

  • A * B = K where A and B are liquidity pool assets, and K is constant. If A is 5 and B is 10, then K = 5 * 10 = 50. If more users sell A to buy B, the amount of B in the pool will reduce while A will increase. But because K = 50, the pool will balance itself such that, regardless of value changes, A * B will always be 50 (K).

  • Another AMM formula is A + B = K. If A = 5 and B = 10, then K = A + B = 15. No matter how the pendulum swings towards any asset in the pool, the sum of A and B must be 15.

  • (ABC)^(⅓) is another popular AMM formula. Protocols that adopt three-asset liquidity pools use it to balance the ratio of assets in the pool and determine the best possible price for each token. In this case, K is the cube root of ABC.

Types of AMMs

Although AMMs are evolving, this article will cover three main types of AMMs, which are:

Constant Product AMM (CPMM)

This type of AMM is one of the most popular among the first-generation automated market makers. It uses the A * B = K formula, meaning that the product of both assets in the liquidity pool must remain constant. Uniswap is a popular AMM protocol that is a CPMM. The first formula above explains how CPMMs work.

CPMMs suffer high slippage and impermanent loss/gain issues due to high volatility and overdependence on rebalancing from arbitrage activity.

Constant Sum AMM (CSMM)

Another constant function model, the constant sum market maker, uses the A + B = K formula in managing its liquidity pool balance and asset pricing. One major drawdown of this approach is its inability to provide infinite pools. Traders will eventually empty one asset reserve, sending it to zero. The second formula above explains how CSMMs work.

Hybrid AMM

This approach leverages the CPMM and CSMM models to produce a unique formula to help reduce price impact for traders and adjust the risk exposure for liquidity providers. Curve Finance is a prominent example of an AMM that uses the hybrid model. With this approach, traders can access deeper liquidity due to reduced price impact and enjoy favorable exchange rates for a large portion of the price curve.

Advantages of AMMs

  • Liquidity provision: AMMs allow the average crypto user to participate in the exchange process and earn a potential yield on their holdings by providing liquidity to facilitate trading. Without sufficient liquidity, trading is nigh impossible due to the high price impact. Liquidity providers earn a portion of the swap fees that traders pay when they interact with a pool.

  • No need for intermediaries: AMMs eliminate middlemen activity using smart contracts and automated functions, reducing the risk of market manipulation and encouraging true decentralization.

  • Low fees: AMMs keep fees low since they do not use order books, which require a high maintenance cost that translates to high fees. Also, by incentivizing liquidity providers, AMMs attract deep liquidity, which in turn reduces slippage and results in low fees. Finally, AMMs use a fixed fee model that keeps fees stable and low.

Limitations of AMM Models

Impermanent Loss/Profit

This particular phenomenon is one of the most misunderstood in DeFi. Impermanent loss or gain is a floating value difference that liquidity providers experience on their assets due to price action. While impermanent gains are possible, losses are more likely to occur due to the price curve. Current AMM models do not do enough to protect LPs from impermanent loss.

Let's say Trader A provides $500k worth of ETH and $500k in USDC to an ETH/USDC pool on Uniswap at 1 ETH = 1,800 USDC. This LP is exposed to losses or gains from the price shifts in the pool. If 1 ETH falls to 1,600 USDC, Trader A will be in a losing position. Most times, LP fees are not sufficient to cover the impermanent loss.

Limited Control Over Price

Unlike traditional market makers who can choose which price points at which they want to buy or sell, liquidity providers on AMMs do not enjoy such a privilege. Thus, they have limited control over price, resulting in limited capital efficiency and high price impacts, especially when liquidity is low. Order book setups offer better capital efficiency in this regard since market makers have some control over price.

Conclusion

While AMMs are a giant step towards a truly decentralized economy, they remain a work in progress. Different iterations of AMMs have emerged recently to address the problems of high slippage, low capital efficiency (lazy liquidity), and impermanent loss, synonymous with first-generation AMMs. As automated market maker protocols evolve, they will streamline DeFi adoption and help drive the crypto space towards true decentralization.

Stay ahead of the curve

Subscribe to our newsletter Bitcoin Bytes for timely insights, razor-sharp analysis, and real alpha about the rapidly evolving Bitcoin ecosystem.

No spam, only alpha!

Stay ahead of the curve

Subscribe to our newsletter Bitcoin Bytes for timely insights, razor-sharp analysis, and real alpha about the rapidly evolving Bitcoin ecosystem.

No spam, only alpha!

Similar to this

Similar to this

This guide covers the complete process of deploying and managing your pool on Velar - from initial setup to liquidity management.

This guide covers the complete process of deploying and managing your pool on Velar - from initial setup to liquidity management.

This guide walks you through each core feature, from bridging assets to earning yields through farming.

This guide walks you through each core feature, from bridging assets to earning yields through farming.

This comprehensive guide will explore how farming works for both existing and new pools

This comprehensive guide will explore how farming works for both existing and new pools

This guide covers the complete process of deploying and managing your pool on Velar - from initial setup to liquidity management.

This guide walks you through each core feature, from bridging assets to earning yields through farming.

©2024, All right reserved.

©2024, All right reserved.

©2024, All right reserved.