decentralized finance education

What is Bancor V2? Chainlink Integration and Dynamic Automated Market Maker Explained.

Intro

What is the latest update to the Bancor protocol called Bancor V2? Will Bancor V2 outcompete other decentralized exchanges such as Uniswap, Curve and Balancer? Also, why are Bancor V2 pools integrated with Chainlink? We’ll be going through all of this in this article.

Bancor

Let’s start with a quick recap of what Bancor actually is.

Bancor is an on-chain liquidity protocol that enables automated, decentralized token exchange on Ethereum and across blockchains. Launched in 2017 with one of the biggest ICOs in the space, the protocol is made up of a series of smart contracts designed to pool liquidity and perform peer-to-contract trades in a single transaction with no counter-party. Users add liquidity to automated market makers (AMMs) in exchange for trading fees, staking rewards and future voting rights in the BancorDAO. If you need a quick recap on liquidity pools and automated market-making you can read this article.

Why Was Bancor V2 Created?

Although Bancor was one of the first protocols that implemented liquidity pools it didn’t get as much traction as some of their competitors. There were a few reasons for this, mainly the requirement to use an additional BNT token to provide liquidity to every pool, high gas fees to execute contracts and a harder process to list new tokens. Some of these problems were already addressed even before launching V2, for example, the Bancor community created permissionless interfaces for listing new coins.

On top of the above problems, the Bancor Team identified a few key obstacles that they believe are stopping AMM from wider adoption. These include exposure to “impermanent loss”, exposure to multiple assets, capital inefficiency and the opportunity cost of providing liquidity.

To tackle each one of them Bancor V2 implemented a bunch of new features.

The biggest one is the introduction of a new AMM called a dynamic automated market maker or DAMM that addresses the first 2 obstacles impermanent loss and exposure to multiple assets.

Before we jump into the mechanics behind the DAMM, let’s make sure we understand what impermanent loss actually is.

Impermanent Loss

In essence, impermanent loss is a temporary loss of funds occurring when providing liquidity. It’s very often explained as a difference between holding an asset versus providing liquidity in that asset. Impermanent loss is usually observed in standard liquidity pools where the liquidity provider (LP) has to provide both assets in a correct ratio and one of the asset’s value is volatile in relation to the other, for example, in a DAI/ETH 50/50 liquidity pool.

If ETH goes up in value, the pool has to rely on arbitrageurs constantly making sure the pool price reflects the real-world price to maintain the same value of both tokens in the pool. This basically leads to a situation where profit from the token that appreciated in value is taken away from the liquidity provider. At this point, if the LP decides to withdraw their liquidity the impermanent loss becomes permanent. The full explanation of impermanent loss is outside of the scope of this article, but I’ll try to make another one just on this fairly complicated topic.

Dynamic Automated Market Maker

We can see the main driver for impermanent loss is the fixed ratio between the tokens. But what if we didn’t have to always rely on a fixed ratio between the tokens in a pool? What if we could dynamically balance the ratio of the tokens in a pool? This is where DAMM comes into play.

DAMMs make use of price oracles to determine if the balance between tokens in the pool should be changed. Price oracles such as Chainlink provide external prices to smart contracts in a decentralized and reliable way. They can, for example, provide a current price of LINK/ETH.

Before we go through a quick example, let’s introduce a concept of the staked and current balance.

Stake balance is the balance provided by the liquidity provider. This is basically the balance that the LP should be allowed to withdraw when they decide to finish providing liquidity. Current balance is a balance of the tokens in the pool also sometimes called the “reserve balance”. Bancor V2 DAMMs always incentivize market participants to bring the current balance as close to the staked balance as possible, making sure that the LPs can withdraw the number of tokens they provided to the pool and mitigate impermanent loss. One of the ways to achieve this is by using dynamic fees. So if the current balance diverges from the staked balance, the fees can be adjusted to incentive market participants to bring both balances closer together.

A V2 pool is always initialized in a balanced state so that the price offered by the pool (“pool price”) is equal to an external reference “market price” provided by price oracles. The V2 pools are designed to always push the pool price to equal the market price.

Let’s see how the balancing mechanism works.

We start with a liquidity provider supplying equal value of 2 assets to the pool. Let’s assume the pool hold 2 assets LINK and BNT.

This is how our pool looks like after the initial supply was added.

So far so good, the state of the pool is not much different from the V1 pools or the Uniswap pools.

