punm parser

This commit is contained in:
thloyi
2025-11-21 12:01:44 +08:00
parent a945f3b45d
commit f86c5591c1
13 changed files with 228 additions and 148 deletions

View File

@@ -64,14 +64,15 @@ func (tx *Tx) GetTxHash() string {
return tx.CachedTxHash
}
func FromTx(tx *parser.Tx, raw *parser.RawTx) []*Tx {
var txs []*Tx = make([]*Tx, 0, len(tx.Swaps))
func FromTx(tx *parser.Tx) []*Tx {
var txs = make([]*Tx, 0, len(tx.Swaps))
mev, mevFee := tx.CheckMevAgent()
for i, s := range tx.Swaps {
var newTx *Tx
platform, platformFee := tx.CheckPlatform(s, raw)
platform, platformFee := tx.CheckPlatform(s)
token0Program := s.BaseTokenProgram
token0Address := s.BaseMint
token0Decimals := s.BaseMintDecimals
if s.Program == "Pump" {
newTx = &Tx{
Err: nil,
@@ -126,6 +127,7 @@ func FromTx(tx *parser.Tx, raw *parser.RawTx) []*Tx {
}
token0Program = s.QuoteTokenProgram
token0Address = s.QuoteMint
token0Decimals = s.QuoteMintDecimals
newTx = &Tx{
Err: nil,
//BondingCurve: s.Pool.String(),
@@ -220,7 +222,7 @@ func FromTx(tx *parser.Tx, raw *parser.RawTx) []*Tx {
}
if newTx.Maker == "HV1KXxWFaSeriyFvXyx48FqG9BoFbfinB8njCJonqP7K" && newTx.EntryContract == "oKXAggregatorV2" {
newTx.Maker = tx.Signer.String()
newTx.AfterSignerToken0Balance = parser.GetTokenBalanceAfterTx(raw, 0, token0Program, token0Address)
newTx.AfterSignerToken0Balance = tx.GetSignerTokenBalanceAfterTx(token0Program, token0Address).Div(decimal.New(1, int32(token0Decimals)))
}
txs = append(txs, newTx)