Discover more from Web3 Bits and Bytes
Automated Market Makers - AMM 101
What are AMMs? Why do we need it? AMMs have fueled decentralized finance, but they also have several challenges. A blessing or a curse?
Hello / Namaste / Vanakkam Readers 🙏🙏
Brahmastra is out, and Indians are honestly losing it. From memes to reviews, almost every one is cringing at the sorry state of the script (Like love storiyan wasn't already enough 😅). But at web3 Bits n Bytes, we believe everyone should be given a fair chance. So here’s yours to kill it at learning all about the new web - Web 3.0.
We recently concluded the Web3 Glossary series at Bits n Bytes. And its time for somthing new. If you’ve subscribed to the newsletter, you’ll be a receiving a daily dose of web3 gyaan right into your inbox every Tuesday🤩. Stay tuned.
And if you haven’t subscribed yet, what are you waiting for? Start your web3 learning journey today 👇👇
We’re all familiar with the centralized/traditional way of banking and the process of sending and receiving money. On any conventional trading platform, buyers and sellers propose multiple prices for an asset/stock.
📌When other users find a listed price acceptable, they trade it, and that price becomes the asset’s market price. Stocks, gold, real estate, and a variety of other assets are traded using this traditional market structure.
Automated market makers (AMMs), on the other hand, employ a different trading method. It allows two users to swap assets without the need for a third party to facilitate the transaction.🤑🤑
Simply put AMM is the underlying protocol that powers all the decentralized exchanges (DEXs).
📌This reduces the need for centralized authority like exchanges and other financial institutions. Instead of a traditional market of producers and customers, AMMs employ liquidity pools to allow digital assets to be transferred automatically without the need for consent.
P.S.: Liquidity (smeasured as market depth sometimes) refers to how much one asset can be traded for another asset at a given price level.
AMM is the foundation protocol for autonomous trading mechanisms on decentralized exchanges and has driven the rise of DeFi.
If you look at it, this branch of Decentralized finance (DeFi) allows strangers on the internet to earn money pretty much the same way as bankers do, by earning fees on financial services.
How does this work?🤔
When it comes to earning money, In most cases, people do so by providing liquidity. Investors stake/lend, digital currencies, not fiat (dollars/Euros/Rupee), and they lend digital currencies to DApps rather than to people or companies. Decentralized exchanges (DEXs) are one such set of DApps with the most need for liquidity and the heaviest flow of transactions, particularly AMMs led by Uniswap.
Its imperative to understand a fundamental difference between CEx and how AMMs work. Users don't trade against another person – they trade with the smart contract, (a kind of software program). An AMM is always willing to buy and always willing to sell at a stated price.
But, Who are market makers? 🤔
The ones who supply liquidity. Liquidity in trade refers to the ease with which an item can be acquired or sold.
Let’s understand this. Say a trader A wants to purchase one BTC. The centralized exchange that handles the sale has an automated mechanism that finds a seller, trader B, ready to sell a BTC at the rate given by trader A. The exchange is operating as a middleman in this case.
Automated market makers are part of decentralized exchanges (DEXs), which were created to eliminate the need for any middlemen in the trade of crypto assets. Think of AMMs as computer software that automates the provision of liquidity. These protocols use smart contracts, which are self-executing computer programs that mathematically set the price of crypto tokens and offer liquidity.
Automated market makers are doing wonders in the crypto industry by increasing their efficiency and ease of usage among the people and also benefiting the investors.
Why are AMMs important to investors?
AMM assists in the establishment of a liquidity system to which anybody can contribute, thus eliminating the need for a middleman and cutting transaction costs for investors.
High liquidity is necessary for a healthy trading environment, insufficiency of which can lead to slippage.
AMMs also allow anybody to become a liquidity provider, which comes with perks. Liquidity providers are paid a small percentage of the fees collected on transactions conducted through the pool.
The Defi ecosystem is rapidly evolving, but three AMM models have emerged as the most popular: Uniswap, Curve, and Balancer
📌To make a deal in the AMM protocol, you don’t require another trader. Instead, you can use a smart contract(a computer program) to exchange. As a result, trades are peer-to-contract rather than peer-to-peer.
A mathematical formula determines the price you receive for an item you wish to purchase or sell. Anyone can become a liquidity provider in AMM if they fulfill the smart contract’s conditions. Therefore, the liquidity provider will need to deposit a set number of Ether and Tether tokens into the ETH/USDT liquidity pool.
Liquidity providers can receive fees on trades in their pool in exchange for providing liquidity to the protocol.
Let’s understand how Uniswap works:
📌It’s powered by constant product formula, i.e. X * Y = k. No order books needed!
where X and Y denote the portion of the token in the Liquidity pool and k : a constant that denotes the total liquidity pool
Let’s consider a ETH/USDT liquidity pool. Let’s call the ETH portion of the pool X and the USDT portion Y. Uniswap takes these two quantities and multiplies them to calculate the total liquidity in the pool(k). Let’s call this k. The core here being k must remain constant, implying the liquidity in the pool should be constant.
What happens when someone wants to make a trade?
Let’s say Ram buys 1 ETH for 500 USDT using the ETH/USDT liquidity pool. By doing that, he increases the USDT portion of the pool and decreases the ETH portion of the pool. This effectively means that the price of ETH goes up.
Coz, there’s less ETH in the pool after the transaction, and the total liquidity (k) must remain constant. This mechanism is what determines the pricing. Ultimately, the price paid for this ETH is based on how much a given trade shifts the ratio between X (ETH) and Y(USDT)
📌It’s worth noting that it’s not linearly scalable. Larger orders become exponentially more expensive compared to smaller orders, leading to larger and larger amounts of slippage.
There’s no denying that AMMs come with a lot of benefits but also a fair share of potenetial pitfalls. It’s a boon or a bane for the DeFi space?🤔🤔
AMMs enables various Defi capabilities that standard exchanges cannot match. Let’s take a look at few:
Less room for manipulation– CEXs are infamous for market manipulation and insider trading. DEXs certainly have no possible way of tweaking the pricing in their favor as no one benefits from such acts.🤑
Decentralization– All orders are autonomously executed by smart contracts. Hence, DEXs, along with governance structures, effectively shift platform and asset ownership to users. 🤩
AMMs eliminate the need for centralized exchanges and traditional market-making techniques that could sometimes lead to price manipulations and liquidity crises.😮
But here’s a catch.🤯🤯
Although there are many comparative advantages of DEXs over CExs - greater security and opportunities for community building among token holders, AMMs are in some way imperfect😳
One of the major limitations to AMMs is the phenomenon of front running, which happens when another user places a similar trade as a prospective buyer, but sells it immediately after.
😬Because the transactions are public, and the buyer has to wait until they can get added to the blockchain, others can view them and potentially place bids.😬
Front runners dont’t intend to execute the trade, rather, they are simply identifying transactions and bidding on them to shoot up the price so that they can sell back and earn a profit. Essentially sandwiching your trade. For a deep dive on this check out this simple explanation.
Though AMMs offer significant returns to the liquidity providers(LPs), there are risks involved: Impairment loss 😮💨
When a token price rises or falls after you deposit it in a liquidity pool, you as a LP incur crypto liquidity pools' impermanent loss. Larger the shift in the price ratir, large the loss. As long as you don’t withdraw your deposited tokens during the time the pool is experiencing a shift in pric eratio, it’s possible to mitigate the loss.
AMMs do have their fair share of flaws but also driving the growth of the DeFi ecosystem. Time will tell how current challenges to the problems plaguing AMMs fare, but one thing’s clear - The DeFi community will need to apply best practices from business to sustain the community going forward.🚀🚀
That’s a wrap for today
Stay tuned for the best of web 3.0, every Tuesday🥳🥳
As ever, thank you for subscribing and reading. It matters. It’s a big deal to me.
And, remember, half-true compliments and feedbacks are always welcome at👇
laisha.wadh [at] gmail [dot] com