Skip to main content
Create and manage different types of liquidity pools on Raydium, including AMM V4 (Legacy), Concentrated Liquidity (CLMM), Constant Product (CPMM) pools, and launch tokens using Raydium Launchlab.

Pool Types & Token Launch

1. AMM V4 (Legacy)

  • Requires OpenBook marketID
  • Traditional AMM model
  • Supports standard SPL tokens

2. CLMM (Concentrated Liquidity)

  • Custom liquidity ranges
  • Increased capital efficiency
  • Supports price range specification

3. CPMM (Constant Product)

  • Newest pool type
  • Supports Token-2022 standard
  • No OpenBook market requirement

4. Launchlab Token

  • Token creation platform
  • Built-in token launch capabilities
  • Automatic migration options (AMM/CPMM)
  • Integrated buy functionality

Usage

AMM V4

const signature = await agent.methods.raydiumCreateAmmV4(
  new PublicKey("market-id"),
  new BN(baseAmount),
  new BN(quoteAmount),
  new BN(startTime)
);

CLMM

const signature = await agent.methods.raydiumCreateClmm(
  new PublicKey("mint1"),
  new PublicKey("mint2"),
  new PublicKey("config-id"),
  new Decimal(initialPrice),
  new BN(startTime)
);

CPMM

const signature = await agent.methods.raydiumCreateCpmm(
  new PublicKey("mint1"),
  new PublicKey("mint2"),
  new PublicKey("config-id"),
  new BN(mintAAmount),
  new BN(mintBAmount),
  new BN(startTime)
);

Launchlab Token

const result = await agent.methods.raydiumCreateLaunchlabToken({
  name: "My Token",
  symbol: "MTK",
  decimals: 9,
  supply: 1000000,
  uri: "https://example.com/metadata.json",
  migrateType: "amm",
  buyAmount: new BN(1000000),
  createOnly: false,
  slippageBps: 100
});

Example Prompts

Natural Language Prompts

"Create a Raydium CPMM pool for USDC/SOL pair"

"Setup concentrated liquidity pool with custom ranges"

"Launch AMM V4 pool with OpenBook market integration"

"Initialize CLMM pool with specific initial price"

"Create a new token on Raydium Launchlab with 1M supply"

"Launch token with automatic AMM migration"

"Create launchlab token and buy 0.1 SOL worth immediately"

LangChain Tool Prompts

AMM V4

{
  "marketId": "9xQFzA...",
  "baseAmount": "1000000000",
  "quoteAmount": "1000000000",
  "startTime": "0"
}

CLMM

{
  "mint1": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "mint2": "So11111111111111111111111111111111111111112",
  "configId": "6VxuT...",
  "initialPrice": "24.5",
  "startTime": "0"
}

CPMM

{
  "mint1": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "mint2": "So11111111111111111111111111111111111111112",
  "configId": "5VxuT...",
  "mintAAmount": "1000000000",
  "mintBAmount": "1000000000",
  "startTime": "0"
}

Launchlab Token

{
  "name": "My Awesome Token",
  "symbol": "MAT",
  "decimals": 9,
  "supply": 1000000,
  "uri": "https://example.com/token-metadata.json",
  "migrateType": "amm",
  "buyAmount": 1000000,
  "createOnly": false,
  "slippageBps": 100
}

Pool-Specific Details

AMM V4

// Parameters
interface AmmV4Params {
  marketId: PublicKey;      // OpenBook market ID
  baseAmount: BN;          // Initial base token amount
  quoteAmount: BN;         // Initial quote token amount
  startTime: BN;          // Pool start time
}

// Constraints
- Requires OpenBook market
- Only supports TOKEN_PROGRAM_ID mints
- Minimum liquidity requirements

CLMM

// Parameters
interface ClmmParams {
  mint1: PublicKey;        // First token mint
  mint2: PublicKey;        // Second token mint
  configId: PublicKey;     // Configuration ID
  initialPrice: Decimal;   // Initial pool price
  startTime: BN;          // Pool start time
}

// Configuration includes
- Pool info
- Index
- Protocol fee rate
- Trade fee rate
- Tick spacing
- Fund fee rate

CPMM

// Parameters
interface CpmmParams {
  mint1: PublicKey;        // First token mint
  mint2: PublicKey;        // Second token mint
  configId: PublicKey;     // Configuration ID
  mintAAmount: BN;         // Initial amount of token A
  mintBAmount: BN;         // Initial amount of token B
  startTime: BN;          // Pool start time
}

