Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Coming soon developer friends
Coming soon^{tm}
Loading...
Loading...
Questions asked in our discord and solved with be highlighted in this section.
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:
In-Given-Out
The In-Given-Out equation will be the opposite thought process as the Out-Given-In formula. The idea is a trader, you, or I, wants to receive a specific number of tokens and this equation will solve how many tokens need to trade into a pool to receive that amount out. Note the variables defined in the introduction have not changed.
For example, we will determine which of two pools is best to trade USDC for WMATIC on Balancerโs Polygon network pools. We will examine the two following pools TEL/WMATIC/USDC 60/20/20 (0.2%) and the WMATIC/USDC/WETH/BAL 25/25/25/25 (0.25%) pools.
Pool (Wo / Wi) | USDC Balance (Bi) | WMATIC Balance (Bo) |
---|---|---|
Firstly, let us see what it will cost us to receive 1000 WMATIC as the amount we know we want out of our trade.
TEL/USDC/WMATIC 60/20/20:
WMATIC/USDC/WETH/BAL 25/25/25/25:
In the case we will spend less using our second option to receive the same amount of WMATIC making it the more desirable pool for the SOR to route us through. Now letโs incorporate swap fees.
In-Given-Out
Our prior equation can now be utilized in place of Ai to determine the actual amount we must spend to receive the 1000 WMATIC we desire. We must now consider Ai to be our initial value as paying our swap fee will increase the Amount-IN required.
TEL/USDC/WMATIC 60/20/20:
WMATIC/USDC/WETH/BAL 25/25/25/25:
We can then determine the break-even swap fee for the WMATIC/USDC/WETH/BAL 25/25/25/25 pool 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.
60/20/20
107,244
56,164
25/25/25/25
5,194,894
2,722,125
As a team we strive to educate and onboard the public on our product's function and capabilities. Our team builds impactful tools for our ecosystem and Defi as whole.
Balancer DAO is the decentralized autonomous organization which encompasses the Balancer community. An architecture of Sub-DAOs has been voted into practice by a governance vote.The major actors in the community may be appointed or removed from any positions they hold in the sub-DAOs. You can learn more about the Sub-DAOs on our super hub linked here.
The Community Developer subDAO aims to accelerate the development of impactful web3 tools on top of the Balancer ecosystem. It thrives by open- and crowd-sourced initiatives. We value open source transparency, collaboration amongst our community, and conviction in those who choose to help build for Balancer.
Learn about Balancer will highlight key elements of our protocol, increasing understanding and interest in Balancer. We hope to not only educate but empower new members to participate in our community and sub-DAOs.
This section will outline spot price and effective price with the end goal of explaining how price impact, also known as slippage in some cases, is calculated.
In order to understand how swaps are going to alter the price of tokens in a pool we must understand the relationship between the spot and effective prices tokens assign to one another as pools go on and off balance. In theory trades in any market are working with a mechanism of price impact. Supply and demand is the root logic, where as you take more of something out of circulation, it becomes more valuable. For example people consume more of a certain product, the price will go up because there is less of it. This happens in an extreme way when swapping a large amount of tokens. The value of what you want goes up, the value of what you are selling in turn will go down.
Dissecting the spot price and effective price functions followed by some small scale and real scale examples will bring us to understand price impact.
The Spot Price as defined in the Whitepaper:
Where the variables represent the following:
SP(i^o) is the spot price of the input and output tokens in the pool.
B(i) is the balance of the token coming into the pool (input)
W(i) is the weight of the token coming into the pool (input)
B(o) is the balance on the token going out of the pool (output)
W(o) is the weight of the token going out of the pool (output)
Important to note that these variables are from a pool in a stagnant state. Do not incorporate the swap you are planning in to do by adding or subtracting the balance changes you will create in your swap at this point.
Balancer Labs Documentation:
This section highlights and dives into the equations and calculations done under the hood of Balancer Protocol. Expanding on the whitepaper and solving examples to solidify understanding.
Reference the Balancer white paper here.
Balancer Labs Documentation:
Balancer protocol math:
Pool Interfacing: Weighted, Stable, MetaStable, Liquidity Bootstrapping, Managed, and Oracle Pools
Here a guide and example of how effective price is calculated will be shown below. Please reference prior portions of this section, trading formulas, or the whitepaper for references.
Next, we will look at the Effective Price which in short will consider the impact on the price you are making on the tokens as you make a trade. Note investing in a pool if it is not of perfect proportion is using the same principle in calculating price impact. The white paper shows the following formula:
EP(i)^(o) represents the effective price of the token input in terms of the token output
A(i) represents the number of tokens one will input (sell)
A(o) represents the number of tokens one will output (buy)
This equation is not much use to us as we want to predict the effective price, and with the formula above we can only do this knowing the number of tokens we will get out of a trade. With the effective price increasing as we buy more of a token the above equation needs to be manipulated.
This brings us to the the Out-Given-In Function (see proof on whitepaper)
Through substituting this equation into our Effective Price equation, we get the following relationship based strictly on variables which are known prior to a trade.
Example Calculations for (BAL WETH 60/40 on Arbitrum)
Known pool trait values:
We are willing to trade 10 WETH in. We will determine how much BAL we will receive and what the price impact of our trade is. We well repeat this for 100 WETH to compare the results.
With these known values we can solve our effective price equation.
The same equation for 100 WETH yields the following:\
Clearly much more WETH is needed to buy a single BAL token, this adds up and grows as the amount going into a trade does. The market is being moved by the trade (within the confines of the pool).
Using this information, we can now calculate the price impact based on ratio between the spot price and the effective price. In theory the spot price equals the effective price only for extremely small trades. (See Balancer whitepaper)
This page is meant to encompass the spot price and effective price calculations discussed prior. The end goal being to understand how price impact affects a liquidity pool and traders.
Using our previous example from Arbitrum we can calculate the spot price using the equation from example 1 and from there determine the price impact using the following equation.
Spot price:
Finally we can calculate price impact for both instances of 10 WETH or 100 WETH trades. (Spot price is technically constant as long as the pool remains in its observed state.) Based on calculations
This example was tested on the actual site in order to confirm this. However depending on the trade you may interact with different pools to receive the best price. Please note this value will always act against the trader, regardless of being presented as a positive or negative value.
Example 4 โ Including Trading Fees
To go one step further we can incorporate the trade fees into our trade. Ultimately our effective price will be altered due to the token we are selling being used to meet the swap fee. The incorporation of the pool swap fees can be done in the effective price function as follows:
This will account for less tokens being put into the pool because they were absorbed by the fee. Therefore lower price impact is expected due to a slightly smaller trade occurring,
Price impact now yields:
An example of a calculation of spot price. Please see the intro for a reference to the equation used for spot price.
See introduction
Letโs look at an entry level example to understand Spot Price before moving on.
Assume a new pool is created. It is an 80/20 AAVE/WETH pool. The fair market price per CoinMarketCap is $284.00 per AAVE and $3500.00 per WETH. The pool creator started the pool off with 100k perfectly split in liquidity therefore we have 80k in AAVE and 20k in WETH.
The relationship between the two can be described as:
Note: These values are precisely equal when using exact numbers. Small margins of error occur in above calculations due to rounding off to 4 or less decimal places.
That is how spot price works. The USD value is to be incorporated after the token relationship is determined in order to not overcomplicate the process the last step should be this conversion.
Overview of asset deposits and withdrawals on Balancer Protocol
What is the act of providing liquidity, and what does it mean for me as an investor? Providing liquidity is when a user or entity places their assets into a liquidity pool. A liquidity pool is its own ecosystem where the assets within it are priced in relation to one another. The relative pricing inside the pool is only altered when outside interactions such as trades or new โoff-balanceโ investments occur. The expectation as a liquidity provider (LP) is that as market prices change, the liquidity pool will be interacted with, and the internal balances of tokens will most likely change over time.
What benefits does providing liquidity give me, why should I not just hold all my assets individually? There are several key benefits providing liquidity for users which holding them does not permit.
Firstly, are the swap fees which are charged to those who interact with your liquidity pool. The more interactions with your pool, the more swap fees you will earn, growing the size of your investment over time. The second benefit are the platform rewards. Multiple decentralized exchange platforms such as Balancer incentivize their liquidity pools with additional rewards for asset pairs which are chosen through the liquidity mining & governance systems. This makes a liquidity pool an easy way to gain access to and maintain exposure in a strategic way to multiple assets while receiving economic incentives.
When providing liquidity to a pool on Balancer users have a few options. Originally in Balancer V1 liquidity providers had one option; to provide liquidity in the portions of tokens designated by the pool. For example, if a pool was weighted at a 50 / 50 ratio the liquidity provider had to provide liquidity of both tokens proportionally. This can become cumbersome in cases of multiple tokens such as eight token index pools.
Balancer V2 now permits liquidity providers the option to invest in pools using only a single asset which will then be added to the pool shifting the ratios of all other assets. This can be done with as many tokens as a liquidity provider has applicable to a pool and in proportion creating an extreme amount of flexibility when userโs want to invest in more exotic asset pools.
When a user invests in a pool in an unproportioned manner a price impact will take place because the internal pool ratios are changing. This is indirectly a cost to a new liquidity provider due to their investment shifting asset prices. This occurrence is called price impact. Like price impact incurred by traders during large swaps, this happens to maintain the supply and demand markets for all tokens involved. In this document we will examine several examples for each of these different investment conditions to display the underlying math which determines price impact on investments.
From these examples we can see not much WETH can be extracted considering the amount of capital required. However, some people may be interested in making even the smallest amount of profit. If this is done effectively it adds up across multiple markets and tokens. Notably, the margin shrinks after gas costs are considered.
Major factors to an arbitrage opportunity are the following:
The discrepancy in price between the two price sources
A larger gap between SPโ and SP will yield a larger profit
The market depth of both sources
If the pools both hold large balances of tokens, they will be resistant to price impact.
Note that one pool may have a lower spot price, but large trades will make the effective or average price of the swap favor pools with larger depths. This would make a pool with a higher spot price, but more stable swap rate, a better option.
The capital you have available
Larger amounts of capital will maximize your profits; however, the margins will be best on the first token traded and decrease as price impact is occurring.
This means with small amounts of capital you be can successful but need to prioritize large price discrepancies.
The goal of sharing this information is to equip our community of current and future users with the knowledge to leverage Balancer Protocol in their best interest. This ultimately will benefit Balancer as a whole, driving innovation, new ideas, and future efficiencies to build, based upon the building blocks of the underlying protocol. By understanding how trading formulas bridge the trading and liquidity providing members of Balancer is key to point us toward a sustainable future for both parties.
Balancerโs trade interface is based on several formulas which give a user the permissions to exchange tokens based on the relationships of the underlying pools. Balancer is host to many pools which contain the same tokens, creating the obstacle of which pool is best to route trades through. The solution is that we as users do not need to concern ourselves with deciding which pool to exchange with. While many tokens are found in several pools, Balancer has developed a Smart Order Router also known as the SOR. The SOR will guide a trade through all the options towards the one which benefits our traders the most.
Why would understanding Balancer Protocolโs trading formulas be important to a user? Every interaction with the Balancer Protocol will be impacted by these equations to some degree. For traders, understanding how the price of assets is calculated can vary across Automated Market Making Platforms. These equations are the foundation of market making on Balancer Protocol and create a massive potential for profitable use cases through arbitrage and liquidity provision. For liquidity providers these same equations will provide a gateway to earning swap fees and making long term positions earn yield by harvesting the surrounding marketโs volatility.
Balancerโs formulas for trades as defined by the whitepaper are the Out-Given-In, In-Given-Out, and the In-Given-Price which will be described below.
The following variables will be used in these equations:
Balancer Labs Documentation:
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:
Out-Given-In
One may raise the point that Balancer pools have fixed or dynamic swap fees and can be controlled by the pool owner(s). Therefore, it is possible that the best pool will change if the swap fee is considered, and a trader receives less BAL by paying the swap fee. To take the swap fee into account we will plug in an alternative value (Aiโ) for the amount in (Ai) variable in the
At the time of writing the swap fee for the 80/20 pool is 0.05% and the 50/50 poolโs is 0.1%. Clearly with a lower fee and already higher yield, the 80/20 pool will remain the best route for traders yielding the following:
However, an optimization for pool holders can be made to increase the swap fee to the point where their pool is just slightly more favorable for traders. In this case the trader gets the best deal still while the liquidity provider is optimizing the market in their favor. This is outside the scope of the Out-Given-In Equation as the amount in and out will be known values while the swap fee will be an unknown value. Here is how our equation would look if we were to solve for Swap Fee.
We can now solve for the maximum swap fee the BAL/WETH 80/20 pool could have had set. This maximum fee correlates to the value at which the Amount Out for the Amount In would be competitive with the market and maximize swap fees collected by liquidity providers. To do this we will back calculate the swap fee at which the 80/20 could have had by using the 50/50 pools benchmark for amount out. All values are the pool traits of the 80/20, only the amount of (Ao) will be based on the prior 50/50 pool calculations.
Please note this a dynamic circumstance and the swap fees should be optimized over a longer period. Once a swap is executed the optimal swap fee will change due to the price impact a pool undergoes caused by a swap. Furthermore, pools on every decentralized exchange are competing for rates with lower swap fees and varying liquidity depths. This example is meant to be an introduction to how liquidity depth, relative prices, and fees are related.
In-Given-Price
Another approach or thought process that can be used between pools as opposed to increasing swap fees to make all pools equal in spot price, is the potential for arbitrage trading. Arbitrage trading is when a trader buys for example the excess BAL from the 80/20 pool and then sells it to the open market. If a large enough gap in price exists, then this will become an efficient transaction, after fees including gas payments are considered. Therefore, an arbitrager can make a profit by balancing out the spot prices of two sources.
The formula for the number of tokens traded to create the intended shift of this type of trading is defined in our whitepaper. A very important note here is the assumption that market depth is infinite for the new spot price. This will be elaborated on throughout the example.
In-Given-Price formula:
The additional variables are defined as follows:
For a further description on Spot Price and how it is calculated please refer to The Value Function and Spot Price sections of our documentation.
Out-Given-In
The first function we will examine is the Out-Given-In which is used to calculate what you will receive based on what you are willing to sell. For example, if you know you will sell or spend a given amount of a token, we can calculate what tokens you will receive in return. Hence what amount you will get out, given what amount you put in; based upon the traits of the pool the trade is routed through.
Letโs look at a very common trade, we will consider trading WETH for BAL. We have intentions of trading 2.5 WETH for the maximum amount of BAL possible. We will look at two possible pools we can route through to mimic what the Smart Order Router is doing under the hood of the Balancer Protocol to make sure users receive the best possible deal.
The two pools we will consider are the 80/20 (0.05%) and 50/50 (0.1%) BAL/WETH pools. At the time of writing, they hold the following balances.
Pool (Wo / Wi) | WETH Balance (Bi) | BAL Balance (Bo) |
---|---|---|
(Please note these are excluding swap fees)
First, we will calculate the amount out for the potential 80/20 pool interaction
Next, we will determine the amount of BAL we would receive if interacting with the 50/50 pool
We can see here the SOR would direct us to the 80/20 pool for our swap to be executed, because it benefits us as the user to receive as much BAL as possible. If another pool exists which would give the trader even more BAL, that route would be executed. See the Smart Order Router section for an example of trade optimization routing through multiple pools as opposed to one. Please note the example above would yield the optimal number of BAL for a user if the trade was routed through both pools depending on the gas price.
80/20 BAL/ WETH Pool In-Given-Price problem and solution
Example
We will utilize our 80/20 BAL / WETH pool (0.05% Swap fee) as a benchmark and will assume the external market spot price to be 0.00455 WETH / BAL. Please note this market for the purpose of the example is considered infinite in depth. This means as we sell our tokens, the price is not impacted.
If the trade was occurring from one pool to another further optimization would be done to justify our swap. The method would then also consider the impact of the arbitrage opportunity on the second market we interact with.
Pool (Wo / Wi) | WETH Balance (Bi) | BAL Balance (Bo) |
---|---|---|
In-Given-Price-Proof - Please note the prerequisites of the spot price function and In-Given-Out Equations.
In-Given-Price Proof:
Firstly, we must site the spot price function:
2. Secondly, to consider the desired spot price (SPโ) we must acknowledge that the Balance-In (Bi) and the Balance-Out (Bo) will be altered based on the Amount-In (Ai) and Amount-Out (Ao) as so:
3. The original spot price can be rearranged to isolate the Balance-Out (Bo):
4. The adjusted spot price equation (SPโ) can be arranged to isolate Balance-Out minus the Amount-Out (Bo โ Ao) as follows:
5. . Using these equations for substitution in our In-Given-Out equation below we can prove the In-Given-Price Equation is valid:
First, we replace the Balance-Out and Balance-Out minus Amount-Out statements with our equations from steps 3 and 4.
At this point the Weights-In and Weights-Out will neutralize one another reducing our equation size, once this is done the next step is to rationalize our fraction:
Now we need to isolate the spot price ratio to remove the Balance-In (Bi) and Amount-In (Ai) from our inner function:
We will move our exponent to the opposite side of the equation and then adjust our ratio of Balance-In over Balance-In minus Amount-In
Now using this adjusted ratio, we can multiply both sides of the equation by Amount-In, Balance-In portion combining the two terms and have the fraction of SPโ and SP on the right side of our equation as shown below:
By adjusting the exponents and reverting the bulk of our equation to the right side again we can solve for the Amount-In as intended for the In-Given-Price Equation:
In depth documentation from basic to deep levels for understanding of the mechanics behind Balancer Protocol.
Balancer is at its core an automated market maker or "AMM". AMMs are required for decentralized finance in order to create markets for assets to be exchanged between individuals without regulation. The price of assets is set by the holders and traders strictly through supply and demand without any boundaries of entry for users.
How can I determine if I should user Balancer?
Understanding Balancer Protocol and what opportunities are available to users is the first step. As a trader Balancer itself has unique options for standard or gasless trading with MEV protection. For invesors, liquidity pools are customizable including stable, meta-stable, bootstrapping, managed, and weighted pools (oracle or index models) including 2 or more tokens across various networks. To learn more continue through our documentation or ask our community preferably in Discord.
Balancer DAO's Learn about Balancer documentation is only for informational purposes. The content provided does not and is not meant to convey financial advise for investment or trading opportunities. Calculations, potential outcomes, and explanations are hypothetical only and in no way are suggested to be reality by the DAO. Please do your own research and make financial decisions based on your own inferences.
After the introduction video you may have some more questions. Check out our goals, detailed explanations of how Balancer functions, and see how to reach out to us if we do not answer your questions here.
Learn the fundamentals of Balancer Protocol to get a deeper understanding of our main features:
50/50 BAL/ WETH Pool In-Given-Price problem and solution
Alternate Example:
We will utilize our 50/50 BAL / WETH pool (0.1% Swap fee) as a benchmark and will assume the external market spot price to be 0.0048 WETH / BAL. Please note this market for the purpose of the example is considered infinite in depth. This means as we sell our tokens, the price is not impacted.
In comparison to our previous example, the following pool is much less deep in terms of total liquidity. Due to the lack of depth, we can expect to create a larger price impact using lower amounts of capital.
Pool (Wo / Wi) | WETH Balance (Bi) | BAL Balance (Bo) |
---|
This section will breakdown the three core cases of asset deposits on Balancer Protocol.
Balancer Protocol allows users to invest in pools in a variety of ways. Proportional deposits yield no price impact and follow the ratios the pool is already in.
Single Sided Deposits permit users to deposit into a pool with only one of the assets. A price impact due to shifting the internal relationship of the tokens will be accounted in this scenario.
Multi-token Deposits are when a user deposits the tokens they have in an unproportional way. Not a single asset but multiple in a non-proportionate way.
See examples of each deposit type in the following pages:
Multi-token deposits encompass the single sided deposit knowledge base and emphasize how Balancer Protocol's invariant and swap fees are incorporated in complex scenarios.
Balancer Protocol has several features which differentiate it from all other core AMM platforms such as Uniswap and Curve. The one of focus in this section is the multi-token pools and the layer of complexity they add to the calculation of price impact, and ultimately disproportionate asset deposits.
Withdrawals only support proportional or single sided options in the current state; therefore, a single sided example will be solved. The principles defined in the proportional and single sided sections will be building blocks for the examples solved here.
For both examples we will utilize the WMATIC MTA WETH 40/40/20 Pool on Polygon as it highlights uneven weightings of assets as well as the multi-token aspects, we are interested in.
80/20
6,005.3009
5,315,514
50/50
135.9922
30,158
80/20
6,005.3009
5,315,514
50/50 | 135.9922 | 30,158 |
Proportional deposits will yield newly minted Balancer Pool Tokens (BPT) for an investor. This function essentially states that the if the proportional amounts of all tokens deposited (Dk) in relation to the Balance of that given token (Bk) will yield that amount of the new total supply of pool tokens. The example in the whitepaper states that depositing 10% of each of the existing tokens in the pool an investor will receive 10% of the current BPT supply.
Equation:
Sample calculation:
Arbitrarily we will assume we are depositing 15% of the total balance meaning Dk divided by Bk will be 0.15
We will assume our total supply to be 10,000 BPTs at this time for the sake of simplicity. From here can make the following calculations:
Substituting 0.15 for our deposit over balance ratio and 10,000 for the supply value we can solve for the issued amount of pool tokens.
This shows that using the formula, based upon the number of tokens we deposit into a pool based upon the balance already we present we will be awarded a proportional number of pool tokens. These pool tokens are a userโs way to redeem their assets when the pool is exited.
An example of a proportional Deposit into the BAL/WETH 80/20 liquidity pool
At the time of writing the BAL / WETH 80/20 pools has the following traits:
Swap fee: 0.05%
BAL: 5,682,882
WETH: 6,232.9054
BPT: 2,891,832.103892
Letโs assume we want to invest 500 BAL, and proportionally this would prompt us to invest 0.548393 WETH to maintain the pool balance (see The Value Function section for reference). We know our amount in and balance in of each token. The ratio of Dk over Bk will be the same regardless of which token is chosen in proportional investments and withdrawals:
See the BAL/WETH 80/20 Withdrawal Section to see that this transaction is reversible.
Pool token spot price (Assume A(t) = 1 BAL):
Then, we must calculate the ratio of the poolโs invariant before and after the exchange of 100,000 BAL.
Using the invariant ratio, we can determine the new total number of pool tokens and in the same stroke, calculate the amount of pool tokens which we received for the exchange.
Knowing the amount of BAL, we needed to invest and the pool tokens we received in exchange we can determine the effective price of a pool token to compare with our spot price:
Two examples of calculating price impact with the incorporation of swap fees in single asset deposit scenarios.
Now letโs assume we are depositing into the BAL/WETH 80/20 Pool with 10,000 BAL and no WETH. We will be charged swap fees on the portion of our investment which is โoff-balanceโ. In this case 20% of our pool is not in the form of BAL, therefore that is the taxed portion. As referenced from the trading with swap fees section.
The calculation follows as:
The current pool traits are as follows:
Swap fee: 0.05%
BAL: 5,691,640
WETH: 6,194.1921
BPT: 2,891,789.44800306
Using the known amount for A(t) we can calculate the amount of pool tokens we will be issued for this deposit.\
We can see on the user interface completing this transaction will yield a price impact of 0.03% (0.18% for the larger interaction). What exactly does this mean for an investor? Well in short from price impact for trading we can note that the ratio between assets change as supply and demand shifts during an exchange. In this case we are essentially exchanging BAL for Pool tokens and in doing so Pool tokens are becoming more expensive in reference to BAL. This is a bit more complex than comparing prices of individual assets in a pool, but we will focus on the current example to start. The spot price of a pool token and effective price of a pool token are the variables we need to calculate to determine our price impact from an investment.
Pool token spot price (Assume A(t) = 1 BAL):
Next, we must calculate the ratio of the poolโs invariant before and after the exchange of 10,000 BAL.
Using the invariant ratio, we can determine the new total number of pool tokens and in the same stroke, calculate the amount of pool tokens which we received for the exchange.
Knowing the amount of BAL, we needed to invest and the pool tokens we received in exchange we can determine the effective price of a pool token to compare with our spot price:
How does a single sided deposit work?
The pool tokens issued to a depositor of a single asset can be determined by utilizing the change in the value function (invariant) of the pool. As seen in the whitepaper the ratio of the change in the value function will yield the number of tokens issued. This information will become even more important when discussing multi-asset deposits:
This can be simplified for our purpose of a single sided deposit where all other tokens in a pool maintain constant balances. The token which we are investing into a pool will be denoted with the letter โtโ. Amount in (At), Balance-In (Bt), Weight-In (Wt) and the pool token supply will be the variables in concern. When simplified the equation is as follows:
This example shows an increase in WMATIC only which evens out the ratios of deposit compare to the previous Multi-token example. Notice the decrease in price impact as the ratio is better managed.
Pool traits at the time of writing:
Swap fee: 0.25%
WMATIC: 273,763
MTA: 1,023,625
WETH: 66.0812
Total BPT: 249494.507172\
The new Base Total BPT will change the proportional values as shown below.
In this case both of our Base Values for WMATIC and WETH are greater than the proportional values for an evenly distributed despot. This means that both deposits will be taxable in terms of the swap fee.
WMATIC
WETH
Finally, we can utilize these values to compare the invariant ratios between the initial and the after-swap fees are paid. This will determine the BPT we receive as opposed to what we would without any change in spot price.
Our invariant ratio, multiplied by the initial total pool tokens, will yield the total pool tokens and therefore the amount which we will receive during our deposit. This value in comparison with our Base Case will determine our price impact.
Here we will solve two examples using the pool above, weights are 40%, 40%, and 20% respectively.
Pool traits at the time of writing:
Swap fee: 0.25%
WMATIC: 273,763
MTA: 1,023,625
WETH: 66.0812
Total BPT: 249494.507172
For this example, we will choose to deposit 1,000 WMATIC and 2 WETH without altering the total MTA within the pool. Our alternate example will use a deposit of 10,000 WMATIC and 2 WETH to solidify understanding in a slightly more complex scenario. These instances are referenced below.
Firstly, we will determine our spot prices of each token in terms of 1 BPT. This can be done using the reciprocal of the redemption function most conveniently, making our input 1 BPT. We will do this for WMATIC and for WETH.
WMATIC
WETH
Next, we can determine the amount of BPT our investments would be worth based upon the spot price, this assumes zero price impact is occurring and sets our base case.
From here we must determine what value of our BPT are disproportionate from the ratios of the pool for an evenly distributed deposit this can be done simply by multiplying the Total BPT by the weight of each token as follows.
Using these values, we can determine how much of the total swap fee will be paid for each single token deposited. If our Base Value deposit for any token in BPT exceeds the Proportionate BPT deposit value, a swap fee will be implemented on the excess portion.
For example, because we deposited a Base Value of 364.5419683 BPT in WMATIC and the proportional deposit is 749.9135826 no swap fee will be implemented on the 1,000 WMATIC which were deposited. These will be crucial in determining our invariant ratio after the swap.
In the case of WETH our Base Value is 1510.241988 BPT, and proportional deposit is only 374.9567913 BPT. This yields the following calculation for a taxable amount:
Lastly, we must calculate our initial and post deposit invariant with fees to determine our net BPT and price impact based on the base case.
Our invariant ratio, multiplied by the initial total pool tokens, will yield the total pool tokens and therefore the amount which we will receive during our deposit. This value in comparison with our Base Case will determine our price impact.
The changes from the will be notably base value of 10,000 WMATIC in BPT changing the calculations that follow.
This section will breakdown the two core cases of asset withdrawals on Balancer Protocol.
Balancer Protocol allows users to redeem their investments from pools in a two possible ways. Proportional withdrawals yield no price impact and follow the ratios the pool is already in.
Single Sided withdrawals permit users to withdraw from a pool in the form of only one of the assets. A price impact due to shifting the internal relationship of the tokens will be accounted in this scenario.
See examples of each withdrawal type in the following pages:
At the time of writing the BAL / WETH 80/20 pools has the following traits:
Swap fee: 0.05%
BAL: 5,682,882
WETH: 6,232.9054
BPT: 2,891,832.103892
Under the same conditions shown in the deposit example we will determine the amount of each token we would receive if we redeemed the 254.433587 pool tokens we were issued. The amount we receive should be the same as we would invest for the issued amount because the pool traits are constant in this example.
This solidifies the premise of accounting for the pool issuing and redeeming pool tokens Given the pool traits the minting or burning (investment or withdrawal) of pool tokens will respect the ratios of the balances within the pool and the percentage of total pool tokens.
The opposite operation is needed to calculate the amount of each token remove from a pool upon withdrawing. The value we calculate will correlate to the balances of the tokens within the pool. Given any pool an investor may have funds in, they can determine the tokens they will receive as a % of the token balances.
Equation:
The Balance term (Bk) will vary for every pool and each token within a pool however the portion of each balance an investor is entitled to is related to their share of the pool in reference to pool tokens always.
As the external market prices of assets change the balances of tokens will fluctuate due to trading. The portion of the pool owned by an investor can only be changed as investors enter and exit the pool. For example, you may own 10% of a pool and after a few months as more people invest you now own 4% due to total supply of tokens increasing.
Assuming our previous example where we hold 1,500 pool tokens letโs assume the pool, we invested in has attracted far more liquidity. Now the total supply is at 25,000 pool tokens. Letโs calculate the number of tokens we will receive when we redeem our BPTs.
Using the expression above we know that given the current balances of each asset in the pool (Bk) we will receive 6% of each token in our wallet upon redemption. These examples may be simple in nature but, coupled with swap fees, they are the first building block towards understanding the complexity of single of mixed asset deposits and withdrawals.
Single Sided Withdrawals will follow the same principles laid out in the single sided deposit section prior. The invariant is the core of these transactions and resulting equations are derived from there. As seen in the whitepaper the ratio of the change in the value function will yield the number of tokens redeemed.
This can be simplified for our purpose of a single sided withdrawal where all other tokens in a pool maintain constant balances. The token which we are removing from a pool will be denoted with the letter โtโ. Amount Out (At), Balance-Out (Bt) before the transaction, Weight-Out (Wt) and the pool token supply will be the variables in concern. When simplified the equation is as follows:
Examples will include impermanent loss calculations for a traditional AMM style pool (50/50) with swap fees or "APY" included.
We will start with a simple 50/50 pool featuring COMP/WETH. We take a time when WETH is worth $2,000 USD and we have 2.5 WETH ($5,000.00). At the same time COMP is worth $250.00 therefore we are investing 20 COMP tokens. Our liquidity position is deposited and we receive pool tokens for this $10,000 investment.
We check back out our position after a period of time and COMP has doubled, 100% gains straight to $500.00 USD. WETH has only made it up to $2300.00 at this point, gains of just 15%. We know at this point we will face some impermanent loss. We still have strictly gains but due to our liquidity position we are missing out on some of our investment in theory.
Here we calculate the invariant from the value function:
Here we can consider the USD values to be the same in the numerator and denominator therefore not needed to determine the ratio between the two.
For the new token balances we consider the invariant ratio compared to the price action of the individual asset. This proportion will yield the new balance of each token in relation to the initial investment.
Please note these calculations can take place over any time frame. These occurred in roughly 12 days between June 25 and July 07 of 2021. This same price action can take place over the course of 1 year and with 4% or more in swap fees or liquidity mining accumulating the LP position would become the more rewarding option.
These calculations are depicted by the following tables.
Initial Investment: $10,000.00
HODL Total: $15750.00
LP Total $15165.75; with 4% Annual yield $15,772.38
In our prior example COMP and WETH went through divergent price changes. When this happens, we saw the potential loss of value that can be created by the nature of impermanent loss. Now if our prices continue to change, we will look at an example where WETH goes up to a price of $3000.00 and COMP decreases down to $375.00. While these are diverging prices changes this will bring us to a 50% gain for both assets in relation to our original investment.
Therefore, because our invariant ratio matches our price action ratio, we have an indicator that there will be no impermanent loss.
This calculation will be done from the point where impermanent loss was experienced to the current state to prove the โlossโ is indeed reversible under the proper conditions.
Initially:
After Price Change:
New Token Balances can be calculated as follows:
These balances match our initial investment meaning overall we lost nothing impermanent loss. The price action is still in our favor by 50% for both assets as we hold the same initial number of each. Also, we would have likely earned swap fees for this from traders making our gains slightly larger.
Through the price action regardless of how dramatic impermanent loss can be reversed as seen above. This can occur countless times as prices of assets in a pool fluctuate in price. The importance of this is understanding the assets you are holding and how comfortable you are with volatility. In theory great volatility will be coupled with large volumes of trading making the swap fees and gains for liquidity providers increase. Weighing the risk of impermanent loss with the reward of accumulating swap fees or โvolatility farmingโ is the game of a liquidity provider long term.
In this section we describe what impermanent loss is, how it occurs, the risks associated with it, and how our users can recognize the potential effects on their investment decisions.
Impermanent Loss is an extremely hot topic within decentralized finance and rightfully so. Often liquidity providers are supplying funds to a pool with a surface level understanding of how impermanent loss can affect their position. While commonly discussed as potentially wipe out the value of an entire pool or slowly chip away at their potential gains the tradeoff of volatility harvesting is not often emphasized.
The reality of impermanent loss is that it is a dynamic and reversible occurrence which is only realized when a position is removed from a liquidity pool, at this point is becomes a permanent loss. The liquidity provided is an investment on either volatility or that both assets will show extremely similar price action while accumulating trading fees. The fees are a tax paid by traders and in some cases traders are called โarbitragersโ. These fees are awarded to the liquidity provider and the market making platform (in most cases) in order to incentivize the holder of a liquidity position to continue to give them a trading source.
Impermanent loss occurs when the prices of two assets experience a divergence in price action. For example if two assets increase by 20% no impermanent loss is noticed. However if one asset increases in value by 20% then a divergence has taken place and some form of impermanent loss would be noticed in the position. This can be reversed by the other token in the pool also increasing 20% or both tokens converging on the same price movement relative to the original investment. A basic example of impermanent loss followed by reversal scenario are is outlined on the following page.
Here we will examine the same circumstance as shown in the 50/50 Pools example to compare what effect a change in pool weights can have on a liquidity provider's investment.
COMP WETH 80/20
To emphasize the weighting of 80 / 20 as opposed to 50/50 we will observe impermanent loss under the COMP favoring pool conditions to display the benefits of uneven pool weightings. We will in turn hold 1 WETH @ $2000.00 each and 32 COMP @ $250.00 each. ($8000 in COMP and $2000 in WETH).
Our gains will then be determined by the invariant ratio. This can be used for our token balances are well.
Here we can consider the USD values to be the same in the numerator and denominator therefore not needed to determine the ratio between the two.
While impermanent loss is still applicable in this scenario in comparison to the 50/50 pool the losses are nearly cut in half (a factor of 0.5825 more precisely). When dealing with very large investments these small amounts can make a large difference in value and ultimately weighting will protect or expose investors from impermanent loss depending on their choices. However if prices return to their initial state or follow the same price change at a certain point the โlossesโ will revert to zero regardless of weighting.
Now letโs assume we are withdrawing from the BAL/WETH 80/20 Pool, we want to remove 5 WETH from the pool not knowing how many pool tokens we will need to redeem. We will be charged swap fees on the portion of our withdrawal which is โoff-balanceโ. In this case 80% of our pool is not in the form of WETH, therefore that is the taxed portion. In this case we know we will receive the total of 5 WETH from the withdrawal, (At), this means our โsentโ value will be unknown and slightly higher to compensate the swap fee we are charged.
The current pool traits are as follows:
Swap fee: 0.05%
BAL: 5,598,984
WETH: 5,798.4836
BPT: 2,816,401.77912812
This equation can be rearranged to solve for A (sent) in terms of our BPT (P_redeemed) as follows:
Using this equation, we can solve for A (sent):
For our Spot Price:
From here we can calculate the amount of pool tokens we redeemed to receive our 5 WETH:
Then, we must calculate the ratio of the poolโs invariant before and after the withdrawal.
Using the invariant ratio, we can determine the new total number of pool tokens and in the same stroke, calculate the amount of pool tokens needed to exchange for our WETH.
Knowing the amount of BPT we needed to redeem and the amount of WETH we received in the withdrawal we can determine the effective price of a pool token to compare with our spot price:
Please note the swap fee and pool traits change dynamically over time making calculations such as these valid for only a short period of time. The purpose of these examples is to deepen the understanding of our platform for those interested in are already utilizing Balancer Protocol.
Besides increased governance voting, how does locking benefit me?
veBAL is financially beneficial to lockers in 3 ways:
Gauges will be voted for through mainnet only, here delegation of BAL incentives can be done across all chains and gauge approved pools.
Users can view the current pools eligible for gauge voting here. Interested in proposing your project's token to be eligible for voting? Check out the instructions page on our forum.
Balancer's multi-token pools are on of our unique features. Below is an example of how impermanent loss on one of these pools on the can occur. Inclusive of details on volatility and stable coins.
Advanced Example โ Multi Token Pool
An example of a multi token pool and how impermanent loss would occur and then be reverted will be solved below. We will look at a polygon pool: 25% USDC, 25% WMATIC, 25% BAL, 25% WETH. Initially we will assume we invested $10,000 in USD evenly amongst the assets.
Initial Conditions:
We will assume USDC stays at a constant value, BAL increase by 15% to $28.75, WMATIC decreases 4% to $1.20, and WETH increase 50% to $3750.00.
New Token Balances can be calculated as follows:
Due to a stable coin (USDC) being a portion of the pool impermanent loss is nearly inevitable unless all tokens return to their initial value at the time of investment. Therefore, the pool above and any pool with stables and non-stable assets an investor is concerned mostly with volatility and their profit to be made from swap fees or reward APY. Essentially investing in their confidence for this type of price pattern:
At any point where all prices revert to their initial investment arbitragers will bring the tokens back to their initial balances. With a stable token present this would mean no gains can be made without impermanent loss or swap fees being present. In turn the goal can be considered to have low IL and high swap or reward APY for a liquidity provider with these types of investments. Also, it can be viewed to manage exposure to volatile assets.
An overview of the redefined governance system for Balancer Protocol
veBAL is the newest pillar of Balancerโs governance system. Derived from Curve finance vote-escrowed voting essentially gives holders of a respective protocolโs token the ability to lock their asset for a period. The longer the asset is locked, the more voting strength their assets are delegated by escrowing system. In Balancerโs case this is unique in that it is the first to adopt a liquidity pool token as the mechanism for governance, the BAL/WETH 80/20 pool token.
Both quantity of the token locked, and the period of locking will determine the voting strength a holder wields. Quite simply this is defined by the number of weeks locked multiplied by the number of tokens locked itself and decays on a weekly basis. One week is considered an epoch. Voting function shown below:
This means that commitment to hold BAL long term will give the strength to long term holders more so than those who lock in short periods of time. Voting decay will follow a linear curve on a weekly model meaning locking for 52 weeks will give a voter 52x the voting strength than that of a holder who locks for 1 week.
The voting strength will decay over time and can accumulate if a user locks separate amounts at different points in time. Please note quantifiably, locking 1 BPT for 1 year equates to holding 1 veBAL, then the multiplier works in a fractional fashion. Locking 1 BPT for 26 weeks would yield 0.5 veBAL.
Ultimately, the benefits of the veBAL tokenomics will be felt by the BAL/WETH liquidity providers with long term commitment. Aligning governance and financial incentives to be encompassed in the tokenโs nature make it organically more desirable.
In short, governance is enhanced, and the protocol revenue distributions, liquidity mining incentive boosts and the ability to direct the incentives all come to token holders in one package. This is a huge step forward to make Balancer more sustainable, while at the same time is still an upgradable system in the case that future advancements are made.
Too Long Didn't Read - A Brief summary of veBAL tokenomics. Vote-escrow governance, financial implications, and the new emissions schedule.
By locking the BAL WETH 80/20 BPT holders are given veBAL in exchange for governance and implied financial purposes and benefits. The longer the length of the time lock a user agrees to the higher their multiplier got governance. In short if I lock 1 BPT for 52 weeks I will receive the same amount of โvote escrowedโ strength as someone who locks 2 BPT for 26 weeks. Quite simply voting strength is a function of the amount of pool tokens locked multiplied by the length of locking time.
Financial implications:
veBAL equates to boosted liquidity mining incentives for all incentivized pools. In short, the staked pool share, and the lock multiplier, or boost, are both factors in a userโs liquidity mining โAPRโ.
Lockers receive 75% of protocol fees. 50% of the swap fees accumulated on Balancer Protocol are collected as protocol fees. So, of all fees 75% of 50% are distributed to the veBAL holders, more veBAL equates to a larger portion of the protocol revenue distribution.
veBAL will be used for a governance gauge voting mechanism to decide which pools receive BAL liquidity mining incentives. Users can direct liquidity mining incentives to the pools of their choice.
veBAL does have a gauge to direct rewards to the holders if chosen. This option is capped at 10% of total emissions of BAL at a given time in the inflation schedule. The overflow, if a vote goes over 10%, will go to the DAO treasury, where governance will have ownership of it.
This gives veBAL holders the option to choose pools they have liquidity positions in for increased incentives or a potential for bribing battles can ensue. Bribing battles will essentially allow projects to provide veBAL holders a compensation or incentivize to vote in a direction they prefer, hence the term โbribeโ.
In the same breath, the emission schedule for BAL has been defined and will be set permanently. Currently 145,000 BAL is emitted per week, which is unsustainable without a ceiling on emissions. The two key takeaways for the new inflation schedule will be a halving of the inflation rate every 4 years, and a total supply of BAL being capped at 94,000,000.
How to calculate the maximum boost possible for a given liquidity pool and investment, as well as the boost a user is entitled to.
The variables to consider when calculating veBAL incentives boosts are the following:
The Liquidity you will provide and stake: l
The staked liquidity in the pool before you deposit and stake: L
The liquidity in the pool after your deposit and stake: L' = L + l
The total veBAL in circulation
The amount of veBAL you hold
A common question is what is the minimum number of veBAL a user needs to hold in order to receive the maximum boost. To calculate this value:
While this does answer what the minimum amount of veBAL is need for maximum boost at one point in time, we must consider what happens over time. if a user has the minimum veBAL required to receive maximum rewards and then more veBAL is minted, this means I will no longer be receiving the maximum rewards due to dilution of the Total veBAL.
To the opposite point, as more liquidity enters the pool your boost may increase, but net rewards decrease, while this is less critical one may require less veBAL if the portion of the pool they own decreases. Therefore, it is up to the userโs discretion how much veBAL they would like to hold.
See here how to calculate the maximum boost one can receive from an investment.
Overview of the Tokenomics after veBAL has been approved by the governance process.
Balancer DAO is extremely excited to introduce the newest iteration of tokenomics for the Balancer governance token (BAL). On February 10th, 2022, the vote for veBAL Tokenomics began. By a landslide of 361,000 votes to 147, the changes have been approved by the governance process. The vote ended three days later February 13th leaving the community riddled with anticipation. Implementation of the new tokenomic model comes coupled with several key points.
Since the initial proposal, a key change has been made regarding the gauge voting. 100% of emissions will be controlled by veBAL holders across all networks. In this case no liquidity mining committee will be required and veBAL will only receive the percentage, which pertains to the voting done the veBAL holders. See more on these changes here.
The highlights are vote-escrowed locking of BAL / WETH pool tokens, gauge voting for veBAL token holders to determine where liquidity mining emissions are allocated, incentives boosting, protocol revenue distribution, and a well-defined BAL inflation schedule. With all these updates wrapped into one package many of our community members may be left asking: what does this mean for me? Continue reading to dive into to the mechanisms and what we have seen from similar projects!
More information:
Balancer DAO is in no way providing financial advice, recommendations, or guarantees of economic outcomes. The documentation covers potential outcomes based on similar circumstances from alternate Defi Protocols (Curve and BeethovenX primarily). The DAO recommends users to do their own research and make financial decisions based on inferences formed by themselves.
How do i calculate my boost for liquidity incentives in a pool?
To calculate a users boost the process from the section will be used considering the veBAL holdings user has.
First we must calculate the user's working supply:
This would mean the minimum or โnon-boostedโ supply a user could have is the following, assume no veBAL is owned.
The boost a user receives is the the ratio of their working supply over the new total working supply, divided by the minimum case of their working supply entering a pool.
In the case of already being in the pool and depositing further liquidity, the following adjustment must to be made to consider the working supply a user already holds a given pool.
How to calculate the maximum boost possible and what effects it.
Under certain conditions, specifically larger liquidity deposits, a maximum boost of less than 2.5x becomes apparent. The logic behind this is that there is only a finite number of incentives going to a pool, for example 10,000 BAL. Regardless of boosting, the pool's 10,000 BAL is distributed to the staked liquidity providers, boosting is a factor in which LPโs receive different portions of the incentives.
i.e. the pie is the same size but the slices are cut differently
The liquidity in terms of how much veBAL correlates to it what is called a working supply. The working supply can range from 40% to 100% of a userโs staked liquidity position. This is the main theory behind how rewards are distributed. The equation below defines a userโs working supply. (see variable list )
This would mean the minimum or โnon-boostedโ supply a user could have is the following, assume no veBAL is owned.
In turn, the maximum working supply possible is defined as the following:
To determine the maximum boost possible for a pool we must compare a userโs non-boosted and maximum working supply to the working supply the pool already has in place.
The poolโs working supply is the sum of all the liquidity providers working supplies prior to the deposit of a new userโs working supply.
The maximum boost possible for a user will be the ratio of their portion of max working supply plus the pools total working supply, divided by their portion of minimum working supply plus the pools total working supply. Please note the pools total working supply used here is prior to the userโs deposit.
Please note if a user has a working supply in a pool already, this must be subtracted total working supply in both the numerator and denominator of the equation a shown below.
Balancer Protocol generates revenue through swap fees, learn how veBAL holders benefit from the trading done on the platform.
Protocol revenue has become a common vehicle for AMMโs to accumulate a treasury of assets as well as redistribute the profits of trading on to their governance token holders. Balancer Protocol is adapting this mechanism in their own form.
In a recent the protocol fee was increased to 50% of all swap fees as noted here. This means all pool revenues on Balancer are being split in half. Half of the swap fee value is going to the protocol revenue and the other half is directly accumulated by the liquidity providers in each pool.
While a liquidity provider may not notice a large difference in profitability, often in the realm of 0 โ 2% APR is being accumulated by the protocol. This is not negligible however in terms of APR majority of liquidity provision is incentivized by liquidity mining incentives.
Regardless this value adds up across the entirety of Balancer Protocol. Of the 50% which is protocol revenue 75% will be distributed back to veBAL holders, based on their share of all veBAL in each epoch. The flow of protocol revenue from swap fees is depicted below. Without revenue share activated on a pool the "Fee Splitter" is bypassed. To understand revenue share for partner's read more .
To be blunt if the swap fees for a given epoch equate to 1,000,000 USD equivalent, the protocol share will be 500,000 USD, meaning the DAO treasury will receive 125,000 USD and veBAL will have 375,000 USD distributed amongst them. This example is only for calculation, not a financial guarantee or promise.
Key questions and answers to how boosting incentives works with veBAL system.
As opposed to the initial liquidity mining incentives where a liquidity provider receives incentives based only on their share of the total liquidity, we will now implement a multiplier based upon the time locking mechanism. Locking the same amount of BPT for a longer period will yield a higher incentive multiplier for a user.
Please note the maximum boost possible for liquidity mining incentives is 2.5x. See here how to .
The boosting mechanism theory is visualized by the graphic below. The fraction of a pool's working supply a user owns is based on upon their share of their respective pool, and their share of total veBAL. Continue reading through this boosting sections for further information on the working supply.
Based upon this new mechanism locking the same number of tokens for twice as long as someone else will result in twice the voting strength. The boosting proportion and more additional benefits are coupled with wielding that strength, however they are not as directly proportional.
Special thank you to Baller, zekraken, for deconstructing the contracts & code to make calculating boost easily accessible to the Balancer community.
Reference link the in more detail.
How to delegate boost from locking veBAL on a standard EOA to a Gnosis Safe or similar contract wallet / mechanism.
A common obstacle faced by users of vote escrowed systems is the inability to lock their token in the time based veBAL contract. For safe users this would mean no access to veBAL governance or boosted liquidity pool incentives.
If you would like to delegate your veBAL boost to another address, you can do so by calling the create_boost function on the veBAL veboost contract https://etherscan.io/address/0x2E96068b3D5B5BAE3D7515da4A1D2E52d08A2647#writeContract
This is useful for situations where you are LP'ing from a contract like a gnosis safe which, because it's a contract, is incapable of locking of veBAL. Instead, you lock up veBAL from an EOA and delegate your boost to your gnosis safe.
Note that the percentage is flexible over the complete range of boost which you would like to delegate.
Vyper_contract | Address 0x2E96068b3D5B5BAE3D7515da4A1D2E52d08A2647...
Hold veBAL and you can determine where liquidity mining incentives should be allocated. Learn more why this would benefit our users by reading below.
Gauge voting has been implemented by Curve finance to give their governance token control over financial outcomes. This delegates a much larger amount of power to token holders and amplifies the meaning of governance by a new magnitude.
Balancer Protocol is adopting this same method of governance and is confident not only from Curveโs outcomes but also from the more comparable friendly fork of Balancer, BeethovenX. By giving a financial power of control to the governance token it not only becomes more desirable to hold it can be utilized as an asset that other protocols wish to control the outcomes of as well.
The initial use case of the gauge voting system is to allow governance token holders, in this case veBAL, the ability to select the pools they are invested in to receive liquidity mining incentives for the next epoch. This eventually transformed when projects would bring their liquidity to Curve or Beethoven and would then bribe the holders to vote for the pools which would benefit the protocols. This has proven to be financially sound for the protocols which are doing the bribing because their tokenโs pools receive incentives for only the cost of their bribe.
Gauges will be voted for through mainnet only, here delegation of BAL incentives can be done across all chains and gauge approved pools. Users do not need to vote each week if they will maintain the same delegation as the previous. Voting is only needed once, and then again if a change in selected pools is done.
Users can view the current pools eligible for gauge voting Interested in proposing your project's token to be eligible for voting? Check out the page on our forum.
A key note here is that veBAL can vote for the gauge of veBAL itself. This is capped at 10% of total emissions of BAL at a given time in the inflation schedule. The overflow, if a vote goes over 10%, will go to the DAO treasury, where governance will have ownership of it.
The potential for external incentives or cross project incentivization, also known as "bribing" is a common byproduct of gauge voting systems. How this benefits veBAL holders and the projects which choose to influence their votes is described below.
To be clear, โProject Aโ will give a veBAL holder their projectโs tokens to use their voting strength to incentivize โProject Aโsโ pool with BAL liquidity mining incentives. Typically, โProject Aโ will offer a lump sum to all those who vote for their pool.
After the voting is completed, this lump sum is then divided amongst the votes proportionally and distributed to those who voted for โProject Aโsโ pool. This means the more veBAL you hold the more bribes you can be entitled to. On the flip side, the more votes โProject Aโ attracts with their bribe, the more liquidity mining incentives their pool will receive.
BAL token inflation has been a topic of uncertainty for quite some time. With emissions weekly being at 145,000 BAL per week a common question arises of, how long can this last?
The answer is that long term, this is an unsustainable model. Holders of long-term projects want predictability of the total token supply over a long-term window. Not only this, but the rate at which BAL is emitted by the liquidity mining program must be curtailed to give a decreasing rate of inflation to the token over time. The change in tokenomics addresses the two issues directly with the new emissions schedule.
BAL emissions will decrease over time, halving every four years based on the date at which the tokenomics goes live. For example, this will be the simulated schedule for the first four-year period:
The entire emissions schedule can be seen here. Emissions are represented graphically below. At this rate the total supply of BAL will reach asymptotic behavior at roughly 94,000,000 BAL tokens in circulation. Therefore, an upper limit to the total supply is defined and set in stone for the future of Balancer Protocol. This change is irreversible and defines the permanent future for circulating BAL tokens.
Frequently asked questions and their answers from and by the Balancer Community.
1. Will voters vote on how much emissions go to each network or is that locked?
The voting mechanism is described in "How it works" in Gauge voting documentation.
Voters will determine the amount of emissions going to gauge listed pools on each chain (Mainnet, Polygon, and Arbitrum), the voting will happen on mainnet. This is because the contracts to read your veBAL balance are on mainnet only.
2. If you have veBAL on mainnet, does it boost your farming on Arbitrum, Polygon?
No, only gauges on L1 (Ethereum mainnet) receive incentive boosts because the contracts must read your veBAL balance.
The boost depends on what fraction of the gauge staked liquidity you hold and what fraction of the total veBAL you hold. See more on boosting here.
3. Is the veBAL vote on-chain, and does it require gas fees?
Yes, gauge votes are on-chain and cost a fee, when gas was 50 GWEI it was about $40 to vote, depending voting incentives (known as bribing) there is potential to offset the cost of voting. ****
If the same pools will be selected each week, no additional vote, transaction, or gas is needed. Users only have to vote once, unless they want to change their allocation.
Gas price is subject to change based on the price of ether and network congestion. ****
4. In the transitioning to veBAL, will I personally need to do any migration from the current pool I have invested?
On mainnet, yes if your LP pool is eligible for gauge voting, you have to stake your LP for incentives.
On Polygon and Arbitrum, not in the initial launch period, but you will need to stake them in the near future.
The only lock-up necessary is to lock the BAL 80 - ETH 20 LP to receive veBAL.
5. Do veBAL holders receive a portion of the trading fees? How are the protocol fees paid?
veBAL holders are receive protocol fees distributed in bbaUSD (Boosted Aave Stable Pool LP Tokens) see Protocol Revenue Distribution.
6. Is there a way to view how much total veBAL there is?
Yes that information is in the following link: https://dune.xyz/balancerlabs/veBAL
7. How do I make a pool eligible for gauge voting?
Need to make a governance proposal, https://forum.balancer.fi/c/vebal/13
8. How much BAL/WETH BPT do I stake to maximize my multiplier? What amount do you need to stake at 1 year to hit the 2.5x boost for liquidity incentives?
The length of time locked corresponds to how much veBAL you'll get for your 80/20 BPT. Voting is 1 veBAL for a 52 week lock of 1 BPT. Where a one week lock of 1 BPT will give 1/52 veBAL. **** See further info here.
The LM boost is separate. Related to your share of the pool and share of veBAL. Range limited from 1-2.5x. This can be calculated on our tools site and the math is explained here.
9. How do i get veBAL, and can i transfer BPT or veBAL?
You will need to have BAL tokens or WETH to invest in the BAL/WETH 80/20 pool. You can deposit a single asset, which will incur some price impact, or you can deposit both assets in the correct weights. You will receive BPT which you can then time lock here to receive veBAL.
Yes, you can transfer BPTs. Rewards will accrue in the wallet where they are held.
veBAL is a non-standard ERC-20 token and cannot be transferred.
10. How do I extend my veBAL lock up?
Just go to the veBAL site, see "Lock until" , click "+", choose the time desired, and confirm.
11. Are incentives paid daily?
Incentives on mainnet are now accrued each block. Protocol fees are distributed on a weekly basis.
12. Does veBAL support Gnosis Safe?
It's normal for vote escrowed (ve) systems to not allow arbitrary contracts to lock as otherwise it's easy to tokenize the ve tokens which defeats the point. Users can lock up veBAL from an EOA and delegate it to your gnosis safe to earn boosts. Guide link.
13. Is there a repository for the contract addresses of all the new staking contracts and veBAL contracts?
Link to the veBAL contracts:
Special thank you to community contributor Cosme Fulanito and baller Joey Wong for putting together these questions and answers.
For more in depth support contact us via the links below. Community is most accessible via Discord.
Balancer Website - https://balancer.fi/
Balancer Labs Github - https://github.com/balancer-labs/
Medium - https://medium.com/balancer-protocol
Balancer Labs - https://twitter.com/BalancerLabs
Balancer DAO - https://twitter.com/balancer
References for the documents above written by various members of the decentralized finance space, Balancer Labs, and DAO members.
Author(s) | Year Published | Description | URL |
---|---|---|---|
Fernando Martinelli & Nikolai Mushegian.
2019
Balancer whitepaper
Fernando Martinelli
2019
Balancer Bonding Curves, Surfaces, and Automated Portfolio Management
Fernando Martinelli
2020
Impermanent Loss and Price Impact (slippage)
Hayden Adams, Noah Zinmesiter, Dan Robinson
2020
Uniswap whitepaper
DefiYield Guides
2020
Impermanent Loss and Asset Management
Balancer Labs, Rabmarut, Solarcurve, and Bakamoto
2021
Volatility Harvesting; Swap fees vs. Impermanent Loss Case Study
Balancer Labs
2021
Balancer Protocol and AMM Overview
Fernando Martinelli
2021
What is an AMM?
Fernando Martinelli
2021
Balancer V2, Vault Architecture and applications
Balancer Labs
2021
Balancer Labs Documentation - Crucial for all sources of information
Balancers Labs
2021
Balancer Labs Documentation - Emphasis on Developer geared inquiries
Balancers Labs
Updated Daily
Balancers Labs Github page