Dynamic AMM as a Solution for Decentralized Smart Indices

PowerPool
PowerPool
Published in
8 min readJan 11, 2021

This article is devoted to the brand new concept of Dynamic AMMs, which continually optimize AMM weights for maximum index capital gains.

DISCLAIMER: This paper is the first draft, describing the idea and implementation of a Dynamic AMM. There will be follow-up articles with additional information covering this topic and answering the community questions.ё

Link to the in-depth article about DAMM and Unlimited ETF concept:
https://medium.com/powerpool/powerindex-v2-unlimited-etfs-automated-portfolio-strategies-6086917e6348

Introduction
The constant invariant Automated Market Making formula, developed by Uniswap and Balancer is essential Defi primitive nowadays. It is simple, it is reliable, and it works. Decentralized exchanges are the first and most popular AMM-based application, holding billions in TVL, processing huge trading volumes, and competing with major CEXes for users. The problem of capital-efficiency was the main driver of AMM development that led to a new generation of AMMs such as Curve, Yield, Mooniswap, and others. These AMMs are used as core parts of complementary products, offering a completely new trading experience for specific types of assets such as stablecoins, wrapped assets, and zero bonds.

Capital-efficient trading was the main direction of upgrading AMM models. But, it is important to note that use cases of AMMs are not limited to swapping assets.

Citing the Balancer Github page:

Balancer is an automated portfolio manager, liquidity provider, and price sensor.

Balancer turns the index fund concept on its head: instead of paying fees to portfolio managers to rebalance your portfolio, you collect fees from traders, who rebalance your portfolio by following arbitrage opportunities.

PowerIndex based on Balancer AMM

PowerPool utilizes Balancer’s AMM for decentralized smart indexes. Power Indexes are ETF-like indexes using composite assets in a productive way. Indices generate cashflows for index token holders by staking assets in their native protocols and allowing the CVP community to participate in protocols’ governance based on PowerPool meta-governance integrations. Additionally, indices are entirely governed by the community (users can change token set, token weights and fees “on-the-fly” via governance proposals) and generate cashflows for CVP token holders via community fees. The possibility to govern the index is based on dynamic weights changing developed by the PowerPool team in collaboration with Anton Bukov, 1inch.exchange co-founder.

PowerIndex = Balancer AMM + using pooled assets in a productive way + meta-governance + index governance based on dynamic weights changing + cashflows for CVP community

Swapping assets is a necessary PowerIndex function mainly used for balancing index to desired weights by arbitrageurs and providing additional income for index LPs and the CVP community based on swap fees.

However, using Balancer AMM for decentralized indexes has one significant drawback: it rebalances all the time. It means that if an asset from the basket rapidly grows against others, it “sells” it via arbitrage trades, maintaining its weight inside the portfolio. The same is applied to asset dropping against the basket — AMM mechanism “buys” more tokens of this type from the market.

It is not a PowerPool-specific problem. It is an infamous problem affecting any LP providing liquidity to Uniswap/Balancer AMM.

This issue limits the index’s growth. If even one asset from the basket performs poorly, the whole basket isn’t growing in value as it should grow. It can be efficiently used only for assets with very high correlation (for example, AAVE SNX SUSHI YFI — ASSY). Pausing swaps looks logical, but it is not a perfect solution: (1) it disables single-side liquidity provision, which is the most demanded option on the market (2) it eliminates profits from swaps for LPs, decreasing returns on capital (3) it requires the development of another solution for balancing the index.

The CVP community noticed this issue of limited price action with Balancer’s constantly rebalancing AMM. One community member, Sergey, proposed an approach to solve this problem (read details using the link). It comes down to one simple idea:

What if the index will continually change weights according to some sort of easily determined indicator, preventing it from selling winners and buying losers?

We found this idea quite interesting and have begun working on a practical implementation. After mainnet implementation it will completely change the PowerIndex user experience, allowing the index to grow “as it should”, being balanced by arbitrage trades and generating swap fees for LPs at the same time. Another advantage will be enhanced security of PowerIndex from composite protocol hacks, preventing draining pool’s capital by selling the hacked token into AMM.

DAMM: the Dynamic AMM algorithm

A Dynamic AMM is an AMM that continually changes weights according to an indicator related to composite assets. It optimizes AMM weights for changing conditions to ensure efficient operation of the product built on top of AMM.

In simple words, Dynamic AMM is an AMM that changes weights in the AMM equation in response to a rapidly changing environment.

Dynamic AMM is based on a trigger which continually optimizes weights in AMM formula

