Dive in the Pool #2 : What is an AMM (Automated Market Maker)?š¤
Welcome back for episode #2 of Dive in the pool!
Based on our poll from last article (donāt forget to vote for next week topic at then end!), you want to know more about AMMs. Here at Lobster, we listen to our community! So get ready to know everything you need to understand about this essential component of decentralized finance (DeFi).
Letās dive in !
Curious about DeFi and its various components? Each week, our team at Lobster takes a closer look at one aspect of DeFi, turning you into an expert on this fast-moving financial sector.
In our previous article on liquidity pools (if you havenāt read it yet, click here), we briefly introduced the concept of AMM (Automated Market Maker). Now itās time to dive deeper into this innovation.
š¤Whatās an AMM ?
An AMM is a key element of DeFi. It is an algorithm that automates the process of executing trades on decentralized exchanges (DEX), making it possible for users to freely swaps their assets for another, 24/7, without an intermediary matching buyers and sellers.
AMMs operate through liquidity pools, where liquidity providers make cryptocurrency pairs available. These pools enable decentralized exchanges to operate. AMMs determine the price of an asset based on its quantity in the pool, according to a precise mathematical formula.
If a user adds (sells) a cryptocurrency to a pool, its price falls due to the increase in supply. Conversely, if a user withdraws (buys) a cryptocurrency, its price rises.
Now you got the big picture, but to make you a true expert, you need to know in detail how it works.
š¼How does an AMM work ?
There are several models of AMMs, but we wonāt explain all of them right now. Letās focus to the most widespread, the āConstant product market makerā formula: X*Y=K.
Here, X represents the total quantity of one token in the pool, Y that of the other token, and K is a constant.
Letās break it down and even if youāre not a math guy(or girl), donāt worry, itās pretty straightforward.
šLetās do some quick maths
Letās take an example:
We have a liquidity pool made up of ether (ETH) and USDC. Initially, the pool contains 500 ETH worth $500,000 and 500,000 USDC also worth 500,000. The value of 1 ETH is 1000 USDC. The constant K for this pool is calculated as follows:
K = Quantity of ETH * Quantity of USDC = 500 * 500,000 = 250,000,000.
Now consider a trader who wishes to exchange 10,000 USDC for ETH. After this exchange, the total quantity of USDC in the pool will increase by 10,000 to 510,000 USDC.
To maintain constant K at 250,000,000, we need to recalculate the new quantity of ETH in the pool. Letās use the formula X * Y = K, where Y is now 510,000 USDC :
500 ETH * 500,000 USDC = 250,000,000 (initial K) X ETH * 510,000 USDC = 250,000,000 (K must remain constant)
To find the new quantity of ETH (X), we rearrange the formula to calculate X :
X = 250,000,000 / 510,000 ā 490.196 ETH
This means that the new quantity of ETH in the pool after the exchange is approximately 490,196 ETH. If the pool originally had 500 ETH, this means that the user receives the difference, that is around 500ā490.196 = 9,804 ETH for his 10,000 USDC. This phenomenon is called āslippageā and happens when a large order is placed on a liquidity pool that is too illiquid to handle the size of the order.
The new ETH price in USDC can be calculated by dividing the total quantity of USDC by the total quantity of ETH in the pool:
New ETH price = Total quantity of USDC / Total quantity of ETH = 510,000 USDC / 490.196 ETH ā 1,040.4 USDC per ETH
So, after the transaction, the new price of one ETH in this liquidity pool is approximately 1,040.4 USDC.
In this example, the price change is quite marked, as the total value of the liquidity pool is not extremely high. However, in a pool worth millions of dollars, the impact on price would be much less significant.
Next, letās explore the various advantages that AMMs offer to users and liquidity providers in the DeFi ecosystem.
šAdvantages of AMMs
AMMs offer unique advantages such as :
- Enhanced Liquidity on decentralized exchanges : AMMs significantly boost the liquidity of decentralized exchanges. This high liquidity is crucial for the efficient operation of these platforms.
- Passive Income for Liquidity Providers: Those who contribute assets to liquidity pools (liquidity providers) can earn passive income through transaction fees generated within these pools. This is a key incentive for participation in the DeFi ecosystem.
While these advantages are significant, itās also important to consider the challenges faced by liquidity providers in these AMMs, particularly the concept of āimpermanent loss.ā
šŖChallenges for liquidity providers
Providing liquidity may seem risk-free at first glance. However, you need to be aware of the phenomenon known as āimpermanent lossā.
This loss occurs when the price of an asset in the pool diverges significantly from the price in the wider market. The liquidity provider could have earned more by simply keeping his cryptos in his portfolio.
This loss is said to be impermanent, because if the price returns to its initial level, there is no real loss. The loss is only effective if the liquidity provider withdraws his cryptos from the pool when the price is different from the one of his initial deposit. If this concept seems complex, donāt worry, weāll come back to it in our next article ā Vote in the poll at the end of this article!
š¦Lobster ā DeFi made easy
At Lobster, weāve created an algorithm in order to benefit from the best yield from liquidity providing, without having to worry about impermanent loss, or anything else.
Thanks to constant market and on-chain observation, Lobsterās algorithm automatically triggers position exits when the risk of negative impact on your returns becomes too high.
Want to dive deeper into the fascinating world of DeFi with Lobster by your side?
Take a look around our website ā
Donāt forget the poll for next week topic!