By Ugly Bob | NOV 17, 2022
4:02 Min Read
Have you been in the trustless area of crypto? Then you’ll have already been exposed to protocols like Uniswap, Orca, or 1inch. These are decentralized exchanges that use algorithmic market-making to provide liquidity.
Automatic Market Makers are protocols that use asset pairings in liquidity pools to facilitate asset swaps (trades). The price is determined by an algorithm. This algorithm observes the ratio of paired assets in a pool as opposed to buyers/sellers (or Oracles). Then it dictates the price through an order book marketplace of supply/demand.
Though these are riskier than centralized exchanges, they both achieve the same end. Using AMMs effectively requires basic knowledge of economic primitives used in DeFi. We’ll get into specific concepts later.
Generally, crypto alleviates issues of access to certain financial institutions. Some people cannot access banks. Some businesses rely on peer-to-peer transactions to operate. Some markets close at end of the day. These accessibility problems in traditional markets are solved by a little game theory and computer science.
When an asset is illiquid it can be difficult to find a buyer. What if we could incentivize a ubiquitous source of liquidity?
Some people can’t or won’t engage in the Know-Your-Customer process for various reasons. What if we could apply the basic principles of Bitcoin to finance?
Your country has no access to banking products. What if the unbanked could earn interest on their money?
For these exchanges and liquidity pools to be automatic, there needs to be a way to maintain these pools without any need for human intervention. Vitalik Buterin and Uniswap have popularized this constant formula to maintain pools:
x * y = k
Pools simply follow this curve to determine the price of an asset. When the pool is balanced, the price is at a fair market value. When the pool is imbalanced, say a user withdrew a large amount of an asset at once, then there is now less of that asset. Therefore its price is higher than the market rate.
On the other side of the pool, there is more of the other asset. This means that the asset’s price has decreased. Users all have the incentive to balance these pools one way or another. These users are Liquidity Providers, Traders/Swappers, and Arbitrageurs. Let’s see how this formula begins to look like law when these users interact.
For any crypto protocol to exist it requires two aspects:
Never mind a well-written smart contract or consensus mechanism. Liquidity is king in crypto.
Liquidity pools are treasuries that contain tokens to be used to facilitate trades. They are usually in pairs, sometimes in triplets but that hasn’t quite been figured out yet. For example, a common pool is ETH/USDC where a smart contract will contain ETH and USDC deposited in different respective wallets that the contract can access.
There are two ways users interact with LPs, depending on their intent.
Deposits simply add tokens to a pool. This function can be in the form of providing liquidity or swapping an asset.
The other aspect is withdrawals which can be in the form of exiting liquidity provision or swapping an asset. Not much difference, but let’s go into detail about these roles and functions.
These users provide assets to LPs for traders (or arbitrageurs) to interact with the protocol. In return, the provider receives a portion of the fee each time a user transacts with the LP.
This type of user is incentivized to balance pools by buying or selling an asset at a premium. We know now from the constant formula that any imbalance in liquidity is an imbalance in price. So when there is less of an asset, the price is increased against the asset with a larger supply.
Arbitrageurs look for these types of opportunities to capitalize on price imbalances until the pool reaches equilibrium. When the pool is balanced, the arbitrageur looks for other opportunities in other pools.
Liquidity is measured by the token amount and token prices vary depending on market conditions. When the provider feels they have collected enough fees from trades, they may think about removing their liquidity. Sometimes the price of the token they provided has decreased in value since depositing. In this case, the user would withdrawal their tokens at a loss, not including fees collected.
They call it “impermanent” because it only takes effect upon withdrawal. Users can decided to keep their liquidity in pools until the price is more reasonable, but price is never guaranteed to reach historical numbers. You may find yourself watching your liquidity dwindle to an impermanent zero that feels incredibly permanent.
The goal of DeFi is to build the same components (and invent new ones) that traditional finance enjoys. The difference between DeFi and TradFi is the freedom to use and create these financial primitives without permission and in a trustless manner. That does come with inherent risks but if you keep reading on AscendEX I think you’ll be OK.