Balancer

Balancer is a decentralized automated market maker (AMM) protocol built on Ethereum with a clear focus on fungible and yield-bearing liquidity.

Balancer's success is intrinsically linked to the success of protocols and products built on the platform. Balancer v3’s architecture focuses on simplicity, flexibility, and extensibility at its core. The v3 vault more formally defines the requirements of a custom pool, shifting core design patterns out of the pool and into the vault.

What is Balancer?

Balancer is a decentralized automated market maker (AMM) protocol built on Ethereum with a clear focus on fungible and yield-bearing liquidity. Balancer's success is intrinsically linked to the success of protocols and products built on the platform. Balancer v3’s architecture focuses on simplicity, flexibility, and extensibility at its core. The v3 vault more formally defines the requirements of a custom pool, shifting core design patterns out of the pool and into the vault.

How Does Balancer Work?

Balancer Pools are smart contracts that define how traders can swap between tokens on Balancer Protocol, and the architecture of Balancer Protocol empowers anyone to create custom pool types. What makes Balancer Pools unique from those of other protocols is their unparalleled flexibility. With the introduction of Hooks and Dynamic Swap Fees, the degree of customization is boundless.

Core Concept of Balancer

The Balancer protocol architecture comprises three primary components, each strategically designed to enhance flexibility and minimize the intricacies involved in constructing pools.

Balancer's BPT Token

BPT Balancer Pool Tokens are tokens that represent ownership or shares in a Balancer pool.

Balancer Pool Types

Every pool type is associated with its own Factory contract, facilitating the creation of new pools. Experienced developers can find the factory deployment addresses through this resource. For further assistance, individuals are encouraged to contact our developers via Discord

Liquidity Bootstrapping Pools (LBPs)

Overview

Balancer's Liquidity Bootstrapping Pools (LBPs) are pools that can dynamically change token weighting (e.g 1/99 to 99/1 for TokenA/TokenB).

LBPs use Weighted Math with time-dependent weights. The starting and end weights and times are selected by the pool owner, who also has the power to pause swaps. The pool owner is the only address that can join the pool.

Balancer Mental Model

You can think of the starting price of your LBP as the ceiling you would want to set for the token sale. This may seem counterintuitive, but since LBPs work differently than other token sales, your starting price should be set much higher than what you believe is the fair price. This does not mean you are trying to sell the token above what it is worth. Setting a high starting price allows the changing pool weights of your LBP to make their full impact, lowering the price progressively until market equilibrium is reached. Unlike older token sale models, such as bonding curves, users are disincentivized to buy early and instead benefit from waiting for the price to decrease until it reaches a level they believe is fair.

Advantages

Sell Presure: During a weight shift, the token price of one token experiences sell pressure while the other experiences buy pressure. When this is mixed with modest swap volume, the price approaches the generally agreed-upon market price. Fair Market: LBPs often start with intentionally high prices. This strongly disincentivizes whales and bots from snatching up much of the pool liquidity at the get-go. When LBPs are used for early-stage tokens, this can help increase how widespread the token distribution is. Starting Capital Can Be Small: Teams who use LBPs to kickstart the liquidity of a token that has not been well distributed yet can do so with minimal starting capital. For a team running an LBP with their TOKEN and DAI, starting with 10% or 20% DAI, as opposed to 50% DAI ** like they might need on another platform, significantly reduces their starting capital requirements. Shifting from 80/20 TOKEN/DAI ** to 20/80

Balancer Routers

In the Balancer v3 architecture, Routers serve as the pivotal interface for users, facilitating efficient interaction with the underlying Vault primitives. Rather than directly engaging with the Vault, users are encouraged to use Routers as their primary entry point. This approach streamlines operations and enhances flexibility by abstracting multi-step operations into simple user-facing functions. Key Functions:

In essence, Routers play a pivotal role in abstracting complexity, enhancing user accessibility, and fostering innovation. By serving as the conduit between users and the underlying Vault system, Routers enable seamless interactions and diverse use cases.

Balancer Routers

Balancer has developed, audited and deployed Router contracts with the goal of providing simplified, easy to use functions for common liquidity actions. These Routers also serve as a useful reference for other Router implementations.

Balancer: The Vault

The Vault is the core of the Balancer protocol; it is a smart contract that holds and manages all tokens in each Balancer pool. First introduced in Balancer v2, the vault architecture separates token accounting from pool logic, allowing for simplified pool contracts that focus on the implementation of their swap, add liquidity and remove liquidity logic.

