Coffer Docs
For Liquidity Providers

Adding Liquidity

Choose a deposit method, review your share, and calculate the tokens used

Adding liquidity exchanges tokens for LP tokens representing your share of a pool. You join its current reserve basket, which can differ from its original composition and pricing weights.

Choose a deposit method

Proportional deposit: contribute in the proportions of the pool's current LP-owned reserves. If it holds 100 A and 200 B, a 10% contribution is 10 A and 20 B. Use reserves, not configured weights, to size this basket.

Single-token deposit: contribute one pool token. The helper swaps part into the other required assets, then deposits proportionally. Those swaps have fees and price impact. This method requires an available helper and an already seeded pool. See Single-token Deposit for the integration.

Your share after depositing

If the pool has 1,000 LP tokens and you add 10% of its reserves, you receive approximately 100 LP tokens. Your share afterward is 100 / 1,100 ≈ 9.09% of the enlarged pool.

Protection and availability

Review the expected spend and minimum LP tokens before signing. minimum_bpt_amount sets the LP tokens you accept: a result below it fails the transaction atomically. Use a fresh quote and a meaningful nonzero minimum.

Proportional deposits require pool_enabled = true; a trading pause alone does not block them. Single-token deposits also need swaps to be permitted and must fit sell-off limits and available output reserves.

Use the deposit flow. A direct transfer to a vault does not automatically credit pool accounting or mint LP tokens. Only the stored pool admin can make the first deposit; see Pool Creation.

How a proportional deposit is calculated

After seeding, deposits use reserve and LP-supply ratios; no invariant is calculated. Let A_i be LP-owned actual balance, N_i your maximum input after any token transfer fee, V_i virtual balance, and S LP token supply. With fixed-point scale Q = 10^18, for positive-reserve tokens:

r = min(floor(N_i × Q / A_i)) over tokens with A_i > 0
lp_tokens_minted = floor(S × r / Q)
credited_to_pool_i = ceil(A_i × r / Q)
new_virtual_i = V_i + ceil(V_i × credited_to_pool_i / A_i)

Inputs are spend ceilings. With maximums of 10 A and 30 B in the example, the pool takes approximately 10 A and 20 B; the rest stays in your wallet. LP issuance rounds down; reserve credits round up. Token transfer fees, if present, are added to the required net credit to determine your gross spend. A deposit that rounds to zero LP tokens is rejected.

actual_balance already excludes protocol_fees_owed; do not subtract it again. Every positive-reserve slot needs a positive maximum input. A zero-reserve slot requires zero input: a proportional deposit cannot replenish it, although an accepted swap selling that token can. Its virtual balance instead scales with LP supply: V_i + ceil(V_i × lp_tokens_minted / S).

Actual and virtual balances grow proportionally, approximately preserving pricing ratios and concentration factors. Integrators must use matching instruction accounts and program versions.

The first deposit is different: it currently derives initial LP supply from virtual balances using a weighted invariant. Creator-selected initial LP supply is a planned feature.

On this page