Qilin Protocol: A Decentralized Liquidity Risk Management Protocol

Qilin
Qilin Protocol
Published in
6 min readApr 10, 2021

Website | Twitter | Github | Documentation | Whitepaper | Discord

1. AMM: A New Way of Providing Liquidity

Through market-making automation, AMM empowers all assets with liquidity provisioning permissionless and enables liquidity for Long Tail assets. As we can see with Uniswap, by solving Long Tail assets’ liquidity issue, it increased demand for Long Tail assets and promoted on-chain liquidity. The result of Uniswap’s solution to unlock Long Tail assets’ liquidity is readily seen. In September 2020, its weekly trading volume exceeded Coinbase, and Long Tail assets contribute 60% of Uniswap’s liquidity. Because of the success of AMM, a new market has emerged in DeFi, encompassing DEX, lending, and insurance etc.

However, AMM has an inherent flaw. That is, AMM only solved the liquidity supply issue but did not set up an LP risk management mechanism that would automatically mitigate the risk exposure of LP’s liquidity. As a result, LPs participating in AMM’s model bear a layer of risk in addition to the existing risks of the asset in liquidity provisioning. In DEX, the risk is impermanent loss; in lending, the risk is single-side asset depreciation.

Since AMM cannot accurately price the counterparty risk of liquidity providers, liquidity tends to migrate to low-risk and high-return areas, such as highly liquid assets, liquidity aggregators, or inter-protocol arbitrage. This fails to enable democratized liquidity for all assets and exacerbates cyclical migration of liquidity from Long Tail assets to top-tier assets. This is bound to inhibit the further development of the AMM trading market.

2. Derivatives Trading Market: Towards a More Diverse Trading Market

The problem of liquidity aggregation in top-tier assets and long-asset liquidity shortages is hard to address by improving the AMM model’s mechanism design. Instead, introducing new trading markets to increase market diversification can enhance the risk-hedging capability of DeFi and optimize liquidity distribution.

In a financial market, derivatives are priced based on liquidity risks and, therefore, can price liquidity risks and hedge. Therefore, financial derivatives can price and hedge liquidity risks. By pricing liquidity risks in derivatives to provide LPs risk-hedging services, AMM can enhance its liquidity risk-hedging capability and solve the liquidity distribution issue, promoting a more diverse market.

Because AMM enables liquidity provisioning for all assets and derivatives to price risks and hedge against risks, a decentralized derivatives market should simultaneously have the ability to provide liquidity and price risks and enable these features for all assets to complement the AMM trading market. While addressing the cyclical top-tier liquidity aggregation issue, the decentralized derivatives market satisfies the market’s need for derivatives services

3. Qilin Protocol

Qilin Protocol is a decentralized perpetual contracts exchange based on the peer to pool model. Qilin allows for the creation of trading markets of perpetual contracts and permissionless liquidity provision. To price liquidity risks accurately, Qilin adjusts the trading cost and the cost of contract positions based on its current liquidity risk level.

3.1 Peer to Pool

The use of leverage in perpetual contracts trading means that the liquidity required for perpetual contracts trading far exceeds that of spot trading. At the same time, in the face of the low capital efficiency of AMM, Qilin adopts the peer-to-pool liquidity model to provide liquidity.

Peer-to-pool is a new way of providing liquidity. The LP creates a liquidity pool and deposits liquidity assets in the pool. Instead of trading through an AMM, users directly trade with the liquidity pool. In this model, the liquidity pool is the counterparty of user transactions. It can provide traders with unlimited depth, solving Long Tail assets’ liquidity issue in the perpetual contract trading market.

3.2 Oracle

Although the peer-to-pool model can provide traders with unlimited trading depth, it cannot discover asset prices. This requires price feeds from an external oracle to provide asset pricing. Uniswap is the biggest spot DEX, and it has far more asset pairs than all the other existing exchanges combined. These factors combined make Uniswap’s oracle capable of providing the most comprehensive price feed for Long Tail assets and thus the information needed for perpetual contracts trading involving these assets.

3.3 Tranche-Structured Pool

