B.AMM: Efficient Automated Market Maker for DeFi Liquidations

Yaron Velner
B.Protocol
Published in
6 min readJun 13, 2021

Liquidations reside at the core of lending platforms, synthetic assets, derivatives and stable coins. The Backstop Automated Market Maker (B.AMM) is an automatic market maker optimized for lending platform liquidations. It is a fully autonomous smart contract and can efficiently handle liquidations of big debt with smaller capital requirements.

B.Protocol aims to improve the liquidation process in DeFi, and to give rise to more stable systems and support higher leverage and capital efficiency.

At the initial v1 stage, with TVL that ranges between $100M-250M, we focused on trying to make the existing DeFi system more stable, by on-boarding professional liquidators who shared their profits with the users, instead of the miners. The design allowed users to get extra yield when using platforms like Maker and Compound, but did not address the capital inefficiency of the current system. Namely, users were still bound by the same poor collateral factor that Maker and Compound offer.

Last week, two of our community members posted a novel design for a user based liquidation system. Such a system could integrate with our current v1 design, and support the liquidity given by professional traders, but also give rise to a v2 system that will facilitate higher leveraged loans in DeFi.

In this blog post we summarize the 11 page whitepaper and try to make it more accessible to the general public.

We first describe the problem that it is trying to solve, then the proposed solution, and the initial promising experimental results.

The problem

Decentralized lending platforms like Maker, Compound, dYdX, bZx, Aave, and others, notoriously enable a poor leverage ratio of x3-x5, despite having billions of dollars of liquidity at decentralized exchanges which can be used for liquidations at time of need.

Lending platforms are being conservative with their collateral factors (compared to CeFi systems like FTX, ByBit and others who offer x100 leverage to their users), because most of DeFi liquidity is concentrated on automated market makers (AMMs) who either (1) offer relatively high slippage w.r.t deposited amount (e.g., Uniswap V2, Sushi, Balancer, and Bancor); or (2) offer tight spreads which can get depleted upon price changes (e.g., Uniswap V3, Kyber’s DMM).

Hence, AMMs like Uniswap V2, will fail to facilitate $20M DAI liquidation, despite having over $200M deposited inventory at its ETH/DAI pool.

This causes a negative spiral, in which lending platforms cannot offer decent leverage/higher collateral factors as they are uncertain of the liquidation results, and liquidators do not optimize their systems for anything more than arbitrages. Indeed, the paper compares liquidation volumes and expected returns on Binance Futures, which give liquidators very high yield even when they lock $200M only for liquidations. While the same amount will result in very poor APY in DeFi historical.

Some lending platforms try to mitigate this concern by keeping dedicated keepers on their payroll. This only makes the problem worse, as (1) there is no certainty on how these will execute at time of need; and (2) this solution is non-transparent, and gives rise to centralization and single point of failure.

These concerns are not only theoretical. A primary example is Maker’s Black-Thursday failed liquidation events, despite Maker’s great attempt to build a keeper’s community.

The solution

The authors of the whitepaper describe a system where users provide liquidity that is used for liquidations (e.g., repay DAI debt in return to ETH collateral), and after liquidation happens, an automatic re-balance process begins. The re-balance process converts the seized collateral from the liquidation, back to the original asset (e.g., the ETH collateral is converted back to DAI).

The rebalance is done by offering the collateral for sale 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 size of collateral to sell), and the exact formula is an adaptation of Curve Finance stable swap invariant.

As user deposits are expected to sit idle for the majority of the time (when liquidations do not occur), the system will deposit it, on behalf of the users, into yield bearing protocols, e.g., Uniswap, YFI, or Compound, and will withdraw it only to facilitate liquidations.

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 our 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.

Initial experimental results

The whitepaper describes a set of experiments and a way to model how the B.AMM could handle liquidations of $1B monthly.

The authors simulate liquidations during some the most 20 volatile days in Binance Futures exchange, for the ETH-USD pair.

The paper defines a simulation model and suggests the B.AMM could handle such a size of liquidations with $100M-$200M capital.

The simulation also shows that the liquidation process can be very profitable.

B.AMM and B.Protocol

Since its launch, B.Protocol stated that its goal is to build a strong backstop for DeFi liquidations in order to let the ecosystem scale in a secure manner. The efforts were concentrated in bringing a big user base which will give priority to professional liquidators, who in turn reward the users for the given priority.

However we witnessed that even with a TVL of over $250M it was hard to on-board more liquidators. In addition, the community kept asking for a way for users to participate in the liquidation process themselves, rather than using only the professional liquidators liquidity.

Hence, it is only natural that the community will explore some user-based solutions for a stronger backstop. Such backstop could enable a set of applications, from high leverage for margin trading platforms, to synthetic assets and derivatives.

What is next?

In the next couple of weeks we will try to make the core concepts of the whitepaper more accessible to the community, and will try to simplify the technical details and results.

We believe B.Protocol V2 could open up a whole new variety of use-cases and collaborations for B.Protocol and its backstop solution.

During the coming weeks we will engage the community in finding the best utilization for it.

About B.Protocol

B.Protocol makes lending platforms more secure by incentivizing liquidity providers (keepers) to commit on liquidation of under collateralized loans and shift the miners extracted profits back to the users of the platform.

To learn more, please visit our website, twitter, discord, forum, and github.

--

--