Balancer V2 — A One-Stop-Shop

How Balancer V2 Has Everything You Would Want From An AMM

Stanislav Kozlovski
Balancer Protocol
13 min readMar 26, 2021

--

Introduction

We are living in an incredibly exciting time for DeFi. Having gone through the craziness that was the summer of DeFi in 2020 and seeing it flourish again this winter, just keeping up with the space is proving to be a full-time job.

Every week there are new projects being announced, claiming to be the latest and greatest in their target niche. With this increased attention comes increased risks. As such, it is important to be prudent as to where you put your hard-earned money to work in the decentralized finance space.

In this article, I will make the case why I believe that Balancer, in particular their V2 version, will likely turn out to be the next big thing in DeFi due to its innovative fundamental characteristics.

Balancer Primer

Before we dive in, let’s do a quick overview of Balancer.

Balancer is an automated market maker (AMM) protocol built on Ethereum. It has its own governance token — $BAL.

Balancer allows for its trading pairs (called pools) to consist of multiple tokens — anywhere between 2 and 8, each token with a different arbitrary share of the pool (from 2% to 98%). This is different than how 50/50 AMMs (e.g Uniswap) rely on the x*y=k equation in that it allows different, varying impermanent loss schemes and capital efficiency according to the specific use case.

To route trades, it uses a system that intelligently sources liquidity from multiple pools so as to automatically figure out the best available price from the range of available pools. This system is called Smart Order Routing (SOR).

Balancer Pools are extremely customizable, allowing anybody to create a pool with custom fees (ranging from 0.00001% to 10%).

This fee is split between those that provide liquidity to the pool, called liquidity providers (LPs).

Further, allowing effectively zero percentage fee is an advantage over competitors (e.g SushiSwap) whose minimum fee can be a deterrent for things like high-frequency trading.

This allows for Balancer to offer a sort of self-balancing index fund — the inverse of an ETF, where instead of the TradFi way of paying a portfolio manager to keep balancing the ETF as prices of its consisting assets inevitably change, in the inverse ETF you, as a liquidity provider, get paid when the ETF is rebalanced.
This works because market actors are incentivized to rebalance the portfolio so as to take advantage of arbitrage opportunities. Their fees are what pays you as the investor in the fund.

The rewards come in the form of Balancer Pool Tokens (BPTs) for that specific pool which allows for composability — you can create Balancer pools of Balancer pools. This can fill the need of products that want to aggregate across many different products — imagine a project which tokenizes real estate and has separate Balancer pools for each city — a composed version of that pool could represent a whole state.

A Balancer pool has the following variables:

  • Change Tokens — add or remove tokens from the pool (2 to 8)
  • Change Weights — change the weighting of any token in the pool (2% to 98%)
  • Change Fee (0.00001 to 10%)
  • White/blacklist LPs — limit the particular addresses that can become LPs in the pool
  • Limit Max Deposited Value — limit the maximum value LPs can deposit
  • Start/Stop Trading — pause trading for the pool.

With that, there are three types of pools:

  • public pools (also called shared)— anyone can add liquidity (and get Balancer Pool Tokens in return), but all the pool parameters are fixed forever. (trustless, finalized)
  • private pools — all the parameters are flexible — only the owner can change them but also only the owner can add liquidity (trusted, unfinalized)
  • smart pools — anybody can add liquidity to them and the parameters can be fixed or dynamic controlled through smart contracts. (trustless, flexible).

All of this extensibility opens up a wide array of use cases beyond simple trading.

LBPs

One other use case worth going over is bootstrapping a brand new token with liquidity, where Balancer offers a new paradigm for optimal token distribution.

Unfortunately, Uniswap’s 50/50 approach to token pricing means that little total volume can produce huge swings in pricing, creating both irrational price-discovery and serving a bad job as a token distribution mechanism where bots can front-run the community with the ability to run a pump & dump scheme on them.
Further, this model requires a lot of capital to be deployed from the founding team (after all, the other 50% needs to be in an established token like ETH).

