How to Use Balancer - Token Swaps & Pool Management [Detailed Tutorial]

How to Use Balancer - Token Swaps & Pool Management [Detailed Tutorial]

By D3F1 | DeFi Box | 14 Jul 2020

In this Tutorial, I want to provide a very intricate understanding of how to use the entire Balancer platform.

Balancer is the recent DeFi player in the Automated Market Maker (AMM) category. 

Balancer is slightly different from your typical AMMs as it is a non-custodial automated portfolio manager. It allows anybody to come and provide liquidity to existing liquidity pools or even create one themselves (we will do both today!).

The unique thing about Balancer is the fact that you can create liquidity pools made up of 2 to 8 tokens (Unlike Uniswap, where a 50%/50% token ratio needs to be maintained. The technology behind Balancer ensures that the set percentage values of each token stick to the assigned weight by trading them between each other.

By the end of this tutorial, I hope you will be able to conduct a token swap on the Balancer Exchange, add liquidity to an existing shared pool, and set your very own shared liquidity pool up.

Your First Token Swap on Balancer Exchange

The absolute first thing that you must do is install either MetaMask (or WalletConnect) to use as a wallet during this entire process. I will be using MetaMask and will be starting with 1.2 ETH;


Next, we head over to the Balancer Exchange platform homepage and connect our MetaMask (or WalletConnect) to the platform. Go ahead and click “connect wallet”’;


You will see the following screen to connect your wallet;


I am using MetaMask in this post, but I am pretty sure that WalletConnect should work just as well. 

You will know that you have successfully connected your wallet if you see something like this in the top right-hand corner;


So, the entire idea of this part of my post is to show you how to actually make your first token swap. 

Let’s go ahead and do that right now. 

On the homepage for the Balancer.Exchange, you should see this following box;


This is the section where you can convert tokens between each other through the Balancer protocol. The left-hand box is the token that I currently possess and would like to sell whilst the right-hand box shows the token that I am looking to buy.

Let’s start by buying some DAI. To buy the DAI I will be selling ETH and, therefore, select ETH as the token to sell and DAI as the token to buy. You can see that I have entered .12 ETH which gives us a total of 27.58 DAI in exchange.

Right now, the exchange rate for 1 ETH is around 230 DAI. So for 30 DAI, a total of 0.13 ETH is required;


Let’s go ahead and hit swap to conduct the swap.


After clicking swap, another window with your MetaMask wallet should pop up;


You can see that the GAS fee is quite high right now at $1.84. Don’t worry, it is not typically this high. I am sure that the network was just fairly busy when I was doing the transaction. Furthermore, fees will be significantly lower when Ethereum switches to ETH 2.0.

The total for the DAI with the GAS fee on top comes to $33.76. Go ahead and press confirm. 

After confirming, you will see that the transaction is occurring on the top-right hand side of the Balance Exchange platform screen.


This shows that your transaction is occurring right now on-chain. You can actually head into your MetaMask wallet and see that a transaction has occurred and is waiting for a number of confirmations. It might take a few minutes for this transaction to be confirmed depending on how busy the Ethereum network is at the time but usually it should be done in under a minute.

Once the transaction has been confirmed, you will see the following after clicking your wallet at the top right-hand side of the screen;


Congratulations! You have successfully made your first token swap on Balancer. You can go to your MetaMask wallet and confirm that the 30 DAI that we purchased has actually gone to our wallet;


Joining a Shared Pool

The entire idea of this next section is to join a Shared Pool on the Balancer Protocol. This will allow us to invest in user-created pools that have a custom percentage distribution of value. 

Each balancer Shared Pool can simply be thought of as a self-balancing index fund, only, the liquidity providers are rewarded each time the pool is rebalanced. 

To join up to a Shared Pool we need to head to the Pool management page. You should see the following screen;


Let me break all of this down for you;


a - this lets you switch between Shared and Private pools.

b - this shows you the liquidity you have in shared pools, currently, I have nothing and nor should you.

c - this section allows you to ‘wrap’ ETH. Wrapping ETH is important because it allows WETH to directly communicate inside the smart contract and ERC-20 tokens inside it.

d - this shows you your current holdings.

e - this is a list of all of the different Shared Pools that you can join to. It shows the different Assets that are in the pool, the fee, liquidity (total value in the Shared Pool), and the past 24hr Trade Volume.

For this tutorial, I will be adding to the pool with the second-largest liquidity;


You can see that this pool requires a distribution of 75% MKR and 25% WETH. We can also see other details for this pool such as the fact that the swapping fee is 0.2% and there is over $6.5 million worth of liquidity here. Let us add liquidity to this pool by clicking on it. You should then see the following screen;


This shows the stats for the pool. We can see that there is over $6.5 million worth of liquidity in this pool. Let us g ahead and add some liquidity to this pool. Click “add liquidity”.

You might be directed to the following screen to set up a proxy contract to manage liquidity on Balancer;


Go ahead and click “Setup”. Your MetaMask wallet should open again asking you to confirm a transaction;


We can see that the GAS fee is still quite high. Go ahead and click confirm. You should see another transaction appearing in your MetaMask wallet page to confirm that it is signed and waiting for 10 confirmations;


Once 10 confirmations have passed, you can go ahead and click add liquidity again on the Shared Pool page that we will be adding liquidity to;


You should see the following screen;


It shows the pool overview and the coins that are associated with the Shared Pool. Here, we can see that there is both MKR and WETH and I have neither coins so the first thing I need to do is pick up some MKR and wrap some ETH.

We can see that the split is 75% MKR to 25% ETH. This means that if I was adding $100 worth of liquidity, I would need $75 worth of MKR and $25 worth of WETH. 

You can buy your MKR and wrap your ETH anywhere you wish, but I will go ahead and exchange some ETH for MKR and wrap ETH directly on the Balance platform.

Firstly, I need MKR. I headed back to the Balancer Exchange page and entered 0.28 MKR into the swap section and we can see that it cost a total of 0.6535 ETH;


Go ahead and click swap. A MetaMask window should open again to confirm the transaction from your wallet;


We can see that the total cost for this swap is $154 with $1.60 worth of fees (prices are coming down quickly!).

Once the swap has been completed on-chain, you will see the MKR in your MetaMask wallet. You can see that I have .280 MKR;


Next, it is time to wrap some ETH. We need around 0.22 ETH to get around $50 in WETH. Head over to the pool management page again. In the ETH wrap section of the platform (section c from above) I entered 0.225 ETH to wrap and clicked WRAP;


As always, a MetaMask window appeared asking me to confirm the transaction;


We can see that the total value of the wrap is $52.35 and the cost for the GAS has dropped right down to $0.30. These are the typical fees you can expect when using Ethereum, not the $5 fees we saw before.

If everything has gone correctly, you will see the MKR and the WETH in the “My Wallet” section on the pool management page;


You can see that I have ETH, WETH, DAI, and MKR. 

Time to put the WETH and MKR to good use!

Head back over to the “add liquidity” page on the Shared Pool;


You will notice that you have to unlock both the MKR and WETH wallet. Hit the “unlock” button next to MKR.

You will be presented with another MetaMask confirmation request;


Hit confirm and do the same for the WETH wallet.

Once both transactions have confirmed, you can head back and add liquidity to the shared pool. Simply click the “Max” for the MKR Deposit Amount and it will automatically calculate what the maximum is you can deposit according to your balance;


You can see that I can deposit a total of 0.28 MKR and 0.217 WETH. Go ahead and click “Add Liquidity” and click confirm on the following MetMask notification;


You now must wait for the transaction to be confirmed;


Once this transaction has confirmed, you will see that you will have your corresponding balance on the Shared Pool page;


You will also notice that your WETH and MKR balance has dropped;


Furthermore, you will also see your new corresponding balance in ‘section b’ of the Balancer Pools Management page;


All of this confirms that you have successfully added liquidity to a Shared Pool. 


Removing Liquidity From a Pool 

Now that you know how to add liquidity to a Shared Pool, it’s now time to learn how to actually remove your liquidity from the pool if you ever need it. 

The process is quite simple.

First, just head over to the specific Shared Pool page that you would like to remove liquidity from and click “Remove Liquidity”;


You should see the following screen;


This screen allows you to remove a specific percentage of liquidity from the Shared Pool. You can enter whatever percentage of the total liquidity you have in the pool and hit “remove liquidity” to remove the liquidity from the pool.

In this example, I will remove 75% of the liquidity from the pool. This means that I will be withdrawing a total of 75% from the entire liquidity which is split between MKR and WETH. I enter 75% and hit “Remove Liquidity” and hit confirm on the MetaMask request screen;


After the transaction is confirmed, you will see that the percentage of the liquidity you removed have returned as coins in your MetaMask wallet;


That is all there is to it!

Creating Your Own Liquidity Pool 

Now you know how to swap tokens, add liquidity to a pool, and remove liquidity to a pool it is now time to learn how to set up your own liquidity pool which is what this next section is all about!

This can get quite technical but, overall, it is fairly easy if you follow this tutorial step-by-step.

Head over to the Pools Management page and click “create pool”;


You should see the following screen;


This page allows you to set up your Shared Pool by selecting which tokens you would like in the pool along with their assigned weight and the total swap fee. 

Personally, I’m a big fan of ETH, BAT, and LRC so I will use these three coins in my self balancing pool - with WETH having a weight of 50% and LRC and BAT having 25% each;


You can see above that WETH is weighted at 50% with BAT and LRC weighted at 25% each. After entering .362 EWTH to add to the new liquidity pool it showed that I would need 188 BAT and 470 LRC. I went for the default 0.15% swap fee but you can change this to anything you wish it to be. The higher the swap fee the more earnings you would make from providing liquidity to the pool.

Once your new liquidity pool is set up, go ahead and click create and hit confirm on the confirmation screen of MetaMask. Remember, we are setting up a pool so the gas fee will be particularly high here;


Now, it is time to wait for the transaction with the contract to go through.

Once complete, you can head over to the main Pools Management page and see your newly created Shared Pool in the “My Liquidity” section;


You can click the Pool here and see all of the stats associated with your pool;


Here, you can also add liquidity or remove liquidity in the same manner as explained previously.

That’s all there is to it! You have now created a liquidity pool on the Balancer protocol between ETH, LRC, and BAT (or whatever token you selected).

Shared vs Private Liquidity Pools

Right now, Shared Pools are the only type of liquidity pools you can create on the Balancer Protocol as this feature is still in the Beta stage. However, this does mean that you can go ahead and add some liquidity to the liquidity pool that we just set up!

Become a liquidity provider and head over to the pool to add some liquidity through this link.

You see, eventually there will be types of pools that you can create on Balancer; Shared and Private.

Shared pools have fixed parameters that cannot be changed by anybody once executed. This means that I cannot change the percentage of each of the tokens in my liquidity pool because this would allow me to indirectly steal money from other liquidity providers.

Private pools are exactly how they sound - private. Only the creator of the Private pool can add liquidity to any type of private pool. This means that it is not open to the public and nobody but the owner of the pool can provide liquidity. 

However, private pools also have a feature that is known as smart pools. Smart pools are private pools that are owned by smart contracts that can be used as a gateway to allow liquidity to be added through known conditions. For example, PieDAO BTC++ pool is a project that is a private pool but allows liquidity to enter through their set conditions. The weightings of each coin can easily be changed by PieDAO through the on-chain governance system that they have in place.


Yet another defi fan

DeFi Box
DeFi Box

DeFi world in a nutshell.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.