punm parser

This commit is contained in:
thloyi
2025-11-20 17:56:45 +08:00
commit a945f3b45d
29 changed files with 9665 additions and 0 deletions

67
globals.go Normal file
View File

@@ -0,0 +1,67 @@
package pump_parser
import (
"errors"
"github.com/gagliardetto/solana-go"
)
var (
WSOLString = "So11111111111111111111111111111111111111112"
WSOL = solana.MustPublicKeyFromBase58("So11111111111111111111111111111111111111112")
USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
)
const (
SOLDecimals = 9
)
var (
InstructionIgnoredError = errors.New("instruction ignored")
)
type swapParser func(result *RawTx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint) ([]Swap, [2]uint, error)
type actionParser func(result *RawTx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint, tx *Tx) ([2]uint, error)
//type PumpComplete struct {
// IsMayhem bool
// IsToken2022 bool
//}
//type PumpStatusCache map[solana.PublicKey]PumpComplete
//
//var (
// pumpCompleteCache PumpStatusCache = make(map[solana.PublicKey]PumpComplete)
// pumpCompleteCacheLock sync.Mutex
//)
//
//func getPumpCompleteStatus(pumpToken solana.PublicKey) (PumpComplete, bool) {
// pumpCompleteCacheLock.Lock()
// defer pumpCompleteCacheLock.Unlock()
// status, exists := pumpCompleteCache[pumpToken]
// return status, exists
//}
//
//func setPumpCompleteStatus(pumpToken solana.PublicKey, mayhem bool, token2022 bool) {
// pumpCompleteCacheLock.Lock()
// defer pumpCompleteCacheLock.Unlock()
// pumpCompleteCache[pumpToken] = PumpComplete{
// IsMayhem: mayhem,
// IsToken2022: token2022,
// }
//}
//
//func removePumpCompleteStatus(pumpToken solana.PublicKey) {
// pumpCompleteCacheLock.Lock()
// defer pumpCompleteCacheLock.Unlock()
// delete(pumpCompleteCache, pumpToken)
//}
func isMayhemPump(feeAccount solana.PublicKey) bool {
for _, mayhemFeeAccount := range mayhemFeeAccounts {
if feeAccount.Equals(mayhemFeeAccount) {
return true
}
}
return false
}