paint-brush
Klein Finance: Low-Slippage, Low-Impermanent-Loss Decentralized Exchange in KCCby@kcc
1,014 reads
1,014 reads

Klein Finance: Low-Slippage, Low-Impermanent-Loss Decentralized Exchange in KCC

by KuCoin Community Chain June 22nd, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

As the leading decentralized exchange (DEX) in the DeFi field, Uniswap strives for the largest market share. Even with unique protocol, there are still many features to be optimized for Uniswap V2 and V3. Under Uniswap V2, when LP provides liquidity to the pool, the liquidity will be evenly distributed along the price curve. So, liquidity will be distributed across all price ranges between 0 and infinity. As most of the assets are actively traded within much narrower price range, it causes the problem of low capital utilization. Uniswap optimized this problem and deepened the pool but caused high impermanent loss which is not friendly to novice users. Faced with the conflict between the potential high impermanent loss and low capital utilization, a solution has to be found to optimize Uniswap system. This article will introduce a new trading platform, Klein Finance. Together with dynamic peg, it provides better solutions to a range of problems such as impermanent losses, centralized liquidity, improved capital efficiency, low slippage and dynamic fees on general exchange channels.
featured image - Klein Finance: Low-Slippage, Low-Impermanent-Loss Decentralized Exchange in KCC
KuCoin Community Chain  HackerNoon profile picture


Uniswap is an Ethereum-based protocol designed to facilitate automatic exchange transactions between ETH and ERC20 token digital assets, automatically providing liquidity on Ethereum. It has the most striking features of decentralization, permissionless, and unstoppable among current DeFi projects.


As the leading decentralized exchange (DEX) in the DeFi field, Uniswap strives for the largest market share. Even with unique protocol, there are still many features to be optimized for Uniswap V2 and V3. Under Uniswap V2, when LP provides liquidity to the pool, the liquidity will be evenly distributed along the price curve. So, liquidity will be distributed across all price ranges between 0 and infinity. As most of the assets are actively traded within a much narrower price range, it causes the problem of low capital utilization.


Uniswap optimized this problem and deepened the pool but caused high impermanent loss which is not friendly to novice users. Faced with the conflict between the potential high impermanent loss and low capital utilization, a solution has to be found to optimize Uniswap system.


This article introduces a new trading platform, Klein Finance. Together with dynamic peg, it provides better solutions to a range of problems such as impermanent losses, centralized liquidity, improved capital efficiency, low slippage, and dynamic fees on general exchange channels.

A brief introduction to Klein Finance

Klein Finance is a liquidity provider on KCC (KuCoin Community Chain), on which tokens under KRC 2.0 standard can be traded. Klein Finance Aims to allow digital assets to be traded in a safe and stable on-chain environment with low slippage, good depth, and low fees, it also enables users to obtain rewards by locking digital assets. With a mixed liquidity pool trading model, Klein Finance provides a cross-market mechanism for creating stable coins, which can meet the requirements of multiple stable coins vs. non-stable coins and multiple non-stable coins vs. multiple non-stable coins.

The Mechanism:

Klein Finance offers a compromise by providing a mechanism to create cross-markets for stable coins in what could be called “Uniswap with Leverage”. Its immutability allows most of the liquidity to be concentrated around the price of 1.0 (or any real price), and this is a very useful feature for creating liquidity between stable coins.


Automated market making using dynamic peg creates liquidity for assets that are not necessarily pegged to each other in a more efficient way than m * n = λ invariant. This creates more than 5 - 10 times more liquidity than Uniswap and also provides higher profits for liquidity providers.


The dynamic peg AMM can further optimize the issues of price stability and liquidity of stablecoins (especially for decentralized stablecoin like DAI).


Highlights of Klein

The most prominent feature of Klein is it can have both low slippage and aggregated liquidity close to the "price equilibrium point”. This can optimize the utilization of capital, and control potential impermanent loss, especially for novice users, which combines the advantages of both Uniswap V2 and V3.


