Weighted Pools
Weighted AMM pools, such as those used by Balancer, represent a flexible way to manage liquidity. Here's a detailed overview of how they work:
Core Concepts
Weighted AMM pools are liquidity pools that allow multiple tokens to be pooled together with customizable weights. Unlike the standard AMM pools (e.g., Uniswap) that typically have a 50:50 ratio of two tokens, weighted pools can have any number of tokens with arbitrary weights. This flexibility allows users to create diversified index funds and more complex trading strategies.
Liquidity Pools:
- Each pool can contain multiple tokens
- Each token in the pool is assigned a weight, which determines its proportion in the total pool value. For example, a pool could have
50% ETH,30% DAI, and20% BTC. - The total weight of all tokens in the pool sums to
100%.
Pool Tokens (LP Tokens):
- When liquidity providers add assets to the pool, they receive pool tokens in return.
- These pool tokens represent their share of the pool and can be redeemed for the underlying assets.
Price Determination
The price of tokens within a weighted pool is determined by the constant product formula generalized to support multiple tokens with different weights. For two tokens, the constant product formula is
where:
is the number of tokens in the pool. is the reserve of token . is the weight of token as a fraction of the total weight.
When a trade is made, the prices of the tokens are adjusted to maintain this constant product, ensuring liquidity and price stability.
Mechanics of a Trade
- Input Token: The trader specifies the token they want to swap and the amount they are providing.
- Output Token: The trader specifies the token they want to receive.
- Price Calculation: The AMM algorithm recalculates the new balances of the tokens in the pool after accounting for the trade, ensuring the invariant (constant product) is maintained.
- Swap Fees: A small fee is deducted from the trade, which is distributed to liquidity providers as an incentive for providing liquidity. The fee ranges from
0.1%for stable pairs to0.3%for volatile pairs.
Adding and Removing Liquidity
Adding Liquidity:
- Liquidity providers can add any combination of tokens in the pool according to their respective weights.
- The provider receives pool tokens proportional to the value of the assets they added relative to the total pool value.
Removing Liquidity:
- Providers can redeem their pool tokens for the underlying assets.
- The amount of each token they receive is proportional to their share of the pool.
Advantages of Weighted Pools
1. Flexibility:
Users can create pools with any number of tokens and any weight distribution, allowing for a high degree of customization.
2. Efficient Diversification:
Pools can serve as automated portfolio managers, rebalancing token weights automatically according to trading activity.
3. Lower Impermanent Loss:
With the ability to customize weights, liquidity providers can mitigate impermanent loss compared to equal-weighted pools.
Use Cases
1. Index Funds:
Users can create pools that act as automated, decentralized index funds by including multiple tokens with specified weights.
2. Liquidity Mining:
Projects can incentivize liquidity by distributing rewards to users who provide liquidity to specific pools.
3. Dynamic Asset Management:
Weighted pools can be used for more advanced asset management strategies, including dynamically adjusting token weights based on predefined criteria.
