Fix dlmm parser
This commit is contained in:
@@ -410,10 +410,13 @@ func metaoradlmmPositionCreateParser(tx *Tx, instruction Instruction, innerInstr
|
||||
return nil, increaseOffset(offset), fmt.Errorf("meteora dlmm create position accounts parse error: %v, offset, %d, %d", err, offset[0], offset[1])
|
||||
}
|
||||
|
||||
createEvent, nextOffset, err := dlmmPositionCreateEventFromInnerInstructions(innerInstructions, instruction, offset)
|
||||
createEvent, nextOffset, found, err := dlmmPositionCreateEventFromInnerInstructions(innerInstructions, instruction, offset)
|
||||
if err != nil {
|
||||
return nil, nextOffset, err
|
||||
}
|
||||
if !found {
|
||||
return nil, nextOffset, InstructionIgnoredError
|
||||
}
|
||||
offset = nextOffset
|
||||
|
||||
if !createEvent.LbPair.IsZero() {
|
||||
@@ -1478,11 +1481,11 @@ func dlmmRebalancingEventFromInnerInstructions(innerInstructions InnerInstructio
|
||||
return dlmmRebalancingEvent{}, increaseOffset(offset), fmt.Errorf("meteora dlmm rebalance liquidity event not found, offset, %d, %d", offset[0], prefixLen)
|
||||
}
|
||||
|
||||
func dlmmPositionCreateEventFromInnerInstructions(innerInstructions InnerInstructions, instruction Instruction, offset [2]uint) (dlmmPositionCreateEvent, [2]uint, error) {
|
||||
func dlmmPositionCreateEventFromInnerInstructions(innerInstructions InnerInstructions, instruction Instruction, offset [2]uint) (dlmmPositionCreateEvent, [2]uint, bool, error) {
|
||||
var prefixLen = offset[1]
|
||||
inners, err := getInnerInstructions(innerInstructions, prefixLen)
|
||||
if err != nil {
|
||||
return dlmmPositionCreateEvent{}, increaseOffset(offset), fmt.Errorf("meteora dlmm create position get inner instructions error: %v, offset, %d, %d", err, offset[0], prefixLen)
|
||||
return dlmmPositionCreateEvent{}, increaseOffset(offset), false, fmt.Errorf("meteora dlmm create position get inner instructions error: %v, offset, %d, %d", err, offset[0], prefixLen)
|
||||
}
|
||||
for innerIndex, innerInstr := range inners {
|
||||
if innerInstr.ProgramIDIndex != instruction.ProgramIDIndex {
|
||||
@@ -1497,9 +1500,9 @@ func dlmmPositionCreateEventFromInnerInstructions(innerInstructions InnerInstruc
|
||||
} else {
|
||||
offset[1] = uint(innerIndex) + 1 + prefixLen
|
||||
}
|
||||
return event, offset, nil
|
||||
return event, offset, true, nil
|
||||
}
|
||||
return dlmmPositionCreateEvent{}, increaseOffset(offset), fmt.Errorf("meteora dlmm create position event not found, offset, %d, %d", offset[0], prefixLen)
|
||||
return dlmmPositionCreateEvent{}, increaseOffset(offset), false, nil
|
||||
}
|
||||
|
||||
func dlmmPositionCloseEventFromInnerInstructions(innerInstructions InnerInstructions, instruction Instruction, offset [2]uint) (dlmmPositionCloseEvent, [2]uint, bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user