Add Liquidity Guide
Balancer v3 supports several different types of add liquidity operations
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 as1000000
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
- Use the standard
- 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 repo
TypeScript SDK
- addLiquidityUnbalanced.ts
- addLiquidityProportional.ts
- addLiquidityUnbalancedToERC4626.ts
- addLiquidityProportionalToERC4626.ts
Solidity
- AddLiquidityUnbalanced.s.sol
- AddLiquidityProportional.s.sol
- AddLiquidityUnbalancedToERC4626.s.sol
- AddLiquidityProportionalToERC4626.s.sol