LBP Migration Router API

The LBP Migration Router can be used to interact with Balancer onchain via state changing operations or used to query operations in an off-chain context.

Specialized router for migrating liquidity from a Liquidity Bootstrapping Pool (LBP) to a new Weighted Pool with custom parameters. Note that migration is optional, and unsupported for some LBP types (e.g., FixedPrice).

Use Case: After an LBP concludes, the pool owner can migrate remaining liquidity to a standard weighted pool with the desired final weights and configuration.

State-changing functions

migrateLiquidity

function migrateLiquidity(
    ILBPool lbp,
    address excessReceiver,
    WeightedPoolParams memory params
) external returns (
    IWeightedPool weightedPool,
    uint256[] memory exactAmountsIn,
    uint256 bptAmountOut
);

Migrates liquidity from an LBP to a newly created weighted pool with custom parameters.

Requirements:

  • Caller must be the LBP owner
  • LBP must have specified this router address on deployment

Process:

  1. Validates caller is LBP owner
  2. Creates new weighted pool with specified parameters
  3. Exits all liquidity from the LBP
  4. Initializes the new weighted pool with the exited tokens
  5. Sends any excess tokens to excessReceiver
  6. Returns new pool address and migration details

Parameters:

NameTypeDescription
lbpILBPoolAddress of the Liquidity Bootstrapping Pool to migrate
excessReceiveraddressAddress to receive any excess tokens after migration
paramsWeightedPoolParamsConfiguration for the new weighted pool

Returns:

NameTypeDescription
weightedPoolIWeightedPoolAddress of the newly created weighted pool
exactAmountsInuint256[] memoryAmounts used to initialize the pool, sorted in token registration order
bptAmountOutuint256BPT received from the new pool

Events:

event PoolMigrated(
    ILBPool indexed lbp,
    IWeightedPool weightedPool,
    uint256[] exactAmountsIn,
    uint256 bptAmountOut
);

Emitted when a pool is successfully migrated from an LBP to a new weighted pool.

Queries

queryMigrateLiquidity

function queryMigrateLiquidity(
    ILBPool lbp,
    address sender,
    address excessReceiver,
    WeightedPoolParams memory params
) external returns (
    uint256[] memory exactAmountsIn,
    uint256 bptAmountOut
);

Simulates a liquidity migration to estimate results before execution.

Parameters:

NameTypeDescription
lbpILBPoolLiquidity Bootstrapping Pool
senderaddressSender address
excessReceiveraddressAddress to receive any excess tokens after migration
paramsWeightedPoolParamsParameters for creating the new weighted pool

Returns:

NameTypeDescription
exactAmountsInuint256[] memoryThe amounts of tokens used to initialize the pool, sorted in token registration order
bptAmountOutuint256The amount of BPT tokens received from the weighted pool after migration

Data Structures

WeightedPoolParams

struct WeightedPoolParams {
    string name;
    string symbol;
    PoolRoleAccounts roleAccounts;     // Pool admin roles
    uint256 swapFeePercentage;
    address poolHooksContract;
    bool enableDonation;
    bool disableUnbalancedLiquidity;
    bytes32 salt;                      // For deterministic address
}

Configuration parameters for creating a new weighted pool.

Fields:

NameTypeDescription
namestringName of the new weighted pool
symbolstringSymbol of the new weighted pool
roleAccountsPoolRoleAccountsPool admin roles (pause manager, swap fee manager, pool creator)
swapFeePercentageuint256Swap fee percentage for the new pool
poolHooksContractaddressAddress of the pool hooks contract (optional)
enableDonationboolWhether to enable donation functionality
disableUnbalancedLiquidityboolWhether to disable unbalanced liquidity operations
saltbytes32Salt for deterministic address generation (CREATE2)