Search
  • KaChinging

Crypto: AMM, LP, IOU, IL, Pool 1/2? What are these?

Before I continue with the strategies series, I feel that I should write more about these terms that are popping up in recent posts.


gif

Imagine that we live during ancient times where we're not too different from our ape friends. Back then, there isn't anything like the currency system we have now. To procure goods, we will have to trade for it using scarce items like shells, precious jewels and gold.


How these traders get their goods (for e.g. chickens) is probably not very different from the present. They approach some farmers, find out what the farmers want then strike up a deal for an exchange. Bring back to their country and sell at a mark up.


Traders knew that the demand for chickens would be crazy high (not wrong since we have countless ways of preparing chicken lol), shrewd ones might manipulate the supply thus driving chicken prices up.


gif

Market was upset yet couldn't do anything about it. Until one day, a chicken fanatic decided to f*** the chicken traders and proposed a solution (let's assume chicken farmers want eggs for their chickens and vice versa for eggs suppliers to continue with my crazy story). Chicken fanatic coordinated with chicken farmers and eggs suppliers to create a Chicken - Egg pool. This (liquidity) pool would facilitate the exchange, eliminating the need of a middleman and finally ending the chicken or egg debate (let's also ignore the logistical intricacies).


Turns out, Chicken Fanatic was actually crazy intelligent dude, super right side of the curve and designed a contraption that will manage the pool 24/7. It was a machine that senses quantity of chicken/egg put in and calculate its value using a simple x * y = k price curve. Based on that, it automatically dispenses the opposite pair in equal value. So just like that, Automated Market Maker (AMM) was introduced!


To begin, both parties have to pool 50% chickens and 50% eggs of equal value. By doing so, they become what we termed as Liquidity Providers (LP). In return, they received an IOU (I Owe U) or pool tokens which represents their stake in the pool. So if one day they decided to bail, they can just exchange their IOU to retrieve their assets.



How liquidity pool works?

Feel free to skip this section if you like to ape into things and don't like math lol

Screenshot from Uniswap Docs.

Did I mention the dude is actually Uniswap? Haha

Don't be retarded like some of my friends thinking PancakeSwap was the first to implement this.


Swap Example

Assuming that the pool currently only has 10 chickens and 100 eggs. Based on the price curve equation where:

  • x = total balance of chickens

  • y = total balance of eggs

  • k = constant

In this case, k = 10 * 100 = 1000.

Calculating asset prices relative to each other:

Price of chicken = y / x = 100 / 10 = 10 Price of egg = x / y = 10 / 100 = 0.1

If I want to get 1 chicken, how many eggs would I require?


Let number of eggs = x (10 - 1) * (100 + x) = 1000 x = 11.11 eggs

Yes I know wtf is 0.11 eggs but yeah lol


Due to low liquidity in the pool, I will have to swap 11.11% more eggs for 1 chicken. This price discrepancy is often referred as Price Impact which can be mitigated by swapping using a pool with greater depth.


Asset prices updated after swapping:

Price of chicken = 111.11 / 9 = 12.35 Price of egg = 9 / 111.11 = 0.81

Now it has become more expensive to swap for 1 chicken compared to egg.


Let's say that there is a shop that is selling 1 chicken for 10 eggs. I can take this opportunity to arbitrage by trading 10 eggs for 1 chicken from the shop and swap it back into the pool.


(9 + 1) * (111.11 - x) = 1000 x = 11.11 Profit = 11.11 - 10 = 1.11 egg!
gif

Through my trade, I have brought the price of chicken back to its original value while earning a profit. This is how an AMM functions by incentivizing traders to arbitrage to adjust asset prices. You might ask what's in it for liquidity providers though? All AMMs charge a trading fee roughly around 0.3% per trade which most of it is given to LPs (around 0.25%).



Back to my story

Plebs had started to realize that hey this is a great source of "passive" income. As long as there is demand for either asset, there will always be people utilizing the pool and you can extract fees from them. This is where we start seeing copies everywhere lol.


gif

However, these copies quickly faced challenges in attracting people to deposit their chicken/egg with them. It all changed when one decided to implement rewards (let's call him Fried Chicken). Hence the birth of Yield Farming aka Liquidity Mining.


Fried Chicken clearly knew that he hasn't met anyone who doesn't like free stuff. So he decided to utilize this human behaviour and give out "y" amount of feathers for "z" amount of deposit everyday. When people heard about this, they were like yo wtf free feathers and that was how liquidity easily piled up in Fried Chicken's pool.


By the way, a pool with useful assets is known as Pool 1 in crypto.


Soon enough, Fried Chicken faced another challenge. People were starting to ask hey what can I do with these feathers? Having eaten chicken brain for all his life might have increased his IQ quite abit, he quickly thought up of a solution.


gif

Two new pools were introduced where feathers can be pooled with either eggs or chickens. Additionally, LPs gets rewarded with even more feathers (usually >4 digits %APY). These type of pools are what we call Pool 2 where the farmed reward is pooled with one usable asset. Once again, people goes batshit crazy yo wtf even more free feathers and jumped right in.


IL Example

Suppose that Egg - Feathers pool had reached 1000 - 100,000 in liquidity:

Price of egg = 100,000 / 1000 = 100 Price of feather = 1000 / 100,000 = 0.01 k = 1000 * 100,000 = 100,000,000

Okay, here comes the real problem. Since feathers don't have a use case yet, people were more interested to cash out instead of holding. Not surprised that price of feather easily crashed by 90% to 0.001 while egg price remained the same.


According to Uniswap docs, pool balances can be calculated as such:

Feather balance = sqrt( k / feather price) = 316,227.7660 Egg balance = sqrt( k * feather price) = 316.2278

This is where it gets interesting. Assuming that price of egg is $1 in FIAT terms, if they chose to hold their feathers - eggs:

Total value = (1000 * $1) + (100,000 * $0.001) = $1100

Versus depositing into the Egg - Feather pool:

Total value = (316.2278 * $1) + (316,227.7660 * $0.001) = $632.4556

Therefore, LPs got rekt really hard here losing $467.5444 which is 42.5% less compared to holding. This, my friends, is referred as Impermanent Loss (IL), a problem all LPs would face. There is still no solution for it, one can only pray that the reward + fees are sufficient to make up for the losses.


The same applies if price of feather goes up, try it out on a IL calculator.


Closing

Hopefully through this retarded story, new folks would understand the terms better and make informed decisions particularly now when we have tons of new farms in BSC and Polygon.


Stay safe.


Disclaimer: The information listed here is accurate at the point of writing. I am not endorsed by any of the platforms mentioned here. It is strictly my personal opinion and should not be regarded as investment advice. Please do your own due diligence.


If you like what you're reading, do like my Facebook page to receive the latest blog updates!



298 views0 comments