Cover photo

TheCarbonSwap 🌱: Week 6 @ ETHIndia Fellowship

Week 6 is here!

With week 6 on the go, and my custom Balancer Composable Stable Pool deployed, it’s time to start testing out the possibilities of Balancer Pools. During this week, I learnt more about swaps, including Batch Swaps and Single Swaps.

As the names imply, a Single Swap is used when only trading 2 tokens against a single pool. And Batch Swap, the more commonly used one, allows for multiple hops, paths, and pools. This differentiation allows for the Single Swap to be even more gas optimized and can be as low as 95k for a swap. I went through the docs to understand how to do a Batch Swap using the balancer-sdk.

I was able to run a script that swaps tokens within a pool, using the SDK. Initially, I had used an Alchemy node for RPC, but the next day the RPC calls were not getting reflected on-chain, which really messed with me, as I thought I had messed something up in my scripts.

screenshot of TS script swapping assets on the Pool.
screenshot of TS script swapping assets on the Pool.

Eventually, after talking with Sarang (my mentor for EIF3.0) I tried changing the RPC provider to Infura, which got things back to working well. This could’ve been caused been the reduced support now given to Goerli as it is getting deprecated at the end of year.

I had thought of redoing the entire project on Sepolia, but the time taken for the initial setup could be much more than I’d like for now. So I’m sticking with Goerli temporarily for the duration of the fellowship, and may redo on Sepolia as and when time allows.

Next Steps

Now that I’ve figured out swapping, it’s now time to start working on writing my custom contracts for joining the pool and maintaining protocol-owned-liquidity. That will be my task for next week.