The second step is when the magic happens. Let’s assume that the LINK price went up to $12 across multiple exchanges and the price is not reflected yet in our LINK/BNT pool. Normally it’d create an instant arbitrage opportunity that would be most likely taken by a market participant and result in impermanent loss for the liquidity provider. This is because the ratio between the tokens remains fixed.

In Bancor v2, price oracles would pick up on that price change and adjust the weights of each token in the pool accordingly. When the LINK price increases, the target weight of LINK in the BNT/LINK pool will grow and there will be no opportunity for arbitrage.

Let’s see how the pool looks like after the price oracle picks up the 20% increase in the LINK price.

As we can see the weights of both LINK and BNT tokens in the pool got adjusted automatically and this is one of the main features of Dynamic Automated Market Makers.

Exposure to Multiple Assets

The mechanism that we just described is also really useful when it comes to tackling another problem – exposure to multiple assets.

In the standard liquidity pool, liquidity providers’ chunk of liquidity is tracked by LP tokens that represent both assets that were provided to the pool. In Bancor V2 liquidity can be supplied to only one of the assets in the pool. So for example, if you have a BNT/LINK pool and you only want to get exposure to LINK, you can just supply LINK and there is no obligation to supply BNT. Because of the DAMMs and the integration with price oracles the V2 liquidity pool will be able to adjust the ratio between the tokens in the pool.

Additionally, for each V2 pool, the liquidity providers receive separate LP tokens for each of the assets provided to the pool.

If we go to our previous example we can see what would happen if someone supplied more LINK to our BNT/LINK pool.

Let’s start with the same initial balances in the pool as before. Now, instead of the increase in the price of LINK, let’s say a new liquidity provider adds 10 more LINK to the pool.

Again we can see that the token weights in the pool got adjusted automatically.

Tackling Capital Inefficiency

To tackle another problem that is capital inefficiency, Bancor V2 introduces a more efficient bonding curve that reduces slippage. Let’s see what it means.

Bonding curves represent a relation between the token supply and price. Standard bonding curves present in constant product market makers such as Uniswap incur quite a lot of slippage as the size of a trade increases in relation to the size of the pool. The Curve Protocol was created to accommodate this problem. The Curve pools are able to provide lower slippage as they consist of assets that should have a very similar price, for example, stable coins like USDC and USDT or different flavours of Bitcoin such as wBTC and renBTC.

Bancor V2, thanks to the integration with price oracles, can provide more efficient bonding curves even for pools where the price of one asset is volatile in relation to the other asset. Bancor V2 bonding curves, even though not exactly as efficient as Curve’s bonding curves for stable assets, are still quite impressive and they provide less slippage and better capital efficiency. According to the Bancor Team, the new DAMM pool can provide similar slippage to the standard liquidity pools with 20x less capital in the pool.

Opportunity Cost of Providing Liquidity

To address the opportunity cost of providing liquidity, Bancor V2 enables the creation of DAMMs that are integrated with lending protocols such as Aave. Essentially, a part of staked liquidity in the pool can be simultaneously lent out which allows liquidity providers to generate lending interest on top of trading fees and maximize their profitability.

Summary

These are pretty much all the new features of Bancor V2. At the time of writing this article, Bancor started their V2 release by creating a LINK/BNT pool that was, for now, max capped at $500k, so the team can verify if everything works as expected before removing the cap.

One extra thing to add is the fact that a V2 pool can only be created if there is a reliable price oracle for the assets that are traded in the pool. So V2 pools may not be the best choice for unpopular and less liquid tokens.

It’s also worth noting that similarly to Bancor V1, Bancor V2 still relies on having BNT in each liquidity pool. So, for example, to trade from ETH to DAI we would have to trade through ETH/BNT and DAI/BNT pools.

When it comes to competing with other Dexes, Bancor V2 can potentially steal some of Uniswap’s volume especially when it comes to the most popular trading pairs. So far, it doesn’t look like Bancor V2 would be a competitor to Curve as they still provide lower slippage for stable assets, also it’s impossible to create a pool such as USDC/USDT in Bancor V2. Also, V2 pools are limited to only 2 assets so Balancer with multiple assets in one pool still provides a unique value proposition.

So what do you think about Bancor V2? Does it have a chance to dethrone Uniswap and attract more liquidity providers? Share your thoughts below.

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.