Skip to main content

High-level description of Automated Market Maker (AMM) - State of adoption in Decentralized Exchanges (DEX) (P.3)

         High-level description of Automated Market Maker (AMM)

Automated market making is not a new notion, with Hakansson, Beja, and Kale (1985) first simulating demand smoothing with a "programmed specialized" market maker.

Even in weakly traded markets, they found automatic demand smoothing to be cost-effective, despite its limited scope. The seminal studies on logarithmic market scoring rules (LMSR) by Robin Hanson (Hanson (2003) and Hanson (2007)) explore an early AMM model within traditional markets. They argue that automation provides significant cost and modularity benefits. His logarithmic model, on the other hand, was unable to maintain efficient price discovery in markets with low and high liquidity.

Othman, Pennock, Reeves, and Sandholm (2013) solve this problem by developing a "liquidity sensitive" AMM that makes money in volatile markets. Gerig and Michayluk (2010) found that automated liquidity provision establishes more efficient prices, enhances informativeness, but raises trader transaction costs. 

AMM's basic terms

As referred, Automated Market Maker is the main feature of Decentralized Exchanges. Trades that happen directly between user wallets on an exchange like Binance DEX are referred to as peer-to-peer (P2P) transactions, but trades that happen between users and contracts on an AMM-based exchange are referred to as peer-to-contract (P2C) transactions (Binance.com). Components of AMM include actors and assets to interact with smart contracts, as well as mechanism and economics. 

  1. Actors 

Liquidity Providers (LP): A liquidity pool can be established using a smart contract and an initial quantity of crypto assets provided by the first LP. Other LPs can then raise the pool's reserve by adding more of the assets in the pool. In turn, they are given pool shares commensurate with their liquidity contribution as a percentage of the total pool (Alex, 2020). LPs profit from transaction fees levied by exchange customers. While there may be a withdrawal penalty in some cases, LPs can freely withdraw funds from the pool (F.Martinelli &  N. Mushegian, 2019) by relinquishing a matching number of pool shares (Alex, 2020).

Exchange users (Traders): A trader places an exchange order with the liquidity pool by stating the input and output asset as well as the quantity. The exchange rates are calculated automatically by the smart contract (Jiahua Xu, 2022) and different between pairs of tokens but not always in sync perfectly which opens up opportunities for arbitrageurs (Ye Wang, 2022) who take advantage of price inefficiency to find a profitable method (Naratorn B, Warodom W, nd). Uniswap V2 lost 138 millions USD in revenue over eleven months due to arbitrageurs (Ye Wang, 2022).

Protocol foundation: A team of founders, developers are responsible for building an user-friendly protocol where LPs and traders interact with smart contracts.

  1. Assets

Risk assets: Characterized by illiquidity (Jiahua Xu, 2022), are the major type of assets for which AMM-based DEX are created. If the centralized exchange has initial exchange offering (IEO), the AMM-based DEX has a capital raising activity known as a "initial DEX offering (IDO)" that is especially ideal for illiquid assets. A risk asset must be whitelisted and compliant with the protocol's technical requirements to be eligible for an IDO (for example, ERC-20 (ethereum.org) for most AMMs on Ethereum).

Base assets: A trading pair must always include a risk asset and a selected base asset, according to some regulations (Jiahua Xu, 2022). BTC and ETH are used as base assets in the majority of situations, but accepted base currencies differ for each exchange (gemini.com, 2022) using native tokens or stablecoin pegged by USD. Aave uses a risk assessment methodology to analyze risk for each asset, consequently, ETH, its wrapped token WETH and stablecoin USDC are the lowest risk assets and volatility (Aave.com, 2021), that's why they are the most popular choice of base assets. Risk and profit of different liquidity pools affect liquidity provider behaviors to redistribute their investment (Lioba, Ye & Roger, 2021). In the next chapter, I will look at liquidity providers' movements in order to better understand their motivations.

Liquidity shares: Indicate ownership in a pool's asset portfolio and are given to Liquidity Providers. In Uniswap, for example, liquidity providers can mint liquidity by investing both ETH and tokens. By burning the potion of liquidity, liquidity providers can withdraw their ETH and token deposited (Y Zhang et al, 2018).

Governance tokens: Tokens that provide users ownership rights on the decision of AMM -e.g., adding or removing trading pairs as well as changing the exchange's fee and vote structure (Christos.A et al, 2021). User engagement and market capitalization of a DEX may be affected by the airdrop of the governance token or the award of liquidity mining.

  1. Fundamental AMM mechanism and economics

This study is based on a broad body of market microstructure research. From game-theoretic perspective, Massimo, James and Alberto (2022) provided a theory of Automated Market Maker in DeFi which is an abstracts operational model of user's interaction with AMM. The original aspect of this model considers the key economic mechanism is swap rate function to determine exchange rate between tokens. Jiahua’s team (2022) states that AMM involves both swap rate and liquidity provision/withdrawal. 

The theory of AMM by Massimo et al (2022) requires that as long as the starting reserves of an AMM must be strictly greater than zero, funds cannot be frozen, users can redeem any quantity of tokens deposited in an AMM. Agostino (2021) investigates that “liquidity freezer” is more likely to happen for tokens with low expected returns. If the token exchange rate is excessively volatile, liquidity providers incur a substantial opportunity cost for holding those tokens in their portfolios. It reduces LP's incentives. 

Business model of the AMM-based DEXes