// Features
- Supports Token-2022
- No market ID required
- Configurable fees

Launchlab Token

// Parameters
interface LaunchlabTokenParams {
  name: string;            // Token name
  symbol: string;          // Token symbol
  decimals?: number;       // Token decimals (default: 6)
  supply?: number;         // Initial supply (default: LaunchpadPoolInitParam.supply)
  uri: string;             // Metadata URI
  platformId?: string;     // Platform ID (default: Raydium platform)
  migrateType?: "amm" | "cpmm";  // Migration type (default: "amm")
  txVersion?: TxVersion;   // Transaction version (default: V0)
  slippageBps?: number;    // Slippage in basis points (default: 100)
  buyAmount?: BN;          // Buy amount in lamports (default: 0)
  createOnly: boolean;     // Create only or create and buy
}

// Features
- Integrated token creation and launch
- Automatic migration to AMM or CPMM
- Built-in buy functionality
- Configurable slippage protection
- Custom platform support

Implementation Details

Common Features

  • Automatic mint verification
  • Decimal handling
  • Fee configuration
  • Transaction versioning

Pool-Specific Features

  • AMM V4: OpenBook integration
  • CLMM: Tick range management
  • CPMM: Token-2022 support
  • Launchlab: Token creation and launch automation

Launchlab Token Features

  • Token Creation: Generates new token mint with custom parameters
  • Metadata Support: Links to off-chain metadata via URI
  • Migration Options: Automatic pool creation with AMM or CPMM
  • Instant Buy: Optional immediate token purchase upon creation
  • Platform Integration: Supports custom platform IDs
  • Slippage Protection: Configurable slippage tolerance

Error Handling

try {
  const pool = await agent.methods.raydiumCreate[PoolType](...);
} catch (error) {
  if (error.message.includes("insufficient liquidity")) {
    // Handle liquidity issues
  } else if (error.message.includes("invalid market")) {
    // Handle market validation issues
  } else if (error.message.includes("Launchpad config not found")) {
    // Handle launchlab configuration issues
  }
}

Best Practices

  1. Pool Type Selection
    • Use CPMM for Token-2022
    • Use CLMM for efficient ranges
    • Use AMM V4 for OpenBook integration
    • Use Launchlab for new token launches
  2. Initial Liquidity
    • Calculate appropriate amounts
    • Consider token decimals
    • Monitor price impact
    • Verify token balances
  3. Configuration
    • Set appropriate fees
    • Choose tick spacing
    • Plan start time
    • Consider trading volume
  4. Launchlab Token Setup
    • Prepare metadata JSON with proper schema
    • Choose appropriate decimals (6-9 recommended)
    • Set realistic initial supply
    • Configure migration type based on use case
    • Test with small buy amounts first
  5. Security
    • Validate all addresses
    • Check token programs
    • Verify configurations
    • Monitor transactions
    • Secure metadata hosting

Common Issues

  1. Setup Issues
    • Invalid market ID
    • Insufficient liquidity
    • Wrong token program
    • Incorrect decimals
    • Missing metadata URI
  2. Transaction Failures
    • Network congestion
    • Invalid parameters
    • Configuration errors
    • Insufficient funds
    • Slippage exceeded
  3. Permission Issues
    • Missing approvals
    • Wrong signers
    • Invalid authority
    • Program restrictions
  4. Launchlab Specific Issues
    • Invalid metadata format
    • Unreachable URI
    • Configuration mismatch
    • Platform ID errors
    • Supply calculation errors

Metadata Schema for Launchlab Tokens

{
  "name": "Token Name",
  "symbol": "TOKEN",
  "description": "Token description",
  "image": "https://example.com/image.png",
  "external_url": "https://example.com",
  "attributes": [
    {
      "trait_type": "Category",
      "value": "DeFi"
    }
  ],
  "properties": {
    "files": [
      {
        "uri": "https://example.com/image.png",
        "type": "image/png"
      }
    ],
    "category": "image"
  }
}

Common Token Addresses

  • USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
  • SOL: So11111111111111111111111111111111111111112
  • USDT: Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
  • RAY: 4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R

Migration Types

AMM Migration

  • Creates traditional AMM pool
  • Suitable for most use cases
  • Higher liquidity requirements
  • OpenBook market integration

CPMM Migration

  • Creates constant product pool
  • Lower barriers to entry
  • Token-2022 support
  • No market ID requirement
  • Faster setup process
I