Decentralized exchanges (DEXes) are a type of cryptocurrency exchange that allows for direct transactions to take place online securely and without the need for an intermediary on a distributed ledger.
They do that entirely through automated algorithms, instead of the conventional approach of acting as a financial intermediary between buyers and sellers.
Market makers are essentially liquidity providers. In trading, liquidity refers to how quickly and seamlessly an asset can be bought or sold.
AMM (Automated Market Makers) is the underlying protocol used by decentralised exchanges with an autonomous trading mechanism. This eliminates the need for centralised authorities like exchanges and other financial entities. Put simply, it allows two users to transact their assets without any intermediary facilitating the exchange.
You could think of an automated market maker as a robot that’s always willing to quote you a price among different assets.
In the AMM protocol, you do not need another trader to make a trade. Instead, you can trade with a smart contract. So trades are peer-to-contract and not peer-to-peer.
In AMM, anyone can be a liquidity provider if they meet the requirements stipulated in the smart contract. In return for providing liquidity to the protocol, the liquidity providers can earn fees from trades in their pool.
A liquidity pool is a smart contract where tokens are contributed for the purpose of providing liquidity. They enable users to buy and sell crypto on decentralized exchanges and other DeFi platforms without the need for centralized market makers. Instead of traditional markets of buyers and sellers, many DEXes use automated market makers (AMMs), which allow digital assets to be traded in an automatic and permissionless manner through the use of liquidity pools.
Therefore, they are the backbone of the decentralized exchange (DEX) in Polaris Finance.
The advantage of using liquidity pools is that it does not require a buyer and a seller to decide to exchange two assets for a given price, and instead leverages a pre-funded liquidity pool. This allows for trades to happen with limited slippage even for the most illiquid trading pairs, as long as there is a big enough liquidity pool.
Users, called liquidity providers, add an equivalent value (specified in the pool) of at least two types of tokens in a pool to create a market. In exchange for providing their funds, they earn trading fees from the trades that happen in their pool, proportional to their share of the total liquidity.
Liquidity pools are often compared with order books. Order books are a collection of currently open orders for a given market. The system that matches orders with each other is called the matching engine. Along with the matching engine, the order book is the core of any centralized exchange (CEX). DeFi trading, however, involves executing trades on-chain. Each interaction with the order book requires gas fees, which makes it much more expensive to execute trades.
Liquidity provider tokens or LP tokens are tokens issued to liquidity providers on a decentralized exchange (DEX) that run on an automated market maker (AMM) protocol. When tokens are deposited into a liquidity pool, the platform automatically generates a new token that represents the share the depositor owns of that pool.
LP tokens are used to track individual contributions to the overall liquidity pool, as LP tokens held correspond proportionally to the share of liquidity in the overall pool.
In terms of technical properties, LP tokens aren’t very much different from other tokens on the same network. For example, LP tokens issued by Polaris operate on the Avalanche network, are ERC20 tokens. These LP tokens can be transferred, traded and staked on other protocols.
Holding LP tokens gives liquidity providers complete control over their locked liquidity. The relationship between LP tokens and the proportional share of a liquidity pool is used most commonly in at least two cases:
- To determine the liquidity provider’s share of transaction fees accumulated during the duration of liquidity provision.
- To determine how much liquidity is returned to liquidity providers from the liquidity pools when LPs decide to redeem their LP tokens.
Price impact is to describe the correlation between an incoming order and the change in the price of the asset involved caused by the trade. Buy trades push the price of the token higher by extracting them out of the liquidity pool, while the opposite happens for sell trades.
Put simply, price impact refers to how much a trade moves the market price, based on the depth of the market. A higher price impact means getting a worse rate than the market price due to a lack of liquidity at that price
Slippage refers to the difference between the expected price of a trade and the price at which the trade is executed. In other words, it is the difference between what you expect to get and what you actually get due to other trades executing first.
Slippage can occur at any time but is most prevalent during periods of higher volatility, and it refers to all situations in which a market participant receives a different trade execution price than intended.
Though the liquidity is pooled and shared, the mechanisms behind AMMs may vary.
The XYK model is the most well-known and widely applied AMM mechanism in DEXs. Uniswap, SushiSwap, Pancakeswap, Traderjoe, etc., are representative projects of the model.
The XYK Model is also called the “x∗y=k market maker.” The idea is that you have a contract that holds x coins of token X and y coins of token Y, and always maintains the invariant that x∗y=k for some constant k. The value of the token X and token Y always stays the same, or the pool has 50/50 shares for both tokens. The changes in the number of tokens will change the price.
Suppose there are no transaction fees, anyone can buy or sell coins by essentially shifting the market maker’s position on the x∗y=k curve as below; if they shift the point to the right, then the amount by which they move it right is the amount of token X they have to put in, and the amount by which they shift the point down corresponds to how much of token Y they get out.
According to XYK, in the chart above, x1∗y1= x2∗y2=(x1+Δx)∗(y1-Δy)=k
Impermanent loss is the loss suffered by the liquidity providers in AMM liquidity pools. It happens when you provide liquidity to a liquidity pool, and the price of your deposited assets changes compared to when you deposited them. The bigger this change is, the more you are exposed to impermanent loss. But if the price shifts back to the point when you make the deposit, the loss will disappear. Therefore, we call this loss “impermanent.”
Impermanent loss is not the total loss of the net worth measured in USD, as we usually evaluate the financial behaviour of a portfolio. It is the loss in the pool compared with the case when just holding the assets.
Impermanent loss is usually observed in standard liquidity pools where the liquidity provider has to provide assets in a predetermined ratio, and one of the assets is volatile in relation to the others.
Impermanent Loss is the difference in value between holding a set of assets and providing liquidity for those same assets.
For pools that heavily weigh one token over another, there is far less impermanent loss, but with higher slippage when making trades due to the fact that one side has much less liquidity.
Impermanent Loss Simulator:
Yield farming, also referred to as liquidity mining, is a way to generate rewards with cryptocurrency holdings. In simple terms, it means locking up cryptocurrencies to provide liquidity or locking up circulation and getting rewards.
The precise mechanics of yield farming depend on the terms and features of the individual DeFi application. The most common yield farming method is to use a DeFi application and earn the project token in return.
Total value locked (TVL), in the context of cryptocurrency, represents the sum of all assets deposited in decentralized finance (DeFi) protocols. It is a metric that is used to measure the overall health of the DeFi and yielding market.
A project’s TVL doesn't only change when users make new deposits or withdraw their assets. It is constantly changing in line with the fluctuating dollar value of all those assets in the cryptocurrency market.
Investors can look at TVL when assessing whether a DeFi project’s native token is valued appropriately. The market cap of the token may be high or low relative to the TVL of the project.