Raydiumswap

Raydiumswap: Classic SPL and Token-2022 Swap Rules

Raydiumswap supports classic SPL tokens and eligible Token-2022 tokens through compatible Solana pools. Classic transfers have no Token-2022 fee withholding; an enabled transfer-fee extension can reduce spendable input or output amounts. Compatibility depends on the mint’s extensions, while the amount received depends on pool pricing and any active transfer fees.

Key takeaway: For CPMM exact-input swaps, minimum output applies to the tokens received after any output transfer fee.

Token Transfers and Spendable Balances

An enabled transfer-fee extension reduces spendable tokens on each charged transfer, so identical gross amounts can yield different recipient balances.

Classic SPL Transfers

Classic SPL tokens use Solana’s original Token Program, with SPL standing for Solana Program Library. That program doesn’t implement the Token-2022 transfer-fee extension. A classic transfer therefore has no withholding from that mechanism. A swap still incurs the fee that the pool charges and Solana transaction costs, which arise separately from the token transfer.

Token-2022 Transfers

Token-2022 adds optional extensions to the SPL token model. An eligible mint can carry TransferFeeConfig and charge a fee on its transfers. The token program records that fee as a withheld amount on the destination account. The receiver’s spendable balance increases by the net amount. A mint without this extension doesn’t incur that fee merely because it uses Token-2022.


Mint Identity and Pool Admission

Pool eligibility depends on the mint’s owning program and enabled extensions, followed by usable liquidity for the exact token pair. Eligibility alone doesn’t establish an executable route.

Mint and Account Ownership

The mint address identifies the asset, while the mint account’s program owner identifies its token program. A shared symbol or similar logo doesn’t establish that two tokens share transfer rules. The same wallet address can own token accounts for both programs, but each account holds tokens of a particular mint.

An associated token account’s address derives from the wallet address, mint address, and token program. Token-2022 transfers require the correct program and account handling. A wallet displaying a token balance doesn’t establish that every swap integration can construct the instructions required for that mint.

CPMM, CLMM, and AMM v4

Raydium’s constant product market maker, or CPMM, and concentrated liquidity market maker, or CLMM, admit eligible Token-2022 mints. Their normal mint filters allow TransferFeeConfig, MetadataPointer, TokenMetadata, InterestBearingConfig, and ScaledUiAmount. Under normal admission, every enabled mint extension must pass the filter; an accepted extension doesn’t cancel another extension’s restriction. A registered SupportMintAssociated account provides a program-controlled, per-mint exception to that normal filter. This exception concerns mint admission and doesn’t establish that every wallet or routing integration implements the admitted mint’s transfer requirements.

AMM v4 supports classic SPL tokens and doesn’t support Token-2022 mints. A route carrying Token-2022 tokens needs compatible programs wherever those tokens move. CPMM and CLMM admission also leaves liquidity and account-state requirements in place.

Where Do Transfer Fees Enter a Swap?

A configured transfer fee affects input transfers, output transfers, or both, depending on which mint carries an active fee configuration.

Input Transfers

For a CPMM exact-input swap, the input mint’s fee reduces the amount available for the pool calculation. The wallet supplies the gross input, while the pool receives the remainder as spendable reserve tokens. The fee that the pool charges then enters its own pricing calculation. Input withholding changes the amount traded before the pool determines output; deducting an input fee from the final output would use the wrong token and calculation basis.

Output Transfers

An output mint’s active fee applies to tokens transferred from the pool vault to the recipient. Gross pool output and spendable tokens received are therefore different quantities when that transfer incurs withholding. Each side uses its own mint’s fee rate and cap. A fee on the input token doesn’t establish that the output token has one.

CPMM’s exact-input instruction rejects a swap if its calculated output after the output transfer fee falls below the specified minimum. A transfer-aware quote should use the same net basis. If a displayed amount already represents net output, subtracting the fee again would count it twice. Slippage tolerance defines acceptable execution variation; it doesn’t switch off the mint’s fee.


Fee Rates, Caps, and Base Units

Token-2022 transfer fees use integer base units and the fee schedule active for the execution epoch. The program rounds the proportional fee upward to a whole base unit before applying the configured cap. For transferred base units A, a basis-point rate b, and a cap M in base units, the fee is min(M, ceil(A × b / 10 000)). Here, ceil means rounding upward. Mint decimals convert base units into ordinary token amounts.

Visual summary: Raydiumswap: Fee Rates, Caps, and Base Units

Open full-size image

A Net-Output Requirement With a Fee Cap

In this hypothetical example, a swap must deliver at least 73.30 spendable tokens. The chosen output is an eligible Token-2022 mint with two decimal places, no special display conversion, and a 0.65-token transfer-fee cap. Pool pricing and pool fees produce a gross output of 73.85 tokens. With a zero active transfer-fee rate, the recipient would receive 73.85 spendable tokens. The trader chooses that quote because it meets the net requirement; a classic SPL output transfer has the same absence of withholding at this gross amount.

Change only the active rate to 125 basis points, or 1.25%. Proportional withholding becomes 0.923125 tokens, which rounds up to 0.93 tokens at this precision. The 0.65-token cap applies, leaving 73.20 spendable tokens from the 73.85-token gross output.

The fee-enabled quote falls 0.10 token short, so the trader doesn’t sign the swap transaction. A fresh quote must reach 73.30 net tokens before it fits the requirement. Increasing slippage tolerance wouldn’t remove the mint’s transfer fee.


Fee Changes and Active Epochs

The transfer-fee configuration authority can change the rate and cap while that authority remains enabled. Token-2022 schedules an updated fee for the current Solana epoch plus two. Its configuration stores older and newer schedules, and the execution epoch selects which one applies. A pending replacement can therefore differ from the fee currently charged. Activation follows epoch progression, so the update doesn’t establish a fixed number of minutes.

A quote’s fee assumptions need to match its execution epoch. An earlier swap’s rate doesn’t establish the fee for a later transfer.

Display Extensions and Token Quantities

Interest-bearing and scaled-display extensions can change the amount an application shows without increasing the stored token balance. InterestBearingConfig applies time-dependent interest calculations to displayed amounts. The extension itself doesn’t mint additional tokens into accounts as time passes.

ScaledUiAmount applies a mint-controlled multiplier to the displayed balance. Updating that multiplier leaves the underlying token units unchanged. Applications need the applicable conversion when interpreting balances and quote amounts. Token-2022 doesn’t permit ScaledUiAmount and InterestBearingConfig on the same mint.

Swap arithmetic and transfer-fee calculations still operate on underlying base units for these mints. Comparing a pool’s raw amount with an adjusted wallet display can create an apparent discrepancy even when token accounting agrees. Classic SPL amounts use the mint’s decimal precision without these Token-2022 display adjustments.

Key questions about Raydiumswap

Are Token-2022 Swap Balances Automatically Private?

Token-2022 doesn’t automatically make swap balances private. Confidential Balances requires separate extension and account configuration, together with compatible instructions. An ordinary pool swap using standard token transfers doesn’t become confidential because its token uses Token-2022. Even confidential transfers leave token-account addresses public; transfer-fee support alone establishes no privacy protection.

Can a Classic SPL Swap Fail Because an Account Is Frozen?

A frozen classic SPL token account can’t send or receive tokens until the mint’s freeze authority thaws it. Freeze authority exists in the original Token Program as well as Token-2022. Choosing the classic program therefore doesn’t remove this restriction. Pool support and the transfer permissions on a particular account are separate requirements.

Does Creating a Token-2022 Receiving Account Require Extra SOL?

The SOL needed for a new receiving account depends on its required storage size. Token-2022 associated token accounts include extension data, and some mints require additional account extensions. Larger accounts require more SOL for rent exemption under the applicable storage rules. This funding is separate from a transfer fee charged in the token itself.

Can the Recipient Reclaim Tokens Withheld by a Transfer Fee?

Withdrawal of withheld fees requires authorization from the mint’s withdraw-withheld authority. The destination wallet doesn’t gain that authority by receiving tokens. Fees can be withdrawn from token accounts or harvested to the mint before withdrawal. A recipient who also controls the required authority can authorize collection, but ordinary token ownership doesn’t confer that permission.

What Happens When the transfer-fee Configuration Authority Is Revoked?

Revoking the transfer-fee configuration authority prevents further authorized changes to the rate and cap. It doesn’t erase the extension, refund previous fees, or revoke the separately defined withdraw-withheld authority. The fee schedules already stored on the mint remain applicable, including a scheduled configuration whose activation epoch hasn’t arrived.

Can Swapping Change a Classic SPL Mint Into a Token-2022 Mint?

A swap exchanges tokens of one mint for tokens of another; it doesn’t change the program that owns either mint. Receiving a Token-2022 asset means acquiring that separate mint’s token, even when its symbol resembles a classic asset. Compatibility, extensions, and fee settings belong to the exact mint received and must be interpreted for that asset.

- last updated