Qilin’s tranche-structured pools classify liquidity pools’ risks by structuring each pool into different tranches with different risk-return profiles. By providing multiple risk-profile options for LP, liquidity pools can attract LP users with more precision. The liquidity pool is divided into Tranche A, and Tranche B. Tranche A is low risk and low return, and Tranche B is high risk and high return.

3.4 Decentralized Risk Management

Qilin’s decentralized risk management adopts the principle from peak-valley time-sharing system in power grids and adjusts the incentive to liquidity providers between liquidity risk peaks and liquidity risk troughs. It fine-tunes liquidity flow and user flow by algorithmically incentivizing liquidity and trading to balance risks and returns.

The tokenization of leverage positions also enables Qilin’s risk management mechanism. By tokenizing leverage positions, the Qilin Protocol simplifies operations around contract positions into ERC-20 Token interactions. In the long run, the position tokens can be interoperable with other DeFi protocols and increase a protocol’s scalability.

3.4.1 Dynamic Algorithmic Slippage

Dynamic Algorithmic Slippage is Qilin’s risk management mechanism for hedging the risk of opening/closing a perpetual contract. It can automatically adjust the opening/closing costs of perpetual contract trading users based on the liquidity pool’s risk tolerance. Through Uniswap’s TWAP price feed, Qilin also obtains the asset trading pair’s liquidity depth X*Y=K. Based on the risk level posed by the size of open contract positions, Qilin adjusts the liquidity depth by adding a risk index to the AMM, thereby constructing a vAMM, expressed as X*Y=P*K. The vAMM adjusts the slippage cost of opening positions based on the level of risk of open positions.

When the total value of open positions is low, liquidity risk is low and the depth in the vAMM depth is high, so the cost of opening/closing a position would be low. When the total value of open positions is high, liquidity risk is high, and the vAMM increases the cost of opening/closing by increasing the slippage. By algorithmically adjusting the cost of opening positions based on the liquidity risk, Qilin algorithmically manages liquidity providers’ risk and returns.

P = Z * LP/|L-S|

X * Y = P * K

3.4.2 Rebase Funding Rate

Rebase Funding Rate is an additional risk mitigation design in the Qilin that manages risk coming from position holdings. It automatically adjusts the funding rate based on the liquidity risk level and collects the funding rate payments from traders through rebasing. In the Rebase Funding Rate mechanism, Qilin sets Q as the target the open-position-to-LP ratio (the initial setting is 0%) and C as the regression epochs C (the initial setting is 30 epochs for one regression). It then calculates the funding rate based on the current open positions’ ratio to the liquidity pool.

When the total value of open positions is high, liquidity risk is high, and the funding rate is high, so the cost of position holdings is high. And vice versa, By dynamically adjusting the position holding cost based on the liquidity pool’s risk level, Qilin algorithmically manages the risk and returns for liquidity providers.

F = (|L-S|/LP — Q)/C

4. Decentralized Derivatives DEX

At the moment, the DeFi market has had applications around spot trading, lending, and insurance. The demand for risk pricing in the AMM market is increasing rapidly as the AMM trading market increases in size. This would bring about an explosion to the decentralized derivatives dex. In 2020, the total locked value of AMM increased by 11.68 million dollars on average, a 405.29% jump. The daily trading volume increased 10.1 million dollars on average, a 2415.79% jump. In the first three months of 2021, the total trading volume among AMM DEXes broke through 120 billion dollars, larger than the total trading volume of the past three years combined. It is almost a certainty that 2021 will set a new record.

As derivatives trading products usually sit at 3–5 times that of the size of the spot trading market, we can reasonably expect the size of perpetual contracts to be in the area of half of trillion dollars in 2021, 20% of which will come from the Long Tail market.

5. About the Team

Codex DAO is the team behind Qilin Protocol’s initial development and market expansion, with the protocol gradually migrating to decentralized governance. Codex DAO was established in 2019 by a professional institutional trading team, loyal DeFi supporters, and senior blockchain developers. As a decentralized organization, Codex DAO firmly believes in the vitality and creativity brought by permissionless protocols.

--

--

Qilin
Qilin Protocol

Decentralized risk-optimizing protocol for derivatives trading.