An innovations journey from Bancor to THORChain & LeoDex: «Impermanent Loss» Protection Mechanisms in Decentralized Cryptocurrency Exchanges (Part 1)

in #inleo14 days ago (edited)

A month ago, during a Tuesday’s INLEO’s AMA session, partly dedicated to the LeoDex launch and its interactions with the THORChain universe, I raised this question:

To what 2 pillars of INLEO’s and Hive’s buidling process, @scaredycatguide and @0xNifty.nft, commented:

That was more than enough to trigger my curiosity and to drive me into the impermanent loss protection rab-bitcoin hole (lol). This DEXes related trilogy will hopefully also constitute an educative resource for the INLEO community, particularly the ones among us not so familiar with how decentralized exchanges and Liquidity Pools work, to get a first grasp of why «impermanent loss» (« IL ») has been to a certain extent a hurdle in the path to a wider DEXes adoption.

In this first article I explore the evolution of impermanent loss protection mechanisms across three prominent DEXes, covering the first initiatives of «relief measures» to counter that phenomenon. I’ll soon dedicate a second publication to focus on Dynamic Automated Market Maker Models, and a third post to the latest innovations in that field, mainly in the case of THORChain and Maya Protocol.

Examining historically the development and implementation of these protective measures should grant us a better understanding of how DEXes are maintaining their core principles of decentralization and security, while addressing the challenges posed by IL.

The main DEXes «IL-lness»

Decentralized finance (DeFi) has been growing over recent years, with DEXes playing a significant role in this expansion. One major challenge faced by these DEXes is impermanent loss, which takes place when the price of tokens in a liquidity pool deviates significantly from their initial values.

Let’s explain it more precisely.
When a user provides liquidity to a DEX by depositing two tokens in a liquidity pool, he is issued liquidity tokens representing his share of the pool. The user earns a fee for each trade made in the pool, proportional to his share. However, if the ratio of the token prices changes significantly from the time of deposit, the dollar value of the user's share may decrease, resulting in impermanent loss. In other words: the ratio of assets in the pool can lead to a reduction in the value of the deposited tokens compared to holding them in a personal wallet, and not trading them.

For example, if a user deposits ETH and PRE tokens (the token associated with the «Presearch» decentralized search engine) in a liquidity pool on a DEX, and the price of PRE increases significantly compared to ETH, the user's share of the pool will contain a higher proportion of ETH and a lower proportion of PRE. If the user withdraws his share, he will have lost the opportunity to benefit from the highly increased PRE price, resulting in impermanent loss. This loss can be temporary if the token prices return to their original ratio, but it can also become permanent if the user withdraws his share before the prices return to normal.

To address this issue, various DEXes have introduced impermanent loss protection mechanisms designed to minimize or offset such losses.

Early approaches to Impermanent Loss Protection

