The Ultimate Guide to Balancer Smart Pools
Dear Bankless Nation,
Balancer Smart Pools are innovating on AMMs.
You can design these smart pools to adjusts parameters based on any sort of arbitrary code. And there’s endless potential for them.
Pools that enable Surge Pricing like Uber or Lyft? Sure.
Pools that are efficient for bootstrapping liquidity? Oh yeah.
This tactic is really detailed but we cover a ton of ground. You’ll learn how to create your own pool to bootstrap liquidity.
Huge possibilities here folks. Read on.
MTN: Balancer Smart Pools
A discussion with Jeff Bennett on Balancer’s new 'Smart Pools'. Learn all the things you can do with a Balancer Smart Pool, like how to bootstrap a token! Or how it can answer to spikes in liquidity demand!
Tactic #63: How (and why!) to create a Balancer Smart Pool
Bankless Writer: David Hoffman, Bankless Founding Father
Balancer Smart Pools—What are they? What can they do? So what?
In this tactic, we go through everything you need to know about Balancer Smart Pools and the process of creating one that changes token weights of the pool over time, so that the price of a token trends lower and lower as time goes on (unless people purchase the tokens, in which then it goes back up).
This is the ultimate resource for Balancer’s innovative new Smart Pools that allow for more flexible constructions!
Let’s get into it.
- Goal: Learn about Balancer Smart Pools & create your own
- Skill: Advanced
- Effort: 1 hour (or two)
- ROI: Unlimited, if you make the right pool 😉
A Guide to Balancer Smart Pools
Here’s the breakdown of this tactic:
Part 1 - Defining the ‘Why’
Balancer Smart Pools - Why are they cool? What’s the big deal? What do they unlock?
Tl;Dr: — Balancer used to only allow pools on the ends of the trusted vs. trustless spectrum. Either you could make a Public pool and have all possible pool parameters permanently fixed, or you could make a Private pool and have every parameter unlocked (but then no one else is allowed to provide liquidity due to risks).
Balancer Smart Pools unlock access to the middle-ground between these two extremes. And there’s endless potential for them 🚀
Part 2 - Illuminating the New Landscape
Balancer Smart Pools enable a new world for Balancer Pool Construction. Instead of having fixed pool parameters, we now have variable parameters.
The 6 variables are:
- Change Tokens
- Change Weights
- Change Swap Fee
- Limit LPs
- Limit Max Deposited Value
- Start/Stop Trading
Some of these variables are more significant than others, but really its up to your imagination on how you can leverage them to produce a Balancer Pool suited to your needs.
We also discuss possible examples as well as how some people have already leveraged Balancer Smart Pools.
Part 3 - Using a Balancer Smart Pool to Re-Launch BAP0
For those that remember, we issued 50 BAP0 tokens that are redeemable for these crazy awesome tee shirts:
We put the tokens on Uniswap and sold 16 of them…then the price got too high! We ran into a dead-end: people wanted to purchase BAP0s so they could get their hands on a tee-shirt, but Uniswap’s rigid curve priced the tokens too high.
In the end, we weren’t able to get the tokens distributed to the people that wanted them! Now, we’ve migrated the remaining 34 tokens to a Balancer Liquidity Bootstrapping Pool, which is a particular kind of a Balancer Smart Pool. This tactic shows the step-by-step process for how we created the Balancer Pool for the BAP0 tokens, and how you can too!
Let’s dive in 🏊♂️
Part 1: Introducing Balancer Smart Pools
Expanding the Landscape of What Balancer Can Do
Balancer’s Public Pools are generally what people consider ‘Balancer’ to be. Public Pools are pools with fixed parameters. The tokens in Public Balancer Pools are fixed; no other tokens will be added or removed. The swap fee size is fixed as the fee amount will never change. The weights of each token is fixed as the pool will never change the targeted balances in the pool.
All other possible rights to a Balancer are stripped from these pools:
- Capping total value deposited into the pool
- Limiting who is approved to be an LP
- Pausing/Enabling swapping (can you guys please stop trading?)
Public, or ‘finalized’ pools need to have these capabilities removed, as an anti-rug pull mechanism. Every feature of a balancer pool that could enable a possible rug pull on the pool is completely stripped in Public Pools.
Private, or ‘unfinalized’ have every possible parameter up to the controller of the pool. Because these pools are completely trusted, adding liquidity to these pools is restricted to just the pool owner, as adding liquidity to these would make one susceptible to one of many rug-pull attacks from the pool creator.
These two pool types represent opposite ends of the trust spectrum:
But what about an area in between the completely trusted and completely trustless Balancer Pools?
Ethereum is powerful because it enables the full expression of all possible trust models. There are likely local ‘peaks’ of value across this spectrum, and being able to access different levels of trusted/trustlessness allows us to discover more value-peaks than what would be found at either end of the spectrum.
Additionally, Ethereum offers the ability to find peaks of value along the trust-spectrum, and move them closer to the trustless end of the spectrum. According to the Protocol Sink Thesis, value-peaks should be higher at the trustless-end of the spectrum.
This is why the Balancer team created Balancer Smart Pools — liquidity pool that can pick and chose the parameters that they want to retain flexible control over, while also relegating control over these parameters to the trustless money-robots.
Balancer Smart Pools
First, let’s go through some of the parameters that a Balancer Smart Pool has:
Balancer Smart Pools can add or remove tokens, even after deployment of the Pool.
Balancer Smart Pools can change the weights of pools, even after deployment of the Pool
The Swap Fee for a Balancer Smart Pool can be set-and-forget, but the fee can also be set to be changeable by the pool controller. With this parameter, the pool controller can setSwapFee and change the swap fee for a particular pool.
What’s interesting to me is if someone sets the pool controller to a wrapper contract, which makes setSwapFee controlled by a robot instead of a human. For example, a contract could consume data from various oracles, or other inputs, and output a new value which changes the Swap Fee for a Balancer Pool!
Balancer Smart Pools could assign swap fees that match the environment of the market at that time!
A Balancer Smart Pool can elect to limit who is able to provide liquidity to it. Initially, a Balancer Smart Pool with the ‘Limit LPs’ option enabled will allow the controller of the pool (who ever minted the pool) to ‘whitelist’ which Ethereum addresses are able to add liquidity to a pool. However, similar to ‘Swap Fee’, this can be constructed to behave according to any logic that an external contract feeds it.
For example, the pool could limit who can be an LP according to addresses that hold a specific POAP token or who holds a Bankless Badge. Or maybe it allows LPs to contribute an amount of capital based on their pro-rata ownership of a specified ERC20 token.
A Balancer Smart Pool can cap the value deposited into the pool and change that cap based on any parameters.
Smart Pools are ‘smart’ because their internal operating functions are able to be defined by external contracts (which, according to the Protocol Sink Thesis, should be robots although they could also be human, centralized actors).
In other words, you could have a Balancer Pool set any possible parameters according to any code that you’re able to deploy to an external contract.
This is how a Balancer Smart Pool can retain trustlessness, but still have access to complete flexibility in the expression of its possible parameters.
Use Cases for Smart Pools
A simple theoretical use-case for a Balancer Smart-Pool is ‘Surge-Pricing’.
If you have ever taken an Uber in a downtown area on a Friday night (obviously pre-COVID), you have likely experienced Surge Pricing. The Uber app notifies you that there is high demand for Uber drivers, and therefore you are going to be charged 2.5x the normal fare!
Uber then rewards drivers above and beyond their typical compensation for driving riders in their area.
This is Uber simply trying to keep its marketplace balanced between Suppliers and Demanders. During 8-12pm on Friday and Saturday nights, it’s regularly atypical market environments for ridesharing apps. Surge Pricing allows for the market to remain flexible so that enough supply can be generated for sufficient demand.
A Balancer Smart Pool can recreate this environment by leveraging external logic to control the fee for its pool!
When a Balancer Smart Pool finds itself under a high-volume environment, the Swap Fee parameter for this pool can be manipulated to the benefit of both buyers and sellers.
Let’s say a Balancer Pool suddenly finds itself under load from a high volume of traders, pushing a lot of trade volume through a pool. Using an external oracle to gain knowledge about the volume flowing through the pool, the pool could increase (or decrease) the Swap Fee.
As the volume in a pool increases, the Swap Fee can be adjusted upwards to reflect the increased demand for the pool. This, in turn, can attract more capital to come into the pool, in order to access the increased fees being pushed through the pool.
This perfectly reflects surge pricing with Uber drivers: Increase rewards for the supply-side in order to meet the spike in demand from the demand siders. The increased Swap Fee is crucial to create the incentive for further liquidity to be made available to the takers of such liquidity.
A number of tokens leveraged Uniswap for their initial liquidity.
Unfortunately, Uniswap’s x*y=k approach to token pricing means that very little total volume can produce insanely wild swings in token pricing. This creates both irrational price-discovery while also operating as a poor token distribution mechanism as the price of a newly minted token will go too high before all of the tokens can be put into the hands of interested owners (what we found with the initial BAP-00 distribution).
Tokens are often a coordination and governance tool. And Uniswap, with its very fixed algorithm for token pricing, is a very blunt tool for getting tokens into the hands of the people who are interested in owning them!
Balancer Public Pools don’t fix this either because the token pricing mechanism is just as fixed as Uniswap.
Balancer Smart Pools on the other hand has the ability to price and distribute tokens, via what is called a ‘Liquidity Bootstrapping Pool’.
Because of how token-dominant Ethereum has become, I expect these Liquidity Bootstrapping Pools to be an extremely handy tool in the Money Lego toolbelt!
The Liquidity-Bootstrapping Pool focuses on the Token Weights parameter of a Balancer Pool. Using the above illustration as an example Pool, this Pool begins with an 80/20 weight of Project Token and DAI.
Over time according to the rules of the Balancer Smart Pool, the weights between these two tokens change. The Project Token’s weight gets reduced while DAI weight increases. This is effectively generating a Dutch Auction, where the price of an item starts high and reduces over time. Once it gets low enough, the buyers start to step in and buy up what’s being auctioned.
The Balancer Smart Pool that follows a Liquidity Bootstrapped weight-changing program is like combining a Dutch Action with an AMM pricing model. As the price quoted by the Balancer ‘Dutch Action’ ticks lower and lower because the weights are being adjusted by the Smart Pool, a buyer may decide to step in and purchase some of the tokens. Since this changes the balance of the tokens in the AMM, the price of the token increases, but it continues to tick downwards over time.
This process continues until all tokens are sold, and the token is effectively distributed. This mechanism was field-tested already with Perpetual Protocol and it was a great success!
Perpetual Protocol was the first project to try this. I’ve borrowed some graphics from their blog post, and added some commentary.
Here’s the weight-change schedule.
PERP began at 90% of the pool, with USDC as 10%. The token-distribution event took place over 72 hours, in which at the end the weights would be at 30% PERP and 70% USDC.
Here’s what the pricing curve for PERP would be, according to the changing weights of the Balancer Smart Pool if no buyers decided to step in to buy a token. This is the projected Dutch Auction price curve if the pool were to be untouched.
But in practice, the price chart of the PERP token looked like this DURING the sale:
As you can see, buyers stepped in to purchase PERP at all different phases of the weight-change time period (72 hours)
If we assume that one address = one person (usually a bad assumption, but here I think it’s okay) the PERP token is INSANELY well distributed:
Part 2: Building a Balancer Smart Pool
You can construct your own Balancer Smart Pool with this link.
⚠️ Warning: Balancer Smart Pools are in BETA!!
Make sure you have ‘Smart’ selected at the top center of the page.
Using this UI, we’re going to deploy a Balancer Liquidity Bootstrapping Pool for the BAP0 tokens. If you remember, we have 50 insanely awesome tee shirts, along with 50 BAP0 tokens that we initially seeded on Uniswap.
Because of how Uniswap works, we were only able to distribute 16 tokens before the price became exorbitantly high!
A Balancer LBP is a perfect solution for those who want to get tokens into the hands of users, without being limited by a rapidly increasing price curve. It does this by changing the weights of tokens slowly over time, to ensure that the price never remains too high for people to participate.
As time goes on, the Balancer Pool increases the weight of DAI (or the money-token being used) and decreases the weight of BAP0 (or the token being issued/sold). This makes the token being sold become cheaper over time (unless people start buying the tokens faster than the price decreases).
When accessing the UI for minting a Balancer Smart Pool, this will be the first thing you see:
You can add any token by finding it from the dropdown menu that appears when you click add token, or by pasting in the contract address in the same place.
Here we pasted in the address to BAP0, and Balancer automatically found the token. Hit Enter!
So now we’ve replaced USDC with the BAP0 token. We are supplying 34.37 of them, because that’s how many we have unsold from the initial Uniswap sale.
Now that we have our tokens selected, the next step is to set the Weight, and the number of tokens that you supply to the pool.
You will also need to unlock any not-yet-unlocked-tokens to interact with the Balancer deployer.
In order to determine the appropriate weights and amounts of tokens we need to supply, we used this simulator!
This spreadsheet model reflects the Balancer Smart Pool we’re using in this tactic. TKN = BAP0 and USDC is actually DAI, but other than that, it’s all the same!
It will help you determine the resulting initial/end prices of tokens, given the variables that you choose to input. There is also a video included in this document that gives you a walkthrough of how to use it!
We wanted the BAP0 token to initially be priced at the highest price it reached during the Uniswap sale, which was ~1,200 DAI. There’s a part of the simulator that informs you of the balances that you need to input, in order to achieve the desired parameters. It looks intimidating at first, but things begin to click as you play around with it (and watch the tutorial video)
Based on our desired parameters, we are setting weights to the following:
- DAI - 10%
- BAP0 - 90%
You can even go as skewed as 2/98 if you want a pool that is really disparate in token balances, but we’ve decided that a 10/90 ratio of DAI to BAP0 is appropriate for our goal. This is setting the initial state of our Balancer Pool. We will set the changes to be made later.
Above are the remaining parameters that need to be filled out:
- Swap Fee: how much the Balancer Pool charges for swapping (0.15% is default)
- Token Symbol: The ticker of the LP token that results from the pool
- Token Name: The name of the LP token that results from the pool
(Symbol and Name are arbitrary; they can be anything)
- Initial Supply: The number of tokens that are minted as Liquidity Providing tokens. This is arbitrary, it can also be any number.
- Rights: Here’s where we determine what kind of smart pool we want to make! We are focusing on one type of smart pool: one that changes weights over time. We don’t want any other features that are unnecessary to achieving our goals! We unchecked everything that’s unnecessary in order to reduce the attack surface area of our Balancer pool.
- Minimum Gradual Update Duration: this determines how often the Balancer Pool can update the quoted price, as a result of the changing weights. It’s not a super important variable, just know that the Balancer Pool can’t change weights faster than the # of blocks inputted here. Leave it at 10 if you don’t have a reason for changing it.
Okay! Here’s the final state of the BAP0 Balancer Pool. I’m going to hit Create!
Here’s the transaction that minted this Balancer Pool:
You’ll be redirected to a new Balancer Pool page which will be populated with some of the parameters that you inputted into your pool.
Notice how this pool has over $40,000 worth of liquidity even though we only supplied $4,000 DAI! This is one of the main points of the Liquidity Bootstrapping version of a Balancer Smart Pool — lots of liquidity for not a lot of capital!
But we’re not done! We need to tell our Balancer Pool how we want it to change weights over time. Here’s what we inputted into our pool:
- Start: 10%
- End: 90%
- Start: 90
- End: 10
Our end block is 11338588, which comes out to ~30 days worth of blocks from now. You can calculate this in the simulator.
Once you process the transaction (this screenshot was taken after I approved the transaction, hence the spinning wheel next to the cancel button), the changing-weights will be implemented!
You can view the BAP0 Smart Pool here.
In the ‘about’ section, you will see the some of the parameters we’ve included in our pool:
Accessing the Pool
Okay, our Pool is finalized and should be live! Lets go to the Balancer front-end and see if we can find our token!
Lets go to the Balancer Exchange and try and find BAP0
If we click on ‘Token to Buy’, and paste in the BAP0 token address: 0x705C71b262C511B66bAA4791cC2BE61B971bD784
And it should show up! The BAP0 Logo should populate in a few days.
We can see that 1 BAP0 costs ~1220 DAI, which is roughly close to what the simulator above predicted.
But wait! Remember how the BAP0 prices goes down over time (unless people buy, which then it goes back up)? We actually need to do something to make that happen.
Going back to the pool manager link here.
…we see an actions tab. The action we need to take is to ‘PokeWeight’. The price that is quoted on the Balancer front end needs to be ‘updated’ in order to reflect the changing weights. The state of the contracts on Ethereum don’t update every block! Someone (anyone!) can update the state of a Balancer Smart Pool by ‘poking’ the weights of that pool.
Simply hit the button, process the transaction (should be very cheap, but gets more expensive with pools that have more tokens), and then the weights will update!
Now you can go back to the Balancer front end, and the token price will likely be cheaper than it was before (or just different, depending on the pool).
In this Tactic, you learned:
- The variables that are possible to change in a Balancer Smart Pool
- How to mint a Balancer Smart Pool that changes weights over time
- How to purchase a BAP0 from a Balancer Smart Pool, but first how to poke the weights to change the price!
If you want a BAP0 ETHSCAPE tee shirts you can purchase it below.
But remember to poke the weights first to get an updated price! The BAP0s should get cheaper and cheaper over the next 30 days as they approach $0—unless people buy them faster than the price decreases.
- Explore the potential of Balancer’s Smart Pools
- Try creating your own Smart Pool
- Participate in the BAP0 Relaunch!
🙏Thanks to our sponsor
Zerion is the easiest way to manage your DeFi portfolio. Explore market trends, invest in 170+ tokens, view returns across wallets and see your full transaction history on one sleek interface. They’re also fully bankless, which means they don’t own your private keys and can’t ever access your funds. I use this app daily! Start exploring DeFi with Zerion on web, iOS or Android. 🔥
P.S. Don’t forget to get check out Zerion’s new Uniswap integration. 🦄]
Not financial or tax advice. This newsletter is strictly educational and is not investment advice or a solicitation to buy or sell any assets or to make any financial decisions. This newsletter is not tax advice. Talk to your accountant. Do your own research.
Disclosure. From time-to-time I may add links in this newsletter to products I use. I may receive commission if you make a purchase through one of these links. I’ll always disclose when this is the case.