Volatile conditions negatively impact the bid/ask spread and willingness of liquidity providers to offer depth of market.
Liquidity is paramount for any market to function. Centralized trading venues offer liquidity through limit order books. Bid and ask prices evolve as a function of market conditions and as market orders take liquidity from the book.
We wrote about this concept in March. If you are unfamiliar with how centralized exchanges function, “what makes a market?” offers an introduction.
For most blockchains, throughput is too low to host a properly functioning order book market. There is also a cost to the decentralized nature of the market – each transaction needs to be confirmed on the network. For Ethereum, this cost is significant, and transaction confirmation times can be long.
Additionally, markets are highly fragmented. While it is relatively simple to create a token, it is much harder to spin up an effective market-making strategy – should anyone even want to list an unknown token on a centralized exchange.
These issues led to the invention of Decentralized Exchanges (“DEX”), offering liquidity via Automated Market Maker (“AMM”) pools.
AMM pools offer 24/7 permission-less liquidity via smart contracts, so there is no need for intermediaries.
The most popular implementation of AMMs is a simple mathematic formula, Constant Product:
x * y = k
x: Number of Token 1 in the pool
y: Number of Token 2 in the pool
k: Constant Product
When a user is swapping tokens, they are depositing tokens into the pool to remove a market rate amount of the other token. The effective price for the swap is determined by the ratio of tokens in the pool.
Let’s take some example figures from 23rd April 2022, using the Uniswap V2 liquidity pool of ETH/USDC:
The current price of ETH in USDC can be calculated as:
y / x
137,560,000 / 46,450 = USDC 2,961
This is a simple swap: no liquidity is added and the constant product [k] remains unchanged
The user is adding 1,000,000 USDC and the constant product remains the same, so that you can calculate the amount of ETH removed. For simplicity, fees are ignored.
ETH received: 6,389,662,000,000 / 138,560,000 = 46,115
The swap is executed at an effective price of USDC 3,005. This represents a slippage of around 1.5%.
Liquidity pools do not rely on external sources to price tokens. The price remains roughly in line with centralized exchanges through arbitrageurs adding and removing tokens.
Anyone can provide liquidity. To incentivize this service, DEXs offer a share of any swapping fees earned.
To earn these fees, Liquidity Providers (“LP”) deposit two tokens of equal value into an AMM pool. In return, they receive an LP token representing their share of the pool’s liquidity. This acts as a receipt to prove their ownership when they wish to withdraw tokens.
DEXs can further incentivize liquidity by providing additional payments to LP token holders – usually in the form of a governance token.
The number of tokens deposited to the smart contract provides the depth of liquidity. If this is low, swapping tokens will cause high slippage – in the same way, thin liquidity does on centralized exchanges.
Fees can be high for more ‘exotic’ tokens, up to 1% generally.
There are also gas fees, which are $10-20 on Ethereum at the time of writing. For other chains, such as Solana, gas fees are negligible.
Lastly, you are interacting with a smart contract, so the usual risks apply there.
For liquidity providers, AMMs can be lucrative but difficult to hedge due to impermanent loss. This is outside the scope of this article, but we can cover it in a future Eqonomics.
AMMs are an effective but not faultless solution to providing liquidity in DeFi.
Bringing digital assets to the world.
EQONEX is a digital assets financial services company focused on delivering a full, digital asset ecosystem that offers innovative, trusted, and transparent products and services.
© 2022 EQONEX Capital Pte Ltd
All rights reserved.