rDEX-The AMM DEX for rTokens

1.Introduction

rDEX V1 is a DEX developed by StaFi that seeks to solve the problems associated with rToken liquidity. It will provide decentralized transaction services for all rTokens based on the StaFi Chain. Being an important part of the StaFi rToken ecosystem, rDEX V1 will be deployed on the StaFi chain. Native rTokens minted by users can directly be traded through the DEX for better liquidity.

This will eliminate the need for cross-chain to Ethereum or other ecosystems.rDEX V1 has the following features:

1.Low slippage in small and medium-sized transactions, which is realized through the AMM CLP market maker model.

2.FIS as the basic trading asset for all rToken trading pairs to promote liquidity.

3.Impermanence loss protection, whereby the loss incurred by Liquidity Provider will be compensated by FIS token.

4.Liquidity can be provided by any single currency or a dual-currency model with different ratios.

2.Liquidity Pool Model

2.1 Overview

StaFi rDEX V1 will be developed with reference to Thorchain's Continuous Liquidity Pools (CLP) model. We have chosen this as this offers the following advantages compared to Uniswap's AMM model:

1.Slippage protection mechanism. When the user's transaction scale is relatively low compared to the pool liquidity scale, the slippage is lower. On the contrary, if the transaction scale is relatively high compared to the pool liquidity scale, the transaction slippage will be rather high. As a result, whales will not be able to drain the liquidity of rToken.

2.Promote liquidity. Since each trading pair needs to use FIS as the basic transaction asset, each pool can establish considerable liquidity through FIS. Every pool can use FIS as a medium to realize the exchange between different rToken assets, or rToken assets with Native Tokens.

3.Support the liquidity of any single currency or any ratio of dual token deposit. Users can deposit a single token type or two different kinds of tokens in any ratio, in order to support the liquidity of the transaction. There is no need to deposit two assets at the same time at a ratio of 50%-50%, like in the case of Uniswap.

2.2 AMM CLP Model

The market maker formula for user transactions under the AMM CLP Model is as follows:

Where:

𝒙:Input amount of Token A

π’š:Output amount of Token B

𝑋:Balance of Token A in the input side of the pool before swap

π‘Œ:Balance of Token B in the input side of the pool before swap

By Delphi Digital’s research, the slippage is lower under the CLP market maker model when compared with the Uniswap AMM model. This is when the transaction is of a small or medium-sized scale, and vice versa. The comparison of transaction slippage between CLP model and AMM model is shown in the figure below:

2.3 Liquidity Provider Fee

Under the CLP market maker mechanism, the Liquidity Fee charged by the StaFi rDEX V1 Liquidity Provider is calculated as follows:

Where:

𝒙:Input amount of Token A

π’š:Output amount of Token B

𝑋:Balance of Token A in the input side of the pool before swap

π‘Œ:Balance of Token B in the input side of the pool before swap