A. Uniswap v2 (https://uniswap.org/)

Uniswap was among the first DEXes to implement an automated market maker (AMM) model using constant product formulae, i.e. a formula, like x*y=k, that maintains a constant value (k) for the product of two reserves (x and y), x and y representing the amounts of two tokens in a liquidity pool. This formula ensures that the ratio of the two tokens' values remains consistent, allowing for seamless trading without an order book.

Although not being an explicit IL protection mechanism, the introduction of ERC-20 compatible liquidity provider (LP) tokens allowed users to claim directly from the smart contract their share of accumulated trading fees. That approach did not eliminate the IL risk, nor did it actually address it at its core. But it brought liquidity providers an opportunity to recoup through fee revenue some of their lost earnings.

B. Balancer (https://balancer.finance/)

Balancer took a more proactive stance towards IL protection by allowing customizable weighting schemes for liquidity pools. By enabling liquidity providers to allocate varying proportions of capital to different assets within a pool without having to first withdraw those assets, Balancer sought to reduce IL exposure by diversifying investment risks.

Let's consider a Balancer pool with two assets, Token A and Token B.

  1. A liquidity provider (LP) Initially has 700 USD worth of Token A and 300 USD worth of Token B, for a total of 1000 USD. Token A and Token B have a 1:1 ratio in value.

Now, let's assume that Token A's price doubles compared to Token B, due to market conditions.

  1. WITHOUT customizable weighting schemes:

Let's calculate the impermanent loss in a scenario where the Liquidity Provider withdraws his liquidity just after Token A has doubled in price compared to Token B.

Initially, the LP has 700 USD worth of Token A and 300 USD worth of Token B, with a total value of 1000 USD. After the price of Token A doubles, its value is now 1400 USD (700 USD x 2), whith the value of Token B remaining at 300 USD.

If we assume that the total value of the pool also doubles, reflecting the price increase of Token A, the total value of the pool is now 2000 USD (1400 USD of Token A + 600 USD of Token B). To calculate the IL, we need to compare the Liquidity Provider's profit from providing liquidity in the pool to the profit he would have made if he had just held onto his initial tokens. If the LP withdraws his liquidity, he will receive 1000 USD / 2000 USD x 2000 USD = 1000 USD.

Whereas if he had just held onto his initial tokens, he would have had 700 USD of Token A (which doubled in value to 1400 USD) and 300 USD of Token B, for a total value of 1700 USD. It means that he experiences an impermanent loss of 1000 USD - 1700 USD = -700 USD. The LP would have made a profit of 700 USD if they had just held onto their initial tokens instead of providing liquidity in the pool.

  1. WITH customizable weighting schemes:

The Liquidity Provider can now allocate 80% to Token A and 20% to Token B.

Thus he will have 1120 USD worth of Token A (1400 USD * 80/100) and 60 USD worth of Token B (300 USD * 20/100). The total value of the Liquidity Provider's investment would now be 1180 USD (1120 USD + 60 USD).
That customizable weighting schemes feature gives the LP the ability to minimize the impact of the price change by adjusting the proportions of tokens in the pool. While it doesn’t remove IL, it reduces its impact on the invested capital.

Additionally, Balancer integrated support for multiple types of digital assets, including stablecoins and non-fungible tokens (NFTs), further enhancing portfolio resilience against IL events.
Indeed, when one of the paired tokens is a stablecoin, its value remains relatively stable compared to the other token. This reduces the overall price volatility of the pool, minimizing the impact of impermanent loss by providing a more stable value reference point for the other traded token.

Compensation Models & Token Emissions

C. *****Bancor***** (https://www.bancor.network/)
Bancor developed an IL protection mechanism known as "staking rewards."

Bancor's staking rewards mechanism aims to redistribute the risk among network participants who stake their BNT holdings.

Here's how it works:

  1. Liquidity Providers stake their earned BNT tokens in dedicated pools, along with other supported cryptos;

  2. Network participants who stake their BNT tokens receive a portion of the trading fees generated by the DEX;

  3. The fees are used to mint new BNT tokens, which are then distributed to stakers proportionally. They receive regular interest payments funded by the newly minted BNT tokens.

  4. Stakers can use these newly minted BNT tokens to cover their impermanent loss, or trade them for other assets.

By incentivizing BNT staking, Bancor encourages network participants to share the IL risk. The more BNT tokens staked, the more fees are generated, and the more BNT tokens are distributed to stakers. This mechanism fosters broader community engagement, as more participants are involved in managing IL exposure. In a way, that mechanism partly transfers IL risk from LPs to network participants, by incentivizing BNT staking, thereby fostering community engagement and shared responsibility for managing IL exposure.

Nevertheless, this method isn’t as fruitful on the long run, due to an increased inflationary pressure and the dilution of the existing BNT stakeholders' value.

Images sources:

Posted Using InLeo Alpha

Posted Using InLeo Alpha

Sort:  

Nice rundown. Didn't realize several of these things.

Congratulations @ijatz! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You received more than 500 HP as payout for your posts, comments and curation.
Your next payout target is 1000 HP.
The unit is Hive Power equivalent because post and comment rewards can be split into HP and HBD

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out our last posts:

Hive Power Up Day - June 1st 2024