In one word, what problems does Klein Finance solve?

  • It inherits the advantages of StableSwap's ultra-low slip point and aggregation liquidity near the "equilibrium point”.
  • By fitting between the constant product curve and the StableSwap curve and to the constant product curve in the middle and tail area of the curve, the advantage of the constant product curve in rapid response to liquidity changes is obtained, to avoid the depletion of pool liquidity and respond flexibly to rapid market changes.


The model of Klein Finance can be applied in transections among stable assets. The mechanism can be briefly explained in this way. As the number of all types of stable assets are equal to each other, which is C/n, hence the product of the numbers should be constant, that is C/n to the power n. Hence, When coefficient Ψ approaches positive infinity, Klein Finance invariant function approaches the sum constant formula, while when coefficient Ψ approaches 0, the Klein Finance invariant function approaches the product constant formula.

If the above equation is valid, the leverage level of the transaction will be maintained on Ψ. However, this mechanism will not support prices far below the ideal price. In order to provide liquidity at any price, Klein finance introduces dynamic Ψ instead. When the price is away from the equilibrium price (i.e Ψ tends to 0), the invariant function is similar to the constant product function while when the price tends to the equilibrium price (i.e Ψ tends to K), the invariant function is similar to the constant sum function.

Key functions of Klein Finance:


  1. Create a transaction pool without permission.
  2. Allow users to freely create trading pairs, not only limited to stablecoins trading pairs, and users can create trading pairs of any tokens: trading pairs of any tokens and meta pool with shared depth.
  3. Allow users to freely create trading pairs and support long-tailed tokens, and use the meta pool to create them, which can be done one by one to complete the swap of main stablecoins.
  4. Transaction Routing: this allows users to create liquidity, transactions require users to use transaction routing to select the exchange pool with the smallest slippage for users at the front end.
  5. Transaction mining: According to the different transaction pools, the user's transactions are
  6. counted, calculated according to the token distribution speed and the different reward pools. Different xTokens are obtained according to the user's transaction volume within a period of time.


The fundamental function: trading.


On Klein Finance, The bottom layer of Klein Finance uses a permissionless transaction module, which can satisfy stablecoin-to- stablecoin transactions and stablecoin-to-non- stablecoin transactions.


First, Uniswap brings a market created by the x y = k invariant that makes no assumptions about the pricing of the underlying asset and distributes liquidity evenly across all prices. Next, Klein introduces the stableswap invariant, which allows to concentrate most of the liquidity around price 1.0 (or really any price), a very useful feature for creating stablecoin-to-stablecoin liquidity.


From the above figure, the blue line is the StableSwap currency exchange curve, while the yellow curve is constructed by automatic market, making using the dynamic peg exchange rate method. Two characteristics can be observed: the yellow line lies between a constant product curve and the blue line; the curve tail features have obvious equal-area curve fitting.

Klein Finance has built a robust ecosystem around governance, rewards, and staking, all designed to drive future growth and decentralization of Klein Finance, resulting in a better experience for users.


The way to calculate KEN (token in Klein Finance platform) can be expressed this way:

KEN = individual transaction volume / total transaction volume * KEN output

Where total transaction volume is the total transaction volume that has not been rewarded. The number of xTokens for transaction rewards will change with the total transaction volume. When the total transaction volume increases, the number of xTokens that an individual can receive decreases; when other people receive KEN rewards, their transaction volume will be added to the total transaction volume. Removed, the number of xtokens that an individual can receive at this time increases.

Staking mining: Additional path to maintain liquidity of the pool.

Other than transaction mining, staking mining gives another way to reward liquidity providers. The protocol will calculate the reward to be obtained based on the amount and type of tokens staked in the pool. The basic reward is set to 1 time, and veToken can be used to accelerate the reward up to the maximum of 3.3 times.

