Update amm buy

This commit is contained in:
bijianing97
2025-12-02 15:51:53 +08:00
parent d8e8d7ba89
commit 9fd0d6a21b
2 changed files with 19 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
package example package parser
import ( import (
"time" "time"
@@ -74,6 +74,11 @@ func FromTx(tx *parser.Tx) []*Tx {
token0Address := s.BaseMint token0Address := s.BaseMint
token0Decimals := s.BaseMintDecimals token0Decimals := s.BaseMintDecimals
if s.Program == "Pump" { if s.Program == "Pump" {
quoteMint := s.QuoteMint
// 有些数据里 quote 会给 SystemProgram统一转成 WSOL
if quoteMint.Equals(solana.WrappedSol) || quoteMint.Equals(solana.SystemProgramID) {
quoteMint = solana.WrappedSol
}
newTx = &Tx{ newTx = &Tx{
Err: nil, Err: nil,
BondingCurve: s.Pool.String(), BondingCurve: s.Pool.String(),
@@ -82,7 +87,7 @@ func FromTx(tx *parser.Tx) []*Tx {
Token0Address: s.BaseMint.String(), Token0Address: s.BaseMint.String(),
Token0Program: s.BaseTokenProgram.String(), Token0Program: s.BaseTokenProgram.String(),
Token0Decimals: s.BaseMintDecimals, Token0Decimals: s.BaseMintDecimals,
Token1Address: "", Token1Address: quoteMint.String(),
Token0Amount: s.BaseAmount.Div(decimal.NewFromInt(1e6)), Token0Amount: s.BaseAmount.Div(decimal.NewFromInt(1e6)),
Token1Amount: s.QuoteAmount.Div(decimal.NewFromInt(1e9)), Token1Amount: s.QuoteAmount.Div(decimal.NewFromInt(1e9)),
Block: tx.Block, Block: tx.Block,

View File

@@ -20,6 +20,7 @@ type ammBuyEvent struct {
QuoteAmountIn uint64 QuoteAmountIn uint64
LpFeeBasisPoints uint64 LpFeeBasisPoints uint64
LpFee uint64 LpFee uint64
ProtocolFeeBasisPoints uint64
ProtocolFee uint64 ProtocolFee uint64
QuoteAmountInWithLpFee uint64 QuoteAmountInWithLpFee uint64
UserQuoteAmountIn uint64 UserQuoteAmountIn uint64
@@ -31,6 +32,15 @@ type ammBuyEvent struct {
ProtocolFeeRecipient solana.PublicKey ProtocolFeeRecipient solana.PublicKey
ProtocolFeeRecipientTokenAccount solana.PublicKey ProtocolFeeRecipientTokenAccount solana.PublicKey
CoinCreator solana.PublicKey CoinCreator solana.PublicKey
CoinCreatorFeeBasisPoints uint64
CoinCreatorFee uint64
TrackVolume bool
TotalUnclaimedTokens uint64
TotalClaimedTokens uint64
CurrentSolVolume uint64
LastUpdateTimestamp int64
MinBaseAmountOut uint64
IxName string
} }
type ammCreatePoolEvent struct { type ammCreatePoolEvent struct {
@@ -101,6 +111,8 @@ type ammSellEvent struct {
ProtocolFeeRecipient solana.PublicKey ProtocolFeeRecipient solana.PublicKey
ProtocolFeeRecipientTokenAccount solana.PublicKey ProtocolFeeRecipientTokenAccount solana.PublicKey
CoinCreator solana.PublicKey CoinCreator solana.PublicKey
CoinCreatorFeeBasisPoints uint64
CoinCreatorFee uint64
} }
type ammWithdrawEvent struct { type ammWithdrawEvent struct {