This introductory information will help you understand better the mechanics behind the HydraDX Omnipool which you can find described in our product documentation.
A Short Intro into AMMs
To explain Automated Market Makers (AMMs) and how they work, we can contrast them to their centralized counterpart: Order books.
Order books provide a mechanism which is deployed by centralized exchanges to facilitate trading between two assets. Users can place a Buy or Sell order in an electronic list managed by the exchange. The orders in this so-called Order Book are organized by price level and progressively filled as demand shifts and orders are being matched. The limitations of order books become apparent against the background of their centralized nature.
The need for an intermediary to “keep” the order book and to facilitate the process of order matching creates a dependency on a central authority. This central authority has control over the trading and needs to be trusted by the participants. In times of substantial volume traffic and volatility, the central authority can decide to halt trading and stop performing its market-making function. Furthermore, the process of adding new tradable assets is permissioned and projects may need to pay in advance to get their assets listed.
Automated Market Makers (AMMs) is the answer by the DeFi industry to order books. AMMs provide a decentralized, permissionless way of trading tokens without the need to subdue oneself to a central authority of control.
AMMs consist of liquidity pools that hold the available liquidity of the underlying tradable assets. This liquidity is provided by users (the so-called “liquidity providers”) who are incentivized to do so by the prospect of earning rewards from the fees generated by trades in the pool.
In the case of AMMs, any user can execute a Buy or Sell order on top of a given trading pool. The price of the trade is determined on the spot by a deterministic algorithm which takes as input the relationship between the liquidity of the traded assets, together with other factors which depend on the particular AMM implementation.
When a trade is executed, users may experience a common side-effect of AMMs known as
slippage. This is the difference between the expected price of a trade and the price when the trade is actually executed.
Slippage is determined by the amount of liquidity available within the trading pool. If there is a low amount of liquidity provided for the asset, then the slippage percentage when transacting with big orders will be higher.
Thanks to the decentralized nature of an AMM, anyone can become a liquidity provider (LP) for a liquidity pool by depositing some amount of value in return for a token representing their liquidity position.
LPs are rewarded with fees for providing this liquidity based on the trading activity experienced by the asset for which they have provided liquidity.
Impermanent Loss (IL)
Impermanent loss (IL) is a risk faced by liquidity providers which embodies the difference in value between holding tokens in an AMM as opposed to holding them in your wallet.
Liquidity pools consist of multiple tokens (usually two) which are pooled together. IL occurs when the tokens inside the pool diverge in price. The greater the divergence, the greater the risk of negative returns for the pool's LPs.
The risk is referred to as "impermanent" because the loss is only realized when liquidity is withdrawn from the pool. If the relative prices of tokens in the pool return to their original state (when the tokens were deposited), the loss is minimized or eliminated. The loss will become permanent at the moment when the liquidity is withdrawn, leading to reduced earnings.
As such, LPs need to weigh the fees and rewards earned from LPing versus simply holding their tokens in their wallets.