all parser

This commit is contained in:
thloyi
2026-02-09 14:46:19 +08:00
parent 5da088ce13
commit 9ece4aebb9
22 changed files with 6720 additions and 174 deletions

57
tx.go
View File

@@ -10,6 +10,8 @@ type Swap struct {
Program string
Event string
TxIndex int
Pool solana.PublicKey
BaseMint solana.PublicKey
QuoteMint solana.PublicKey
@@ -34,6 +36,13 @@ type Swap struct {
UserQuoteBalance decimal.Decimal
EntryContract solana.PublicKey
MigrateToPool solana.PublicKey
MigrateTopProgram solana.PublicKey
LpMint solana.PublicKey
AfterSOLBalance decimal.Decimal
//For meteora dlmm
StartBinId int32
EndBinId int32
@@ -129,7 +138,6 @@ func (tx *Tx) GetTxHash() string {
func (tx *Tx) CheckPlatform(swap Swap) (string, decimal.Decimal) {
// hasSolProgramRaydiumLaunchLabBonk
rawTx := tx.rawTx
var platform string
var platformFee decimal.Decimal
if len(tx.Platform) == 0 {
@@ -141,49 +149,14 @@ func (tx *Tx) CheckPlatform(swap Swap) (string, decimal.Decimal) {
platformFee = info.PlatformFee
break
}
if swap.Event == "buy" {
switch swap.Program {
case SolProgramRaydiumLaunchLabBonk:
for _, p := range tx.Platform {
switch p.Platform {
case PlatformAxiom:
if !checkBonkAxiomBuy(rawTx) {
platform = PlatformFake
}
case PlatformGMGN:
if !checkBonkGmgnBuy(rawTx) {
platform = PlatformFake
}
}
}
}
if swap.Program == SolProgramRaydiumLaunchLabBonk {
for _, p := range tx.Platform {
switch p.Platform {
case PlatformAxiom:
if !checkPumpFunAxiomBuy(rawTx) {
platform = PlatformFake
}
case PlatformGMGN:
if !checkPumpFunGmgnBuy(rawTx) {
platform = PlatformFake
}
}
}
}
quoteAmount := swap.QuoteAmount
if swap.BaseMint.Equals(solana.WrappedSol) {
quoteAmount = swap.BaseAmount
}
if platform != "" &&
platform != PlatformFake {
if (swap.QuoteMint.Equals(wSolMint) || swap.QuoteMint.IsZero()) &&
platformFee.LessThan(swap.QuoteAmount.Div(decimal.New(1, int32(swap.QuoteMintDecimals))).Div(decimal.NewFromInt(10000)).Mul(decimal.NewFromInt(9))) {
platform = PlatformFake
} else if swap.BaseMint.Equals(wSolMint) &&
platformFee.LessThan(swap.QuoteAmount.Div(decimal.New(1, int32(swap.QuoteMintDecimals))).Div(decimal.NewFromInt(10000)).Mul(decimal.NewFromInt(9))) {
platform = PlatformFake
}
platform != PlatformFake &&
platformFee.LessThan(quoteAmount.Mul(decimal.NewFromInt(9)).Div(decimal.New(10000, 9))) {
platform = PlatformFake
}
if platform == "" {
platform = PlatformNone