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,