Crypto 101
Author
Clara Lee
Published
09 Nov 2022
Share
SUMMARY
Share
An Automated Market Maker (AMM) is a protocol that automatically prices crypto assets that are traded in liquidity pools without the need for directly transacting buyers and sellers. Traders interact with AMM smart contracts, aka the liquidity pool to exchange tokens.
In traditional finance, buyers and sellers that are trading offer various prices for the assets, other traders will then find if there is a suitable price that is listed and proceed to trade, upon completion, that price becomes the market price. As such, the price listed on the market is not automated, with every investment, there must be a buyer or seller in that transaction; moreover, the buyer and seller of the assets sometimes will not find their matched seller or buyers. This is where traditional market makers are involved.
According to Andrew Bloomenthal - Investopedia, “market maker refers to a firm or individual who actively quotes two-sided markets in a particular security, providing bids and offers (known as asks) along with the market size of each. Market makers provide liquidity and depth to markets and profit from the difference in the bid-ask spread. They may also make trades for their own accounts, which are known as principal trades”. This helps to create liquidity in the market and helps transactions happen quickly and smoothly. Without market makers, the market would be less liquid and less lively, making transactions difficult for investors.
Centralized exchanges such as Binance or Coinbase work similarly to traditional financial markets, in which the exchanges also serve as market makers. This becomes the problem of one-single failure point that the exchange locks your account or decides not to trade with certain users (financial sanction). Since crypto is created to reduce centralization, crypto users what to have a place where they can trade, and exchange tokens without any middlemen. AMM is a revolutionary solution.
Conversely, AMM provides a new decentralized alternative to asset pricing that has revolutionized decentralized exchanges. Since the AMM is a protocol and not a human entity, it is always available for trading and does not depend on any middleman between buyers and sellers. People can think of a liquidity pool as a fund reservoir of crypto assets that anyone can access. Those who provide liquidity to this reservoir will receive a portion of the transaction costs for each user interaction in return for providing liquidity.
AMM protocols are built by smart contracts. This means that instead of trading with other individuals, users are trading with the liquidity that is already locked within the smart contracts. All transactions will be fully automated, and since decentralization is a core principle of crypto and naturally decentralized finance, AMMs serve the purpose of evening the playing field so that no one can control or manipulate the greater system. As such, AMMs promote a more equitable trading environment, preventing centralized entities from charging exorbitant fees.
The AMM’s smart contract is the program that locks liquidity in what is known as a liquidity pool. This smart contract, by nature, is immutable, meaning that no one can simply change the smart contract in order to change previous transactions or their terms. Interestingly, anyone can be a liquidity provider if they hold any type of ERC-20 tokens and provide the tokens to the AMM’s liquidity pool. This is how liquidity providers earn profits – by earning the fee required by traders who interact with the liquidity pool.
AMMs use a mathematical formula that is designed to avoid discrepancies in the pricing of pooled assets and to ensure that the ratio of assets in liquidity pools is as balanced as possible. The most common formula for AMMs was proposed by Uniswap:
x*y = k
While x represents token A, y represents token B and k is a constant. In other words, the amount of token A and the price of token B multiplied together always equal the same number. In addition, users can exchange tokens basically by shifting the market makers’ position based on the x*y=k curve. When the curve shifts right, the amount of tokens x that the traders have to put in is the amount of how much the curve moves right; hence, the amount of which the curve shifts the point down correlates to how much token y is withdrawn out. For example, the illustration above shows a hypothetical liquidity pool comprising two tokens, USDT and ETH. To provide to the liquidity pool, the liquidity provider must transfer USDT and ETH in proportion to the two crypto assets' dollar values in the pool. By using the formula x*y=k, we know that k is 130,000 (13,000 USDT*10 ETH).
In order to calculate how much USDT the trader needs to pay, we’ll calculate this equation (13,000 + x) * (10 - 1) = 130,000 where x is the amount of USDT that needs to be paid. After calculating, we know that x = 1,444.44 USDT, which means the trader has to pay an additional 144.44 USDT to get 1 ETH. As the supply of USDT in the liquidity pool goes up, the price of 1 USDT decreases; conversely, as the amount of ETH goes down, ETH price goes up. The visual above is for illustration only; realistically, the difference in price for paired liquidity pool tokens will not be as steep as it would be in a liquidity pool with a much larger total supply.
Liquidity providers get their profits just by supplying assets to the pool, which is a combination of traders’ swapping fees and the reward fees provided by the decentralized exchange (DEX). In practice, liquidity providers may experience losses if the relative prices of the two crypto assets on other exchanges deviate significantly from the bonding curve's (the relationship between price and the supply of an asset) predicted value. When the value-increasing crypto asset is withdrawn by traders, the loss is realized, leaving the liquidity providers worse off than if they had kept their money outside of the pool. This is called "impermanent loss", we will talk about this topic in the following article.
https://www.coindesk.com/learn/2021/08/20/what-is-an-automated-market-maker/
https://www.gemini.com/cryptopedia/amm-what-are-automated-market-makers
https://coin98.net/what-is-amm
https://medium.com/everstake/staking-or-liquidity-providing-which-is-right-for-you-a382efb034a9