IsCashbackCoin

This commit is contained in:
cachalots
2026-02-27 02:07:52 +08:00
parent bcd442195c
commit 972ddc7960
4 changed files with 16 additions and 9 deletions

View File

@@ -61,16 +61,13 @@ func main() {
if tx.Program != parser.SolProgramPumpAMM { if tx.Program != parser.SolProgramPumpAMM {
continue continue
} }
if tx.EntryContract == "" || tx.EntryContract == parser.SolProgramPumpAMM || tx.EntryContract == parser.EntryContractOKXDexRouterV2 || tx.EntryContract == "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" {
continue
}
//if tx.Token1Amount.GreaterThanOrEqual(decimal.NewFromFloat(0.1)) || tx.Event != "buy" { //if tx.Token1Amount.GreaterThanOrEqual(decimal.NewFromFloat(0.1)) || tx.Event != "buy" {
// continue // continue
//} //}
// printed = true // printed = true
fmt.Printf("t: %s, block: %d, hash: %s, maker: %s, program: %s, event: %s, token0: %s, entryContract: %s, token balance: %s, EntryContract: %s\n", fmt.Printf("t: %s, block: %d, is cash:%v hash: %s, maker: %s, program: %s, event: %s, token0: %s, entryContract: %s, token balance: %s, EntryContract: %s\n",
time.Now().Format(time.RFC3339Nano), time.Now().Format(time.RFC3339Nano),
tx.Block, tx.GetTxHash(), tx.Maker, tx.Program, tx.Event, tx.Token0Amount, tx.EntryContract, tx.AfterSignerToken0Balance, tx.EntryContract) tx.Block, tx.Cashback, tx.GetTxHash(), tx.Maker, tx.Program, tx.Event, tx.Token0Amount, tx.EntryContract, tx.AfterSignerToken0Balance, tx.EntryContract)
//break //break
} }
//if !printed { //if !printed {

View File

@@ -50,7 +50,8 @@ type Tx struct {
AfterSOLBalance decimal.Decimal `gorm:"column:after_sol_balance;type:numeric" json:"after_sol_balance"` AfterSOLBalance decimal.Decimal `gorm:"column:after_sol_balance;type:numeric" json:"after_sol_balance"`
EntryContract string `gorm:"column:tx_entry_contract;type:entry_contract;default:'none'" json:"tx_entry_contract"` EntryContract string `gorm:"column:tx_entry_contract;type:entry_contract;default:'none'" json:"tx_entry_contract"`
Mayhem bool Mayhem bool
Cashback bool `json:"is_cashback_coin"`
} }
func (tx *Tx) GetTxHash() string { func (tx *Tx) GetTxHash() string {
@@ -121,6 +122,7 @@ func FromTx(tx *parser.Tx) []*Tx {
EntryContract: s.CheckEntryContract(), EntryContract: s.CheckEntryContract(),
Mayhem: s.Mayhem, Mayhem: s.Mayhem,
Cashback: s.Cashback,
} }
} else if s.Program == "PumpAMM" { } else if s.Program == "PumpAMM" {
if s.BaseMint.Equals(solana.WrappedSol) { if s.BaseMint.Equals(solana.WrappedSol) {
@@ -175,6 +177,7 @@ func FromTx(tx *parser.Tx) []*Tx {
EntryContract: s.CheckEntryContract(), EntryContract: s.CheckEntryContract(),
Mayhem: s.Mayhem, Mayhem: s.Mayhem,
Cashback: s.Cashback,
} }
} else { } else {
newTx = &Tx{ newTx = &Tx{
@@ -219,6 +222,7 @@ func FromTx(tx *parser.Tx) []*Tx {
EntryContract: s.CheckEntryContract(), EntryContract: s.CheckEntryContract(),
Mayhem: s.Mayhem, Mayhem: s.Mayhem,
Cashback: s.Cashback,
} }
} }
} }

View File

@@ -62,9 +62,7 @@ func NewClientWithPumpSwap(endpoint string, ch chan SubscriptionMessage) *Client
"pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", //Pump AMM "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", //Pump AMM
"6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", //Pump "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", //Pump
} }
subscription.Transactions["transactions_sub"].AccountRequired = []string{
"ARu4n5mFdZogZAravu7CcizaojWnS6oqka37gdLT5SZn",
}
subscription.BlocksMeta = make(map[string]*pb.SubscribeRequestFilterBlocksMeta) subscription.BlocksMeta = make(map[string]*pb.SubscribeRequestFilterBlocksMeta)
subscription.BlocksMeta["block_meta"] = &pb.SubscribeRequestFilterBlocksMeta{} subscription.BlocksMeta["block_meta"] = &pb.SubscribeRequestFilterBlocksMeta{}

