fix parse error
This commit is contained in:
@@ -848,11 +848,11 @@ func orcaWhirPoolSwapV2Parser(tx *Tx, instruction Instruction, innerInstructions
|
||||
var baseFound, quoteFound bool
|
||||
var skipOffset = 0
|
||||
for i, inner := range inners {
|
||||
if !tx.rawTx.accountList[inner.ProgramIDIndex].Equals(solana.Token2022ProgramID) && !tx.rawTx.accountList[inner.ProgramIDIndex].Equals(solana.TokenProgramID) {
|
||||
continue
|
||||
}
|
||||
from, to, amount, err := parseTokenTransfer(tx.rawTx, inner)
|
||||
if err != nil {
|
||||
if i <= 1 { //maybe momo??
|
||||
continue
|
||||
}
|
||||
return nil, increaseOffset(offset), fmt.Errorf("orca whirpool swapv2 parse token transfer error: %v, offset, %d, %d", err, offset[0], offset[1])
|
||||
}
|
||||
if !baseFound && (from.Equals(vault0Account) || to.Equals(vault0Account)) {
|
||||
@@ -1010,11 +1010,11 @@ func orcaWhirPoolTwoHopSwapParser(tx *Tx, instruction Instruction, innerInstruct
|
||||
{
|
||||
baseTokenBalance, err := getTokenBalanceAfterTx(tx.rawTx, pool2VaultBase)
|
||||
if err != nil {
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool1 token0 vault balance after tx: %v", err)
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool2 token0 vault balance after tx: %v", err)
|
||||
}
|
||||
quoteTokenBalance, err := getTokenBalanceAfterTx(tx.rawTx, pool2VaultQuote)
|
||||
if err != nil {
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool1 token1 vault balance after tx: %v", err)
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool2 token1 vault balance after tx: %v", err)
|
||||
}
|
||||
|
||||
userBase := getAccountBalanceAfterTx(tx.rawTx, pool2UserBase)
|
||||
@@ -1105,8 +1105,8 @@ func orcaWhirPoolTwoHopSwapV2Parser(tx *Tx, instruction Instruction, innerInstru
|
||||
//pool2UserBase := instruction.Accounts[8]
|
||||
pool2VaultBase := instruction.Accounts[11]
|
||||
|
||||
pool2UserQuote := instruction.Accounts[12]
|
||||
pool2VaultQuote := instruction.Accounts[13]
|
||||
pool2VaultQuote := instruction.Accounts[12]
|
||||
pool2UserQuote := instruction.Accounts[13]
|
||||
|
||||
swaps := make([]Swap, 2)
|
||||
{
|
||||
@@ -1186,11 +1186,11 @@ func orcaWhirPoolTwoHopSwapV2Parser(tx *Tx, instruction Instruction, innerInstru
|
||||
{
|
||||
baseTokenBalance, err := getTokenBalanceAfterTx(tx.rawTx, pool2VaultBase)
|
||||
if err != nil {
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool1 token0 vault balance after tx: %v", err)
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool2 token0 vault balance after tx: %v", err)
|
||||
}
|
||||
quoteTokenBalance, err := getTokenBalanceAfterTx(tx.rawTx, pool2VaultQuote)
|
||||
if err != nil {
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool1 token1 vault balance after tx: %v", err)
|
||||
return nil, increaseOffset(offset), fmt.Errorf("failed to get pool2 token1 vault balance after tx: %v", err)
|
||||
}
|
||||
|
||||
userBase := decimal.Zero
|
||||
|
||||
Reference in New Issue
Block a user