1

I am working on my raydium swap bot on python. I am able to buy some tokens and can't buy some other tokens. I dont know the reason why my codes are working for one and not for the other one. I wrap sol before buying, and for some tokens i get error "Program log: Error: User token input does not match amm" ...

I have read somewhere someone told that you must send token account creation and initialization process with the swap transaction itself, I have tried also that and got same error.

WrapSOL and SOL program_id is same or i am wrong? I always check base_mint from pool and see So11111111111111111111111111111111111111112

Any help would make me so thankful ...

Here is the logs:

SendTransactionPreflightFailureMessage 
{ message: "Transaction simulation failed: Error processing Instruction 4: custom program error: 0x2a", data: RpcSimulateTransactionResult(RpcSimulateTransactionResult 
{ err: Some(InstructionError(4, Custom(42))), 
logs: Some(["Program 11111111111111111111111111111111 invoke [1]", 
"Program 11111111111111111111111111111111 success", 
"Program 11111111111111111111111111111111 invoke [1]", 
"Program 11111111111111111111111111111111 success", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 
"Program log: Instruction: InitializeAccount", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3442 of 1199700 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]", 
"Program log: Create", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 
"Program log: Instruction: GetAccountDataSize", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1569 of 1190744 compute units", 
"Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 
"Program 11111111111111111111111111111111 invoke [2]", 
"Program 11111111111111111111111111111111 success", 
"Program log: Initialize the associated token account", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 
"Program log: Instruction: InitializeImmutableOwner", 
"Program log: Please upgrade to SPL Token 2022 for immutable owner support", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 1184157 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 
"Program log: Instruction: InitializeAccount3", 
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3158 of 1180275 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 19458 of 1196258 compute units",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success", 
"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]", 
"Program log: Error: User token input does not match amm", 
"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 12519 of 1176800 compute units",
"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 failed: custom program error: 0x2a"]),
accounts: None, units_consumed: Some(23200), return_data: None, inner_instructions: None }) }
1
  • Maybe the problem is wrapping sol is not successful because the transactions which successful is interacted directly with the pool without my wrapped sol token account
    – NFT_Player
    Commented May 28 at 8:00

1 Answer 1

1

I'm not sure if this will be the full answer but it could help you to find the reason for the failure. From the error, I would say that you constructed the instructions with the wrong input data or accounts.

The error reported by the execution is

"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]", 
"Program log: Error: User token input does not match amm", 
"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 12519 of 1176800 compute units",
"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 failed: custom program error: 0x2a"]),
accounts: None, units_consumed: Some(23200), return_data: None, inner_instructions: None }) }

We can see it comes from address 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 which is the Raydium AMM Program https://explorer.solana.com/address/675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8/domains

We can check the program code by pointing to the particular error 0x2a -> 42 -> InvalidUserToken https://github.com/raydium-io/raydium-amm/blob/master/program/src/error.rs#L159C5-L159C21

When we check the code where it's called and failed then it's instruction SwapBaseIn https://github.com/raydium-io/raydium-amm/blob/master/program/src/processor.rs#L2261

and it shows some mismatches at provided data against the pc_vault or coint_vault.

1
  • 1
    Thanks @chalda I found the problem and solved. My input token adress was not valid adress, that was the problem.
    – NFT_Player
    Commented May 30 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.