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

View File

@@ -20,6 +20,7 @@ type ammBuyEvent struct {
QuoteAmountIn uint64
LpFeeBasisPoints uint64
LpFee uint64
ProtocolFeeBasisPoints uint64
ProtocolFee uint64
QuoteAmountInWithLpFee uint64
UserQuoteAmountIn uint64
@@ -31,6 +32,15 @@ type ammBuyEvent struct {
ProtocolFeeRecipient solana.PublicKey
ProtocolFeeRecipientTokenAccount 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 {
@@ -101,6 +111,8 @@ type ammSellEvent struct {
ProtocolFeeRecipient solana.PublicKey
ProtocolFeeRecipientTokenAccount solana.PublicKey
CoinCreator solana.PublicKey
CoinCreatorFeeBasisPoints uint64
CoinCreatorFee uint64
}
type ammWithdrawEvent struct {