Update amm buy
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user