This article was first published on Bancor - Medium
Calculating Dynamic Reserve Weights in Bancor V2
A key part of Bancor V2 liquidity pools is the use of dynamic reserve weights.
Liquidity pools hold reserves (balances) of ERC20 tokens. The “weights” of a pool refer to the percentage exposure of each token in the pool.
Most liquidity pools today are deployed with fixed weights. In a pool that consists of two tokens and fixed 50/50 weights, each reserve maintains 50% of the pool’s total value. Liquidity pools can be deployed with even (50%/50%) or uneven (80%/20%) weights.
Bancor V2 introduces a new type of liquidity pool where weights update dynamically based on market conditions. If a token’s price rises on external markets, the token’s weight in the pool also rises, and vice versa.
These automated weight adjustments incentivize arbitrageurs to re-balance reserves and bring prices offered by the pool into alignment with external market prices. This allows for the pool to closely track external market prices while maintaining the value of staked balances in the pool.
The remainder of this post describes the process by which dynamic weights are calculated in Bancor V2. We will soon release open-source code for dynamic weighting as well as technical documentation.
For better formatting of the below mathematical formulas, please refer to this PDF Document.
First, let’s consider a liquidity pool with two reserve tokens S and R of equal weights, where:
- s=balance of token S
- r=balance of token R
Converting an amount of S tokens into R tokens is based on:
- x=input amount of token S
- y=output amount of token R
The conversion formula for any type of weighted-pool is
- w1=weight of token S
- w2=weight of token R ...
To keep reading, please go to the original article at:
Bancor - Medium