<!-- file: docs/reports/RAYDIUM_CPMM_UPSTREAM_COVERAGE_REVIEW_PRE22.md -->

# Raydium CPMM upstream coverage review — 0.7.49-pre.22

## Scope

Compared local `raydium_cpmm` coverage against the currently referenced upstream surfaces:

- Solscan program IDL for `CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C`.
- `sevenlabs-hq/carbon` `raydium-cpmm-decoder`.
- `0xfnzero/sol-parser-sdk` `idl/raydium_cpmm.json`.
- `pinax-network/substreams-solana-idls` `src/raydium/cpmm`.
- Raydium official `raydium-cp-swap` source.

## Local CPMM coverage entries

Local registry currently lists 16 `raydium_cpmm` entries:

### Instructions

- `close_permission_pda` — `9c5420764587467b`
- `collect_creator_fee` — `1416567bc61cdb84`
- `collect_fund_fee` — `a78a4e95dfc2067e`
- `collect_protocol_fee` — `8888fcddc2427e59`
- `create_amm_config` — `8934edd4d7756c68`
- `create_permission_pda` — `878802d889a9b5ca`
- `deposit` — `f223c68952e1f2b6`
- `initialize` — `afaf6d1f0d989bed`
- `initialize_with_permission` — `3f37fe4131b25979`
- `swap_base_input` — `8fbe5adac41e33de`
- `swap_base_output` — `37d96256a34ab4ad`
- `update_amm_config` — `313cae889a1c74c8`
- `update_pool_status` — `82576c062ee0757b`
- `withdraw` — `b712469c946da122`

### Anchor / Program-data events

- `lp_change_event` — `79a3cdc939da753c`
- `swap_event` — `40c6cde8260871e2`

## Upstream comparison

Carbon `raydium-cpmm-decoder` exposes the same 14 instruction modules and the two event-like discriminator entries, `lp_change_event` and `swap_event`.

`sol-parser-sdk` `idl/raydium_cpmm.json` exposes the core CPMM instruction set (`createAmmConfig`, `updateAmmConfig`, `updatePoolStatus`, `collectProtocolFee`, `collectFundFee`, `initialize`, `deposit`, `withdraw`, `swapBaseInput`, `swapBaseOutput`) and IDL events `LpChangeEvent` and `SwapEvent`. The local registry also includes the permission and creator-fee entries present in Carbon / Raydium source.

The official Raydium `raydium-cp-swap` source lists the CPMM program ID and the main program instructions including admin/config, fee collection, permission PDA, initialize, initialize with permission, deposit, withdraw, swap base input, and swap base output.

## Finding

No missing CPMM instruction/event discriminator was identified relative to the reviewed Carbon / Raydium / fnzero / Pinax surfaces available during this check.

## Current local caveat

CPMM remains covered by the earlier 0.7.48 tranche. The useful final validation remains DB-side:

```sql
SELECT
    entry_name,
    entry_kind,
    event_family,
    expected_db_target,
    proof_status,
    local_event_kind,
    discriminator_hex,
    observed_count,
    materialized_count,
    trade_count
FROM k_sol_dex_event_coverage_entries
WHERE decoder_code = 'raydium_cpmm'
ORDER BY entry_kind, entry_name, discriminator_hex;
```

Any future upstream addition should appear as a new entry in Carbon/Solscan/IDL and should be added to `upstream_registry_generated.rs`, `known_local_event_kind` only after local decoder support exists, and then validated with local corpus evidence.
