B.Protocol <> Liquity Integration is Live!

Yaron Velner
B.Protocol
Published in
6 min readAug 2, 2021

Tldr: B.Protocol automatically converts ETH back to LUSD for Liquity’s Stability Pool providers and deposits it back to the Stability Pool. This locks the liquidation profits for the users, allows passive(!) APY on LUSD (currently 15%), saves gas costs, and strengthens Liquity’s stability.

Try it out at https://app.bprotocol.org/liquity

B.Protocol makes lending platforms more secure by improving their underlying liquidation process and by fighting MEV — preventing liquidators from gas wars over liquidation transactions. After two successful integrations with MakerDAO and Compound, we are happy to launch our third integration with Liquity protocol.

Liquity protocol operates the LUSD stable coin via a novel interest-rate-free and governance-less mechanism. The LUSD is backed only by ETH, and as in most algorithmic coins, it crucially relies on successful and efficient liquidations when the price of ETH declines.

At the core of Liquity liquidation protocol relies its stability pool. Liquity protocol incentivizes users to provide LUSD to the stability pool, and whenever a liquidation happens, LUSD is taken from the pool, to pay the debt of the liquidated Trove, and the pool receives an equivalent amount of ETH, with a 10% discount on ETH-USD price, from the liquidated Trove’s collateral.

Currently, over 80% of the entire LUSD circulation is deposited in the stability pool, which provides very strong stability guarantees to the Liquity protocol. However, the outcome of a liquidation is that the depositor’s LUSD is converted to ETH, and users who wish to maintain their ETH exposure balanced need to sell it back to LUSD and deposit it into the pool themselves.

This introduces a short term drawback for the users, which might result in a long term drawback for the entire Liquity protocol:

  • Short term drawback: Users have to develop and maintain their own rebalancing system that automatically withdraws their ETH and sells it back to LUSD. This entails both development and maintenance costs, as well as gas costs.
  • Long term drawback: Asking users to actively rebalance their ETH position, and deposit it back to the stability pool increases the safety margins for the required stability pool. The Liquity protocol dictates that over time the LQTY token incentives for depositing in the stability pool are decreasing, and thus it is imperative to increase the efficiency of the rebalance process.

Making the rebalance process fully automatic and trustless improves the user experience in the short term, and in the long run could lead to lower capital requirements from the stability pool.

User experience with and without B.Protocol

We illustrate the different stability-pool-user experience with and without B.Protocol in the next two diagrams:

Without B.Protocol, the user simply deposits LUSD to the stability pool, and whenever a liquidation occurs, part of his LUSD is converted to ETH. At this point the liquidation process is completed, and it is up to the user to either sell the ETH and deposit the return back in the stability pool, or to do other things with his ETH.

With B.Protocol, the deposits are done via B.Protocol’s wrapping smart contract interface, which deposits the LUSD to the stability pool on behalf of all users. Once liquidation happens, the discounted ETH is automatically offered for sale by B.Protocol’s Backstop AMM (B.AMM). This is done according to a deterministic formula, which takes into account the current ETH and LUSD inventory, and the current ETH-USD market price (which is taken from Chainlink). Whenever the sale occurs, the smart contract deposits the returned LUSD back to the stability pool.

This forms a circular system, in which the ETH is always eventually sold and the size of the LUSD stability pool does not decrease over time (unless users actively withdraw their deposits). Moreover, as Liquity users are being rewarded with LQTY tokens only for their LUSD in the stability pool, but not for their ETH, B.Protocol’s rebalancing automation process optimizes also the user’s LQTY rewards, which affects the distribution of Liquity’s fees paid in LUSD.

On top of these optimizations, users save the gas costs that are needed for the sale and the deposit operations, and the Liquity protocol benefits from a more stable stability pool.

“B.Protocol integration with Liquity does not only save gas expenses to users and allows them for passive participation, it also makes Liquity’s Stability Pool more capital efficient, and could contribute to the stability of the Liquity protocol”

Robert Lauko, Liquity CEO.

How does it work?

Users deposit LUSD into B.Protocol, which in turn deposits it to Liquity’s stability pool on behalf of B.Protocol smart contract. An internal accounting system in the smart contract makes sure that all users get their fair share of LUSD and LQTY rewards.

Whenever a liquidation happens on Liquity, the Liquity liquidation system takes LUSD from the stability pool to cover the debt of the liquidated Trove, in return for the Trove’s discounted ETH.

B.Protocol is another account in the stability pool, pooling all its users’ funds together, and thus, from time to time, part of its LUSD will be replaced with ETH, according to a conversion rate that offers a 10% discount over the ETH-LUSD market price.

This applies also to the B.Protocol account in the stability pool. And when the ETH balance of the account is non zero, it is offered for sale by the smart contract. The sale offer is simply a smart contract function that lets anyone buy ETH in return to LUSD, according to a quantity based price formula. The formula is an adaptation of Curve Finance’s stable swap invariant, and Chainlink price feed, and the details are described in the B.Protocol v2 whitepaper.

The formula offers the ETH for sale with a discount over market price. And the bigger the ETH balance is (w.r.t total LUSD + ETH inventory) the bigger the discount is. Up to a limit of 4% over market price.

The sell price is aggregated by DEX aggregators such as Kyber Network and Paraswap, and decentralized keepers from Gelato and Chainlink Keepers were integrated to execute an arbitrage trade whenever the price falls too much below market price as a secondary safety measure.

Risks

  • B.Protocol is another smart contract layer on top of Liquity’s stability pool. And even though it was audited the usual smart contract risks still apply.
  • Participating in the stability pool is not risk free, with or without B.Protocol interface. Pool participants get ETH with a 10% discount in return to LUSD, however there is always a risk that ETH price will go down by more than 10% before it is sold back to LUSD. B.Protocol mitigated this risk by offering it to sale on DEX aggregators, and by deploying a dedicated decentralized keepers from Gelato and Chainlink, however this does not fully mitigate the risk in cases of severe and rapid market crashes.
  • B.Protocol is built on top of Liquity protocol and uses Chainlink price oracle (and Liquity protocol itself is built on top of Chainlink price oracle itself). A bug in any of these two protocols could put B.Protocol users at risk.

About B.Protocol

B.Protocol is a Backstop Liquidity protocol, handling liquidations in scale for DeFi lending platforms. By creating a transparent, committed, smart contract-based liquidation system, B.Protocol enables better capital efficiency for DeFi users, while creating another layer of stability for the lending platforms themselves. As liquidations are the main growth engine for DeFi, The B.Protocol backstop solution is unleashing its growth potential.

B.Protocol is live on mainnet since Oct. 2020, is fully decentralized, and controlled by the BPRO token holders.

To learn more, please visit our Website, Docs, Twitter, Discord, Medium, Forum, Reddit, and GitHub.

--

--