From 0a97b4219657108733064f2c8ff58704cfe3887d Mon Sep 17 00:00:00 2001 From: dr-f <85728474+dr-f@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:59:56 +0300 Subject: [PATCH 1/3] Create kip-13.md --- KIPs/kip-13.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 KIPs/kip-13.md diff --git a/KIPs/kip-13.md b/KIPs/kip-13.md new file mode 100644 index 0000000..ce259e8 --- /dev/null +++ b/KIPs/kip-13.md @@ -0,0 +1,55 @@ +--- +kip: 13 +title: Use B.Protocol v2 as a liquidation engine for the Kyber Network's fee liquidation framework +status: Draft +type: Configuration +authors: Dr. F +created: 2021-08-12 +--- + +``` +executor: long timelock executor +voting_power: current staked voting power +execution: TBD +start_timestamp: TBD +end_timestamp: TBD +``` + +## Summary +[KIP-11](https://github.com/KyberNetwork/KIPs/blob/master/KIPs/kip-11.md) deployed a framework for fee liquidations, namely to convert the protocol fees to KNC before distributing them to the DAO members. +KIP-13 propose to use B.Protocol as the liquidation engine, and to list the liquidation engine as a reserve in Kyber Network. + + +## Motivation +B.Protocol v2 implements a novel and fully decentralized [algorithm](https://docs.bprotocol.org/technical-documentation/untitled-1) for inventory sell. The algorithm is already live with our [Liquity integration](https://docs.bprotocol.org/info/user-guides/liquity-user-guide) and manage over $30m of users' deposits. +In the core of the protocol resides a smart contract formula that price inventory according to an imbalance parameter and market price. +Using B.Protocol will offer the following benefits: +1. **Better (expected) execution price:** Kyber's current liquidation system offer a fixed discount in order to incentives keepers to perform the liquidation. With B.Protocol the discount varies according to the inventory imbalance, and will be on average much lower. +In addition Kyber's current liquidation system executes the trade as a taker, while in B.Protocol the inventory is being sold as maker orders. + +2. **Better contribution to the Kyber Network DEX:** The current system encourage short term arbitrage bots to participate in the trade, while B.Protocol v2, as a reserve in Kyber, will offer, during the liquidation process, non arbitrage prices, which would benefit real users who will enjoy better trade price. + +3. **Fully distributed and incentive compatible:** The current system relies on bot operators, and the incentive for the bot operators comes on the expense of the DAO profits. + +## System Overview +B.Protocol's automatic market maker (B.AMM) will be deployed and will offer token=>ETH and ETH=>KNC pairs. +Kyber's DAO will control the B.AMM price oracle, and B.Protocol's DAO will control the imbalance factor and the rebalance fee (capped by an agreed value). + +Whenever fees are accumulated at the Kyber's treasury, they will be priced for sale in return to ETH by the B.AMM, which will be a reserve at kyber network. +Whenever ETH is accumulated it will be offered for sale in return to KNC in the same way. +Whenever KNC is accumulated it will be automatically be transfered to the Kyber's DAO. + +Chainlink keeper service will be deployed to automatically convert LP tokens into their original underlying tokens. + +Technical details about the B.AMM along with the original whitepaper could be found [here](https://docs.bprotocol.org/technical-documentation/untitled-1). + +## Implementation +TODO + +## Onchain execution + +TODO + +## Conclusion +This fee liquidation framework could greatly benefit by adopting the B.Protocol's B.AMM. It could potentially increase Kyber DAO's profit, could help improving the value proposition to its users (rather than the existing mechanism which only improves arbitrage bots) and can help fight MEV and be more incentive compatible w.r.t current implementation. + From 21b68a2ee785da93baba6d6e3e55bedd065a6e76 Mon Sep 17 00:00:00 2001 From: dr-f <85728474+dr-f@users.noreply.github.com> Date: Thu, 26 Aug 2021 10:59:03 +0300 Subject: [PATCH 2/3] Update kip-13.md --- KIPs/kip-13.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/KIPs/kip-13.md b/KIPs/kip-13.md index ce259e8..7656112 100644 --- a/KIPs/kip-13.md +++ b/KIPs/kip-13.md @@ -43,6 +43,16 @@ Chainlink keeper service will be deployed to automatically convert LP tokens int Technical details about the B.AMM along with the original whitepaper could be found [here](https://docs.bprotocol.org/technical-documentation/untitled-1). +## How BAMM works? +The process of selling fee token X to KNC (and for the reminder of this section we assume for simplicity that X is ETH) is done by offering the ETH for sale (in return of KNC) according to the market price, which is determined according to a price oracle (e.g., Chainlink). An optional discount on market price is given according to the imbalance size (the amount of tokens to sell w.r.t a target inventory size), and the exact formula is an adaptation of Curve Finance stable swap invariant. + +Hence, the BAMM is in fact a pricing function for ETH vs KNC, and adhere to kyber reserve interface. Therefor the prices it offers are available to all of kyber network users. + +### Use of Curve formula +Curve Finance AMM is using the stable swap invariant to price assets. It’s core property is that it has a target portfolio (i.e., target ratio between two or more assets) and it provides different slippage according to the distance from the target portfolio, and the bigger the target is, the bigger the slippage is. +This property makes it ideal to use the stable swap invariant for the automated rebalancing process. However, the stable swap invariant was tailored to correlated asset classes, e.g., DAI and USDT. +As the existing Kyber Network's system already relies on an external price feed for the liquidation process, we can normalize all portfolio assets to their USD values, and plug it into the stable swap invariant, without additional security risk. + ## Implementation TODO From f1b506b0fa42d2efbfe2ffcc91ef61b5d66efa03 Mon Sep 17 00:00:00 2001 From: dr-f <85728474+dr-f@users.noreply.github.com> Date: Tue, 31 Aug 2021 12:06:29 +0300 Subject: [PATCH 3/3] Update kip-13.md --- KIPs/kip-13.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KIPs/kip-13.md b/KIPs/kip-13.md index 7656112..a100693 100644 --- a/KIPs/kip-13.md +++ b/KIPs/kip-13.md @@ -54,7 +54,7 @@ This property makes it ideal to use the stable swap invariant for the automated As the existing Kyber Network's system already relies on an external price feed for the liquidation process, we can normalize all portfolio assets to their USD values, and plug it into the stable swap invariant, without additional security risk. ## Implementation -TODO +https://github.com/dr-f/BAMM/blob/main/contracts/BAMM.sol ## Onchain execution