The Vault

Using Vault is simple and straightforward:

  1. Transient accounting: Transient accounting shifts the validation of accurate token accounting to the start and conclusion of a Vault interaction. This is achieved by initiating a transient state that monitors the debt and credit created during vault interactions. This transient state guarantees the atomic execution of operations within it and confirms the proper settlement of all debt and credit at the end of the execution, prior to exiting the transient state.
  2. ERC20MultiToken: ERC20MultiToken was inspired by ERC1155, but customized for Balancer v3. At a high level, it allows the Balancer Vault full control over Balancer Pool Token (BPT) accounting, enabling it to both mint and burn BPT directly. By centralizing both token and BPT accounting in the vault, Balancer v3 ensures atomic updates to critical pool state. In contrast to ERC1155, ERC20MultiToken allows Balancer Pool Tokens to be fully ERC20-compliant, supporting composability.
  3. Token scaling: Working with fixed-point math in Solidity presents a unique set of challenges that developers must navigate to ensure accurate and secure smart contract functionality.
  4. Swap fee: A swap fee is charged for each swap, as well as on the non-proportional amounts in add/remove liquidity operations. When a pool is registered, the initial swap fee is passed as a parameter and stored as part of the pool's configuration. The swap fee is always charged on the amount in (i.e., on the given amount for EXACT_IN, and the calculated amount for EXACT_OUT).

Build on Balancer

AMMs built on the Balancer protocol benefit from the security of the Balancer vault. This enables developers to utilize the well-developed Balancer AMM ecosystem, while the vault's optimized architecture streamlines the development process and allows teams to concentrate on their product.

Developer Reference

For the most common use cases the APIs of interest will be the Router or the BatchRouter. We also provide a JS/TS SDK to assist with interacting with the Balancer Protocol. Checkout the Integrations Guides for Solidity and Javascript examples on common actions like adding/removing liquidity and making swaps. Individuals are encouraged to contact our developers via Discord to request further assistance.

Balancer Partner Onboarding

With a vastly simplified developer experience, 100% boosted pools, LST base pairings, and customizable pool hooks, Balancer v3 provides partners with a streamlined hub to optimize yield-bearing liquidity, build robust governance tokenomics, and streamline AMM innovation.

Data and Analytics overview

Balancer offers data about the protocol, accessible through various sources. This data is helpful for understanding the protocol's performance, usage, and trends. One of the primary sources of data is our API GraphQL endpoint. This endpoint provides real-time data, making it an excellent resource for those who need up-to-the-minute information about the protocol.

In addition to the API, we also provide a subgraph that indexes the Balancer protocol. This subgraph offers a comprehensive view of the protocol's data, making it easy to analyze and understand the protocol's behavior over time. Lastly, various Dune dashboards exist. These dashboards provide a visual representation of the protocol's data, making it easy to understand and interpret. They are a great resource visual data analysis.

Balancer V2

Onboarding to Balancer v2

Balancer v2 has been a core pillar of DeFi since 2021. By leveraging innovative pool types Balancer v2 has attracted liquidity in the liquid staking token (LST) and liquid restaking token (LRT) sector.Balancer Technology provides decentralised infrastructure for DAOs, which enables efficient scaling of Yield Bearing assets, creating advanced Governance positions, and developing customised pool types. In addition, the Balancer ecosystem facilitates the streamlined scaling of liquidity for DAOs through core pool incentive flywheels and its network of liquidity enhancing protocols.

Onboarding Steps: Onboarding to Balancer v2's tech stack involves various steps depending on the specific needs. In general the onboarding journey consists of following steps: Choosing and launching your pool. Providing initial liquidity. Onboard to Balancer's gauge system. Voting Incentive Markets.

Conclusion

Balancer is a powerful and versatile decentralized automated market maker (AMM) protocol built on Ethereum with a clear focus on fungible and yield-bearing liquidity. With the introduction of Hooks and Dynamic Swap Fees, the degree of customization is boundless. Several custom pools have already been developed by external protocols like Gyroscope and Xave. You can follow this guide to create your own custom pools.

Disclaimer: This article is for informational purposes only and does not constitute financial advice. Investing in cryptocurrencies carries 1 risks, and you should always do your own research and consult with a financial advisor before making any investment decisions.

Additional Resources: