swap_base_input
Raydium CPMM
What this page showsOne instruction (an action a wallet lists) of Raydium CPMM: whether the code that runs it is the code an audit reviewed, why, and the recorded transactions that called it.
Verdict
Changed
The reviewed commit and the live source are both established, and the handler file or a traced related file changed between them.
Checked against the snapshot at slot 472,718,301
Instruction decoded
Established
The instruction bytes match one entry in a pinned IDL or schema, with no collision.
Live code rebuilt by POA
Established
POA rebuilt a source commit and its hash equals the on-chain executable.
Report names the handler file
Not established
A published audit report's scope covers the file that implements this instruction.
Reviewed commit printed
Not established
That report prints the scope and the exact commit it reviewed.
Reviewed code is the live code
Known difference
The reviewed commit and the rebuilt live commit hold the same program code.
Every link must hold before POA says Matched. A missing link is not a failure, and never an approval.
Reasons
- Program snapshot at slot 472718301: executable, RPC agree, hash 7e691824f591….
- Decoded by anchor-idl-discriminator 8fbe5adac41e33de.
- Handler programs/cp-swap/src/instructions/swap_base_input.rs#L75 (instructions::swap_base_input).
- Only partly reviewed per raydium-cpmm-sec3-2025-pr55 (PR55 (support creator fee) diff 7732131 → 0ddfda5 only; findings marked P2 are beyond PR55 and outside the audit scope); these reports give neither MATCHED nor CHANGED for this instruction.
- Live source 3d691227 established by POA's independent build.
- No report with directly extracted scope names a path covering the handler file.
- CHANGED: between raydium-cpmm-madshield-2024's reviewed commit 8f10f251 and live 3d691227 the handler's traced files changed: programs/cp-swap/src/curve/calculator.rs (M +97 -71), programs/cp-swap/src/error.rs (M +18 -3), programs/cp-swap/src/instructions/swap_base_input.rs (M +71 -86), programs/cp-swap/src/lib.rs (M +217 -22), programs/cp-swap/src/states/mod.rs (M +14 -2), programs/cp-swap/src/utils/token.rs (M +264 -35).
What would be needed for a stronger verdict
- A report whose printed scope paths cover the handler file.
Checks
- Decoded
- Yes
- Handler located
- Yes
- Handler in report-named files
- No
- Review scope established
- No
- Reviewed commit known
- Yes
- Live source rebuilt by POA
- Yes
- Live source equals reviewed
- No
- Handler changed since review
- Yes
- Program crate changed since review
- Yes
- Program immutable
- No
- Evidence fresh
- Yes
Discriminator and decoding
- Discriminator
- 8fbe5adac41e33de
- Method
- Anchor IDL discriminator
- IDL SHA-256
- 1202f6dc8e1c3216598f2ad5c620b9aa8c64ac584563fafed68125c27fb6df81
- Collisions
- None
Arguments
| Name | Type |
|---|---|
| amount_in | u64 |
| minimum_amount_out | u64 |
Accounts
Signer and writable flags from the interface definition.
| Account | Flags | Fixed address | Notes |
|---|---|---|---|
| payer | Signer | The user performing the swap | |
| authority | Read-only | ||
| amm_config | Read-only | The factory state to read protocol fees | |
| pool_state | Writable | The program account of the pool in which the swap will be performed | |
| input_token_account | Writable | The user token account for input token | |
| output_token_account | Writable | The user token account for output token | |
| input_vault | Writable | The vault token account for input token | |
| output_vault | Writable | The vault token account for output token | |
| input_token_program | Read-only | SPL program for input token transfers | |
| output_token_program | Read-only | SPL program for output token transfers | |
| input_token_mint | Read-only | The mint of input token | |
| output_token_mint | Read-only | The mint of output token | |
| observation_state | Writable | The program account for the most recent oracle observation |
Handler source
- Function
- instructions::swap_base_input
- File
- programs/cp-swap/src/instructions/swap_base_input.rs · lines 75–212
- At commit
- 3d69122790e97cd6aff24e8ba95940793773f58c
- Mapping
- Anchor program module
Related files
- programs/cp-swap/src/curve/calculator.rs (opens in a new tab)
- programs/cp-swap/src/error.rs (opens in a new tab)
- programs/cp-swap/src/instructions/swap_base_input.rs (opens in a new tab)
- programs/cp-swap/src/lib.rs (opens in a new tab)
- programs/cp-swap/src/states/mod.rs (opens in a new tab)
- programs/cp-swap/src/utils/token.rs (opens in a new tab)
Audit relations
How each report relates to this instruction's handler file.
| Auditor | Relation | Reviewed commit | Scope confidence |
|---|---|---|---|
| Mad ShieldRaydium Constant Product AMM Program Audit Report (raydium-cp-swap v1.0.0) (opens in a new tab) | Program covered, no paths named | 8f10f25 | Printed in the report |
| Sec3Security Assessment Report Raydium CP Swap PR55 (opens in a new tab) | Program covered, no paths named | f361e34 | Printed in the report |
Changed files since review
Files changed between the reviewed commit and the live source, as recorded.
| File | Status | Added | Removed |
|---|---|---|---|
| programs/cp-swap/src/curve/calculator.rs | modified | 97 | 71 |
| programs/cp-swap/src/error.rs | modified | 18 | 3 |
| programs/cp-swap/src/instructions/swap_base_input.rs | modified | 71 | 86 |
| programs/cp-swap/src/lib.rs | modified | 217 | 22 |
| programs/cp-swap/src/states/mod.rs | modified | 14 | 2 |
| programs/cp-swap/src/utils/token.rs | modified | 264 | 35 |
Call trees
The static tree comes from the handler source. The observed tree comes from a finalized transaction. They are separate evidence and are not merged.
- Instruction
- The instruction itself, with its own verdict.
- Static
- A source file read at the handler map's pinned commit.
- Observed
- A call seen in a finalized mainnet transaction.
- Inferred
- A call read from the handler source, not observed on chain.
Static, from source at 3d69122
- Signer
- InstructionChanged
- StaticChanged
- StaticChanged
- StaticChanged
- StaticChanged
- StaticChanged
- StaticChanged
- InferredUnknown
- InferredUnknown
Observed in transaction 5JEh36vFpd… at slot 472,699,897
- Signer
- InstructionUnknown
- InstructionUnknown
- InstructionUnknown
- InstructionUnknown
- ObservedUnknown
- ObservedUnknown
- ObservedUnknown
- ObservedUnknown
- InstructionUnknown
- InstructionUnknown
- InstructionChanged
- ObservedUnknown
- ObservedUnknown
- InstructionUnknown
Current deployment predates this transaction. Deployment slot 463,522,946, transaction slot 472,699,897, snapshot slot 472,718,301.
Transactions
Each curated transaction that calls this instruction, with what is known about the code that ran.
01
Transaction at slot 472,699,897
Current deployment predates this transaction. Deployment slot 463,522,946, transaction slot 472,699,897, snapshot slot 472,718,301.
- Signature
- 5JEh36vFpd8uJFfhsZa8aMqzpcLE8tvJLmPc4q3vAkRPhhvjg5WeEKj6dNAbyXeoty2AWdBQFwqngvW9Yc5ZDPrs
- Slot
- 472,699,897
- Block time
- 2026-11-22 21:58 UTC
- Status
- Succeeded
- Fee
- 270,518 lamports
- Compute units
- 44,887
- Message version
- legacy
- RPC response SHA-256
- 28e14b14f382617fb653895b990a76328d5078917bc9fc7f187598708808064d