Alchemix Balancer Migrator Tool

Alchemix Finance
4 min readJun 27, 2023

--

Alchemix and Balancer logos

Alchemix has developed a liquidity migration tool designed to facilitate the seamless transition of liquidity from any Sushiswap or Uniswap v2 liquidity pool to a corresponding 50/50 or 80/20 Balancer pool, while also staking the LP tokens in Aura. Instead of creating a one-time-use solution or a tool that needs to be redeployed for each migration, Alchemix has created a general-purpose deployment that supports the migration of any Sushiswap/Uniswap v2 LP to a Balancer LP. This approach allows projects to leverage existing live contracts, eliminating the need for additional deployments.

For end users, this tool offers a seamless experience to migrate their existing liquidity position into a new composition and platform, reducing the numerous steps into a single click.

Migration tool UI

To date, more than $400k in liquidity has migrated from the 50/50 ALCX/ETH Sushiswap pool to the 80/20 ALCX/ETH Balancer pool using the migration tool.

Contract details

  • The Alchemix solution includes validation features that can be used to query corresponding liquidity pools for existing Balancer pools, thereby streamlining the migration process. In the contract, users will find validation around any contract with which the migrator interacts. This is to ensure security.
  • Works for migrations to ve-systems (e.g. 50/50 Sushi pool to an 80/20 Balancer pool) as well as normal pool migrations (i.e. 50/50 to 50/50). Note: the tool only works with liquidity pairs against ETH/wETH.
  • Additionally, the tool supports automatic staking into Aura, if they exist, and if users opt to do so. Of note, the migration tool is not dependent on an Aura pool existing.
  • A single transaction to migrate pools and stake the LP tokens offers a better user experience vs. doing multiple transactions on different websites/apps. Since operations and data is shared across the contract it also will result in a lower average gas spend.
  • To prevent price manipulation during migration, the contract is designed in a way that enables off-chain or separate calculations. To enhance the migration and developer experience, Alchemix has created a companion calculator contract that can be used to query the on-chain data necessary to facilitate migrations for any Sushiswap/Uniswap V2 and Balancer LP tokens.

OKcontract UI

While the migration tool is live on Alchemix UI for the Sushi to Balancer migration (link: https://alchemixfi.medium.com/lp-migration-guide-3534eef91ebc), Alchemix has also teamed up with OKcontract to develop a generalized UI to make using this migration tool even easier for other protocols and end users.

OKcontract has created a multi-step widget (https://medium.com/@okcontract/multi-step-widgets-teaming-up-with-alchemix-to-streamline-liquidity-migration-bca0a2d1cd2d) for Alchemix to facilitate this liquidity migration process. The widget has three steps:

Step 1: Users need to withdraw their liquidity from the deprecated Sushi pool.

OKcontract displays the total SLP tokens amount and notifies users that they will claim unclaimed reward tokens while withdrawing. By clicking on the Withdraw button, users initiate the first transaction: OKcontract calls the Sushi staking contract to withdraw and harvest SLP tokens from the Sushi pool. It also claims any outstanding rewards from the farming contract.

Step 2: Users need to approve the Alchemix Migrator contract for spending X amount of LP tokens.

OKcontract displays the amount of available SLP tokens, a slider to choose the amount and option to choose if they want to stake tokens in BTP pool. The Approve button initiates the second transaction: OKcontract calls the migration contract MigrationCalcs.getMigrationParams() to get the struct Alchemix passes into the migrate function.

Step 3: Migrate funds to Balancer

Once approval is over, the Migrate button allows users to initiate the last transaction: OKcontract calls Migrator.migrate() passing in the struct returned in the previous step.

Contracts and Repository

The deployed contract can be used by projects to perform complete migrations from Sushiswap to Balancer. Migrating from other DEXes to Balancer, like Uniswap v2, is possible but will require a new deployment of the below contracts (code is the same for Sushiswap and Uniswap v2, but the addresses are different).

The tool can either be used on Etherscan, through the OKcontract UI, or a white-labeled UI can be developed for end users. All the required deployment ABI code is provided in Alchemix’s open-source repository. In the repository, users will also find extensive documentation and tooling throughout, providing clear instructions and insight into how the Migration tool and calculator have been architected.

Alchemix’s repository includes comprehensive Foundry fuzz testing and has undergone extensive internal security reviews, ensuring high quality and reliability of the codebase for adoption across the ecosystem. The attack surface is also minimized due to the fact that the migrator contract can never hold any user funds. Please note that the code has not undergone a third party audit.

The developers at Alchemix are excited to provide this tool to Alchemix’s liquidity providers, and to see its adoption as more projects embrace 80/20 Balancer pools.

Links

Repository: https://github.com/alchemix-finance/migrate2balancer

OKcontract widget (Sushi -> Balancer): https://okcontract.com/w/view/4APh79oIJVDqQw2CtwCC

Migrator (Sushi -> Balancer): https://etherscan.io/address/0xa311f930f603567d656b3992d36e4cc384d85c5d

Calculator (Sushi -> Balancer): https://etherscan.io/address/0xe7ad39d1891100c734ee78a777a0aa99aacd12da

--

--

No responses yet