Add Liquidity Guide

Balancer v3 supports several different types of add liquidity operationsopen in new window

Core Concepts

The core concepts of adding liquidity are the same for any programming language or framework:

  • The sender must do a permit2 approval with the Router as the spender for each token
  • Token amount inputs/outputs are always in the raw token scale, e.g. 1 USDC should be sent as 1000000 because it has 6 decimals
  • If a pool's tokens include an ERC4626 with an initialized buffer, you have the option to add liquidity using the asset() of the ERC4626, which we refer to as the "underlying" token.
  • Transactions are always sent to the appropriate Router
    • Use the standard Router to add liquidity with pool tokens
    • Use the CompositeLiquidityRouter to add liquidity with a pool's underlying tokens
  • In exchange for providing liquidity the sender will receive Balancer Pool Tokens (BPTs) which represents their share of the pool and can be used to remove liquidity at any time

Example Scripts

Run any of the scripts listed below against a local fork of Ethereum mainnet using the v3 pool operation examples repoopen in new window

TypeScript SDK

Solidity

Beginner Tutorials