KittenSwap (8): Synthetic Asset & Leverage using Chainlink feed
News from the KIF Coin Development team on June 20, 2021
This is part 8 of the KittenSwap series, in which we gradually present our unified swap+lending+option product (https://kitten.finance).
Here we show our synthetic asset & leverage design using Chainlink feed.
We will begin with BULL and BEAR tokens, such as QQQ_BULL_3x and QQQ_BEAR_3x. The benefits of our design:
1. Suitable for long-term holding. No time decay.
It is known that usual BULL & BEAR leverage tokens are not suitable for long-term holding, because their values decay over time. This is solved in our design.
Consider an example. Assume the underlying asset price goes $100 → $90 (so, -10%) → $100 (so, +11.1%). The final price of the underlying asset is the same as the initial price.
In usual leverage designs, the price of a BULL_3x token goes $1 → $0.7 (so, -30%) → $0.933 (so, +33.3%). The final price ($0.933) of the BULL_3x token is lower than the initial price ($1), because its pricing formula is problematic:
In our design, the price of a BULL_3x token goes $1 → $0.729 (so, -27.1%) → $1 (so, +37.2%). The final price ($1) of the BULL_3x token is the same as the initial price ($1), because we use a much better formula:
and there is no longer any time decay. If the price of the underlying asset return to the initial price, so does the price of the leverage token.
2. No liquidation.
Moreover, there is no liquidation in our design, because the price of our leverage token is always above zero.
As an example, assume you are holding BULL_10x token. This is highly risky in usual leverage designs, while being much safer in our design.
In usual leverage designs, your BULL_10x token will be liquidated with extra penalty when the asset price drops less than 10%. Every trader knows how it feels to see the asset price recovers after your liquidation 😂. And that’s why leveraged trading is so risky in usual designs.
In our design, if the asset price drops 10%, your BULL_10x token will still worth (1-0.1)¹⁰=34% of its initial value. And you can fully recover if the asset price goes back to its initial level.
Careful readers will ask the question: if the traders on the wrong side are not losing all $, can the traders on the correct side make enough profit? The answer is YES (if the two sides are balanced), and this is explained in the next section.
3. Liquidity without LP. No slippage. Unlimited Liquidity.
Because we are using the oracle feed to guide the pricing, there is no need for any LP, and traders can enjoy unlimited liquidity.
As an example, let the initial price of QQQ be $350.
Let the initial price of both BULL_3x and BEAR_3x token be $1.
Albert purchases 1000 BULL_3x token with $1000. Ben purchases 1000 BEAR_3x token with $1000.
So there are $2000 in the contract at this moment.
If QQQ rises 2% to $357, then the expected “raw price” of BULL_3x is 1.02³=1.0612, and the expected “raw price” of BEAR_3x is (1/1.02)³=0.9423.
Note 1000*1.0612 + 1000*0.9423 = 2003.5 > 2000, which means we shall normalize the raw prices by the factor 2000/2003.5 in this case.
So the new price of BULL_3x is 1.0612*2000/2003.5 = 1.0593, and the new price of BEAR_3x is 0.9423*2000/2003.5 = 0.9407.
Hence now Albert has a profit of 5.9%, and Ben has a loss of 5.9%. They are free to trade any amount of token at any moment with zero slippage.
4. Balancing the position. Incentives. Details.
If the $ value of outstanding BULL token is close to the $ value of outstanding BEAR token, then the leverage factors of both tokens are close to the target.
For example, if there are 7000 outstanding shares of BULL_3x token at $1.5, and 15000 outstanding shares of BEAR_3x token at $0.7, then the leverage factors of both tokens are close to 3. Readers are welcome to verify this.
But if there are 10000 outstanding shares of BULL_3x token at $1.5, and 10000 outstanding shares of BEAR_3x token at $0.7, then the two sides are not balanced, and the leverage factor of BULL_3x token is 1.91, and the leverage factor of BEAR_3x token is 4.09.
We can make the two sides balanced using the usual trick: the side with less $ value can receive interests from the side with more $ value, and the interest rate is determined by the difference.
Moreover, as an extra incentive, the side with less $ value can receive trading fees of the pair. And we will periodically adjust factors to improve the balance.
Finally, experienced readers will ask the important question: is our design safe from front-running attacks as we are using an oracle feed for pricing? This has been the problem with Synthetix since its beginning.
And we will use a simple yet effective strategy. Let’s say you are buying BULL token. If the price is updated after your trade and becomes higher, then in your next interaction with the contract it will compute the difference, so it is as if you are buying at the updated price.
We are Kitten.Finance (https://www.kitten.finance/) and we are working on multiple DeFi products (lending, swap, option, vaults and more) and our own L2 solutions.