This page will discuss both the 80/20 pool mechanisms as well as how to correlate USD value to the balance of tokens with in a pool. The relationship is a function of the pool traits.
Pools with assets which are much more independent of one another such as BAL/WETH are subject to impermanent loss which we can model here or see the simulator linked here. The invariant function does not depend on external market prices, only the balance of tokens and weightings within the pool. However, we can consider a pool’s USD value over time.
At the time of writing the BAL/WETH 80/20 Pool holds
5,532,476 BAL ($112,530,555)
9,726.09 WETH ($28,160,135)
Therefore, the total balance is $140,690,690.
The expected balances:
Therefore, a pool can go through a transition to hold slightly more WETH than anticipated and slightly less BAL. Yielding the following charts.
In this case we now know our weights will be constant based on the pool ratios.
In the prior example an opportunity for profit through arbitrage presents itself. A trader or investor can input their tokens valued higher than the open market does in terms of USD in order to extract value in by exchanging on an external market.
This example is done at a snapshot in time, but please understand there is much more working internally. Slippage, price impact, and gas fees must be considered when an arbitrager is acting to rebalance a pool and extract profit for doing so.
This example is based upon the Arbitrum Weighted pool named in the title
At time of writing, this pool holds roughly 10.261 million USD. To be less precise on decimals we will say the pool holds $3.410MM of USDC, $3.422MM of WETH, and $3.429MM of WBTC. Please note in this example we are ignoring price impact and swap fees which are incurred during a trade. To solidify the idea that a pool is its own market and is independent of the external prices, we can see here that the USD price of USDC is slightly under $1. These prices are dictated directly by token balances, and will only be arbitraged back to market price by external users if the extractable amount is greater than the “financial friction” (gas and swap fees) of the system.
We can see our pools will keep the weighting constant. This means the value of the token will dynamically change with the quantity of each token in the pool.
Weight (Wt) will be constant, in this case each token’s weight is 33.33% of the pool. This is set during the creation of the pool
The value V(usd) will be our pool value over the number of tokens in this case is calculated by:
We can now determine our value of each token.
Using the expected value as a benchmark for what the pool would hold in a perfectly balanced state, we can generate the following data:
In both instances the value function holds true yielding essentially the equations below:
The center building block for all Balancer Protocol pools and swaps stems from the value function. Learn more in this section.
The invariant, or Value Function, of Balancer Weighted Pools is critical for maintaining pool value and fair swap prices. . This weighted constant product equation facilitates pools of assets with fluctuating prices with respect to one another. Fluctuations inherently lead to price impact, which creates r arbitrage opportunities for rebalancing the pool to market price. Another consequence of this mechanism is impermanent loss, or divergence loss. What does this mean to a user and what is different between two token and multiple token pools? We will look at several examples to explain the differences.
Value Function:
Where
t ranges over the tokens in the pool
Bt is the balance of the token in the pool
Wt is the normalized weight of the token, such that the sum of all normalized weights is 1.
t
Essentially t represents how many tokens there are in a pool. We will do even splits to start (33/33/33) and look at when we have uneven weights (80/20) afterwards.
Bt
Bt is the balance of the token but this is not to be confused with the universal cost of the token. The pool is only as aware of prices as its contents dictate. The market of traders are responsible for (and financially incentivised to) making the value match the rest of the market.
For general use:
The USD value of the balance of a given token within the pool is dependent upon an external definition of price, often supplied by CoinGecko:
Wt
Wt is the weight of the token in the pool. If a pool is well balanced with market prices, the weight of a token corresponds to how much of the pool’s value is denominated in that token.
This is a proof for the net USD value of a pool based upon the invariant. Please note this can be done for any denomination of currency.
The change in value of a Balancer pool given a price reference (in this case a base of USD) as seen on the medium article linked here can be defined by the following equation :
Note per the whitepaper the invariant (V) is a constant value based upon a pool’s traits. This would mean that
This understanding of the invariant as a constant surface is crucial when proving the initial equation stated to be true.
Next, we can calculate the Value function in relation to the USD reference point using the following equations:
Assuming Pi is equal to the price of a token in reference to USD in this case
2. Once a change in price occurs the Balance of each token will change due to the pool being rebalanced by arbitrageurs yielding (B’) at a new price (P’) in relation to the reference.
3. To determine the change in dollar value of our entire pool we will need the ratio of our new USD value divided by our initial USD dollar value. This is shown as the following:
4.This is to be simplified to the following by isolating our balances from our prices.
5. Therefore the fraction of these two values is equal to 1 leaving: