Parallel AMM: Swap, Provide Liquidity, and Earn on the go!

Dai
Parallel Finance
Published in
7 min readMar 29, 2022

What is Parallel Automated Market Maker (AMM)?

In order to understand our new product, we need to dive into AMMs, which is an important component of decentralized finance (DeFi). An AMM is an underlying protocol that enables decentralized exchanges like Parallel AMM to carry out non-custodial and autonomous trading. This autonomous trading mechanism removes the need for centralized third parties like exchanges, trading platforms, and financial entities and allows users to trade assets without relying on any of these intermediaries.

AMMs operate without the need to create an account or go through any KYC procedure. Rather, a user only needs to connect his wallet, select the tokens and the exchange direction and watch how the Parallel Heiko AMM pallet instantly executes the transaction and sends the corresponding token to his wallet.

To have a solid understanding of the concept of AMMs, we will take a look at their precursor — Market Maker and how AMM is an improvement over their performance restrictions, risks, and high fee.

What is a market maker?

Before the advent of AMMs, centralized exchange platforms, also referred to as market makers, used a classical order book mechanism to correctly match trading orders. An order book consists of different offers from buyers and sellers for an asset. It lists the quantities and prices that traders are willing to buy and sell for and gives users real-time information regarding market price information in regards to an asset.

For example, if a trader were to buy 1 HKO token for $1.00, the market maker would find another trader who is willing to sell 1 HKO for $1.00. They basically act as a middle man, matching buyers to sellers and taking a cut of the transaction.

Unfortunately, they suffered from liquidity issues, which is when a seller cannot be successfully matched with a buyer — usually due to price differences. When liquidity is low there is a risk of slippage and slippage is when the price of an asset considerably changes before the execution of a transaction. This is common in volatile markets such as crypto. Therefore, there is a need to conduct transactions instantaneously to reduce slippage risk.

Market makers rely on:

  • Traders and financial institutions to provide liquidity and the price of assets
  • An exchange that ensures the various parties agree to each trade that is happening

How is an AMM different?

An AMM replaces the conventional matching system and order books with autonomous protocols that are powered by pallets that function similarly to smart contracts. These protocols define the price of an asset and are also responsible for liquidity provision. As such, users trade against the liquidity locked in the protocol and not counterparties as we have in market makers. With this method of executing transactions, AMMs do not need a governing body, such as a trader or a financial institution, to manage and trade assets. Users can carry out these transactions directly.

How does Parallel AMM work?

Generally, there are two types of AMMs — dynamic and stable AMM. A dynamic AMM is used for assets combination with a higher slippage, e.g, KSM-HKO, while a stable AMM is used for asset pairs that have the same price, for example, USD-USDT or DOT-xDOT that fluctuate less on different transactions using this specific AMM. However, at the time of writing this article, Parallel offers a dynamic AMM. The stable AMM will come in the future to give our users greater capital efficiency.

The AMM features an automated liquidity protocol that is controlled by a “constant product” formula which allows anyone to provide liquidity and contribute an equivalent value of the underlying token — KSM. In return, users will receive minted derivative tokens — sKSM that represent the number of tokens contributed and can be used to redeem their supplied asset at 1:1.

For any exchange operation, two liquidity pools are needed. For example, exchanging KSM to HKO on Parallel AMM requires a KSM/HKO liquidity pool (LP — KSM/HKO) and to make sure the ratio of the assets in the liquidity pools remains as balanced as possible to eliminate discrepancies in the pricing of pooled assets, we use a constant product formula similar to Uniswap V2.

x * y = k

X = the quantity of token A (e.g.: HKO) in the liquidity pool

Y = the quantity of token B (e.g.: KSM) in the liquidity pool

K = constant

Using our example, if the demand for token A (HKO) increased, the number of HKO tokens in the liquidity pool would decrease and therefore the price of the token would increase. In contrast, if it did not have as much demand as token B — KSM, the price will level out.

In return, liquidity providers are given a percentage fee that matches their stake in the liquidity pool. So if you contributed 10% of the liquidity in the pool, you would receive 10% of the fee.

To determine the price of token A (HKO), we will return to the constant product formula — x*y=k. From here, it follows that the price of that token x is simply:

price_token_x = reserve_token_y / reserve token_x

Invariably: price_HKO = reserve_KSM / reserve_HKO

*Reserve = Liquidity pool

Crucially, the AMM does not update this price as other markets move around it. The market price only moves as the reserve ratio of the tokens in the pool changes, which happens when someone trades against it. This is because the liquidity pool has both its hyperparameter and invariant factors set at the creation of the pool and the hyperparameter factor remains the same afterward. However, the invariant factor which refers to the pool variable stays constant during swap actions but changes at liquidity provision and withdrawal.

In particular, a pure liquidity provision and withdrawal activity requires a proportional change in reserves based on the general rules of AMM-based DEX:

1) The price of assets in an AMM pool stays constant for pure liquidity provision and withdrawal activities.

2) The invariant factor of an AMM pool stays constant for pure swapping activities.

Here’s a guide on how to use Parallel AMM: AMM GUIDE

What am I supposed to do with my crypto locked in a liquidity pool?

Despite your token (KSM) being locked when you provide liquidity, you still have a form of liquidity through the minted derivative token (sKSM) you received when you contributed to a liquidity pool. These tokens represent your holding in the liquidity pool and your pass to withdraw your contribution at any time.

However, that’s not all you can do with your sKSM on Parallel AMM. Parallel wants users to stay liquid, even when they’ve provided liquidity. As a result, you can use your sKSM to earn additional returns via an indirect form of staking called yield farming.

Risks Associated with using AMM

As much as AMMs provide a lot of benefits to users, from fast swap activities to liquidity provision and yield farming, there are some risks associated with using them. They are price impact and impermanent loss.

Price impact: this is the difference between the current market price and the expected price of an asset, a correlation between an incoming order and the subsequent price change. It usually occurs when a trader is swapping a large volume of assets and it is a function of:

  1. Trade size relative to the liquidity pool size
  2. The trading rule i.e constant product formula.

Impermanent loss: This is when you deposit tokens into a liquidity pool and the price of that asset drops considerably from when you first deposited them due to the volatility of the market. The bigger the drop in value, the more you lose. Interestingly, the impermanent loss is counteracted by a trading fee reward as liquidity providers are rewarded pro-rata with a portion of the trading fee which usually covers their losses.

While there are risks to contributing to liquidity pools and yield farming, the benefits are very substantial. It is a great way for users to interact with the wider money market, access more DeFi products, and earn additional yield. Interestingly, Parallel opens up this opportunity for individuals to benefit from DeFi with its comprehensive suite of DeFI products so that decentralized finance can be easily accessed and users can have a greater capital efficiency.

About Parallel Heiko

Heiko is the Kusama blockchain-based sister network to Parallel Finance. It features a suite of DeFi super dapps that include Staking, AMM, v2 Decentralized Crowdloan, Wallet, Farm, Cross-Chain Bridge, and Decentralized money market. The platform is committed to building a decentralized future that empowers the community to increase DeFi capital efficiency, security, and accessibility.

We are one of the largest parachains in the Polkadot space with over $700M+ TVL and 200K+ active users and have some of the best investors including Sequoia, Founders Fund, Coinbase, Polychain, etc. The platform has a rapidly growing global team of over 65 doers from top organizations in and outside the cryptocurrency space, including The World Bank Group, Dash, Crypto.com, ChainLink, Meta, Polygon, Ledger, JP Morgan, Standard Chartered, Amazon, BlockFi, etc and we are still hiring!

Stay in touch with us.

Website: https://parallel.fi

Twitter: https://twitter.com/ParallelFi

Telegram: https://t.me/parallelfi_community

Discord: https://discord.gg/buKKx4dySW

Medium: https://parallelfinance.medium.com

--

--