MultiversX Tracker is Live!

Understanding DeFi Part 1: Automatic Market Makers and Liquidity Pools

All Cryptocurrencies

by COINS NEWS 82 Views

Introduction

This guide is the first of a 2-part series that is meant to explain the core ideas underlying DeFi: automatic market makers, decentralized exchanges, and liquidity pools (and impermanent loss). After reading these guides you should have a solid enough grounding to start experimenting as a liquidity provider yourself, and you will be able to hold your own in conversations about decentralized finance.

Here is part 2: Understanding DeFi Part 2: Providing Liquidity, LP Tokens, and Impermanent Loss

Background: Centralized Exchanges

We're all familiar with centralized exchanges (CEXes): entities that use order books to facilitate trades between customers. CEXes are indispensible as fiat onramps, and have been the primary form of market maker in the crypto world since basically the beginning. However, they have several shortcomings.As the name suggests, CEXes are centralized, so they require that we trust a single entity, which is antithetical to the crypto ethos. CEXes can fail, and bring all your assets down with them. You don't actually control your assets in your CEX account: your account is not really a wallet, and you don't have any keys; when you withdraw assets from a centralized exchange, you are really just making a request that they do it for you, which you must trust they will obey. When you make transactions on a CEX, they are not real in the eyes of the blockchain. The blockchain doesn't even know about anything you do on a CEX; instead, the exchange is just simulating transactions for you off-chain while using their own private database to keep track of which customer is entitled to which assets that the CEX holds in its huge liquidity wallets.

These shortcomings led the crypto world to spend years developing the idea of smart-contract-based peer-to-peer exchanges. This idea finally came to fruition when the first decentralized exchange launched on Ethereum and triggered the DeFi explosion a few years ago. There are now hundreds of DEXes spread across many different smart contract chains, and they are the bread and butter of DeFi. The mechanism behind DEXes was inspired by the structure of traditional stock dealer markets like the Nasdaq (rather than broker markets like the NYSE, which work in a similar fashion to crypto CEXes).

Automatic Market Makers and Liquidity Pools

AMMs are the innovation that lies at the core of every decentralized exchange, like UniSwap, SushiSwap, PancakeSwap, and hundreds of others. AMMs use smart contracts to create an automatic, decentralized, peer-to-peer alternative to order books, allowing people to trade assets without going through CEXes.The central idea of AMMs is a concept called liquidity pools. Each liquidity pool in an AMM allows people to trade a specific asset pair (like ETH/USDC) in either direction. In other words, an ETH/USDC liquidity pool would allow you to buy ETH with USDC or buy USDC with ETH. AMMs are made up of large amounts of these liquidity pools, allowing for large amounts of possible trade pairs.

Each liquidity pool is made up of equal portions (in terms of value) of the trading pair's two assets. These pools are filled by liquidity providers, who are people like you and me who choose to supply their assets to facilitate trades by other people, in order to earn rewards in the form of trading fees.

When a trader uses the pool to make a swap, they are really just adding some amount to one of the two assets in the pool, and taking out the corresponding amount of the other asset in the pool. The trader also pays a trading fee, which is what rewards all the liquidity providers in that pool (they share the fee, weighted in proportion to how much of the pool each provider is providing).

**As a side note, liquidity providers also sometimes get rewarded in a separate way if they provide liquidity to "incentivized pools". Sometimes, when some DEX or DeFi protocol is new, they will temporarily offer incentives to liquidity providers out of their own pocket in order to attract traders and gain a larger slice of the DeFi world, to profit more in the long run. These incentives usually follow a diminishing returns type of curve. Getting these rewards is called liquidity mining, and it is the central strategy in yield farming.**

The description of liquidity pools I have provided so far is something a lot of you will have heard before. But it is missing a few key mechanics that I think are important to understand. If you are sharp, then you might have thought of one or two questions when reading my explanation so far.

The two questions that I think we need to get to the bottom of before we truly understand liquidity pools are: what happens when the two halves of the pool are put out of balance due to traders using the pools to swap, and how does the pool know what relative price to use between the two assets?

These are highly related questions. Here is the key: no matter what, the pool itself always considers the two sides of the pool (for example, the ETH side and the USDC side) to be of equal value.

So, let's say you decide to buy ETH with USDC using a DEX. You want to spend $4000 USDC. The amount of ETH that will get you will depend on the ratio between the amount of ETH and the amount of USDC in the pool, and nothing else. Let's say the pool currently contains 1,000,000 USDC and 500 ETH. That is a ratio of 2000 USDC per 1 ETH. That means, in the pool's opinion, the price of ETH in USDC is 2000, regardless of what the outer world of CEXes and other DEXes might believe.

So, after your trade, you end up with 2 ETH, and the pool now contains 1,004,000 USDC and 498 ETH (plus a tiny bit extra, because your trading fee actually just gets added to the pool, and the providers will get their share of it whenever they pull their liquidity out).

Now the ratio of USDC to ETH in the pool is 2016 : 1, so the price of ETH in the pool's opinion is now 2016 USDC, and the price of USDC in the pool's opinion is 0.000496 ETH.

This brings us to a very key concept. The price of ETH in the pool's opinion has gone up to 2016 due to your trade, but this price spike didn't happen in the rest of the world of CEXes and DEXes! Therefore, the rest of the world probably still agrees that ETH costs about 2000 USDC, which brings an arbitrage opportunity: people can now buy discount USDC with their ETH from the pool in our example, and then use it to buy back their ETH plus a little extra on any other exchange. When people take advantage of this arbitrage opportunity, it pushes the price of ETH down (or equivalently the price of USDC up) in the eyes of the pool, reversing the effect of your trade, because they are adding ETH and removing USDC from the pool, bringing the ratio back towards 2000 : 1.

The following two facts are extremely key:

  1. The prices of the two assets in a pool are determined entirely by the ratio between their amounts. For example, if our pool somehow ended up containing 1 ETH and 1 million USDC (wouldn't happen because people would take advantage of arbitrage long before we could get there), then the price of ETH in that pool would be 1 million USDC, regardless of the rest of the world.
  2. These arbitrage trades are the one and only thing that serve to rebalance the ratios of pools to keep the prices on DEXes more or less in lockstep with all other DEXes and CEXes. It basically makes it so that the average price in the eyes of the entire world acts as a point of gravity for any specific pool.

Closing Thoughts

So, DeFi's central pillar is decentralized exchanges, which are based upon the invention of automatic market makers. AMMs use liquidity pools to allow traders to make peer-to-peer, pseudoanonymous trades in a decentralized paradigm. Liquidity pools each contain a single asset pair, and the price of each asset is defined exclusively in terms of the other asset in the pool. The two sides of the pool are, by definition, equal in value, and as such, the price of the two assets in the opinion of the pool itself are simply a matter of the current ratio between the amounts of the assets in the pool. When traders use the pool to trade, they are adding assets to one side and removing some from the other side, shifting the ratio and therefore the prices of the assets. This is how supply-and-demand economics control the prices of assets in a liquidity pool. When an asset's price in a pool diverges from that asset's price in the rest of the world, arbitrage traders will trade against the pool in such a way that the ratio will naturally rebalance until it is once again aligned with the rest of the world.

submitted by /u/pseudoHappyHippy
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments