fix raydium v4 swap v2
This commit is contained in:
@@ -402,11 +402,14 @@ func raydiumv4SwapParser(tx *Tx, instruction Instruction, innerInstructions Inne
|
||||
|
||||
func raydiumv4SwapV2Parser(tx *Tx, instruction Instruction, innerInstructions InnerInstructions, offset [2]uint) ([]Swap, [2]uint, error) {
|
||||
accountsLen := len(instruction.Accounts)
|
||||
if accountsLen != 8 {
|
||||
if accountsLen < 8 {
|
||||
return nil, increaseOffset(offset), fmt.Errorf("invalid number of accounts for raydiumv4 swapv2 instruction, offset %d, %d", offset[0], offset[1])
|
||||
}
|
||||
var entryContract = tx.rawTx.accountList[tx.rawTx.Transaction.Message.Instructions[offset[0]].ProgramIDIndex]
|
||||
|
||||
// Raydium's documented V2 layout uses the first 8 accounts. Routed CPI calls
|
||||
// may append extra readonly accounts (for example the Raydium program id) at
|
||||
// the tail, so we only require the canonical prefix here.
|
||||
ammAccount := tx.rawTx.accountList[instruction.Accounts[1]]
|
||||
user := tx.rawTx.accountList[instruction.Accounts[7]]
|
||||
userSourceTokenAccount := tx.rawTx.accountList[instruction.Accounts[5]]
|
||||
|
||||
Reference in New Issue
Block a user