Solana Programs

Raydium CP Swap

Optimized Constant Product AMM

A revamped constant product AMM program optimized for straightforward pool deployment with modern features and integrations. Built with Anchor framework for improved developer experience.

Audited by MadShield
Token-2022 Support
Built-in Oracle

Wallet Required

Connect your wallet to interact with Raydium CP Swap

Available Instructions

create_amm_config
create_pool
deposit
withdraw
swap_base_input
swap_base_output

Key Improvements

No Openbook Dependency

Unlike the original Raydium AMM, no Openbook market ID is required for pool creation. This simplifies deployment and reduces setup costs.

Token-2022 Support

Full support for Token-2022 program extensions including transfer fees, transfer hooks, and other modern token features.

Built-in Price Oracle

Integrated time-weighted average price (TWAP) oracle for reliable price feeds without external dependencies.

Anchor Optimization

Rewritten in Anchor framework for better security, maintainability, and developer experience.

How It Works

Constant Product Formula

x * y = k

Uses the classic constant product market maker formula. When you trade token X for token Y, the product of their reserves remains constant.

Automated Pricing

Prices are determined algorithmically based on the ratio of tokens in the pool. No manual price setting required.

Core Features

  • Token Swaps

    Swap tokens at the current pool price with automatic slippage protection

  • Liquidity Provision

    Add liquidity to pools and earn trading fees from swappers

  • LP Token Rewards

    Receive LP tokens representing your share of the pool and earned fees

  • Price Oracle

    Built-in TWAP oracle provides manipulation-resistant price data

Security & Audit

Audited

Audited by MadShield in Q1 2024

Bug Bounty

In-scope for Raydium's Immunefi bug bounty program

Open Source

Full source code available at programs/raydium-cp-swap

Integration Guide

1. Build the Program

cd programs/raydium-cp-swap && anchor build

2. Generate TypeScript Types

anchor idl parse -f programs/cp-swap/src/lib.rs -o target/idl/raydium_cp_swap.json

3. Use in Your App

import { Program } from '@coral-xyz/anchor';
import idl from './idl/raydium_cp_swap.json';

const program = new Program(idl, provider);

When to Use

New Pools

Best choice for creating new liquidity pools without Openbook market

Token-2022

Required for pools with Token-2022 tokens and their extensions

Simple AMM

Ideal for straightforward AMM functionality without order book complexity