Bancor An on-chain liquidity protocol for asset swaps

Bancor is a decentralized exchange (DEX) built on the Ethereum and EOS blockchains. The Bancor protocol employs an automated market maker (AMM) smart contract to facilitate token trades against token liquidity pools without matching buyers and sellers. It has a built-in token called BNT that serves as the common price token to fulfill trades among other smart contract tokens. A portion of total trading fees are distributed to Liquidity Providers, or LPs, that deposit tokens into Liquidity Pools. Trading fees also protect user deposits from Impermanent Loss while minted and burned BNT supply maintains the constant market function for continuous token pricing. While Bancor already exists on Ethereum and EOS, it can be integrated into any smart contract-enabled blockchain to provide cross-chain liquidity.

Background

As thousands of tokens have been created and continue to be created, there is a growing need to swap between them. Traditional exchanges require there to be a willing buyer and seller for each token pair to trade, also called liquidity. However, insufficient liquidity for many long-tail cryptoassets prevented centralized exchanges from listing them. Bancor was designed to create permissionless token trading markets for a burgeoning token economy.

Bancor launched on June 12, 2017, with the largest initial coin offering, or ICO, at the time. It raised $153 million, distributing half of the initial BNT supply in the process. The other half was distributed among Bancor's founders, investors, and treasury. Bancor was the first DEX to use an AMM to facilitate swaps between Ethereum-based tokens. Instead of a central order book that matched buyers and sellers according to their bid and ask prices, the AMM fulfilled orders with on-chain liquidity pools.

In July 2018, an attacker stole 25,000 ETH, 2.5 million BNT, and 230 million NPXS tokens from the Bancor protocol. The team was able to recover, freeze, or destroy the stolen BNT, but no ETH nor NPXS were recovered. The Bancor team's recovery sparked controversy about the protocol's centralized governance that enabled the team to unilaterally manipulate the BNT supply. The event pushed the team to decentralize its platform by transitioning governance to a DAO. The Bancor went live towards the end of 2020. It allows BNT holders to propose and vote on upgrades and protocol governance issues.

In September 2019, Bancor announced it would airdrop its entire Ethereum reserve to BNT holders. The team also altered the token model to create an inflationary model to reward liquidity pools, oracles, and developers as determined by the community.

Bancor V2.1 launched in March 2021 with new BNT supply and governance updates to address issues common to AMM exchanges. The previous Bancor iteration required LPs to deposit two assets to each pool, BNT and its paired token, in proportional amounts. This often resulted in involuntary exposure to either token. Liquidity providers experienced impermanent loss when token prices on Bancor lagged prices elsewhere. The new BNT supply is elastic to mitigate both problems. Single-sided deposits are now accepted and paired with newly minted BNT, eliminating involuntary exposure. As LPs deposit BNT in the same pool, minted BNT is burned to balance BNT's circulating supply. Bancor now requires a minimum BNT staking time to receive vBNT, the protocol's new governance token. The Bancor Vortex provides BNT depositors with additional rewards for subsequently staking their vBNT.

Technology

Bancor Network Architecture
Bancor integrates a series of smart contracts to convert tokens on and across blockchains. Users access the Bancor Network contract to discover prices and buy, sell, or deposit tokens. Liquidity Pools store token reserves supplied by Liquidity Provider deposits that fulfill the conversion, or exchange, function. All trades require token fees paid to each Liquidity Pool that are distributed to Liquidity Providers according to their share of the pool.

Smart Tokens
The protocol uses Smart Tokens which have one or more connectors holding the balance of other tokens. Smart Tokens are ERC-20 compliant with additional logic to allow users to buy and sell them directly by depositing or withdrawing the connected token. Bancor uses BNT and a stable version, USDB, as the protocol's Smart Tokens. The price at which they are exchanged is determined based on a fixed ratio between the value of the Smart Token and the value of the connector balance. The weight affects the price elasticity between the tokens and a higher weight leads to less volatility and vice versa. A weight of 100% represents a stable peg to the connected token as the price does not change.

The BNT token connects all of these processes to convert tokens. Each BNT SmartToken is managed by a single BancorConverter to calculate the BNT amount required to exchange for another token. Upon calling the convert function for two non-BNT tokens, the Converter calculates and calls the amount of both tokens, denominated in BNT. By denominating converted tokens in BNT, Bancor can efficiently exchange any one token for another, given they are registered in the protocol. The supply of BNT is elastic to facilitate token liquidity on the exchange and protect users from common exchange risks. As tokens move into Liquidity Pools, BNT is minted proportionately. Simultaneously, BNT is burned as tokens move out of Liquidity Pools. This action limits price slippage as it maintains the user's initial token supply by flexing the BNT supply to convert one token to another.

One implementation of a Smart Token is a “relay” which has two connected tokens each with a weight of 50%. Anytime a trade occurs that shifts the supply of the connected token, the prices adjust to re-balance.

Liquidity Pools
Liquidity Pools are registered on the Contract Registry through BancorDAO proposals and votes. Once whitelisted, the token's Liquidity Pool, Converter, and BancorFormula are set. The BancorFormula contract is established upon registry to calculate the price and supply for all tokens in BNT reflexively. The formula is the core of the AMM function and adjusts a token's price incrementally as token conversions change the Liquidity Pool supply.

This set of smart contracts is open for all users to access and build upon. Developers can use APIs or public interfaces to integrate Bancor contracts into other decentralized applications. These contracts can provide liquid token markets for applications that need permissionless token exchanges.

BancorX
BancorX is a bridge that facilitates token exchange between the Ethereum and EOS networks. The bridge uses the BNT token to convert smart contract assets across the blockchains. The BancorX software is operated on three servers called Oracles. The Oracles interact with Gate Contracts on Ethereum and EOS.

From Ethereum, a user sends BNT to the ETH Gate Contract address with a transaction memo that contains the destination EOS address. The ETH Gate Contract notifies the EOSBNT smart contract to issue BNT to the EOS wallet.
From EOS, the user sends a transaction memo with the destination ETH address and EOSBNT to the EOS smart contract. The EOSBNT smart contract notifies the ETH address to release the BNT balance and destroys the corresponding EOSBNT amount.

The BancorX architecture is designed to be ported to other smart contract-enabled blockchains. Each new blockchain requires unique BancorX oracle addresses. The new blockchain must allow the BancorX oracle to monitor, generate, and transmit new transactions on the new blockchain.