To solve this, Balancer offers the so-called Liquidity Bootstrapping Pools (LBPs) — short-lived smart pools which dynamically change their token weighting (e.g 2%/98% ETH/$TOKEN to 98%/2% ETH/$TOKEN), allowing founders to create a liquidity bootstrapping pool with little required capital from their side. The result is that the token price continually experiences downward pressure throughout the sale. When this is mixed with modest buying demand, the price stays stable throughout the sale, as whales/bots are disincentivized to buy it all at once.

There have been numerous successful LBPs to date, with Radicle (blog post coming soon), HydraDX, and Perpetual Protocol being the most recent.

Balancer offers value to all parts of the liquidity ecosystem — a self-balancing portfolio for investors, a deep liquidity source for traders, and an efficient bootstrapping tool for issuers.

Since Balancer successfully offers a stable, highly-configurable building block to the DeFi ecosystem, we can be certain that more use cases are going to pop up with time as people experiment with it.

As of writing, Balancer is in the top 10 DeFi protocols with relation to total value locked — clocking in at $1.62B TVL.

With the V2 improvements shipping in April, there is reason to believe that Balancer will be able to establish itself in the top 5. Not only that, but it has clear potential for becoming the primary source of DeFi liquidity.

V2 Benefits

Here are the reasons I believe that Balancer V2 and its continual development will give it the shot to become the top DEX in the space in 2021.

Track Record & Backing

Before diving into technical details, we should reflect that the team driving the project is perhaps the most important piece of the puzzle for success.

Obviously, any team that’s not in it for the long-term is not competent, or does not listen to the community is doomed for eventual failure. There is a reason VCs bet first and foremost on the founder.

It is hard to predict what will be successful but it is easy to predict that the right team will eventually find and capture it.

The team behind Balancer (Balancer Labs) has been in the DeFi space for a while, having started Balancer as a research project in early 2018.

They have proven that they can ship and maintain a successful DeFi product that is driven by decentralized governance. The team has shown that they respect and care about the ethos of the industry. This collaborative mindset made them built snapshot.page, an open-source tool that allows for gasless voting which became the de-facto standard for decentralized governance voting with 600 projects using it as of writing.

Follow The Money
It seems like I am not the only person to share the same thoughts about Balancer Labs, as they have never been short of funding. They have raised a respectable amount of funding from big names in the space — $3M from Accomplice and Placeholder in March 2020 and a fresh Series A round totaling $12M from the juggernaut Three Arrows Capital, DeFiance Capital, Alameda Research, and Pantera Capital in February 2021.

Gas Efficiency

The elephant in the room — gas fees! What would a DeFi article in 2021 be without it?

The high gas fees are making the whole DeFi ecosystem suffer.
In terms of Balancer, the high gas fees are neutering the SOR (smart order router), as sourcing liquidity from multiple pools becomes more expensive than the potential savings in slippage it’s supposed to offer due to the gas fees incurred when drawing from each pool.

To solve this, Balancer V2 groups each pool’s assets under a single vault (called the Protocol Vault) that holds the assets for all Balancer pools.

All under one vault

The benefit is that what would have been multiple transactions before, each with gas fees will now be a single transaction. This will finally allow Balancer to take full advantage of its multi-pool trading routing so as to offer the greatest possible liquidity with the lowest possible slippage.

This is achieved through decoupling the pools’ AMM logic from the token management and accounting.

As far as I am aware, every other AMM has the old gas inefficient model when trading with more than one pool for additional liquidity. This means that Balancer should be the best in the industry at offering low slippage with the same amount of liquidity.

Net Token Transfers

Storing every token in a single vault offers another large advantage where intra-exchange transactions can be more efficiently managed requiring only one settlement when leaving the exchange.

In Balancer’s new Protocol Vault, only the final net token amounts are transferred from and into the vault (via an ERC20 transaction). This makes arbitrage trades significantly easier, allowing you to execute a successful arbitrate trade across Balancer Pools without any tokens, to begin with.