View File

@@ -41,6 +41,8 @@ type ammBuyEvent struct {
LastUpdateTimestamp int64 LastUpdateTimestamp int64
MinBaseAmountOut uint64 MinBaseAmountOut uint64
IxName string IxName string
CashbackFeeBasisPoints uint64
Cashback uint64
} }
type ammCreatePoolEvent struct { type ammCreatePoolEvent struct {
@@ -113,6 +115,8 @@ type ammSellEvent struct {
CoinCreator solana.PublicKey CoinCreator solana.PublicKey
CoinCreatorFeeBasisPoints uint64 CoinCreatorFeeBasisPoints uint64
CoinCreatorFee uint64 CoinCreatorFee uint64
CashbackFeeBasisPoints uint64
Cashback uint64
} }
type ammWithdrawEvent struct { type ammWithdrawEvent struct {
@@ -329,6 +333,7 @@ func ammBuyParser(tx *Tx, instruction Instruction, innerInstructions InnerInstru
userBalance, _ := GetSolAfterTx(result, userIndex) userBalance, _ := GetSolAfterTx(result, userIndex)
userQuote = userQuote.Add(decimal.NewFromUint64(userBalance)) userQuote = userQuote.Add(decimal.NewFromUint64(userBalance))
} }
isCashbackCoin := event.CashbackFeeBasisPoints > 0 || event.Cashback > 0
return []Swap{ return []Swap{
{ {
Program: SolProgramPumpAMM, Program: SolProgramPumpAMM,
@@ -347,6 +352,7 @@ func ammBuyParser(tx *Tx, instruction Instruction, innerInstructions InnerInstru
BaseReserve: decimal.NewFromUint64(event.PoolBaseTokenReserve - event.BaseAmountOut), BaseReserve: decimal.NewFromUint64(event.PoolBaseTokenReserve - event.BaseAmountOut),
QuoteReserve: decimal.NewFromUint64(event.PoolQuoteTokenReserve + event.QuoteAmountIn), QuoteReserve: decimal.NewFromUint64(event.PoolQuoteTokenReserve + event.QuoteAmountIn),
Mayhem: isMayhemPump(result.accountList[instruction.Accounts[9]]), Mayhem: isMayhemPump(result.accountList[instruction.Accounts[9]]),
Cashback: isCashbackCoin,
UserBaseBalance: userBase, UserBaseBalance: userBase,
UserQuoteBalance: userQuote, UserQuoteBalance: userQuote,
EntryContract: entryContract, EntryContract: entryContract,
@@ -448,6 +454,7 @@ func ammSellParser(tx *Tx, instruction Instruction, innerInstructions InnerInstr
userBalance, _ := GetSolAfterTx(result, userIndex) userBalance, _ := GetSolAfterTx(result, userIndex)
userQuote = userQuote.Add(decimal.NewFromUint64(userBalance)) userQuote = userQuote.Add(decimal.NewFromUint64(userBalance))
} }
isCashbackCoin := event.CashbackFeeBasisPoints > 0 || event.Cashback > 0
return []Swap{ return []Swap{
{ {
Program: SolProgramPumpAMM, Program: SolProgramPumpAMM,
@@ -466,6 +473,7 @@ func ammSellParser(tx *Tx, instruction Instruction, innerInstructions InnerInstr
BaseReserve: decimal.NewFromUint64(event.PoolBaseTokenReserves + event.BaseAmountIn), BaseReserve: decimal.NewFromUint64(event.PoolBaseTokenReserves + event.BaseAmountIn),
QuoteReserve: decimal.NewFromUint64(event.PoolQuoteTokenReserves - event.QuoteAmountOut), QuoteReserve: decimal.NewFromUint64(event.PoolQuoteTokenReserves - event.QuoteAmountOut),
Mayhem: isMayhemPump(result.accountList[instruction.Accounts[9]]), Mayhem: isMayhemPump(result.accountList[instruction.Accounts[9]]),
Cashback: isCashbackCoin,
UserBaseBalance: userBase, UserBaseBalance: userBase,
UserQuoteBalance: userQuote, UserQuoteBalance: userQuote,
EntryContract: entryContract, EntryContract: entryContract,