Rather than depending on traditional buyers and sellers in a market, Automated Market Maker uses liquidity pools to make the DeFi ecosystem liquid high all the time. When Uniswap started in 2018, it was the first decentralized marketplace to effectively use an automated market maker mechanism. In recent years, there has been a surge in interest in decentralized finance (DeFi). In this article, we will get a complete understanding of Automated Market Maker.
Table of Contents
- Definition: CEXes regulates the transactions on their platform and offers an automated mechanism that guarantees trading orders are correctly matched.
- Example: If Trader X decides to purchase one bitcoin for $40,000, the exchange makes sure that it finds a Trader Y ready to sell one bitcoin at Trader X’s chosen rate. As a result, the CEXes serves as an intermediary between them.
- Goal: Its goal is to make the procedure smooth, match users buy and sell orders as instantly as possible.
- Disadvantage: If the exchange cannot locate precise matches for buy and sell orders instantly, there is low liquidity.
- Price Slippage: When liquidity is low, the price of an asset at the time of completing a trade fluctuates significantly before the trade is completed. To prevent this, CEXes must ensure that transactions are completed instantly.
Automated Market Makers:
- Definition: They enable the trading of digital assets in a permissionless and automated manner by utilizing liquidity pools.
- Users of AMM provide liquidity pools with crypto tokens, the prices of which are set by a constant mathematical formula.
- AMM systems were first implemented by Shearson Lehman Brothers and ATD in the early 1990s.
- Vitalik Buterin made a blog post on Reddit. He described an x * y = k algorithm-based mechanism for on-chain DEXes.
- In a long blog post, the Gnosis team concretely conceptualized the AMM model.
- Bancor implemented the model, holding a $153 million ICO to fund a fully on-chain DEX development. It was the largest ICO ever at the time, solving the liquidity problem without using centralized methods.
- Uniswap, received a $100,000 grant from the Ethereum Foundation. Within a few months, Uniswap was competing with Bancor’s trading volumes.
- In terms of an Asset: It refers to the capacity to exchange an asset without significantly changing its price, as well as the ease with which an asset can be converted to cash. The more liquid an asset is, the easier it is to convert it to cash.
- In terms of Markets: It refers to the quantity of trading activity in a market. The more trading volume there is in the market, the more liquid it is.
- In terms of Trading: It refers to how quickly an item can be bought and sold. High liquidity indicates that the market is busy and that many traders buy and sell a certain item. Low liquidity indicates less activity and that it is more difficult to purchase and sell an item.
- Definition: It is a crowdsourced pool of cryptocurrencies or tokens locked in a smart contract and used to enable trades between such assets on DEXes.
- Relationship: More assets are in the pool, and the pool has more liquidity. The easier trading becomes on DEXes.
- Definition: They are the users that deposit their tokens into a liquidity pool.
- LP Tokens: In exchange for providing liquidity, users are generally granted liquidity provider tokens, which reflect the user’s share in the liquidity pool.
Constant Product Formula
- It is a basic mathematical formula that has taken many different forms.
- Vitalik’s Formula: The most widely used was suggested by Vitalik Buterin as
tokenA balance (p) * tokenB balance (p) = k
- UniSwap’s Formula: Same formula is implemented on UniSwap as
x * y = k.
- Explanation: The constant k denotes a constant balance of assets that determines the price of tokens in a liquidity pool. The x and y represent equal quantities of pool assets.
- Example: If an AMM contains ether (ETH) and bitcoin (BTC), two volatile assets, the price of ETH rises every time ETH is purchased since there is less ETH in the pool than before the transaction. In contrast, when more BTC is added to the pool, the price of BTC falls. The pool is always in a state of equilibrium.
In this section, we will understand the working of AMMs by taking Uniswap as an example.
- Step 1: Assuming we are using Uniswap to buy ETH tokens with UNI tokens.
- Step 2: When we click on the swap button, the algorithm performs some calculations to determine how our trade will affect the liquidity pool’s reserves and then provides us with a price.
- Step 3: The smart contract puts our UNI tokens into the ETH-UNI pool.
- Step 4: It transfers the amount of ETH specified from the pool to our wallet.
- Step 5: AMM protocols employs x * y = k formula to price assets.
- Step 6: To buy ETH (x) on Uniswap, we must first add UNI (y) tokens to the pool. Keep in mind that k requires that the quantity of liquidity stay constant. So, adding UNI tokens increases one side of the pool while lowering the other (removing ETH).
In this section, we will understand arbitrage trading on AMMs.
What is Arbitrage Trading?
- It is the method of identifying price variations in an asset across several exchanges, purchasing it on the platform where it is somewhat cheaper and selling it on the platform where it is a little higher.
- They identify assets trading at lower prices in liquidity pools and purchase them up until the asset’s price recovers to its market price. For example, if the price of ETH in a liquidity pool is lower than its exchange rate on other marketplaces,
- When large orders are placed in AMMs, a significant amount of a token is removed or added to a pool.
- This leads to discrepancies between the asset’s price in the pool and its market price.
- Example: The market price of ETH can be $2,500, but in a pool, it may be $2,200 because someone added a large amount of ETH to a pool to remove another token.
- This means that ETH would be trading at a discount in the pool, creating an arbitrage opportunity.
- Arbitrage traders will profit by purchasing the ETH in the pool at a cheaper rate and selling it at a higher price on external exchanges.
In this section, we will understand yield farming on AMMs.
What is Yield Farming?
- Definition: Activity of staking or lending crypto assets to produce large returns or rewards in the form of extra crypto.
- Liquidity Providers on Automated Market Maker can also take advantage of yield farming.
- Step 1: We need to deposit the necessary proportion of our assets in a liquidity pool.
- Step 2: The AMM protocol will issue us LP tokens after our deposit is verified.
- Step 3: We will have maximized our revenues by utilizing the composability, or interoperability, of DeFi protocols.
- Step 4: We will need to redeem the liquidity provider token to withdraw our funds from the liquidity pool.
Major Implementations of Automated Market Maker
In this section, we will understand various implementations of AMMs.
- It is an interface for exchanging ERC20 tokens built on Ethereum.
- It was launched in November 2018.
- It is dedicated to enabling free and decentralized asset exchange by serving as an open-source frontend interface for traders and liquidity providers.
- It intends to provide token trading automated and available to anybody who has tokens.
- It is a DEX that allows us to trade BEP20 tokens on Binance Smart Chain.
- It employs an automated market maker model in which users trade against a liquidity pool.
- These pools are filled with users funds. Users deposit their funds into the pool in exchange for liquidity provider tokens.
- They can reclaim their share and a portion of the trading fees by using LP tokens.
- It is a DEX for stablecoins that uses an automated market maker to manage liquidity.
- It was launched in January 2020.
- It has shown significant growth in the second half of 2020.
- It enables fast, efficient, and low-friction stablecoin swaps.
- It is built on the Ethereum blockchain.
- It was launched in March 2020.
- Its protocol acts as a weighted portfolio, price sensor, and liquidity provider self-balancing.
- It lets users earn profit using its $BAL token by contributing to customizable liquidity pools.
- It is an example of an automated market maker.
- It was launched in September 2020 as a fork of Uniswap.
- The trading cost on Uniswap is 0.3 percent; however, SushiSwap divides the 0.3 percent differently, distributing 0.05 percent in the form of SUSHI tokens.
- It also wants to add extra features which were not previously present on Uniswap.
In this section, we will understand the advantages of Decentralized Exchanges.
- They do not require sign-ups, KYC checks etc.
- Anyone with a cryptocurrency wallet and an internet connection can trade at any time.
- AMM exchanges obtain liquidity from users who are willing to deposit their assets in exchange for a portion of the trading fees.
- This leads to high liquidity, unlike CEXes rely on huge market makers for liquidity.
In this section, we will understand the disadvantages of Decentralized Exchanges.
Smart Contract Risk
- Problem: When we place our crypto into a smart contract on an AMM protocol, we become a liquidity provider. If there is a bug in the smart contract, a hacker can take advantage of it. This might result in the total loss of our funds.
- Solution: DeFi protocols, such as Compound, Aave, and Yearn Finance, maintain a sizable reimbursement fund to tackle such a scenario.
- Problem: It occurs when the price ratio of deposited tokens changes after they have been put in the pool. The more the change, the greater the impermanent loss. Impermanent loss is insignificant if the pair’s price ratio maintains within a small range.
- Solution: It is reduced by depositing pairs of stablecoins (which have more or less identical values) on AMM protocols.
Conclusion: Automated Market Makers
Even though Automated Market Makers are new, many implementations have already shown to be an essential financial tool in the rapidly growing DeFi ecosystem. They have demonstrated improved liquidity for all users. AMMs are still in their early stages. There will very certainly be many more innovations in AMMs in the coming future.