Balancer V2 Upgrade: Progress Thread

Hi everyone,

As you’re hopefully aware (or are about to be by the end of this sentence), Indexed recently received a grant from Balancer in order to fund the development of a protocol upgrade to a custom Balancer V2 implementation rather than the custom fork of Balancer V1 that we currently utilise.

I’d like to quickly lay out here what that upgrade entails in terms of actual work, and use this thread as a place to update everyone on progress as individual pieces progress (as opposed to updating the roadmap only when a piece is done and out).


The work that comprises the upgrade is in three distinct pieces. In the order that they’ll be tackled (and shamelessly nicked from a document that @d1ll0n submitted to Balancer as part of the grant application process), they are:

The Metaoracle

Comment

Rough Estimate of Development Time : 4-8 weeks, not including audit.

Useful To : Any DeFi project which needs a reliable oracle for token prices. Integration of Balancer V2 as a price source can also help exemplify its new oracle feature.

Background

There are two types of price queries that are often needed for DeFi products: current prices and arbitrary-duration TWAPs. The former is the most widely applicable, as it is needed for collateralization calculations, token purchase and sale by contracts and other use-cases. The latter is more applicable to ETFs, particularly Indexed - these prices are used for broader analysis of trends, such as how tokens are performing relative to each other over days or weeks rather than a particular moment.

TWAPs can be difficult to accurately measure, particularly for newer tokens, because tokens are traded on a variety of markets. For instance, the SAND token has nearly $28m of liquidity on its Uniswap V2 ETH pair, but does not even have a pair on Sushiswap. Tokens from Mirror protocol do have large markets on Uniswap V2, but they are only paired with UST.

Current prices are even more difficult to accurately measure - the gold standard for most DeFi projects is a Chainlink price feed, but Chainlink has fairly strict requirements for their feeds which very few newer tokens meet.

At Indexed, we’ve been using an oracle that tracks prices of tokens using their Uniswap V2 ETH pairs, but this has been a significant restriction on which tokens we can add to our indices.

Overview

The goal of the meta oracle we intend to build is to provide the most accurate on-chain prices possible by aggregating data from multiple sources. We will use several metrics to select between sources such as:

  • type of query being made (current or TWAP price)
  • availability of CL price feed
  • liquidity on a market
  • types of measurements that can be made (does the pair have TWAP security features?)
  • available pairs (is the token paired with ETH, or is a conversion needed?)

We’ll do this using the following as price sources:

  • Uniswap V2
  • Uniswap V3
  • Sushiswap
  • Balancer V2 oracle pools
  • CoinBase’s signed price API
  • ChainLink price feeds

ETF Base Pool

Rough Estimate of Development Time : 4-8 weeks, not including audit

Useful To : Anyone building passively managed ETFs on Balancer V2.

Our fork of Balancer V1 allowed our index pools to rebalance without active management and with minimal use of external markets. It does this by allowing controllers to set target compositions which are then rebalanced toward over time: for introduction of a new asset, a price oracle is used to price swaps on the token until it reaches a set threshold, after which it is enabled for normal trades; for adjusting the weight of a current asset, its weight is modified by 1% whenever a swap occurs which moves the balance in the direction of the weight target, with a maximum frequency of twice per hour.

The feature for introducing new assets is, so far as we are aware, unique to Indexed. The weight pushing feature for rebalancing has also been utilized by other projects, but only through “poke” functions, whereas ours is executed as a post-swap hook.

This base framework is ideal for an ETF as it allows rebalancing a portfolio to an arbitrary new composition without swapping on external markets, requiring a bot to do regular maintenance calls, or giving permissioned access to any individual. We intend to port the same logic over to a custom Balancer V2 pool.

Nirn Asset Manager

Rough Estimate of Development Time : 1-3 weeks, not including audits

Useful To : Any project using Balancer V2 pools.

Background

Balancer V2 introduced asset managers capable of lending assets to other protocols or depositing them into vaults so that pools can generate passive revenue from their capital rather than have them sitting idle. In order to get the most out of this feature, capital must be deployed to the protocol which gives the best interest rate for each asset. While this could be done manually, it is much more efficient for rates to be optimized in aggregate.

Overview

Indexed Finance recently released Nirn - a permissionless yield optimizer which currently supports 6 lending protocols, with more to be integrated soon. Once audited, Nirn will allow anyone to deploy a vault for any asset with at least 2 supported lending markets. Nirn vaults allow anyone to propose a better allocation of deposits between lending markets, which is adopted if it results in a better interest rate. This enables interest on capital to be optimized in aggregate without any individual holder needing to perform upkeep.

We intend to create a Nirn asset manager for Balancer V2 pools which automatically handles deposit and withdrawal of eligible assets held by pools into their corresponding Nirn vaults. The Nirn asset manager will provide Balancer pools access to the best interest rates on Ethereum lending markets without any additional effort.

5 Likes