Ultimate magazine theme for WordPress.

Guest article by TegroFinance: Mechanisms of liquidity pools on the DEX exchange using the example of TGR/TON

Please note that this material was created to familiarize yourself with the ins and outs of liquidity pools on DEX Tegro.Finance. The calculations shown are simulated for illustrative purposes.

We do not claim that the following calculations are suitable for every cryptocurrency: all DEX have their own features, commissions and so on. We would also like to emphasize that, among other things, the transaction costs of the TON network must be taken into account.

The DEX exchange Tegro.Finance charges a commission of 0.4% for each exchange. 0.25% of the total commission is included in the liquidity pool and distributed to all liquidity providers.

In order to become a liquidity provider on the DEX exchange, it is important to know a few key components:

  • When tokens are withdrawn from the pool, their amount may differ from the amount initially transferred to the liquidity pool. This is due to the fact that the pool structure changes during the exchange process according to the rebalancing algorithm set by the DEX exchange;
  • The bottom line is affected by network transaction costs and commissions for depositing and withdrawing assets from the liquidity pool;
  • The amount of the commission depends on the turnover. The higher the trading volume, the higher the income of the liquidity provider;
  • Keeping a cryptocurrency in a wallet can be more profitable than depositing tokens into the liquidity pool – if one of the cryptocurrencies rises or falls sharply, then rebalancing the pool significantly reduces the volume of the rising coin;
  • The amount of the commission is distributed among all liquidity providers: the higher the provider’s share in the pool, the higher the income it can generate.

Scheme of the liquidity pool on DEX

Let’s imagine a pool of 1500 TGR and 100 TON – we round up the values ​​for better understanding. Here is the constant product formula: x*y=k, where x is TON, y is TGR, and k is a constant.

For this liquidity pool, k = 100 TON * 1500 TGR = 150,000. At the rate x/y = 100 TON / 1500 TGR = 0.07 TON/TGR we can conclude that 1 TGR equals 0.07 TON.

Let’s assume that the new liquidity provider brings 50 TON and 750 TGR into the pool, then k = 100 TON (current pool volume in TON) + 50 TON (TON volume added to the pool) * 1500 TGR (current pool volume in TGR) + 750 TGR (TGR volume added to the pool) = 337,500.

It turns out that the new participant’s share of the pool is 33.33%, which is calculated as follows: 50 TON (participant’s contribution) / 150 TON (total number of TON in the pool together with his share).

Estimated value of contributed tokens: 750 TGR * 0.07 TON/TGR + 50 TON = 102.5 TON.

Suppose DEX-Exchange receives a request to exchange 10 TON for TGR. Goes into the liquidity pool: 0.25% / 10 TON = 0.025, ie goes into the pool 10.025 TON = 10 TON + 0.025 TON.

To save k (337,500), 2109,045 TGR must remain in the liquidity pool. You get this number as follows: 337,500 / (150 TON + 10.025 TON) = 2109.045.

In exchange for the 10 TON, the user will receive 140.955 TGR = 2250 TGR – 2109.045 TGR. At the current rate 0.0709 TON/TGR = 10 TON / 140.955 TGR.

As a result, the pool rate increased and is now used to calculate the amounts of TGR and TON when the new participants bring liquidity into the pool: 160.025 TON / 2109.045 TGR = 0.07587 TON/TGR.

The scheme is identical when trading TGR for TON on the DEX exchange.

Note: The equilibrium exchange rate will decrease, but the volume of TGR in the liquidity pool will increase due to the reduction of TON.

Liquidity provider final results

A user with a 33.33% share of the liquidity pool owns 702.9447 TGR = 33.33% * 2109.045 TGR and 53.3363 TON = 33.33% * 160.025 TON.

The specified amounts in TGR and TON are credited upon withdrawal from the liquidity pool.

Please note: the numbers are different from the original 750 TGR and 50 TON.

The estimated value of the tokens 702.9447 TGR * 0.07587 TON/TGR + 53.3363 = 106.6687 TON.

The difference from the initial evaluation of the deposited funds: 4.1687 TON = 106.6687 TON – 102.5 TON.

Please note: the number does not match the expected commission percentage: 33.33% * 0.025 = 0.00833 TON. This is explained by the change in the volume of cryptocurrency TGR and TON in the pool, the estimate is made based on the updated equilibrium rate.

If the user did not become a liquidity provider, he would be left with 750 TGR and 50 TON, which at the new exchange rate is 750 TGR * 0.07587 TON/TGR + 50 TON = 106.9025 TON.

It turns out the difference from the original estimate is bigger: 4.4025 TONNES.

The difference is explained by a decrease in the volume of TGR and an increase in TON as a result of the transaction: the pool participant exchanged its stake in TGR for TON.

Impermanent loss is the difference between the results of depositing assets into the liquidity pool and storing them in a cryptocurrency wallet. Over time, due to the accumulation of commissions in the pool, it is possible to make up the resulting difference. If the asset price movement is too strong, the difference can become significant. It will take a long time and many exchanges on the DEX exchange for commission income to become reasonable.

Learn Crypto Trading, Yield Farms, Income strategies and more at CrytoAnswers
https://nov.link/cryptoanswers

Comments are closed.

%d bloggers like this: