1B+ transactions on IDX ecosystem
IDX community
Home
Add Liquidity
Raydium CPMM

Add Liquidity on Raydium (Solana DeFi)

Enter your Raydium CPMM liquidity pool address to securely add liquidity positions and expand token workflows on Solana. You can add liquidity to your token pools and remove liquidity later to receive your tokens back when you want to exit or rebalance.

This tool calculates the required pair ratio automatically using current pool pricing. You must provide both assets proportionally to add liquidity successfully.

01

How to Add Liquidity on Raydium

Adding liquidity on Raydium means depositing both tokens of a pair (for example, TOKEN/SOL) into a Solana liquidity pool. In return, you receive LP tokens representing your share.

Follow these steps to add liquidity using IDX Tools on Raydium:

01

Enter Pool Address

Enter your Raydium CPMM liquidity pool address to securely add liquidity pool positions.

02

Set Deposit Amounts

Choose the deposit amount for the Base Token and Quote Token.

03

Add Liquidity

Click Add Liquidity to submit your deposit and complete the transaction.

If you want to add liquidity to your token pool safely, this flow helps you:

  • -Higher liquidity reduces slippage and improves trading efficiency.
  • -Deeper pools make your token pair more attractive to traders and investors.
  • -Consistent liquidity helps market continuity and healthier price discovery.

Adding liquidity through IDX AutoBot typically costs about 0.1 SOL. You can add liquidity to any existing Raydium CPMM pair, even if you did not create it.

02

Manage Your Liquidity Position (LP Tokens)

LP tokens represent your ownership share of the liquidity pool. Keep them secure, because they are required to remove liquidity later. When you remove liquidity, LP tokens are burned and the underlying assets are returned based on your pool share.

03

Code Example

addLiquidity helper

export async function addLiquidity(
  connection, raydium, userWallet, poolStateFromUI, userInput, options = {}
) {
  const { slippageBps = DEFAULT_SLIPPAGE_BPS, ...txOptions } = options;

  const poolRatio = calculatePoolRatio(poolStateFromUI);
  const parsed    = parseUserInput(userInput, poolStateFromUI);

  let finalAmountARaw   = parsed.amountARaw;
  let finalAmountBRaw   = parsed.amountBRaw;
  let finalAmountAHuman = parsed.amountAHuman;
  let finalAmountBHuman = parsed.amountBHuman;

  if (parsed.inputSide === "A") {
    const c = computeRequiredPairAmount(parsed.amountARaw, "A", poolStateFromUI);
    finalAmountBRaw = c.requiredAmountRaw; finalAmountBHuman = c.requiredAmountHuman;
  } else if (parsed.inputSide === "B") {
    const c = computeRequiredPairAmount(parsed.amountBRaw, "B", poolStateFromUI);
    finalAmountARaw = c.requiredAmountRaw; finalAmountAHuman = c.requiredAmountHuman;
  }

  const withSlippage = applySlippage(finalAmountARaw, finalAmountBRaw, slippageBps);

  const result = await buildAddLiquidityTransaction(
    connection, raydium, userWallet, poolStateFromUI, withSlippage, txOptions
  );

  return {
    setupTx:                   result.setupTx,
    depositTx:                 result.depositTx,
    setupBlockhash:            result.setupBlockhash,
    setupLastValidBlockHeight: result.setupLastValidBlockHeight,
    depositBlockhash:          result.depositBlockhash,
    lastValidBlockHeight:      result.lastValidBlockHeight,
    transaction:          result.depositTx,
    blockhash:            result.depositBlockhash,
    userAtaA:             result.userAtaA,
    userAtaB:             result.userAtaB,
    userAtaLP:            result.userAtaLP,
    missingAtaCount:      result.missingAtaCount,
    costBreakdown:        result.costBreakdown,
    quote: {
      amountAHuman: finalAmountAHuman, amountBHuman: finalAmountBHuman,
      amountARaw: finalAmountARaw, amountBRaw: finalAmountBRaw,
      minAmountARaw: withSlippage.minAmountARaw, minAmountBRaw: withSlippage.minAmountBRaw,
      slippagePct: withSlippage.slippagePct,
    },
    poolRatio,
  };
}
04

What does it mean to provide liquidity for a Solana token?

A liquidity pool pairs your token with a quote asset such as SOL, USDC, or USDT.

Adding liquidity can reduce volatility, because larger pooled reserves absorb trades better.

If one side of the pair is depleted, trading becomes inefficient or impossible until liquidity is restored.

Raydium is one of the most widely used CPMM liquidity providers on Solana.

Adding liquidity on Raydium is one of the most common Solana approaches and involves depositing a token pair into a smart contract to enable swaps between those assets.

Proceed to Add Liquidity

Open the tool to add liquidity to an existing Raydium CPMM pool.

Open Tool →