In our opinion, any AMM can be upgraded to a dynamic variant if there is a gas-efficient solution for dynamic weights changing. In this article we cover the case with Balancer AMM as it is most relevant for PowerIndex.

Generalized requirements for Dynamic AMM:

  1. Clearly defined business logic — why weights should be changed and how to define optimal weights
  2. Trigger for weights changing. Which system parameter would work as a signal for weights changing
  3. Practical implementation. How to receive input data feed for triggering weights changing in a secure and decentralized way

So, to run a product based on Dynamic AMM it is necessary to understand what is the logic behind weights changing, what is the proper trigger for launching weights changing, and how this control signal will be generated and controlling AMM formula.

Dynamic AMM requirements applied to PowerIndex:

  1. Weights should change in a way to maximize profits from growth of index portfolio. The index shouldn’t sell “winners” and buy “losers” assets.
  2. The most obvious indicator for triggering weight changing is the Mcap of the tokens.
  3. Based on the fact that AMM has the price sensor function, it can be used as trigger for weights changing

PowerIndex based on Dynamic AMM wouldn’t sell winners and buy losers. It will optimize weights for maximizing profits of index holders.

How would it work in practice? Imagine PIPT — an index of 8 tokens (YFI AAVE UNI COMP MAKER SNX WNXM CVP). Suddenly, one token starts to grow against the remaining basket. Dynamic AMM algorithm tracks this grow and starts to increase weight in order to keep this asset inside the pool, maximizing returns for index token holders (preventing AMM for selling this token via arbitrage). If the price of an asset drops against the basket, Dynamic AMM decreases the weight of this asset preventing buying more tokens from the market. Finally, PowerIndex keeps winners and doesn’t buy losers offering good performance as an index product.

For the case of a fast dumping token (for example, in case of a hack), the automatic swap disabling will be enabled based on the same trigger. It will work as automated protection PowerIndexes from COVER-like hacks.

All the features of PowerIndex, such as single-side liquidity provision, token swaps, Vault strategies for composite assets and meta-governance are available in case of Dynamic AMM application.

Practical implementation

Currently, we consider three main implementations of triggers for Dynamic AMM:

  1. Triggers, based on decentralized oracles (including PowerOracle — decentralized cross-chain oracle)
  2. MCap or relative prices of assets, calculated against the “base asset” inside AMM, using the price sensor AMM design feature
  3. Trigger based on the rate of changing token balances inside pool based on token swaps

The first one is the most obvious solution. However, such an approach requires solving several security challenges. From our point of view it may work, but better is to try other options.

The second one is based on the fact that AMM itself is a price sensor and can be used for calculating relative prices of assets. Selecting one asset as the base one and taking into account that all circulating supply of all assets inside AMM can be updated automatically it is possible to calculate relative MCaps every block. If the market cap of one asset starts to grow, algorithm starts to increase weight of this asset and decrease other ones accordingly to their relative MCaps (it means that if another asset grows as well and its market cap remains unchanged, its weight wouldn’t change).

The third one is based on tracking trades inside AMM and making decisions regarding weights changing based on this data. If the balance of some asset is continually decreasing, it means that the price of this asset becomes bigger (relatively to other ones). This information can be used as a controlling signal to increase weight of this asset in order to prevent its selling via arbitrage. The same if applied to increasing the balance of the asset (in this case it means that the price of this asset decreases). The basic trigger parameters are the rate of balance changing and the speed of weight changing:

  • If balance grows (what means that token price drops), the rate of weights changing is negative (weight is decreasing)
  • If balance decreases (what means that token price grows), the rate of weights changing is positive (weight is increasing)
  • If the balance doesn’t change, the weight doesn’t change

Each of the approaches to build a proper trigger system for dynamic AMM has its own limitations and challenges to be solved. Currently, we are researching all mentioned options from the technical point of view while the Token Engineering team (funded by PowerPool and BalancerLabs) is building a simulation model for Balancer AMM, including the DAMM case. Our current vision is to use the rate of balancer/weight changing coupled with the additional intelligence provided by PowerOracle. We will publish more updates on DAMM research soon.

Closing notes

It is important to point out that decentralized indexes and portfolios aren’t the single product that can greatly benefit from being built on Dynamic AMM. We expect that once PowerPool Dynamic AMM model will be simulated and implemented in mainnet, many Defi products will be able to use it for building complex financial products.

--

--

PowerPool
PowerPool

DePIN layer powering AI Agents and DeFi automation in multichain universe.