Files
pump-parser/globals.go

49 lines
1.3 KiB
Go
Raw Permalink Normal View History

2025-11-20 17:56:45 +08:00
package pump_parser
import (
"errors"
2025-11-21 12:01:44 +08:00
"fmt"
2025-11-20 17:56:45 +08:00
"github.com/gagliardetto/solana-go"
)
var (
WSOLString = "So11111111111111111111111111111111111111112"
WSOL = solana.MustPublicKeyFromBase58("So11111111111111111111111111111111111111112")
USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
)
const (
SOLDecimals = 9
)
var (
InstructionIgnoredError = errors.New("instruction ignored")
)
2025-11-21 12:01:44 +08:00
type swapParser func(tx *Tx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint) ([]Swap, [2]uint, error)
type actionParser func(tx *Tx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint) ([2]uint, error)
2025-11-20 17:56:45 +08:00
2025-11-21 12:01:44 +08:00
func getInnerInstructions(innerInstructions InnerInstructions, offset uint) ([]Instruction, error) {
var inners []Instruction
var prefixLen = offset
if prefixLen > uint(len(innerInstructions.Instructions)) {
return nil, fmt.Errorf("error inner instruction index out of range")
}
if prefixLen == 0 {
inners = innerInstructions.Instructions
} else {
inners = innerInstructions.Instructions[prefixLen:]
}
return inners, nil
}
2025-11-20 17:56:45 +08:00
func isMayhemPump(feeAccount solana.PublicKey) bool {
for _, mayhemFeeAccount := range mayhemFeeAccounts {
if feeAccount.Equals(mayhemFeeAccount) {
return true
}
}
return false
}