WrapFi: The First Specialized DEX for Interest-Bearing Tokens Powered by TMM Algorithm

Wrapped-Finance
16 min readMay 7, 2021

Introduction

Overview

As the crypto world is flourishing, the diversification of cryptocurrencies is an irresistible trend. Many different kinds of tokens, such as Interest-Bearing Tokens(IBT), derivatives tokens, and hybrid assets, are enriching the crypto world. At the same time, DeFi infrastructure built on smart contract platforms, such as DEXes, lending protocols, yield aggregators, etc., is developing rapidly. The existing infrastructure, however, is restricted by the community, contract upgrades, cognition, and other factors, so they are falling behind the fast evolution of new crypto assets.

In response to this great trend and times, WarpFi came into being. It focuses on solving the trading dilemma of IBTs in DEXes. During the development of cryptos, the existing algorithms adopted by DEXes(AMM/PMM) can’t reflect the benefits (beared interest) of IBT in the trading price, which causes the loss of IBT traders. Some of IBT holders even has to exchange IBTs into the original tokens before trading on the DEX, and this is complicated in process and requires time commissions. However, this is the mainstream trading method of IBTs. And this is a great business opportunity for DEXes that are specialized for trading IBTs. The core algorithm adopted by WrapFi is called Tracking Market Maker(TMM), which is an upgrade from the PMM algorithm. TMM tracks the interest fluctuations in IBT issuers’ smart contracts, and integrates the interest information into the prices oracles. This algorithm is pivotal to the transaction of all IBTs. For this reason, the TMM algorithm can be called Price-Recorrection Mechanism (PRM). And with the help of cross-chain oracles, interest monitoring of different chains, and contract integration, TMM is better than other algorithms in terms of IBT trading.

The scale of IBTs is still difficult to estimate, but with the increase of on-chain assets, assets that bear interest will be more in the future. And with the development of DeFi, more IBT will be issued in related scenarios. In the lending protocols, the interest comes from the supply and demand of crypto capital. And when we talk about PoS, the interest is generated from the token inflation of the network. As for the algorithm stable coins, the interest comes from the dynamic adjustments of the algorithm. What’s more, Staked LP, mining assets, protocol-dividend assets, etc. all bear interest. The interest of native tokens lies in various application scenarios. These tokens all come with a Voucher Token, such as the cToken of Compound, the rToken of StaFi, and the BAS of Basis. Their value is supported by the native tokens and smart contracts guarantee the fulfillment of value.

The development of IBT will boost the development of supporting tools. Currently, DEX, Lending, Yield Farming are designed for native tokens. For instance, you will find it convenient to trade ETH on Uniswap, but if you trade IBTs on that, the trading price often has a great gap with the real exchange rate released by the IBT’s issuer. If you sell cTokens on Uniswap, you may not find a reliable price because the Uniswap cannot fetch the real time interest of cToken in Compound into its price oracle. For another instance, Aave is friendly for the loan of native tokens, but IBTs are difficult to enjoy their due interest on their platform. Because if you lend rETH on Aave, the value of rETH will increase with the accumulation of Staking Reward, but Aave’s price oracle cannot effectively capture that.

In the world of DeFi, new tools tend to support IBTs. Trading tools will first emerge, and asset management tools will follow. Trading tools will liberate tokens’ liquidity. Only when liquidity is worry-free can IBT-based products and derivatives flourish. After that, the demand for asset management will increase, such as IBT-based index, leverage, and hedging contracts, etc. We call this Wrapped Finance, which refers to the ecosystem of a specific kind of asset. Wrapped Finance is short for WrapFi and it aims to become the underlying contract in Wrapped Finance, providing liquidity for IBT assets.

The standardization of the underlying protocol is the problem that WrapFi is solving for now. We are developing and perfecting TMM algorithms. Currently, different IBTs are varied in interest-generation methods, as well as their calculation methods and on-chain standards. This makes it impractical for WrapFi to implement a universal solution. Therefore, when WrapFi takes off, its priority is to support mainstream IBT assets and gradually support and open the access standard, which is more practical. However, we will never stop exploring a universal solution and it remains an important agenda for WrapFi.

WrapFi is the pioneer of Wrapped Finance. For a long time in the future, WrapFi will grow with Wrapped Finance, and we believe that IBT will become a sophisticated ecosystem. That’s a very important reason why WrapFi exists.

Wrapped Finance