Three types of transaction pools: solve targeted liquidity problems

Klein Finance supports integration with other DeFi protocols, and Klein's liquidity pools are divided into three types, each of them is created to solve a specific liquidity problem.


  1. Meta pools: a meta pool is a liquidity pool composed of a stablecoin and a Base Pool. The purpose of this liquidity pool is to reuse the stablecoins with higher capital utilization and better pool depth in the base pool.


  2. Stablecoin pools: a Stablecoin pool supports 2-4 stablecoins. Considering that swaps among stablecoins are very common, pools of this type are crucial as they can efficiently reduce slippage.


  3. Plain pools: a Plain pool supports a stablecoin and a non-stablecoin. This type is designed to provide liquidities to non-stablecoins so that range of users can be expanded. All these three pool types form the ecosystem where users can make transactions with low costs and improve the utilization of tokens. As the scale of pools improves, a forward cycle can be expected in long run.

KEN Tokenomics

Ken token is the non-stablecoin in in the Klein Finance protocol. The initial supply of KEN is 100 million. Three key functions are required for KEN token: to regulate the and stabilize the liquidity of the system; to balance the benefit of users, Liquidity providers and governors; to behave as the transection fees among all protocols. Also, the Klein Finance introduced veKEN to act as governance token, which can distinguish the governance and voting rights with the other rights. The below table demonstrates the general usage of KEN tokens.

Also, the above graph demonstrates the scale of released tokens, percentage of tokens for different usage, as well as release rhythm.

DAO & veKEN mechanism in Klein Lab.

KEN tokens can be used for community voting, staking to boost the mining process, and making proposals in the community. However, the above-mentioned functions can only be applied when the KEN token is converted to veKEN token, which can be realized by locking KEN for a certain period of time. The number of veKEN obtained is determined by both the number of KEN locked and the locking period. The below curve shows the relationship between the locking time and voting weight of the locked tokens.


For instance, 1 veKEN can be obtained once 1 KEN token is locked for 4 years; while only 0.25 veKEN can be obtained if the locking period is 1 year. As it approaches the end of lock-up period, the balance of veKEN will linearly decrease. Such a mechanism will motivate KEN holders to lock their tokens for a longer period, thus promoting the activity of the community. During the lock-up period, the locked KEN cannot be traded or unlocked in advance, which can assist to prevent “dig and sell” actions, releasing selling pressure and stabilizing the price of KEN. Then it comes to the functions of veKEN in detail.


Firstly is boosting the liquidity mining process, users will get different boosting rates according to the amount of veKEN staked. The more veKEN used for boosting a certain pool, the higher the boosting rate will be. The ceiling of boosting rate is 2.5X. Besides, users will also receive proportional transaction fee dividends. Eventually, the voting right is also essential for veKEN holders. As the voting weight is proportional to the number of veKEN, the users are motivated to extend the lock-up period for more voting rights.


Conclusion

Klein Finance applies a completely different technical path from Uniswap V3 in AMM. In Uniswap V3, LPs can decide the price range they would like to provide liquidity, which can be risky for novice users as there are high potential impermanent losses. Unlike Uniswap V3, the AMM mode of Klein Finance can automatically adjust the liquidity aggregation range based on the feed price of the internal Oracle, without requiring liquidity providers to redeploy the liquidity range. This design is more friendly to novice investors and does not require liquidity providers to formulate complex market-making strategies.


This article has generally discussed the underlying architecture, key functions as well as basic technical paths of Klein Finance. We can observe that the Klein Finance trading platform performs well in stablecoin trading, but in the field of non-stablecoin trading, AMM of the dynamic peg is still in process of exploration. In later articles, we will further discuss detailed technical methods and advanced trading strategies of the Klein Finance platform.

Join Klein Finance:

Website: https://klein.finance/ Twitter: https://twitter.com/KleinSwap Telegram: https://t.me/KleinFinance