The Liquidity Provider Fee of rDEX V1 is flexible (in comparison, Uniswap's default is 0.3%), and is adjusted by the slippage generated by the user during the transaction. Therefore, when the transaction scale is larger, the slippage will increase accordingly, and more Liquidity Provider Fee will be charged.

This model provides the following benefits:

1.Large-scale transactions will no longer be lucrative. In other words, small and medium-scale transactions will be encouraged;

2.Traditionally, a fixed Liquidity Provider Fee, say 0.3%, cannot encourage Liquidity Providers to actively provide liquidity when large-scale transactions occur. On the other hand, this method will be able to do that. Liquidity Provider Fee mechanism based on slippage is adopted to give liquidity providers higher returns in the case of large-scale transactions in the pool, and even incentivize more liquidity providers to join. Even whales will not be able to have a drastic impact on the liquidity of the Pool.

2.4 Different Deposit Types

Most DEXs, such by Uniswap, require users to provide dual tokens at a ratio of 50%-50% when providing liquidity. This limits users' motivation and increases the transaction cost of Liquidity Providers to some extent.

rDEX V1 will allow Liquidity providers to support liquidity with one single token. If they offer two, they will be provided the flexibility to decide the ratio. This will also help them save intermediate transaction costs.

2.5 Pool Share

When users provide liquidity for rDEX V1, it needs to calculate the liquidity Pool Share provided by them. The Pool Share calculation formula taking into account the slippage adjustment is as follows:

Where:

𝑓:The deposited amount of FIS token

π‘Ÿ:The deposited amount of rToken

𝑭:Balance of FIS token in the pool before depositing liquidity

𝑹:Balance of rToken in the pool before depositing liquidity

𝑃:Existing pool Share

3.Impermanent Loss Protection

When a Liquidity Provider faces market-making decisions, the most worrying concern is impermanent loss. In extreme cases, it may be greater than the Liquidity Provider Fee income. Therefore, rDEX V1 will provide an impermanent loss protection mechanism - the value of assets while withdrawing is not lower than what it was when depositing if the Liquidity Provider serves for a certain period of time (say, 100 days).

For example, a user called Alice provides 100 rATOM and 2000 FIS as liquidity for the rATOM/FIS trading pair on Day1 (when the price of the oracle is 1 rATOM=20 FIS).Assuming that after Day 60, the price of the oracle is 1 rATOM=30 FIS, and the assets of Alice's Pool share become 80 rATOM and 2400FIS, with a total value of 4800 FIS.

Although the total value of FIS of Alice's Pool share is rising, the value of its redeemable assets has fallen relative to the value of assets that do not provide liquidity after 2 months.

1.After providing liquidity, the asset redemption on Day 60 will be 80 rATOM and 2400 FIS, and the total value will be 4800 FIS.

2.If liquidity is not provided, on Day60, Alice still holds 100 rATOM and 2000 FIS, and the total value is 100*30+2000=5000 FIS.

After Alice has provided liquidity, the total value of assets has dropped by 200FIS (5000FIS-4800FIS) compared to what it would have been for simply holding rATOM and FIS.

In order to make up for the possible impermanence losses of Liquidity Providers like Alice, StaFi will set up an Impermanent Loss Protection Reserve to issue FIS to Alice as compensation.

The compensation can be calculated by:

Where:

𝑭0:The amount of FIS token deposited by Alice on Day 0

𝑹0:The amount of rToken deposited by Alice on Day 0

𝑭1:The amount of FIS token to redeem by Alice on Day N

𝑹1:The amount of rToken to redeem by Alice on Day N

𝑃1:The oracle price of rToken against FIS on Day N

4.Participants

rDEX V1 Key participants include traders and liquidity providers:1οΌ‰Trader A trader can exchange one token for another token through rDEX V1 using the price determined by the liquidity pool ratio.2οΌ‰Liquidity ProviderLiquidity provider adds rToken or FIS token to their corresponding rDEX V1 pair pool to earn liquidity provider fees as revenues or liquidity mining rewards.

5. Trading Pairs and Fees

rDEX V1 will support trading pairs between rToken and FIS, such as rATOM/FIS, rDOT/FIS, rKSM/FIS, rSOL/FIS, rBNB/FIS, rMATIC/FIS, etc. In the future, all rTokens supported by StaFi will be listed.

The Fee types supported by rDEX V1 are mainly Liquidity Provider Fee and Gas Fee:

6. FIS Utility

rDEX V1 will drastically promote FIS Utility through the following aspects:1) The basic transaction assets of rToken in rDEX V1 are all FIS, which will become an important medium to promote the liquidity of rToken.2) Since rDEX V1 is directly deployed on the StaFi chain, users need to pay FIS as a gas fee when using rDEX V1.3) FIS will be used for Impermanent Loss Protection Fund Reserve to motivate Liquidity Providers.4) FIS will be used for rDEX V1 liquidity mining incentives.5) FIS will be used by community members to vote for the liquidity mining weight of each rToken pool.6) The transaction fee income of rDEX V1 will be collected by the Treasury and used for the Buyback and burning of FIS.

7. Future Work

rDEX V1 will not be the end of the story, just like rSwap V1 wasn’t. On the contrary, it is just the prelude of the StaFi team building liquidity for rToken Holders. After rDEX V1 is rolled out, the core StaFi team members will continue exploring the following areas:1) Support Native Token cross-chain to StaFi Chain, and build Native Token/FIS trading pairs. On that basis, users can trade between rTokens and Native Tokens.2) Explore the IDO of new rToken assets, so that when a new rToken is listed in the future, users of rDEX V1 can directly use Native Tokens to purchase rToken assets at a certain discount.3) Establish a FIS liquidity mining reward pool to encourage users to vote by FIS for the distribution of the FIS liquidity pool among different rToken pools.

Last updated