The idea of Wrapped Finance evolved from Decentralized Finance. In theory, Wrapped Finance refers to the ecosystem of a specific kind of asset, while Decentralized Finance makes you think of non-custodial management contracts. Wrapped Tokens include many types of assets, such as WBTC, WETH and IBT. WBTC and WETH assets are more dependent on some DeFi protocols, so we narrow down Wrapped Finance to the ecosystem of IBTs.

Compared with spot assets, IBTs advantages are their interest-bearing attribute. Without security and risk issues, IBTs are preferred under the same liquidity conditions compared with native tokens. Especially the crypto players are rather bold sometimes, which is favorable for the development of IBTs.

Under this circumstance, the peripheral development based on IBT is almost disjointed. Let’s try to understand the current ecosystem. The first step in the development of on-chain assets is Tokenization. At present, the environment for Tokenized assets has been well developed, with friendly trading tools and asset management tools. The second step is Derivatives. We call derivative assets Wrapped Tokens, which are varied by different functions, and a big group is IBT. Compared with the first step, there are almost no tools that could serve IBTs properly and friendly. That is the status quo for most DeFi applications now: the interest generation of assets is well-supported, but interest-bearing assets is not.

Let’s prove that by calculating the growth of the value of cTokens, which is just one kind IBTs, in the past year (in order to simplify the calculation, cToken value equals TVL). The value of TVL in April 2020 is $93,722,250, but by April 2021, the TVL has reached $10,006,144,321, an increase of 10 times more within just one year. It is hard to imagine that the development of services for this billion-dollar-token is almost zero. Though billion-dollar level isn’t outstanding compared with the whole crypto world, but there’s huge potential.

With more kinds of assets emerge, it is of great importance and urgency to develop IBT based tools, like DEX, asset management tools and Index, etc.

WrapFi Solution

More cryptocurrencies have emerged as Interest-Bearing Tokens (IBT) with the development of DeFi. Their interest may have originated in different sources, though. The existing IBTs are mainly applied in the following scenarios:

1.PoS Staking

It is the earliest Interest-Bearing Tokens scenario with the largest asset scale. The interest comes from the inflation of the PoS network. IBTs applied in PoS Staking is represented by StaFi’s rToken series, such as rETH, rDOT, rKSM, etc.;

2.Lending

In this scenario, the interest comes from the borrower. The representative tokens are cTokens of Compound, such as cETH, cDAI, etc.

3.Vaults

In this case, the interest of IBT assets come from the DeFi Yield Farming income strategy. The representatives is the ibETH issued by Alapha Homora;

4.Others.

There are other scenarios such as the LP tokens issued by DEXes and the staked DeFi governance tokens like xSUSHI that could receive dividends, and so forth.

With more scenarios been discovered, more IBTs are issued and become the premium assets with high growth rate in the DeFi world. However, when IBT asset holders trade in the secondary market, such as DEXes, they often find that the trading price of IBT deviates greatly from the real exchange price. Also, the trading liquidity is insufficient. Those problems greatly cap the adoption of IBTs as well as their circulation across different DeFi protocols. As a result, capital efficiency is gravely lowered.

To stabilize the price of IBTs in the secondary market remains a problem that must be solved to boost the adoption of IBTs.

Before we introduce WrapFi solution, let’s take a look at how existing IBTs are priced, and why now DEXes are not friendly to the traders of IBTs. Generally speaking, the price discovery system exists in the following two markets:

1.The primary market price

It refers to the exchange rate between the IBT assets issued by the project party and the Deposited Tokens(DT), like in the cETH token scenario, ETH is the deposited token and cETH is IBT. For example, the exchange price of the cETH Token announced by Compound is: 1 ETH = 49.899947569999995 cETH (3:30 AM UTC, April 9, 2021). This is called the primary market exchange price of cETH, which changes in real-time. By change it usually means rises.

2.The secondary market price

It is the real-time trading price of IBTs in DEXes represented by Uniswap. This price is supported by the primary market price. The two prices now, as we mentioned before, has a rather big gap, mainly because:

1)The AMM DEXes like Uniswap.The trading price between IBT and DT is determined by the constant product formula of XY=K. So the IBT/DT trading pair price will be still if there is no transaction given a period of time. However, the primary market exchange rate of IBT/DT has been constantly changing, so there will still be a gap between the IBT/DT price on DEXes and the real exchange rate in the primary market. This gap will rapidly expand if the liquidity of IBT lacks in the AMM DEX.