AMM-based DEXs differ from traditional order-book exchanges in that they allow traders to match market bids and/or asks. Again, smart contracts operate as middlemen and are referred to as Liquidity Pools in this scenario. Investors or, in this case, Liquidity Providers (LPs) can deposit a pair of equal-value tokens, such as ETH/DAI, into these Liquidity Pools (Fig. 8). In exchange, they will receive LP tokens as evidence of deposit and will be paid a percentage of the fee paid to the Buyer when they switch. The protocol's price function - commonly calculated by the constant rate formula - is used to assign a price to each token. The Buyer who wishes to trade - or "swap" - DAI for ETH will deposit DAI, plus interest, in the Liquidity Pool, and get ETH. This is called Automated Market Marker mechanism (Teng & Jiahua, 2022) 

Fig. 8. The business model of Decentralized Exchanges  (Teng&Jiahua, 2022)

From left to right, Liquidity Providers put a couple of assets in the Liquidity Pool, in this example DAI/ETH. They are given LP tokens in exchange as proof of their deposit. A smart contract sits in the center, handling locked assets, new deposits, swaps, and gas fees. A fee will be charged to the buyer who wishes to convert his DAI for ETH. This charge will be split pro-rata across all LPs, with a portion going to the DEX Treasury. 

The orders of buyers in smart contracts are written by miners, it is “a first-past-the-post race”, and the gas fee is obtained by the winner. As a result, a higher gas cost is likely to attract more miners, reducing the order processing time (Michael B & Marius Z, 2020). 

Types of AMMs for Decentralized Exchanges


Fig. 9. Types of Automated Market Maker within the broader taxonomy of DEX 

Johannes et al classify AMM into Constant Function Market Maker (CFMM) and Token Swap Market Maker (TSMM). The term CFMM refers to a function variation that requires the content of two or more liquidity pools in a trading pair to approximate a constant k. Constant Product Market Maker (CPMM) has received the most attention in the DeFi community and is the most popular model of AMM used by the two leading DEXes - Uniswap and Sushiwap. Constant Product is a special case of Constant Mean (CMMM) (Vijay Mohan, 2022). Jiahua (2022) states that Constant Sum (CSMM) is another representative form of CFMM because it has no price slippage but it is unfit for DEX use cases due to arbitrage problems (Vijay Mohan, 2022). Curve Finance integrates exchange function of both CPMM (CMMM) and CSMM (Curve Finance, 2021), Bancor dynamically adjusts weights (DAMM) in response to changes in the external market price (Eyal H et al, 2017) instead of using directly CMMM like Balancer (Martinelli and Mushegian, 2019). Besides, concentrated liquidity (CLMM) is defined by Uniswap V3 to improve the current issues of CPMM (Uniswap.org). Both the basic AMM mechanism CPMM and the innovation  model CLMM will deep-dive in the next section. 


Comments

Popular posts from this blog

Uniswap V3 Breakdowns - State of adoption in DEX (P.8)

  On 23 March 2021, Uniswap team announced the details of their upcoming V3 release but it officially launched on 5 May 2021.  As a result, all analysis of Uniswap V3 would take place from May 2021 onwards.  Fig. 47.  Number of market supported on Uniswap V3 A day after its launch, about 280 new pools were formed in which the 0.3%-fee market had 151 pools because users were becoming accustomed to the general fee of the previous version. Besides, users also created many new pools in the 1%-fee market with 99 new pools. Other lower fee tiers were not of favor to liquidity providers, 0.05%-fee market has only 31 new ones, while no pool was in 0.01%-fee market. Up to now, the number of pools created on V3 has been fairly limited, averaging only about 2 to 20 pools established daily (Fig. 47). It is insignificant when compared to V2.  Fig. 48. Daily positions created in Uniswap V3 in May 2022 In May 2022, on average, more than 300 positions were generated every day;...

State of adoption in DEX (P.10)

  A powerful incentive of AMM-based DEX for liquidity provision The results from analyzing the operation of Uniswap V2 and V3 reveal answers to the research question. In most circumstances, exchange operators have a motivation to attempt to and enhance the observed volume on a certain exchange. Increased volume indicates increased liquidity and trust, which will attract more people. This motivation may differ for completely decentralized exchanges, but it is a significant aspect to consider for most existing ones. According to the previous section, V3 market is extremely active when gradually occupying the market share of its predecessor, especially recently when the number of users participating as traders in both versions has become equal. Although the number of pairs made on V3 cannot be compared with a huge variety of pairs on V2, it does not affect the number of swaps executed on V3, particularly in May 2022. All these aspects are facilitating V3 to be an attractive market for...

Uniswap V3 Polygon Breakdowns - State of adoption in DEX (P.9)

The Uniswap community approved the deployment of Uniswap V3 on Polygon in December 2021. Since then the number of swaps per day has been around 65,000  or less (Fig. 64). However in May 2022, this number has spiked, particularly on 11 May 2022, more than 174 thousand of swap was executed with $348.1m of trading volume (Fig. 65). The liquidity providers reaped about $245k of fee (Fig. 66) and Uniswap V3 Polygon gained $240k revenue (Fig.67) at the same time. It was the time when V3 Polygon achieved the most profit ever. Compared with V3 on Ethereum, the popularity of V3 Polygon is still restricted. On the same day, the traded volume of V3 Ethereum was $544m, and a $1.63m fee was generated for LPs. It can be seen that only 1.56 times higher trading volume brought 6.65 times higher LP’s fee in V3 Ethereum. Looking at the Polygon price per trade, except for several days in Jan 2022 with a higher gas fee of more than $0.7 per swap, each transaction on V3 Polygon just costs about $0.115 ...