To better understand Balancer V2 and Embr we have to look at the history and protocols that came before it. The simple history began with Uniswap, which evolved to Balancer and then Balancer V2.
The vast majority of crypto trading takes place on centralized exchanges, like Coinbase and Binance. These platforms are governed by a single authority and require the users to place funds under their control via a traditional order book system. Order book-based trading is where buy and sell orders are presented in a list along with the total amount placed in each order. The amount of open buy and sell orders is known as the “market depth”. To execute a trade, a buy order has to be matched with a sell order on the opposite side of the book for the same amount and price of an asset. That means you would have to wait for a buyer to appear on the other side who’s looking for your asset at an equal or higher price before your sell order goes through. The main problem with the order book is liquidity. If there is low liquidity it means traders may not be able to fill their buy or sell orders.
In 2018, the Uniswap platform was built on top of the Ethereum blockchain, making it compatible with all ERC-20 tokens and infrastructure. Uniswap is a decentralized exchange which means the users maintain control of their funds at all times as opposed to the centralized exchange system where users had to give up control of their asset/private keys so that an order can be logged on an internal database. A DEX eliminates the risk of losing assets if the exchange is ever hacked since the users retain control of their private keys. Uniswap runs on two smart contracts; an “exchange” contract and a “factory” contract. These contracts are designed to perform specific functions when certain conditions are met. For example, the factory smart contract is used to add new liquidity pools to the platform and the exchange contract facilitates all token swaps.
The way Uniswap solves the liquidity problem of centralized exchanges is through an automated liquidity protocol. This works by incentivizing people trading on the exchange to become liquidity providers. Uniswap users pool their money together to create a fund that is used for executing trades that take place on the platform. Each token listed has its own pool/pairing that users can contribute to, and the prices for each token are worked out using an algorithm. This system allows a buyer or seller to execute a trade instantly at a known price as long as there is enough liquidity in the pool to facilitate it. In exchange for putting up their funds, each Liquidity Provider receives a token that represents the staked contribution to the pool. If you contributed $100 to a pool that held $1,000 you would receive a token for 10% of the pool, which can be redeemed for a share of the trading fees.
Uniswap uses an Automated Market Maker (AMM) system. This method for adjusting the price uses a mathematical equation. It works by increasing and decreasing the price of a coin depending on the ratio of how many coins there are in the pool. The equation for working out the price of each token is x*y=k, where the amount of one token is “x” and the amount of another token is “y”. K is a constant value and doesn’t change. For example, if meta wants to trade Avaware for Embr using this equation and meta adds a large amount of Avaware to the pool it increases the ratio of Avaware in the pool to Embr. Since the value K must remain the same, it means the cost of Embr increases while the cost of Avaware decreases. The size of the liquidity pool also determines how much the price of tokens changes during a trade. The more liquidity (money) there is in a pool, the easier it is to make larger trades without causing the price to slide as much.
Part 3 of this series will move into how Uniswap’s features evolved into the original Balancer.