2)The PMM DEXes like DODO. This, in theory, can track the exchange rate of IBT/DT in the primary market. But as a universal solution, DODO cannot adjust oracles for each and every IBT token, which is often not issued on the Ethereum. So the problems that are happening in Uniswap also can be seen in DODO-like DEXes.

3)In addition to the DEX transaction price algorithm, the size of the liquidity pool is another important contributing factor to the secondary market price of IBT. But now, it takes rather a high cost to encourage users to provide liquidity for IBTs. So the trading volume for those assets, especially issued by medium and small DeFi protocols , are nearly stagnant. And the DEX trading price faces a huge gap compared with the real exchange price in the primary market.

4)There’s another problem: trading IBTs of different types requires the interactions between multiple assets and multiple public chains, which is quite complicated and specific work. Therefore, the IBT trading market needs a dedicated DEX solution .

As an emerging and promising new type of crypto assets, IBTs is facing an extremely unfriendly and unreasonable secondary trading market, which should be solved immediately for bothe IBT issuers and holders.

Therefore, WrapFi seeks to redefine the trading mechanism of IBTs in DEXes, which will solve the liquidity and price gap problems of IBTs/DT. WrapFi’s mission is to become the first and best DEX that is dedicatedly born for IBTs.

TMM Design

In order to stabilize the price and boost liquidity of IBTs, WrapFi proposed the Tracking Market Maker (TMM) algorithm which is improved from the PMM algorithm. TMM has three unique strengths:

1.Exchange Rate Tracking

When IBTs are traded on WrapFi, the price of the oracle will track the exchange rate of IBT in the primary market in real-time, and write it into the price discovery mechanism.

2.Customized VRF Oracles

Since some IBT assets are issued on different public chains, and the primary market prices of different tokens are displayed on various IBT issuers’ Dashboards, WrapFi will customize cross-chain price oracle quotation mechanism for each IBT trading pair. WrapFi will adopt the VRF algorithm to implement a license-free decentralized oracle quotation mechanism to ensure Oracle’s security;

3.Dynamic LP Fees

WrapFi will dynamically adjust the LP commission fee based on the liquidity of each IBT pair, attracting more LPs.

1.Exchange Rate Tracking

As we mentioned above, there are actually two price discovery markets for IBT assets. The primary market price is the IBT/DT Exchange Rate announced by the asset issuers. The other often referred to as secondary market price, exists in DEXes. The latter is supported by the former and adjusted by the demand of buyers/sellers. WrapFi will track the primary market price of IBTs so that the price discovery mechanism on WrapFi can also reflect the fluctuation of the real price of the primary market.

PMM’s price curve:

i is the primary market exchange rate price between IBT assets and Deposited Token, which is tracked and fetched by WrapFi’s Customized VFR Oracle in real-time.

R is flexible:

If B< B0, then R=1-k+( B0/ B)² * k

If Q>Q0, then R=1/[1-k-(Q0/Q)² *k]

In other cases R=1

B is the number of base tokens currently in the inventory and B0 is the initial number of base tokens in the inventory. Q is the number of quote tokens currently in the inventory and Q0 is the initial number of quote tokens in the inventory.The value range of k is [0,1]and it affects the slope of the price.

Detailed PMM algorithm please refer to DODO PMM

2.Customized VRF Oracles

A sharp, accurate, and secure Orcale integrated in TMM algorithm is indispensable for each IBT pair. Since the underlying chain and exchange rate mechanism of each IBT asset may vary, WrapFi will customize an oracle mechanism that can capture the corresponding primary market price (Price Fetching Script) for each IBT asset. The Script will be run by a group of SSV (StaFi Special Validators) on the StaFi chain through a verifiable random number VRF(Verifiable Random Function) algorithm. Finally, the trade price between IBTs and Deposited Tokens will be determined by PMM algorithm.

For WrapFi’s oracle system, it is very important to assign random numbers for SSVs, in order to ensure absolute randomness and effectiveness. Only in this case can users trust the data uploaded by SSVs to be well-intentioned. To discourage the collusion of multiple SSVs, WrapFi will adopt a Verifiable Random Function (VRF) algorithm to ensure absolute security and verifiability in terms of the random number generation process, as well as the number’s uniqueness. The VRF algorithm adopts elliptic curve encryption and zero-knowledge proof, thereby realizing the decentralization and security of the Oracle pricing mechanism.

The VRF algorithm encompasses three parts:

1) Public and private key pair generation function G

Assuming that the base point of the elliptic curve is O and the order is n, function G is as follows:

