chore: filter wsol for bonk
This commit is contained in:
@@ -229,7 +229,11 @@ func parseFlasBonkBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal,
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[15]))
|
||||
base, err := tx.GetAccount(int(instruction.Accounts[15]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
quote, err := tx.GetAccount(int(instruction.Accounts[16]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -237,6 +241,12 @@ func parseFlasBonkBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !quote.Equals(wrappedSOL) {
|
||||
// just ignore this
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if len(instruction.Data) > 20 {
|
||||
instruction.Data = instruction.Data[:20]
|
||||
}
|
||||
@@ -249,7 +259,7 @@ func parseFlasBonkBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal,
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "flas",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.Amount2),
|
||||
Token1Amount: formatSolAmount(args.Amount1),
|
||||
@@ -268,7 +278,11 @@ func parseFlasBonkSell(tx VersionedTransaction, instructionIndex int) (*TxSignal
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[15]))
|
||||
base, err := tx.GetAccount(int(instruction.Accounts[15]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
quote, err := tx.GetAccount(int(instruction.Accounts[16]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -277,6 +291,11 @@ func parseFlasBonkSell(tx VersionedTransaction, instructionIndex int) (*TxSignal
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !quote.Equals(wrappedSOL) {
|
||||
// just ignore this
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var args flasArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)
|
||||
@@ -286,7 +305,7 @@ func parseFlasBonkSell(tx VersionedTransaction, instructionIndex int) (*TxSignal
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "flas",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.Amount1),
|
||||
Token1Amount: formatSolAmount(args.Amount2),
|
||||
|
||||
@@ -59,7 +59,11 @@ func parseRaydiumLaunchLabCreate(tx VersionedTransaction, instruction Instructio
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
base, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
quote, err := tx.GetAccount(int(instruction.Accounts[7]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -68,11 +72,16 @@ func parseRaydiumLaunchLabCreate(tx VersionedTransaction, instruction Instructio
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !quote.Equals(wrappedSOL) {
|
||||
// just ignore this
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "raydiumlaunchlab",
|
||||
Maker: creator.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: decimal.Zero,
|
||||
Token1Amount: decimal.Zero,
|
||||
@@ -94,7 +103,11 @@ func parseRaydiumLaunchLabSwap(tx VersionedTransaction, instruction Instructions
|
||||
return nil, fmt.Errorf("data too short for raydium launch lab swap args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[9]))
|
||||
base, err := tx.GetAccount(int(instruction.Accounts[9]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
quote, err := tx.GetAccount(int(instruction.Accounts[10]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -103,6 +116,11 @@ func parseRaydiumLaunchLabSwap(tx VersionedTransaction, instruction Instructions
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !quote.Equals(wrappedSOL) {
|
||||
// just ignore this
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
amountA := binary.LittleEndian.Uint64(instruction.Data[8:16])
|
||||
amountB := binary.LittleEndian.Uint64(instruction.Data[16:24])
|
||||
|
||||
@@ -112,7 +130,7 @@ func parseRaydiumLaunchLabSwap(tx VersionedTransaction, instruction Instructions
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "raydiumlaunchlab",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amountB),
|
||||
Token1Amount: formatSolAmount(amountA),
|
||||
@@ -130,7 +148,7 @@ func parseRaydiumLaunchLabSwap(tx VersionedTransaction, instruction Instructions
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "raydiumlaunchlab",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amountA),
|
||||
Token1Amount: formatSolAmount(amountB),
|
||||
@@ -150,7 +168,7 @@ func parseRaydiumLaunchLabSwap(tx VersionedTransaction, instruction Instructions
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "raydiumlaunchlab",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amountA),
|
||||
Token1Amount: formatSolAmount(amountB),
|
||||
@@ -168,7 +186,7 @@ func parseRaydiumLaunchLabSwap(tx VersionedTransaction, instruction Instructions
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "raydiumlaunchlab",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amountB),
|
||||
Token1Amount: formatSolAmount(amountA),
|
||||
|
||||
Reference in New Issue
Block a user