For example, if you detect a price asymmetry, you could execute the following trade:

  1. DAI -> MKR (pool 1)
  2. MKR -> BAL (pool 2)
  3. BAL -> DAI (pool 3)
  4. Receive the profit in DAI
Balancer V2 executes many trades at once while the Protocol Vault only does one settlement

Internal Token Balances

Further, Balancer V2 allows users to hold internal token balances inside the vault. For example, if you are trading ETH for DAI but know that you’ll trade DAI back to ETH in a few hours, you can keep both tokens in the vault and use them for your next trade without the need for an intermediate useless ERC20 transaction.

Internal token balances are extremely useful for high-frequency trading and are a very advantageous DeFi building block, allowing DEX aggregators to leverage Balancer internal balances in order to provide traders with the lowest gas costs to their users.

Dynamic Fees

Balancer recently announced its partnership with Gauntlet to introduce dynamic fees to the mix.

Today, it’s nearly impossible to choose a correct swap fee at pool creation time. Inherently, the optimal trading fee for a pair continuously changes throughout both tokens’ lifecycles and the overall market cycle.

For example, a static fee can have diminishing returns after circumstances change, like liquidity moving to another pool. Another example is that during times of wild volatility, liquidity providers risk sustaining greater impermanent losses.

Just like ride-sharing apps have accommodative pricing (surge pricing) during high-traffic times, Gauntlet can similarly provide pools with appropriate fee optimizations accommodative to the situation at play.

Because the fee itself will be dynamically changing in response to the ever-changing conditions, you can rest assured that the fee will always be optimal as computed by Gauntlet’s battle-tested algorithm.

Asset Managers

This has to be the feature I am most excited about as a retail investor!

Traditional AMMs are not very efficient with their capital since a large chunk of the assets in a pair remain unused (no trade digs deep enough to the last ounce of liquidity).

To leverage the potential of these assets, Balancer V2 introduces a new revolutionary concept called Asset Managers.

Asset Managers — external smart contracts, nominated by pools, that have full power over the pool’s tokens.

An Asset Manager can therefore lend the unused tokens out to a lending protocol, improving the pool’s yield by putting capital to work when it’s not being used as swap liquidity.

A visual representation of the idle capital (`Invested Amount`) chunk of the pool leveraging the Lending Protocol for extra yield.

Most excitingly, Balancer has already partnered with Aave to build the first asset manager!

Asset Managers are an innovative new AMM feature that goes to show the power of DeFi’s composability.

The details of how this works are well abstracted away from the end-user — but if you are curious, this blog post explains it well.

With these latest additions, Balancer LPs can earn yield from 3 places:

  • BAL from liquidity mining
  • swap fees that are dynamically optimized
  • asset managers

UX/UI

They say you best learn from experience! Balancer has historically had its fair share of UX hiccups and while it launched a new, simplified UI in December 2020, it still had some imperfections. For example, the default slippage setting was easy to not take into account when conducting a trade — the worst-case scenario resulting in your transaction failing and gas being wasted.

With V2, Balancer has invested in building out a full-time UI team that are redesigning the UX experience from the ground up. The GUI is expected to be completely different, incorporating best practices from blue-chip dApps.

As the team learned how important it is, extra care will also be added to user education in this version.

The new UI will be greatly simplified, transparent, and user-friendly, making it much harder to make mistakes when using it and providing clearer error messages if things ever do go wrong.

Resilient Price Oracles

On-chain price feeds are a critical component for many DeFi applications (prediction markets, lending, margin trading, etc). It is currently not a good idea to use a Balancer pool as a price oracle by deriving the exchange rate from the ratio of tokens in the pool, as that is vulnerable to sandwich attacks. Nevertheless, perhaps due to lack of education, some teams inadvertently use it.

Balancer V2 will make the protocol more resilient and user-friendly by introducing price oracles that are resistant to such sandwich attacks by leveraging accumulators (as pioneered by Uniswap V2).

