The balancer is an automated market maker (AMM) protocol built on the Ethereum blockchain. It has its own governance token –BAL. Balancer just rolled out a new update. This new update, Balancer v2 smart contracts are public and open source.
What is new?
Balancer V2 smart contracts introduce customizable AMM logic. It is the first AMM to give users the ability to write a custom invariant or fee structure based on the invariant. Now, developers can build different curves without having to worry about proxying through other exchanges, managing lower-level details, or security concerns. Balancer will list user’s assets for trade on their frontend and they will be available to any other contract integrating with Balancer. Their order router plugs into balancers user’s pools and assets.
Why Balancer v2 Smart Contracts?
One of the biggest concern in Defi Ecosystem is the gas fees. As far as in balancers case, sourcing liquidity from multiple pools becomes more expansive than the assumed slippage due to incurred gas fees to draw from each pool.
Solution:
Unlike other AMMs, Balancer V2 keeps all the pools’ tokens in one vault. The pools themselves are decoupled from the token management and accounting logic and are just responsible for the AMM logic.
How v2 works?
Balancer v2 decouples the pools’ AMM logic from the token management and accounting. This allows Balancer to take full advantage of its multi-pool trading routing to offer the greatest possible liquidity with the lowest possible slippage.
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, it transfers only the final net token amounts from and into the vault (via an ERC20 transaction). This makes arbitrage trades significantly easier allowing users 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:
USDT -> UNI (pool 1)
UNI -> BAL (pool 2)
BAL -> USDT (pool 3)
Receive the profit in USDT
Further, Balancer V2 allows users to hold internal token balances inside the vault. Internal token balances are extremely useful for high-frequency trading. It allows DEX aggregators to leverage Balancer internal balances in order to provide traders with the lowest gas costs to their users.
For example, if you are trading ETH for USDGT but know that you will trade USDT 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 executing an ERC20 transaction.
By plugging into Balancer, users can trade from any asset staked in Balancer’s existing V1 and V2 pools. They can plug into the existing liquidity and did not need to write proxy contracts to trade through other exchanges.
Additional benefits of Balance V2 Smart Contracts:
Gas on Arbitrage
Arbitrage against principal tokens or yield tokens of different terms and their spreads against each other can be handled efficiently via internal balances in the vault. This means internal balances manage trades across the different pools, making them more gas efficient.
Flash loan
Balancer V2 introduces an asset manager, which will likely be beneficial to users acting as LP providers in the future. It allows for LPs to gain additional APY on the liquidity they provide by staking it in lending protocols. They also will allow users to use the liquidity for flash loans, which plans to use it, particularly for Yield Token Compounding.