A1: Choose a random number

k=[1, n-1]

A2: Generate private and public elliptic curve keys. The former is k and the latter is

Y=kO;

2) Random number and proof generating function F

Input: message m, private key k;

Output: random number v, proof;

B1: Choose a random number

r=[1, n-1];

B2: Use the hash function h1 to calculate H=h1(m), and map m to a point H on the elliptic curve;

B3: Calculate rH, rO;

B4: Use the function h2 to encode the input into an integer s.

s=(rH, rO)

B5: calculation

t=(r-s*k)mod n

B6: calculation

V=kH

B7: Use the function h3 to encode the point on the elliptic curve into an integer. Then we have a random number value=h3(V), and proof is (V;t;s).

3) Verification function V

Input: message m’, proof proof’

Output: valid or invalid

C1: Use the hash function h1 to map the message m’ to a point H’ on the elliptic curve;

C2: calculate:

U1=t’H’+s’V’

U2=t’O+s’Y

C3: Calculate:

s’=h2(U1, U2)

C4: If s=s’, it indicates that the random number and out is valid, and the verification has passed. If not, the random number and the output are invalid and the verification has not passed.

Apart from the VRF algorithm, SSV must stake certain amount FIS tokens as pledge, which further enhance the security and stability of WrapFi oracle. If any SSV does evil, it will be fined from the deposit.

3.Dynamic LP Fees

WrapFi will set different levels of LP commission fees by the liquidity of each IBT pair. This will dynamically adjust the commission income of the LP providers. When an IBT trading pair comparatively stagnant, the LP commission fee will increase, encouraging more LPs to join and vice versa.

Value Proposition

WrapFi Target Market Size

As we mentioned above, IBT assets are divided into four categories, so the market size of IBTs can be estimated by calculating the size of each market, and the summed up amount is about 40 billion USD:

1.PoS Staking Derivatives Market. The total value of Staking assets according to StakingRewards in April 2021 is $160,297,302,844, and the total value of Staked ETH in ETH2.0 is 8,195,593,852 (total amount is 3,787,243). Assume that Staking Derivatives Accounting for 20% of all staking total assets, the market size of PoS Staking Derivatives is estimated to be approximately 33.7 billion USD.

2.Lending Protocols Market. According to data released by DeFi Pulse, the total lock-up value of the current Lending Protocol is 36.4 Billion USD;

3.Vaults Protocols Market. The strategic revenue aggregator DeFi protocol, such as Yearn, Alpha Homora, Cream, etc., is estimated to be around US$1 billion;

4.Other IBTs. Including all kinds of DEX’s LP token and dividend-sharing token like veCRV.etc., the estimated scale is about 2 billion USD.

Based on the above estimation, WrapFi serves approximately US$40 billion of IBT assets. Moreover, the overall market size of IBT assets is still in rapid growth.

WrapFi’s Value

As an interest-bearing and tradable token, IBTs are very premium assets in the DeFi protocols like DEX, lending, and index-related DeFi products. The various circulation scenarios of IBTs rely heavily on IBT’s secondary market price data, so it is very important to have a stable secondary market pricing system.

WrapFi will be the first and best DEX that focuses on providing better decentralized trading services for IBT assets. The goal of WrapFi products is to provide a DEX with a more customized Price Oracle service, a more stable price mechanism, and better liquidity for all IBT assets:

1.Customized and decentralized Oracle.The current Oracles of DEXes are mainly based on the transaction price under the AMM algorithm, which lacks the primary market price as a reference, so the price gap often exists. To address this problem, WrapFi will deploy a decentralized price oracle script based on the underlying chain and exchange rate computer system issued by each IBT. Random nodes on the StaFi chain will run and provide quotes on the strength of the VRF algorithm. And finally, the service of Price Oracle will be highly customized and decentralized.

2.A more stable pricing mechanism.WrapFi adopts the Proactive Market Maker algorithm namely PMM as the trading price algorithm of IBTs, which can track the IBT primary market exchange rate in real-time, so that the price discovery mechanism on WrapFi can include the fluctuation of the primary one.

3.Better liquidity.WrapFi will attract IBT holders and LP market makers with lower commissions, liquidity farming incentives, and better price discovery mechanisms. It will become the best DEX with the best liquidity for IBTs.

Tokenomics

Token Function