There will be two types of oracles that can be queried for low gas costs:

  • Instant A more up-to-date price but less resilient to manipulation
  • Resilient — Less up-to-date but more resilient to manipulation

The existence of two price types allows projects to use the one that best fits their use case — a lending protocol would likely use the resilient price whereas something like a prediction market may prefer the instant price.

Governance

As Balancer continues to transition toward a community-driven protocol, V2 will implement three new types of protocol-level fees that fuel the treasury, entirely controlled by BAL token holders.

  • Trading Fees — a small percentage of the trading fees paid by traders to pool LPs.
  • Withdrawal Fees — a small percentage of any tokens that are withdrawn from the Protocol Vault. Note that trades and moving liquidity between pools are not included.
  • Flash Loan Fees — A small percentage of assets that are used for flash loans from the Protocol Vault.

At inception, the first two (trading & withdrawal) fees will be turned off. The flash loan fee will start at a small value solely to ensure there is always some cost of capital for creating a flash loan on Balancer.

Initially, all protocol fees will be kept in the Protocol Vault, setting the stage for the community governance to decide whether/how these fees will be used.

Summary

That was a doozy!

Let us try to summarize what we just read.

In this piece, we made the case of why Balancer can be considered a one-stop-shop for all things AMM. We went over the basics of the protocol (V1) and saw how it can be leveraged for multiple use-cases besides traditional trading, the most common being self-balancing funds and liquidity bootstrapping pools (LBP).

Balancer is able to fulfill these use cases through its unique blend of high customizability, multi-token pools, and different kinds of pools (public, private, smart).

With V2, Balancer comes closer to fulfill its larger vision of becoming the primary source of DeFi liquidity by introducing a new set of innovative features that thoroughly set it apart from the competition.

The extra gas efficiency gained by the new protocol vault and internal token balances not only help Balancer reach gas-usage parity with other popular protocols but also unlock additional use cases (e.g for DEX aggregators) that are unrivaled in low-gas usage across the industry.

Being efficient in gas usage translates to efficient capital usage. As sourcing liquidity from multiple pools does not incur extra cost, Balancer can leverage its wide array of pools to offer superior liquidity when compared to other decentralized exchanges pound for pound.

If that wasn’t enough, Balancer V2 introduces the novel asset manager and dynamic fees, both of which will bring LPs additional yield at no extra cost by simply making intelligent use of the pool’s idle liquidity and continuously optimizing a pool’s fees.

To ensure that everything laid out above is usable, V2 will also introduce a redesign of the UI and an increased focus on UX and user education.

Further improvements like resilient price oracles and governance control over fees, while not as big and sexy as the others, are on their own very important building blocks that will help hone the protocol over the long-run.

Takeaway

Balancer’s core team of brilliant mathematicians and engineers are building an important primitive at the liquidity layer within decentralized finance. With their extremely flexible protocol, the field of programmability with Balancer is vast. Because of this, it is reasonable to expect more use cases to pop up as other talented engineers experiment with the protocol to solve unmet needs within DeFi.

Combined with their non-stop drive to innovate, I am very optimistic about the future of the protocol.

And with the overall decentralized exchange ecosystem hitting new records in terms of volume, seemingly just beginning to gain attention from the traditional finance sector, there is surely a lot more room to grow for the collective industry.

While first-mover advantage and dominant liquidity pools have allowed some tokens to gain a significant share of the market, I believe the fight for the title of top DEX is just getting started and is very reliant on which team manages to innovate faster while both addressing the elephant in the room (gas fees) and concurrently making their platform more attractive to both traders and LPs than the competition.

I am incredibly excited to see the Balancer team continue towards building the primary source of liquidity for tomorrow’s financial system.

Follow Balancer

Twitter | Discord | Website | Dashboard

--

--

Stanislav Kozlovski
Balancer Protocol

A generally curious individual — software engineer, mediterranean dweller, regular gym-goer and coffee lover