WRA is the governance token of the WrapFi protocol, and its main functions are:
1.To encourage WrapFi users, especially Liquidity Providers, to build the WrapFi ecosystem with the team together;
2.Governance of WrapFi’s ecosystem. It is required when adjusting business parameters, submitting token-listing proposals, etc.;
3.WRA can also be staked to share the WrapFi protocol’s income;
4.Trading fee discount.

Token Distribution

The total amount of WRA tokens is capped at 100 million, without any additional issuance. In order to ensure Fair Launch, the only way to distribute WRA Token in the Genesis phase is through liquidity-mining of IBT assets, such as the mint of the StaFi protocol rToken and providing liquidity.

Also to ensure that WrapFi users can get the greatest incentives, we reserve 60% of the token to motivate WrapFi users, mainly DEX Traders and Liquidity Providers. This part of Token will be locked until WrapFi DEX is officially launched.

The proportion of Staking Reserve is 15%, which will be distributed to WRA Token Stakers (6%), FIS Token Stakers (4%), StaFi rToken LP 2 (5%); Development Fund (10%). The last one is used for the development of WrapFi protocol, burying engineering costs, etc. Plus, Eco Fund accounts for 5%, which is mainly for Marketing, partnerships, and listing fees.

Except for the Genesis Tokens(10%), other parts of the tokens will be gradually unlocked in 4 years since the fourth month of the Genesis. The details are in this table:

Interest-Bearing Tokens

Overview

Interest-bearing tokens, abbreviated as IBT, can be literally understood as assets that can earn interest. There are not many types of IBTs in all cryptos. The mainstream includes loan vouchers (such as Compound’s cToken), Staking derivative vouchers (such as StaFi’s rToken), Vault vouchers (such as Yearn’s yToken), DEX LP tokens (such as Uniswap LP), etc.

From 2020 to now, two types of assets grew significantly, DeFi assets and Staking assets. DeFi applications are designed to serve the different kinds of demands coming from the growing crypto assets, such as lending, mining, leverage, emerge accordingly. The growth of staking assets is after the launch of ETH2.0, and derivatives of staked assets start to be more popular. In addition to these two types of assets, there are also some mining vouchers and dividend vouchers, which are all IBTs. Here are the main categories of IBTs and their representatives.

1.Staking Derivatives Voucher

a.rToken

b.crETH

c.stETH

2.Lending Voucher

a.yToken

b.crToken

3.Vault Voucher

a.yToken

b.crToken

c.ibETH

4.Others

1) the dividend voucherfor DeFi governance protocols, such as veCRV, xSushi.

2) DEX LP Token assets, such as Uniswap LP, Sushi SLP.

Potential Use Cases

There are many potential application scenarios for IBTs. The tokens couldbe applied in almost every DeFi protocol. In addition to serving as the most basic trading medium, IBT can also act as collateral to generate stableCoins and synthetic assets. The Interest can bury debts, optimizing capital utilization. IBT can also be used for loans. The advantage of lending IBTs rather than native tokensis that the lender can choose to lend only the token or both the token and interest it bears. IBT can also directly be used in Yield Farming to truly realize dual-mining witha single asset, during the process the IBT holder will still have interest generated.

With the development of DeFi, there will be more interesting applications in the future.

Vision

WrapFi’s vision is to propose a universe solution for all mainstream IBTs through TMM algorithm, which will provide general standards, horizontally scaling solutions, and better pricing mechanism and trading liquidity for IBTs. Meanwhile, WrapFi hopes to boost the development of crypto derivatives under the premise of preventing any “subprime mortgage crisis”. WrapFi’s mission is to pioneer Wrapped Finance.

In the future, WrapFi also will launch more IBT-based Apps, like management tools, etc., which will greatly improve capital utilization efficiency for IBTs community.

About WrapFi

WrapFi is the first specialized DEX for Interest-Bearing Tokens(IBTs) powered by TMM algorithm. Price discovery of IBTs on the current AMMs or PMMs not works well, and there always exsits a huge gap between the trading price on DEX and the real exchange rate. WrapFi creates an innovative Tracking Market Maker (TMM) algorithm to provide the most stable price and sufficient liquidity for IBTs.

Website: https://wrapfi.io/
Medium:https://medium.com/@wrapped-finance
Twitter:https://twitter.com/Wrapped_Finance
Telegram Chat: https://t.me/wrapped_finance
Announcements Channel: https://t.me/wrapfi_ann

--

--

Wrapped-Finance

WrapFi is the first specialized DEX for Interest-Bearing Tokens(IBTs) powered by TMM algorithm.