Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb394c5650 | ||
|
|
1223b34117 | ||
|
|
d866701679 | ||
| fa1875996c | |||
|
|
519b0ebb0b | ||
|
|
be86c888eb | ||
|
|
35c5c83f4b | ||
|
|
5f97972194 | ||
|
|
741d333e1b | ||
|
|
594c46a1d2 | ||
|
|
45107aa8c3 | ||
|
|
36db4729d4 | ||
| 23f37cff2c | |||
| 6bab10866b | |||
| 83aa772710 | |||
| da51b19b50 | |||
| f39b89b497 | |||
| 26e07ec52e | |||
| 35c57c3c7a | |||
| 3e58b62e1f | |||
|
|
4c0abc5c34 | ||
|
|
d9aea3e8d7 | ||
|
|
b82b7d9b0e | ||
| d9bc106eb1 | |||
| 871dac8bd3 | |||
|
|
156fd9b0bf | ||
|
|
2504636fb0 | ||
|
|
c4d35bd3d4 | ||
|
|
214d9e984e | ||
| c30d64fe88 | |||
| 27dde60e93 |
2
Makefile
2
Makefile
@@ -19,4 +19,4 @@ shreder:
|
||||
.PHONY: build
|
||||
# build
|
||||
build:
|
||||
mkdir -p bin/ && CGO_ENABLED=0 go build -o ./bin/ ./...
|
||||
mkdir -p bin/ && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/ ./...
|
||||
187
README.md
187
README.md
@@ -15,6 +15,8 @@ go get github.com/samlior/libsam
|
||||
| fra | fra1.shreder.xyz:9991 |
|
||||
| ams | ams1.shreder.xyz:9991 |
|
||||
| ewr | ny1.shreder.xyz:9991 |
|
||||
| uk | lon.shreder.xyz:9991 |
|
||||
| jp | tyo.shreder.xyz:9991 |
|
||||
|
||||
### Usage
|
||||
|
||||
@@ -105,6 +107,13 @@ See [example](./cmd/shreder/main.go).
|
||||
"keepAliveUrl": "http://germany.solana.dex.blxrbdn.com/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "soyas",
|
||||
"sendTxUrl": "fra.landing.soyas.xyz:9000",
|
||||
"sendBundleUrl": "",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -191,6 +200,13 @@ See [example](./cmd/shreder/main.go).
|
||||
"keepAliveUrl": "http://amsterdam.solana.dex.blxrbdn.com/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "soyas",
|
||||
"sendTxUrl": "ams.landing.soyas.xyz:9000",
|
||||
"sendBundleUrl": "",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -278,6 +294,177 @@ See [example](./cmd/shreder/main.go).
|
||||
"keepAliveUrl": "http://ny.solana.dex.blxrbdn.com/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "soyas",
|
||||
"sendTxUrl": "nyc.landing.soyas.xyz:9000",
|
||||
"sendBundleUrl": "",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary> London </summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "helius",
|
||||
"sendTxUrl": "http://lon-sender.helius-rpc.com/fast",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://lon-sender.helius-rpc.com/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "blockrazor",
|
||||
"sendTxUrl": "london.solana-grpc.blockrazor.xyz:80",
|
||||
"sendBundleUrl": "",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "node1",
|
||||
"sendTxUrl": "http://lon.node1.me",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://lon.node1.me/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "nextblock",
|
||||
"sendTxUrl": "http://london.nextblock.io/api/v2/submit",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://london.nextblock.io/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
|
||||
},
|
||||
{
|
||||
"name": "flashBlock",
|
||||
"sendTxUrl": "http://london.flashblock.trade/api/v2/submit-batch",
|
||||
"sendBundleUrl": "http://london.flashblock.trade/api/v2/submit-batch",
|
||||
"keepAliveUrl": "http://london.flashblock.trade/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "stellium",
|
||||
"sendTxUrl": "http://lhr1.flashrpc.com/be95e80d-afc2-4a48-b017-db021fc4c19e",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://lhr1.flashrpc.com/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "blocxroute",
|
||||
"sendTxUrl": "http://uk.solana.dex.blxrbdn.com/api/v2/submit",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://uk.solana.dex.blxrbdn.com/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "soyas",
|
||||
"sendTxUrl": "lon.landing.soyas.xyz:9000",
|
||||
"sendBundleUrl": "",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<details><summary> Japan </summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "helius",
|
||||
"sendTxUrl": "http://tyo-sender.helius-rpc.com/fast",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://tyo-sender.helius-rpc.com/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "0slot",
|
||||
"sendTxUrl": "http://jp1.0slot.trade?api-key=3fec78a0d361418a8eff95be9ed85cc3&anti-mev=true",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://jp1.0slot.trade/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "blockrazor",
|
||||
"sendTxUrl": "tokyo.solana-grpc.blockrazor.xyz:80",
|
||||
"sendBundleUrl": "",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "node1",
|
||||
"sendTxUrl": "http://tk.node1.me",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://tk.node1.me/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "nextblock",
|
||||
"sendTxUrl": "http://tokyo.nextblock.io/api/v2/submit",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://tokyo.nextblock.io/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 4
|
||||
},
|
||||
{
|
||||
"name": "flashBlock",
|
||||
"sendTxUrl": "http://tokyo.flashblock.trade/api/v2/submit-batch",
|
||||
"sendBundleUrl": "http://tokyo.flashblock.trade/api/v2/submit-batch",
|
||||
"keepAliveUrl": "http://tokyo.flashblock.trade/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "astralane",
|
||||
"sendTxUrl": "http://jp.gateway.astralane.io/iris?api-key=zhaozNc5OIadLPI3r9nUVVPpCZcQAUjngO6Tgr5XUJcmBrIisFaaZF81Ijn01Ytn",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://jp.gateway.astralane.io/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "nozomi",
|
||||
"sendTxUrl": "http://tyo1.nozomi.temporal.xyz/?c=34cff37e-f1a5-446a-98bb-66aa1b62cb74",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://tyo1.nozomi.temporal.xyz/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "stellium",
|
||||
"sendTxUrl": "http://tyo1.flashrpc.com/be95e80d-afc2-4a48-b017-db021fc4c19e",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://tyo1.flashrpc.com/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "blocxroute",
|
||||
"sendTxUrl": "http://tokyo.solana.dex.blxrbdn.com/api/v2/submit",
|
||||
"sendBundleUrl": "",
|
||||
"keepAliveUrl": "http://tokyo.solana.dex.blxrbdn.com/api/v2/ping",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
},
|
||||
{
|
||||
"name": "soyas",
|
||||
"sendTxUrl": "tyo.landing.soyas.xyz:9000",
|
||||
"sendBundleUrl": "",
|
||||
"tips": "0.001",
|
||||
"rateLimit": 0
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/gagliardetto/solana-go/programs/system"
|
||||
"github.com/gagliardetto/solana-go/rpc"
|
||||
"github.com/samlior/libsam/pkg/consts"
|
||||
"github.com/samlior/libsam/pkg/enum"
|
||||
"github.com/samlior/libsam/pkg/swqos"
|
||||
"github.com/samlior/libsam/v2/pkg/consts"
|
||||
"github.com/samlior/libsam/v2/pkg/enum"
|
||||
"github.com/samlior/libsam/v2/pkg/swqos"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/gagliardetto/solana-go/rpc"
|
||||
|
||||
"github.com/samlior/libsam/pkg/shreder"
|
||||
"github.com/samlior/libsam/v2/pkg/shreder"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -25,6 +25,7 @@ func main() {
|
||||
}
|
||||
rpcClient := rpc.New(rpcUrl)
|
||||
shreder.SetLogLevel(slog.LevelDebug)
|
||||
//handlers := shreder.GetRegisteredHandlers()
|
||||
shrederClient, cleanup, err := shreder.NewShrederClient(
|
||||
url,
|
||||
rpcClient,
|
||||
@@ -50,8 +51,19 @@ func main() {
|
||||
"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
|
||||
},
|
||||
},
|
||||
"okxdexroutev2": {
|
||||
AccountRequired: []string{
|
||||
"proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u",
|
||||
},
|
||||
},
|
||||
|
||||
// TODO: axiom, gmgn, etc.
|
||||
})
|
||||
},
|
||||
//shreder.WithCustomParsers(map[solana.PublicKey]shreder.Handler{
|
||||
// solana.MustPublicKeyFromBase58("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"): handlers[solana.MustPublicKeyFromBase58("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4")],
|
||||
// solana.MustPublicKeyFromBase58("proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u"): handlers[solana.MustPublicKeyFromBase58("proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u")],
|
||||
//}),
|
||||
shreder.BlocksStats(false), shreder.LogParsedStats(true), shreder.ShowTableLoaded(false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -65,11 +77,10 @@ func main() {
|
||||
<-exitSignal
|
||||
cancel()
|
||||
}()
|
||||
|
||||
// async read from shreder
|
||||
txCh := make(chan shreder.TxSignalBatch, 1000)
|
||||
txCh := make(chan shreder.TxSignal, 1000)
|
||||
go func() {
|
||||
err := shrederClient.ReadSync(ctx, txCh)
|
||||
err := shrederClient.ReadEntriesSync(ctx, txCh)
|
||||
if err != nil {
|
||||
if !errors.Is(err, context.Canceled) {
|
||||
panic(err)
|
||||
@@ -81,14 +92,10 @@ func main() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case txBatch := <-txCh:
|
||||
//jsonData, _ := json.MarshalIndent(txBatch, "", " ")
|
||||
for _, tx := range txBatch {
|
||||
if tx.Label == "jupiterV6" {
|
||||
fmt.Println("===============", tx.TxHash, tx.Token0Address, tx.Token0Amount)
|
||||
}
|
||||
case tx := <-txCh:
|
||||
if tx.Label == "photon" || tx.Label == "jupiterv6" || tx.Label == "okxdexroutev2" {
|
||||
fmt.Println("===============", tx.TxHash, tx.Label, tx.Event, tx.Token0Address, "token:", tx.Token0Amount, "parse time:", tx.ParseEnd.Sub(tx.ParseStart))
|
||||
}
|
||||
//fmt.Println(txBatch[0].TxHash)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
191
cmd/txparse/main.go
Normal file
191
cmd/txparse/main.go
Normal file
@@ -0,0 +1,191 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/gagliardetto/solana-go/programs/address-lookup-table"
|
||||
"github.com/gagliardetto/solana-go/rpc"
|
||||
|
||||
"github.com/samlior/libsam/v2/pkg/shreder"
|
||||
)
|
||||
|
||||
const (
|
||||
rpcURL = "https://staked.helius-rpc.com?api-key=5adcf1f9-5719-43d1-bf3f-c2d4e1e5f94d"
|
||||
txSignature = "3hFamox2W1oWMwbRkfF5r9YiPULsdRsnR2TQsFDVtFCXf6cJ8ijGNgHGFmEbxEbVEryLg21sbt4qoGLwrPfvJ2UC"
|
||||
labelFilter = ""
|
||||
)
|
||||
|
||||
func main() {
|
||||
if rpcURL == "" || rpcURL == "REPLACE_WITH_RPC_URL" {
|
||||
log.Fatal("rpcURL is not set in cmd/dlmmparse/main.go")
|
||||
}
|
||||
if txSignature == "" || txSignature == "REPLACE_WITH_TX_SIGNATURE" {
|
||||
log.Fatal("txSignature is not set in cmd/dlmmparse/main.go")
|
||||
}
|
||||
|
||||
client := rpc.New(rpcURL)
|
||||
sig, err := solana.SignatureFromBase58(txSignature)
|
||||
if err != nil {
|
||||
log.Fatalf("invalid txSignature: %v", err)
|
||||
}
|
||||
version := uint64(0)
|
||||
tx, err := client.GetTransaction(
|
||||
context.Background(),
|
||||
sig,
|
||||
&rpc.GetTransactionOpts{
|
||||
Commitment: rpc.CommitmentFinalized,
|
||||
MaxSupportedTransactionVersion: &version,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatalf("getTransaction failed: %v", err)
|
||||
}
|
||||
if tx == nil || tx.Transaction == nil {
|
||||
log.Fatal("transaction is empty")
|
||||
}
|
||||
|
||||
rawTx, err := tx.Transaction.GetTransaction()
|
||||
if err != nil {
|
||||
log.Fatalf("decode transaction failed: %v", err)
|
||||
}
|
||||
if rawTx == nil {
|
||||
log.Fatal("decoded transaction is nil")
|
||||
}
|
||||
|
||||
if len(rawTx.Message.AddressTableLookups) > 0 {
|
||||
tables := make(map[solana.PublicKey]solana.PublicKeySlice, len(rawTx.Message.AddressTableLookups))
|
||||
for _, lookup := range rawTx.Message.AddressTableLookups {
|
||||
state, err := addresslookuptable.GetAddressLookupTable(context.Background(), client, lookup.AccountKey)
|
||||
if err != nil {
|
||||
log.Fatalf("load address table %s failed: %v", lookup.AccountKey, err)
|
||||
}
|
||||
tables[lookup.AccountKey] = state.Addresses
|
||||
}
|
||||
if err := rawTx.Message.SetAddressTables(tables); err != nil {
|
||||
log.Fatalf("set address tables failed: %v", err)
|
||||
}
|
||||
if err := rawTx.Message.ResolveLookups(); err != nil {
|
||||
log.Fatalf("resolve address lookups failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
update := toSubscribeUpdate(tx.Slot, rawTx)
|
||||
signals := parseSignals(context.Background(), update)
|
||||
if len(signals) == 0 {
|
||||
fmt.Println("no signals parsed")
|
||||
return
|
||||
}
|
||||
|
||||
printed := false
|
||||
for _, signal := range signals {
|
||||
if labelFilter != "" && signal.Label != labelFilter {
|
||||
continue
|
||||
}
|
||||
printed = true
|
||||
output, err := json.MarshalIndent(signal, "", " ")
|
||||
if err != nil {
|
||||
log.Fatalf("marshal signal failed: %v", err)
|
||||
}
|
||||
fmt.Println(string(output))
|
||||
}
|
||||
|
||||
if printed {
|
||||
return
|
||||
}
|
||||
|
||||
if labelFilter != "" {
|
||||
fmt.Printf("no %s signal parsed, dump all signals:\n", labelFilter)
|
||||
} else {
|
||||
fmt.Println("no matching signal parsed, dump all signals:")
|
||||
}
|
||||
for _, signal := range signals {
|
||||
output, err := json.MarshalIndent(signal, "", " ")
|
||||
if err != nil {
|
||||
log.Fatalf("marshal signal failed: %v", err)
|
||||
}
|
||||
fmt.Println(string(output))
|
||||
}
|
||||
}
|
||||
|
||||
func parseSignals(ctx context.Context, update *shreder.SubscribeUpdateTransaction) []shreder.TxSignal {
|
||||
signalsCh := make(chan shreder.TxSignal, 64)
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
shreder.ParseTransactionForSubscribe(ctx, update, nil, signalsCh, done)
|
||||
}()
|
||||
go func() {
|
||||
<-done
|
||||
close(signalsCh)
|
||||
}()
|
||||
|
||||
signals := make([]shreder.TxSignal, 0)
|
||||
for signal := range signalsCh {
|
||||
signals = append(signals, signal)
|
||||
}
|
||||
return signals
|
||||
}
|
||||
|
||||
func toSubscribeUpdate(slot uint64, tx *solana.Transaction) *shreder.SubscribeUpdateTransaction {
|
||||
signatures := make([][]byte, len(tx.Signatures))
|
||||
for i, sig := range tx.Signatures {
|
||||
signatures[i] = sig[:]
|
||||
}
|
||||
|
||||
accountKeys := make([][]byte, len(tx.Message.AccountKeys))
|
||||
for i, key := range tx.Message.AccountKeys {
|
||||
accountKeys[i] = key[:]
|
||||
}
|
||||
|
||||
instructions := make([]*shreder.CompiledInstruction, len(tx.Message.Instructions))
|
||||
for i, instr := range tx.Message.Instructions {
|
||||
accounts := make([]byte, len(instr.Accounts))
|
||||
for j, acc := range instr.Accounts {
|
||||
accounts[j] = byte(acc)
|
||||
}
|
||||
instructions[i] = &shreder.CompiledInstruction{
|
||||
ProgramIdIndex: uint32(instr.ProgramIDIndex),
|
||||
Accounts: accounts,
|
||||
Data: instr.Data[:],
|
||||
}
|
||||
}
|
||||
|
||||
addressTableLookups := make([]*shreder.MessageAddressTableLookup, len(tx.Message.AddressTableLookups))
|
||||
for i, lookup := range tx.Message.AddressTableLookups {
|
||||
writable := make([]byte, len(lookup.WritableIndexes))
|
||||
for j, idx := range lookup.WritableIndexes {
|
||||
writable[j] = byte(idx)
|
||||
}
|
||||
readonly := make([]byte, len(lookup.ReadonlyIndexes))
|
||||
for j, idx := range lookup.ReadonlyIndexes {
|
||||
readonly[j] = byte(idx)
|
||||
}
|
||||
addressTableLookups[i] = &shreder.MessageAddressTableLookup{
|
||||
AccountKey: lookup.AccountKey[:],
|
||||
WritableIndexes: writable,
|
||||
ReadonlyIndexes: readonly,
|
||||
}
|
||||
}
|
||||
|
||||
return &shreder.SubscribeUpdateTransaction{
|
||||
Transaction: &shreder.Transaction{
|
||||
Signatures: signatures,
|
||||
Message: &shreder.Message{
|
||||
Header: &shreder.MessageHeader{
|
||||
NumRequiredSignatures: uint32(tx.Message.Header.NumRequiredSignatures),
|
||||
NumReadonlySignedAccounts: uint32(tx.Message.Header.NumReadonlySignedAccounts),
|
||||
NumReadonlyUnsignedAccounts: uint32(tx.Message.Header.NumReadonlyUnsignedAccounts),
|
||||
},
|
||||
AccountKeys: accountKeys,
|
||||
RecentBlockhash: nil,
|
||||
Instructions: instructions,
|
||||
Versioned: false,
|
||||
AddressTableLookups: addressTableLookups,
|
||||
},
|
||||
},
|
||||
Slot: slot,
|
||||
}
|
||||
}
|
||||
49
go.mod
49
go.mod
@@ -1,49 +1,50 @@
|
||||
module github.com/samlior/libsam
|
||||
module github.com/samlior/libsam/v2
|
||||
|
||||
go 1.25.1
|
||||
|
||||
require (
|
||||
github.com/BlockRazorinc/solana-trader-client-go v0.0.0-20250722092120-44561cb37455
|
||||
github.com/gagliardetto/solana-go v1.12.0
|
||||
github.com/BlockRazorinc/solana-trader-client-go v0.0.0-20250908052524-06493dcc1bb4
|
||||
github.com/gagliardetto/binary v0.8.0
|
||||
github.com/gagliardetto/solana-go v1.14.0
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7
|
||||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/near/borsh-go v0.3.2-0.20220516180422-1ff87d108454
|
||||
github.com/panjf2000/ants/v2 v2.11.4
|
||||
github.com/quic-go/quic-go v0.59.0
|
||||
github.com/shopspring/decimal v1.4.0
|
||||
google.golang.org/grpc v1.75.0
|
||||
google.golang.org/protobuf v1.36.10
|
||||
google.golang.org/grpc v1.78.0
|
||||
google.golang.org/protobuf v1.36.11
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
|
||||
github.com/blendle/zapdriver v1.3.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/fatih/color v1.9.0 // indirect
|
||||
github.com/gagliardetto/binary v0.8.0 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/gagliardetto/treeout v0.1.4 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.13.6 // indirect
|
||||
github.com/klauspost/compress v1.18.3 // indirect
|
||||
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
|
||||
github.com/mattn/go-colorable v0.1.4 // indirect
|
||||
github.com/mattn/go-isatty v0.0.11 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect
|
||||
github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect
|
||||
go.mongodb.org/mongo-driver v1.12.2 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
github.com/streamingfast/logging v0.0.0-20260108192805-38f96de0a641 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.7 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/ratelimit v0.2.0 // indirect
|
||||
go.uber.org/zap v1.21.0 // indirect
|
||||
golang.org/x/crypto v0.44.0 // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/sync v0.18.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/term v0.37.0 // indirect
|
||||
golang.org/x/text v0.31.0 // indirect
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
golang.org/x/crypto v0.47.0 // indirect
|
||||
golang.org/x/net v0.49.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
golang.org/x/term v0.39.0 // indirect
|
||||
golang.org/x/text v0.33.0 // indirect
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
|
||||
)
|
||||
|
||||
144
go.sum
144
go.sum
@@ -1,26 +1,25 @@
|
||||
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
|
||||
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/AlekSi/pointer v1.1.0 h1:SSDMPcXD9jSl8FPy9cRzoRaMJtm9g9ggGTxecRUbQoI=
|
||||
github.com/AlekSi/pointer v1.1.0/go.mod h1:y7BvfRI3wXPWKXEBhU71nbnIEEZX0QTSB2Bj48UJIZE=
|
||||
github.com/BlockRazorinc/solana-trader-client-go v0.0.0-20250722092120-44561cb37455 h1:MMc4/hemlMtG76VkDZt6zNL0u+OwNYBCNp2KX5jqolQ=
|
||||
github.com/BlockRazorinc/solana-trader-client-go v0.0.0-20250722092120-44561cb37455/go.mod h1:vKj1SKlrekR9fuZgWQNNAWt/PUZIfzpGjDpIcbf1kT0=
|
||||
github.com/BlockRazorinc/solana-trader-client-go v0.0.0-20250908052524-06493dcc1bb4 h1:yvrhmN9vQIrquQP1fYul30khwfoE8oEL0VmwFZ37Mq8=
|
||||
github.com/BlockRazorinc/solana-trader-client-go v0.0.0-20250908052524-06493dcc1bb4/go.mod h1:vKj1SKlrekR9fuZgWQNNAWt/PUZIfzpGjDpIcbf1kT0=
|
||||
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI=
|
||||
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129/go.mod h1:rFgpPQZYZ8vdbc+48xibu8ALc3yeyd64IhHS+PU6Yyg=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE=
|
||||
github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/gagliardetto/binary v0.8.0 h1:U9ahc45v9HW0d15LoN++vIXSJyqR/pWw8DDlhd7zvxg=
|
||||
github.com/gagliardetto/binary v0.8.0/go.mod h1:2tfj51g5o9dnvsc+fL3Jxr22MuWzYXwx9wEoN0XQ7/c=
|
||||
github.com/gagliardetto/gofuzz v1.2.2 h1:XL/8qDMzcgvR4+CyRQW9UGdwPRPMHVJfqQ/uMvSUuQw=
|
||||
github.com/gagliardetto/gofuzz v1.2.2/go.mod h1:bkH/3hYLZrMLbfYWA0pWzXmi5TTRZnu4pMGZBkqMKvY=
|
||||
github.com/gagliardetto/solana-go v1.12.0 h1:rzsbilDPj6p+/DOPXBMLhwMZeBgeRuXjm5zQFCoXgsg=
|
||||
github.com/gagliardetto/solana-go v1.12.0/go.mod h1:l/qqqIN6qJJPtxW/G1PF4JtcE3Zg2vD2EliZrr9Gn5k=
|
||||
github.com/gagliardetto/solana-go v1.14.0 h1:3WfAi70jOOjAJ0deFMjdhFYlLXATF4tOQXsDNWJtOLw=
|
||||
github.com/gagliardetto/solana-go v1.14.0/go.mod h1:l/qqqIN6qJJPtxW/G1PF4JtcE3Zg2vD2EliZrr9Gn5k=
|
||||
github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw=
|
||||
github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
@@ -29,8 +28,6 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
@@ -41,19 +38,18 @@ github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyf
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
|
||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw=
|
||||
github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
|
||||
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
|
||||
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
@@ -61,7 +57,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||
github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 h1:mPMvm6X6tf4w8y7j9YIt6V9jfWhL6QlbEc7CCmeQlWk=
|
||||
github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1/go.mod h1:ye2e/VUEtE2BHE+G/QcKkcLQVAEJoYRFj5VUOQatCRE=
|
||||
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
|
||||
@@ -73,125 +68,112 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
|
||||
github.com/panjf2000/ants/v2 v2.11.4 h1:UJQbtN1jIcI5CYNocTj0fuAUYvsLjPoYi0YuhqV/Y48=
|
||||
github.com/panjf2000/ants/v2 v2.11.4/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
|
||||
github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
|
||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
|
||||
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
|
||||
github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 h1:RN5mrigyirb8anBEtdjtHFIufXdacyTi6i4KBfeNXeo=
|
||||
github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091/go.mod h1:VlduQ80JcGJSargkRU4Sg9Xo63wZD/l8A5NC/Uo1/uU=
|
||||
github.com/streamingfast/logging v0.0.0-20260108192805-38f96de0a641 h1:dI+b2TyFS0rJw1xVGzxBBvn/RrSgBpqM/RjwDInxEfo=
|
||||
github.com/streamingfast/logging v0.0.0-20260108192805-38f96de0a641/go.mod h1:fJ5nP7ZSMB4MQQ6RM7cF+LiSQ43b5cVletcSUNL8z2M=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE=
|
||||
github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.mongodb.org/mongo-driver v1.12.2 h1:gbWY1bJkkmUB9jjZzcdhOL8O85N9H+Vvsf2yFN0RDws=
|
||||
go.mongodb.org/mongo-driver v1.12.2/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
|
||||
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
|
||||
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
|
||||
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
|
||||
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||
go.mongodb.org/mongo-driver v1.17.7 h1:a9w+U3Vt67eYzcfq3k/OAv284/uUUkL0uP75VE5rCOU=
|
||||
go.mongodb.org/mongo-driver v1.17.7/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
|
||||
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
|
||||
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
|
||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
|
||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=
|
||||
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA=
|
||||
go.uber.org/ratelimit v0.2.0/go.mod h1:YYBV4e4naJvhpitQrWJu1vCpgB7CboMe0qhltKt6mUg=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
|
||||
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
|
||||
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
|
||||
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU=
|
||||
golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc=
|
||||
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
|
||||
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
||||
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
|
||||
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
|
||||
golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY=
|
||||
golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
|
||||
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
|
||||
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
||||
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda h1:i/Q+bfisr7gq6feoJnS/DlpdwEL4ihp41fvRiM3Ork0=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||
google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4=
|
||||
google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
|
||||
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
|
||||
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
|
||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package consts
|
||||
|
||||
import "github.com/samlior/libsam/pkg/enum"
|
||||
import "github.com/samlior/libsam/v2/pkg/enum"
|
||||
|
||||
var SWQoSFeeAddresses = map[string]string{
|
||||
"96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5": enum.SWQoSAgentJito,
|
||||
@@ -121,4 +121,5 @@ var SWQoSFeeAddresses = map[string]string{
|
||||
"ste11p5x8tJ53H1NbNQsRBg1YNRd4GcVpxtDw8PBpmb": enum.SWQoSAgentStellium,
|
||||
"ste11p7e2KLYou5bwtt35H7BM6uMdo4pvioGjJXKFcN": enum.SWQoSAgentStellium,
|
||||
"ste11TMV68LMi1BguM4RQujtbNCZvf1sjsASpqgAvSX": enum.SWQoSAgentStellium,
|
||||
"soyas4s6L8KWZ8rsSk1mF3d1mQScoTGGAgjk98bF8nP": enum.SWQoSAgentSoyas,
|
||||
}
|
||||
|
||||
@@ -12,4 +12,5 @@ const (
|
||||
SWQoSAgentBlockRazor = "blockrazor"
|
||||
SWQoSAgentAstralane = "astralane"
|
||||
SWQoSAgentStellium = "stellium"
|
||||
SWQoSAgentSoyas = "soyas"
|
||||
)
|
||||
|
||||
@@ -11,24 +11,35 @@ import (
|
||||
"github.com/panjf2000/ants/v2"
|
||||
)
|
||||
|
||||
type TableInfo struct {
|
||||
overErrCount int
|
||||
|
||||
addresses []solana.PublicKey
|
||||
}
|
||||
|
||||
const MaxOverErrCount = 10
|
||||
|
||||
type AddressTables struct {
|
||||
showTableLoaded bool
|
||||
|
||||
rpcClient *rpc.Client
|
||||
mux sync.RWMutex
|
||||
loadMux sync.Mutex
|
||||
tables *lru.Cache[solana.PublicKey, []solana.PublicKey]
|
||||
tables *lru.Cache[solana.PublicKey, *TableInfo]
|
||||
loading map[solana.PublicKey]struct{}
|
||||
|
||||
pool *ants.Pool
|
||||
}
|
||||
|
||||
func NewAddressTables(rpcClient *rpc.Client) *AddressTables {
|
||||
func NewAddressTables(rpcClient *rpc.Client, showTableLoaded bool) *AddressTables {
|
||||
pool, _ := ants.NewPool(5, ants.WithPreAlloc(true), ants.WithNonblocking(true))
|
||||
cache, _ := lru.New[solana.PublicKey, []solana.PublicKey](10000)
|
||||
cache, _ := lru.New[solana.PublicKey, *TableInfo](10000)
|
||||
return &AddressTables{
|
||||
rpcClient: rpcClient,
|
||||
tables: cache,
|
||||
loading: make(map[solana.PublicKey]struct{}),
|
||||
pool: pool,
|
||||
|
||||
showTableLoaded: showTableLoaded,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,53 +65,78 @@ func (at *AddressTables) loadAddressTable(tablePubkey solana.PublicKey) ([]solan
|
||||
return addresses, nil
|
||||
|
||||
}
|
||||
|
||||
func (at *AddressTables) GetAddressTable(tablePubkey solana.PublicKey, idx []uint8) []solana.PublicKey {
|
||||
at.mux.RLock()
|
||||
addresses, ok := at.tables.Get(tablePubkey)
|
||||
if !ok {
|
||||
at.mux.RUnlock()
|
||||
_ = at.pool.Submit(func() {
|
||||
at.loadMux.Lock()
|
||||
_, loading := at.loading[tablePubkey]
|
||||
if loading {
|
||||
at.loadMux.Unlock()
|
||||
return
|
||||
}
|
||||
at.loading[tablePubkey] = struct{}{}
|
||||
func (at *AddressTables) load(tablePubkey solana.PublicKey) {
|
||||
_ = at.pool.Submit(func() {
|
||||
at.loadMux.Lock()
|
||||
_, loading := at.loading[tablePubkey]
|
||||
if loading {
|
||||
at.loadMux.Unlock()
|
||||
return
|
||||
}
|
||||
at.loading[tablePubkey] = struct{}{}
|
||||
at.loadMux.Unlock()
|
||||
|
||||
table, err := at.loadAddressTable(tablePubkey)
|
||||
if err != nil {
|
||||
logger.Error("loadAddressTable failed", "err", err, "table", tablePubkey)
|
||||
at.loadMux.Lock()
|
||||
delete(at.loading, tablePubkey)
|
||||
at.loadMux.Unlock()
|
||||
return
|
||||
}
|
||||
table, err := at.loadAddressTable(tablePubkey)
|
||||
if err != nil {
|
||||
logger.Error("loadAddressTable failed", "err", err, "table", tablePubkey)
|
||||
at.loadMux.Lock()
|
||||
delete(at.loading, tablePubkey)
|
||||
at.loadMux.Unlock()
|
||||
return
|
||||
}
|
||||
at.loadMux.Lock()
|
||||
delete(at.loading, tablePubkey)
|
||||
at.loadMux.Unlock()
|
||||
|
||||
at.mux.Lock()
|
||||
at.tables.Add(tablePubkey, table)
|
||||
total := at.tables.Len()
|
||||
at.mux.Unlock()
|
||||
logger.Info("loadAddressTable", "table", tablePubkey.String(), "table count:", total)
|
||||
at.tables.Add(tablePubkey, &TableInfo{
|
||||
addresses: table,
|
||||
})
|
||||
if at.showTableLoaded {
|
||||
total := at.tables.Len()
|
||||
logger.Info("loadAddressTable", "table", tablePubkey.String(), "table count:", total)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (at *AddressTables) FillToTx(tx *VersionedTransaction, tablePubkey solana.PublicKey, idx []uint8) bool {
|
||||
addresses, ok := at.tables.Get(tablePubkey)
|
||||
if !ok {
|
||||
at.load(tablePubkey)
|
||||
return false
|
||||
}
|
||||
|
||||
for _, i := range idx {
|
||||
if int(i) >= len(addresses.addresses) {
|
||||
logger.Error("over loadAddressTable failed", "idx", i, "table", tablePubkey)
|
||||
addresses.overErrCount++
|
||||
if addresses.overErrCount > 10 {
|
||||
at.load(tablePubkey)
|
||||
}
|
||||
return false
|
||||
}
|
||||
tx.StaticAccountKeys = append(tx.StaticAccountKeys, addresses.addresses[i])
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (at *AddressTables) GetAddressTable(tablePubkey solana.PublicKey, idx []uint8) []solana.PublicKey {
|
||||
addresses, ok := at.tables.Get(tablePubkey)
|
||||
if !ok {
|
||||
at.load(tablePubkey)
|
||||
return nil
|
||||
}
|
||||
at.mux.RUnlock()
|
||||
|
||||
var result solana.PublicKeySlice = make([]solana.PublicKey, 0, len(idx))
|
||||
for _, i := range idx {
|
||||
if int(i) >= len(addresses) {
|
||||
if int(i) >= len(addresses.addresses) {
|
||||
logger.Error("over loadAddressTable failed", "idx", i, "table", tablePubkey)
|
||||
//todo... update table?
|
||||
continue
|
||||
addresses.overErrCount++
|
||||
if addresses.overErrCount > MaxOverErrCount {
|
||||
at.load(tablePubkey)
|
||||
}
|
||||
break
|
||||
}
|
||||
result = append(result, addresses[i])
|
||||
result = append(result, addresses.addresses[i])
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -1,25 +1,80 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/gagliardetto/solana-go/rpc"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
enableBlockStats bool
|
||||
enableParseStats bool
|
||||
|
||||
conn *grpc.ClientConn
|
||||
client ShrederServiceClient
|
||||
tableLoader *AddressTables
|
||||
subscription map[string]*SubscribeRequestFilterTransactions
|
||||
|
||||
entriesFilter map[string]FilterParams
|
||||
|
||||
parser map[solana.PublicKey]Handler
|
||||
|
||||
pool *ants.Pool
|
||||
|
||||
lastSlot uint64
|
||||
lastSlotTime time.Time
|
||||
}
|
||||
|
||||
type ClientOpts struct {
|
||||
blockStats bool
|
||||
showTableLoaded bool
|
||||
logParseStats bool
|
||||
|
||||
parser map[solana.PublicKey]Handler
|
||||
}
|
||||
|
||||
type ClientOption func(*ClientOpts)
|
||||
|
||||
func ShowTableLoaded(enable bool) ClientOption {
|
||||
return func(opts *ClientOpts) {
|
||||
opts.showTableLoaded = enable
|
||||
}
|
||||
}
|
||||
|
||||
func WithCustomParsers(parsers map[solana.PublicKey]Handler) ClientOption {
|
||||
return func(opts *ClientOpts) {
|
||||
opts.parser = parsers
|
||||
}
|
||||
}
|
||||
|
||||
func BlocksStats(enable bool) ClientOption {
|
||||
return func(opts *ClientOpts) {
|
||||
opts.blockStats = enable
|
||||
}
|
||||
}
|
||||
|
||||
// LogParsedStats enables logging of parsed transaction statistics.
|
||||
// Deprecated: do not use.
|
||||
func LogParsedStats(enable bool) ClientOption {
|
||||
return func(opts *ClientOpts) {
|
||||
opts.logParseStats = enable
|
||||
}
|
||||
}
|
||||
|
||||
func NewShrederClient(
|
||||
url string,
|
||||
rpcClient *rpc.Client,
|
||||
subscription map[string]*SubscribeRequestFilterTransactions,
|
||||
options ...ClientOption,
|
||||
) (*Client, func(), error) {
|
||||
if rpcClient == nil {
|
||||
return nil, func() {}, fmt.Errorf("rpc client is nil")
|
||||
@@ -30,11 +85,46 @@ func NewShrederClient(
|
||||
return nil, func() {}, err
|
||||
}
|
||||
|
||||
poolSize := runtime.NumCPU()*2 + 2
|
||||
logger.Info("creating shreder client", "url", url, "pool_size", poolSize)
|
||||
pool, err := ants.NewPool(poolSize, ants.WithNonblocking(false))
|
||||
if err != nil {
|
||||
return nil, func() {}, err
|
||||
}
|
||||
o := &ClientOpts{
|
||||
blockStats: false,
|
||||
showTableLoaded: true,
|
||||
logParseStats: false,
|
||||
parser: registered,
|
||||
}
|
||||
for _, option := range options {
|
||||
option(o)
|
||||
}
|
||||
filterParams := make(map[string]FilterParams)
|
||||
for name, params := range subscription {
|
||||
filterParams[name] = FilterParams{
|
||||
Exclude: parseAccountArray(params.AccountExclude),
|
||||
Require: parseAccountArray(params.AccountRequired),
|
||||
Include: parseAccountArray(params.AccountInclude),
|
||||
}
|
||||
}
|
||||
if len(filterParams) == 0 {
|
||||
filterParams["default"] = FilterParams{
|
||||
Include: defaultFilterAccount,
|
||||
}
|
||||
}
|
||||
|
||||
s := &Client{
|
||||
conn: conn,
|
||||
client: NewShrederServiceClient(conn),
|
||||
subscription: subscription,
|
||||
tableLoader: NewAddressTables(rpcClient),
|
||||
conn: conn,
|
||||
client: NewShrederServiceClient(conn),
|
||||
subscription: subscription,
|
||||
entriesFilter: filterParams,
|
||||
parser: o.parser,
|
||||
tableLoader: NewAddressTables(rpcClient, o.showTableLoaded),
|
||||
pool: pool,
|
||||
|
||||
enableBlockStats: o.blockStats,
|
||||
enableParseStats: o.logParseStats,
|
||||
}
|
||||
|
||||
return s, func() {
|
||||
@@ -45,6 +135,10 @@ func NewShrederClient(
|
||||
func (c *Client) Wait() {
|
||||
logger.Debug("waiting for shreder client to stop")
|
||||
|
||||
if c.pool != nil {
|
||||
c.pool.Release()
|
||||
}
|
||||
|
||||
err := c.conn.Close()
|
||||
if err != nil {
|
||||
logger.Error("failed to close connection: ", "err", err)
|
||||
@@ -53,12 +147,56 @@ func (c *Client) Wait() {
|
||||
logger.Debug("shreder client stopped")
|
||||
}
|
||||
|
||||
func (c *Client) ReadSync(ctx context.Context, txCh chan<- TxSignalBatch) error {
|
||||
func (c *Client) ReadEntriesSync(ctx context.Context, txCh chan<- TxSignal) error {
|
||||
stream, err := c.client.SubscribeEntries(ctx, &SubscribeEntriesRequest{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Debug("reading entries from shreder client")
|
||||
for {
|
||||
response, err := stream.Recv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
slot := response.Slot
|
||||
if c.enableBlockStats {
|
||||
now := time.Now()
|
||||
if c.lastSlotTime.IsZero() || slot > c.lastSlot {
|
||||
if !c.lastSlotTime.IsZero() {
|
||||
logger.Info("block processed", "running", c.pool.Running(), "slot", slot, "prev_slot", c.lastSlot, "delta_ms", now.Sub(c.lastSlotTime).Milliseconds())
|
||||
}
|
||||
c.lastSlot = slot
|
||||
c.lastSlotTime = now
|
||||
}
|
||||
}
|
||||
|
||||
err = c.pool.Submit(func() {
|
||||
err := entriesToVersionedTransaction(slot, bytes.NewReader(response.Entries), func(versioned VersionedTransaction) {
|
||||
// filter out vote transactions
|
||||
if FilterTransactionForEntriesWithFilter(versioned, c.entriesFilter) {
|
||||
return
|
||||
}
|
||||
go ParseTransactionWithHandler(ctx, versioned, c.tableLoader, txCh, c.parser)
|
||||
})
|
||||
if err != nil {
|
||||
logger.Debug("txparser: failed to parse entries", "error", err)
|
||||
}
|
||||
})
|
||||
if err != nil && errors.Is(err, ants.ErrPoolOverload) {
|
||||
logger.Warn("task pool is full")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) ReadSync(ctx context.Context, txCh chan<- TxSignal) error {
|
||||
stream, err := c.client.SubscribeTransactions(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Debug("subscribing to transactions")
|
||||
|
||||
err = stream.Send(&SubscribeTransactionsRequest{
|
||||
Transactions: c.subscription,
|
||||
})
|
||||
@@ -66,26 +204,53 @@ func (c *Client) ReadSync(ctx context.Context, txCh chan<- TxSignalBatch) error
|
||||
return err
|
||||
}
|
||||
|
||||
// reboot the pool
|
||||
c.pool.Reboot()
|
||||
|
||||
for {
|
||||
response, err := stream.Recv()
|
||||
var response *SubscribeTransactionsResponse
|
||||
response, err = stream.Recv()
|
||||
if err != nil {
|
||||
return err
|
||||
break
|
||||
}
|
||||
|
||||
txBatch := ParseTransaction(response.Transaction, c.tableLoader)
|
||||
if len(txBatch) == 0 {
|
||||
continue
|
||||
if c.enableBlockStats {
|
||||
slot := response.Transaction.Slot
|
||||
now := time.Now()
|
||||
if c.lastSlotTime.IsZero() || slot > c.lastSlot {
|
||||
if !c.lastSlotTime.IsZero() {
|
||||
logger.Info("block processed", "running", c.pool.Running(), "slot", slot, "prev_slot", c.lastSlot, "delta_ms", now.Sub(c.lastSlotTime).Milliseconds())
|
||||
}
|
||||
c.lastSlot = slot
|
||||
c.lastSlotTime = now
|
||||
}
|
||||
}
|
||||
|
||||
// set fixed source for tx signals
|
||||
for _, tx := range txBatch {
|
||||
tx.Source = "shreder"
|
||||
}
|
||||
// txData := response.Transaction
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case txCh <- txBatch:
|
||||
err := c.pool.Submit(func() {
|
||||
versioned, err := toVersionedTransaction(response.Transaction)
|
||||
if err != nil {
|
||||
logger.Debug("txparser: failed to convert to versioned transaction", "error", err)
|
||||
return
|
||||
}
|
||||
ParseTransactionWithHandler(ctx, versioned, c.tableLoader, txCh, c.parser)
|
||||
})
|
||||
if err != nil && errors.Is(err, ants.ErrPoolOverload) {
|
||||
logger.Warn("task pool is full")
|
||||
}
|
||||
}
|
||||
|
||||
// sync waiting for all tasks to complete
|
||||
c.pool.Release()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func parseAccountArray(accountArray []string) []solana.PublicKey {
|
||||
var result []solana.PublicKey
|
||||
for _, acc := range accountArray {
|
||||
result = append(result, solana.MustPublicKeyFromBase58(acc))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
1989
pkg/shreder/dflow_idl.json
Normal file
1989
pkg/shreder/dflow_idl.json
Normal file
File diff suppressed because it is too large
Load Diff
8471
pkg/shreder/dlmm_idl.json
Normal file
8471
pkg/shreder/dlmm_idl.json
Normal file
File diff suppressed because it is too large
Load Diff
272
pkg/shreder/entry.go
Normal file
272
pkg/shreder/entry.go
Normal file
@@ -0,0 +1,272 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
type wrapperReader struct {
|
||||
io.Reader
|
||||
}
|
||||
|
||||
func (wr *wrapperReader) ReadU64() (uint64, error) {
|
||||
var buf [8]byte
|
||||
_, err := io.ReadFull(wr, buf[:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return uint64(buf[0]) | uint64(buf[1])<<8 | uint64(buf[2])<<16 | uint64(buf[3])<<24 |
|
||||
uint64(buf[4])<<32 | uint64(buf[5])<<40 | uint64(buf[6])<<48 | uint64(buf[7])<<56, nil
|
||||
}
|
||||
|
||||
func (wr *wrapperReader) Skip(n int) error {
|
||||
_, err := io.CopyN(io.Discard, wr, int64(n))
|
||||
return err
|
||||
}
|
||||
|
||||
func (wr *wrapperReader) ReadCompactU16() (uint16, error) {
|
||||
ln := 0
|
||||
size := 0
|
||||
var buf [1]byte
|
||||
for i := 0; i < 3; i++ {
|
||||
_, err := io.ReadFull(wr, buf[:])
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("unable to decode compact u16 at %d: %w", i, err)
|
||||
}
|
||||
elem := int(buf[0])
|
||||
if elem == 0 && i != 0 {
|
||||
return 0, fmt.Errorf("alias")
|
||||
}
|
||||
if i == 2 && (elem&0x80) != 0 {
|
||||
return 0, fmt.Errorf("byte three continues")
|
||||
}
|
||||
ln |= (elem & 0x7f) << (size * 7)
|
||||
size++
|
||||
if (elem & 0x80) == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return uint16(ln), nil
|
||||
}
|
||||
|
||||
func (wr *wrapperReader) ReadByte() (uint8, error) {
|
||||
var buf [1]byte
|
||||
_, err := io.ReadFull(wr, buf[:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return buf[0], nil
|
||||
}
|
||||
|
||||
func ResizeSlice[T any](slice []T, newSize int) []T {
|
||||
if cap(slice) < newSize {
|
||||
slice = append(slice, make([]T, newSize-len(slice))...)
|
||||
}
|
||||
return slice[:newSize]
|
||||
}
|
||||
|
||||
// entriesToVersionedTransaction converts raw entry bytes to versioned transactions.
|
||||
func entriesToVersionedTransaction(slot uint64, data io.Reader, callback func(tx VersionedTransaction)) error {
|
||||
b := &wrapperReader{data}
|
||||
var entriesNumBuf [8]byte
|
||||
n, err := io.ReadFull(b, entriesNumBuf[:])
|
||||
if err != nil {
|
||||
if err == io.EOF && n == 0 {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unable to read entries num: %w", err)
|
||||
}
|
||||
entriesNum := binary.LittleEndian.Uint64(entriesNumBuf[:])
|
||||
//if entriesNum == 0 {
|
||||
// return nil, nil
|
||||
//}
|
||||
if entriesNum > 2048 {
|
||||
return fmt.Errorf("entries num is too large: %d > %d", entriesNum, 2048)
|
||||
}
|
||||
|
||||
for i := uint64(0); i < entriesNum; i++ {
|
||||
err = b.Skip(40)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to skip num_hashes + hash of entry %d: %w", i, err)
|
||||
}
|
||||
numTx, err := b.ReadU64()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read num_transactions of entry %d: %w", i, err)
|
||||
}
|
||||
for j := 0; j < int(numTx); j++ {
|
||||
numSignatures, err := b.ReadCompactU16()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read numSignatures in entry %d, txn %d: %w", i, j, err)
|
||||
}
|
||||
|
||||
// enforce a maximum number of signatures to prevent OOM
|
||||
if numSignatures > 32 {
|
||||
return fmt.Errorf("numSignatures %d exceeds maximum in entry %d, txn %d", numSignatures, i, j)
|
||||
}
|
||||
if numSignatures == 0 {
|
||||
return fmt.Errorf("numSignatures is zero in entry %d, txn %d", i, j)
|
||||
}
|
||||
|
||||
versioned := VersionedTransaction{}
|
||||
versioned.Block = slot
|
||||
versioned.Time = time.Now()
|
||||
versioned.Signatures = ResizeSlice(versioned.Signatures, int(numSignatures))
|
||||
for k := 0; k < int(numSignatures); k++ {
|
||||
_, err = io.ReadFull(b, versioned.Signatures[k][:])
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read signature in entry %d, txn %d, sig: %d, %w", i, j, k, err)
|
||||
}
|
||||
}
|
||||
|
||||
msgVersion, err := b.ReadByte()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read message version in entry %d, txn %d: %w", i, j, err)
|
||||
}
|
||||
msgVersion = (msgVersion & 0x80) >> 7 // mask to get only the version bits
|
||||
legacy := msgVersion == 0
|
||||
headerSkip := 2
|
||||
if !legacy {
|
||||
headerSkip = 3
|
||||
}
|
||||
// skip msg version, mx.Header+3
|
||||
|
||||
err = b.Skip(headerSkip)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to skip message header in entry %d, txn %d: %w", i, j, err)
|
||||
}
|
||||
|
||||
// read mx.AccountKeys
|
||||
// _, err = r.Read(u16[:])
|
||||
|
||||
numAccountKeys, err := b.ReadCompactU16()
|
||||
// logger.Info("tx", "hash", versioned.Signatures[0].String(), "version", msgVersion)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode numAccountKeys in entry %d, txn %d: %w", i, j, err)
|
||||
}
|
||||
// enforce a maximum number of account keys to prevent OOM
|
||||
if numAccountKeys > 255 {
|
||||
return fmt.Errorf("numAccountKeys %d exceeds maximum in entry %d, txn %d", numAccountKeys, i, j)
|
||||
}
|
||||
|
||||
versioned.StaticAccountKeys = ResizeSlice(versioned.StaticAccountKeys, int(numAccountKeys))
|
||||
|
||||
for k := 0; k < int(numAccountKeys); k++ {
|
||||
_, err = io.ReadFull(b, versioned.StaticAccountKeys[k][:])
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read accountKey[%d] in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
}
|
||||
|
||||
//skip solana hash
|
||||
err = b.Skip(32)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to skip recentBlockhash in entry %d, txn %d: %w", i, j, err)
|
||||
}
|
||||
|
||||
// read mx.Instructions
|
||||
numInstructions, err := b.ReadCompactU16()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode numInstructions in entry %d, txn %d: %w", i, j, err)
|
||||
}
|
||||
|
||||
// enforce a maximum number of instructions to prevent OOM
|
||||
if numInstructions >= 256 {
|
||||
return fmt.Errorf("numInstructions %d exceeds maximum in entry %d, txn %d, txHash: %s", numInstructions, i, j, versioned.GetSignature())
|
||||
}
|
||||
versioned.Instructions = ResizeSlice(versioned.Instructions, int(numInstructions))
|
||||
for k := 0; k < int(numInstructions); k++ {
|
||||
versioned.Instructions[k].ProgramIDIndex, err = b.ReadByte()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read mx.Instructions[%d].ProgramIDIndex in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
numAccounts, err := b.ReadCompactU16()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode numAccounts for ix[%d] in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
|
||||
// enforce a maximum number of accounts to prevent OOM
|
||||
if numAccounts >= 256 {
|
||||
return fmt.Errorf("numAccounts %d exceeds maximum for ix[%d] in entry %d, txn %d", numAccounts, k, i, j)
|
||||
}
|
||||
versioned.Instructions[k].Accounts = ResizeSlice(versioned.Instructions[k].Accounts, int(numAccounts))
|
||||
|
||||
//.AccountsLen = int(numAccounts)
|
||||
if numAccounts != 0 {
|
||||
_, err = io.ReadFull(b, versioned.Instructions[k].Accounts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read mx.Instructions[%d].Accounts in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
}
|
||||
dataLen, err := b.ReadCompactU16()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode mx.Instructions[%d].Data length in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
// enforce a maximum data length to prevent OOM
|
||||
if dataLen > 2048 {
|
||||
return fmt.Errorf("mx.Instructions[%d].Data length %d exceeds maximum in entry %d, txn %d, txHash: %s", k, dataLen, i, j, versioned.GetSignature())
|
||||
}
|
||||
versioned.Instructions[k].Data = ResizeSlice(versioned.Instructions[k].Data, int(dataLen))
|
||||
if dataLen > 0 {
|
||||
_, err = io.ReadFull(b, versioned.Instructions[k].Data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read mx.Instructions[%d].Data in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !legacy {
|
||||
// read mx.AddressTableLookups
|
||||
numLookups, err := b.ReadByte()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read numAddressTableLookups in entry %d, txn %d: %w", i, j, err)
|
||||
}
|
||||
if numLookups >= 32 {
|
||||
return fmt.Errorf("numLookups %d exceeds maximum in entry %d, txn %d", numLookups, i, j)
|
||||
}
|
||||
versioned.AddressTableLookups = ResizeSlice(versioned.AddressTableLookups, int(numLookups))
|
||||
for k := uint8(0); k < numLookups; k++ {
|
||||
_, err = io.ReadFull(b, versioned.AddressTableLookups[k].AccountKey[:])
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read address table account key for lookup[%d] in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
numWritable, err := b.ReadCompactU16()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode numWritableIndexes for lookup[%d] in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
// enforce a maximum number of writable indexes to prevent OOM
|
||||
if numWritable >= 256 {
|
||||
return fmt.Errorf("numWritableIndexes %d exceeds maximum for lookup[%d] in entry %d, txn %d", numWritable, k, i, j)
|
||||
}
|
||||
versioned.AddressTableLookups[k].WritableIndexes = ResizeSlice(versioned.AddressTableLookups[k].WritableIndexes, int(numWritable))
|
||||
if numWritable > 0 {
|
||||
_, err = io.ReadFull(b, versioned.AddressTableLookups[k].WritableIndexes)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read writableIndexes for lookup[%d] in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
}
|
||||
|
||||
numReadonly, err := b.ReadCompactU16()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode numReadonlyIndexes for lookup[%d] in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
// enforce a maximum number of readonly indexes to prevent OOM
|
||||
if numReadonly > 256 {
|
||||
return fmt.Errorf("numReadonlyIndexes %d exceeds maximum for lookup[%d] in entry %d, txn %d", numReadonly, k, i, j)
|
||||
}
|
||||
versioned.AddressTableLookups[k].ReadonlyIndexes = ResizeSlice(versioned.AddressTableLookups[k].ReadonlyIndexes, int(numReadonly))
|
||||
if numReadonly > 0 {
|
||||
_, err = io.ReadFull(b, versioned.AddressTableLookups[k].ReadonlyIndexes)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to read readonlyIndexes for lookup[%d] in entry %d, txn %d: %w", k, i, j, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callback(versioned)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
30
pkg/shreder/entry_test.go
Normal file
30
pkg/shreder/entry_test.go
Normal file
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
|
||||
package shreder
|
||||
|
||||
//func parseOkxDexRouteV2Instruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
//
|
||||
//}
|
||||
129
pkg/shreder/program_azcz.go
Normal file
129
pkg/shreder/program_azcz.go
Normal file
@@ -0,0 +1,129 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
// has no sell function with pump and pump.amm program
|
||||
var azczProgramID = solana.MustPublicKeyFromBase58("AzcZqCRUQgKEg5FTAgY7JacATABEYCEfMbjXEzspLYFB")
|
||||
var (
|
||||
azczBuyTokensIX = []byte{11}
|
||||
azczAmmBuyTokensIX = []byte{0xf}
|
||||
)
|
||||
|
||||
type azczBuyArgs struct {
|
||||
SolAmount uint64
|
||||
TokenAmount uint64
|
||||
}
|
||||
|
||||
func parseAzczInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
if matchMethod(instruction.Data, azczBuyTokensIX) {
|
||||
txSignal, err = parseAzczBuy(tx, instructionIndex)
|
||||
} else if matchMethod(instruction.Data, azczAmmBuyTokensIX) {
|
||||
txSignal, err = parseAzczAmmBuy(tx, instructionIndex)
|
||||
}
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func parseAzczAmmBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(instruction.Data) < 17 {
|
||||
return nil, fmt.Errorf("data too short for azcz amm buy args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
solAmount := binary.LittleEndian.Uint64(instruction.Data[1:9])
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "azcz",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: decimal.Zero,
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: 0,
|
||||
Token1AmountUint64: solAmount,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseAzczBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[7]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(instruction.Data) < 2 {
|
||||
return nil, fmt.Errorf("data too short for azcz buy args len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
var args azczBuyArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "azcz",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.TokenAmount),
|
||||
Token1Amount: formatSolAmount(args.SolAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.TokenAmount,
|
||||
Token1AmountUint64: args.SolAmount,
|
||||
}, nil
|
||||
}
|
||||
118
pkg/shreder/program_binancewallet.go
Normal file
118
pkg/shreder/program_binancewallet.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
)
|
||||
|
||||
var binanceWalletProgramID = solana.MustPublicKeyFromBase58("B3111yJCeHBcA1bizdJjUFPALfhAfSRnAbJzGUtnt56A")
|
||||
|
||||
const (
|
||||
binanceWalletMinDataLen = 72
|
||||
binanceWalletSolOffset = 23
|
||||
binanceWalletTokenOff = 39
|
||||
binanceWalletSolRepeat = 51
|
||||
binanceWalletSideOff = 71
|
||||
|
||||
binanceWalletPumpBuy = 0x05
|
||||
binanceWalletPumpSell = 0x06
|
||||
)
|
||||
|
||||
var binanceWalletMarker = []byte{0x13, 0x2c, 0x82, 0x94, 0x48, 0x38, 0x2c, 0xee}
|
||||
|
||||
func parseBinanceWalletInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) < len(binanceWalletMarker) || !bytes.Contains(instruction.Data, binanceWalletMarker) {
|
||||
return nil, nil
|
||||
}
|
||||
if len(instruction.Data) < binanceWalletMinDataLen {
|
||||
return nil, fmt.Errorf("data too short for binance wallet, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
side := instruction.Data[binanceWalletSideOff]
|
||||
if side != binanceWalletPumpBuy && side != binanceWalletPumpSell {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) <= 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
wsolIdx := 7
|
||||
tokenIdx := 8
|
||||
if side == binanceWalletPumpSell {
|
||||
wsolIdx = 8
|
||||
tokenIdx = 7
|
||||
}
|
||||
|
||||
wsolKey, err := tx.GetAccount(int(instruction.Accounts[wsolIdx]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !wsolKey.Equals(solana.WrappedSol) {
|
||||
return nil, nil
|
||||
}
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[tokenIdx]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
amountA := binary.LittleEndian.Uint64(instruction.Data[binanceWalletSolOffset : binanceWalletSolOffset+8])
|
||||
if amountA == 0 && len(instruction.Data) >= binanceWalletSolRepeat+8 {
|
||||
repeat := binary.LittleEndian.Uint64(instruction.Data[binanceWalletSolRepeat : binanceWalletSolRepeat+8])
|
||||
if repeat > 0 {
|
||||
amountA = repeat
|
||||
}
|
||||
}
|
||||
amountB := binary.LittleEndian.Uint64(instruction.Data[binanceWalletTokenOff : binanceWalletTokenOff+8])
|
||||
|
||||
solAmount := amountA
|
||||
tokenAmount := amountB
|
||||
if side == binanceWalletPumpSell {
|
||||
solAmount = amountB
|
||||
tokenAmount = amountA
|
||||
}
|
||||
|
||||
maker := ""
|
||||
if len(tx.StaticAccountKeys) > 0 {
|
||||
maker = tx.StaticAccountKeys[0].String()
|
||||
} else if len(instruction.Accounts) > 0 {
|
||||
key, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
maker = key.String()
|
||||
}
|
||||
|
||||
event := "buy"
|
||||
exactIn := true
|
||||
if side == binanceWalletPumpSell {
|
||||
event = "sell"
|
||||
exactIn = false
|
||||
}
|
||||
|
||||
return TxSignalBatch{&TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "binancewallet",
|
||||
Maker: maker,
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(tokenAmount),
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "Pump",
|
||||
Event: event,
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: exactIn,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
}}, nil
|
||||
}
|
||||
111
pkg/shreder/program_bloomrouter.go
Normal file
111
pkg/shreder/program_bloomrouter.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
)
|
||||
|
||||
var bloomRouterProgramID = solana.MustPublicKeyFromBase58("b1oomGGqPKGD6errbyfbVMBuzSC8WtAAYo8MwNafWW1")
|
||||
|
||||
type bloomRouterArgs struct {
|
||||
Side uint16
|
||||
SolAmount uint64
|
||||
TokenAmount uint64
|
||||
}
|
||||
|
||||
func parseBloomRouterInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) < 26 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var (
|
||||
amount uint64
|
||||
sol uint64
|
||||
exactIn bool
|
||||
event string
|
||||
)
|
||||
|
||||
args, err := decodeBloomRouterArgs(instruction.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch args.Side {
|
||||
case 0:
|
||||
event = "buy"
|
||||
exactIn = true
|
||||
case 1:
|
||||
event = "sell"
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
if args.SolAmount > ^uint64(0)/100 {
|
||||
return nil, fmt.Errorf("bloomrouter sol amount overflow")
|
||||
}
|
||||
// bloomrouter SOL amount has 2 fewer decimals than lamports.
|
||||
sol = args.SolAmount * 100
|
||||
amount = args.TokenAmount
|
||||
|
||||
if len(instruction.Accounts) == 0 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
maker, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var (
|
||||
mint solana.PublicKey
|
||||
ok bool
|
||||
)
|
||||
for _, acctIdx := range instruction.Accounts {
|
||||
key, err := tx.GetAccount(int(acctIdx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if strings.HasSuffix(key.String(), "pump") {
|
||||
mint = key
|
||||
ok = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return TxSignalBatch{&TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "bloomrouter",
|
||||
Maker: maker.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amount),
|
||||
Token1Amount: formatSolAmount(sol),
|
||||
Program: "Pump",
|
||||
Event: event,
|
||||
ExactSOL: exactIn,
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: amount,
|
||||
Token1AmountUint64: sol,
|
||||
}}, nil
|
||||
}
|
||||
|
||||
func decodeBloomRouterArgs(data []byte) (bloomRouterArgs, error) {
|
||||
if len(data) < 26 {
|
||||
return bloomRouterArgs{}, fmt.Errorf("data too short for bloomrouter args, len=%d", len(data))
|
||||
}
|
||||
return bloomRouterArgs{
|
||||
Side: binary.BigEndian.Uint16(data[8:10]),
|
||||
SolAmount: binary.LittleEndian.Uint64(data[10:18]),
|
||||
TokenAmount: binary.LittleEndian.Uint64(data[18:26]),
|
||||
}, nil
|
||||
}
|
||||
77
pkg/shreder/program_bobo.go
Normal file
77
pkg/shreder/program_bobo.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var boboProgramID = solana.MustPublicKeyFromBase58("BobogA5N2KN2GG4XN3E3rNNRw3L8H1QPXp7QLxGrNHGM")
|
||||
var (
|
||||
boboBuyPumpTokensIX = []byte{0xff, 0xe7, 0x11, 0x53, 0x15, 0xc5, 0xc3, 0xdf}
|
||||
)
|
||||
|
||||
type boboBuyArgs struct {
|
||||
Placeholder1 uint64
|
||||
Placeholder2 uint64
|
||||
SolAmount uint64
|
||||
Placeholder3 uint64
|
||||
Placeholder4 uint64
|
||||
Placeholder5 uint64
|
||||
Placeholder6 uint64
|
||||
}
|
||||
|
||||
func parseBoboInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
if len(instruction.Data) < 8 || !bytes.Equal(instruction.Data[:8], boboBuyPumpTokensIX) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 16 {
|
||||
return nil, fmt.Errorf("data too short for bobo buy args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var args boboBuyArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[8:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)
|
||||
}
|
||||
|
||||
return TxSignalBatch{&TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "bobo",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: decimal.NewFromInt(1),
|
||||
Token1Amount: formatSolAmount(args.SolAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: 1,
|
||||
Token1AmountUint64: args.SolAmount,
|
||||
}}, nil
|
||||
}
|
||||
111
pkg/shreder/program_bonk.go
Normal file
111
pkg/shreder/program_bonk.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
)
|
||||
|
||||
var bonkProgramID = solana.MustPublicKeyFromBase58("BBRouter1cVunVXvkcqeKkZQcBK7ruan37PPm3xzWaXD")
|
||||
var (
|
||||
bonkBuyAndSellTokensIX = []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a}
|
||||
)
|
||||
|
||||
func parseBonkInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
if matchMethod(instruction.Data, bonkBuyAndSellTokensIX) {
|
||||
txSignal, err = parseBonkBuyAndSell(tx, instruction)
|
||||
}
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func parseBonkBuyAndSell(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
programId, err := tx.GetAccount(int(instruction.Accounts[7]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if programId != pumpProgramID {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
flagAccount, err := tx.GetAccount(int(instruction.Accounts[4]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
amount1 := binary.LittleEndian.Uint64(instruction.Data[17:25])
|
||||
amount2 := binary.LittleEndian.Uint64(instruction.Data[25:33])
|
||||
|
||||
if user == flagAccount {
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "bonk",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amount2),
|
||||
Token1Amount: formatSolAmount(amount1),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: amount2,
|
||||
Token1AmountUint64: amount1,
|
||||
}, nil
|
||||
} else {
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[5]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "bonk",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amount1),
|
||||
Token1Amount: formatSolAmount(amount2),
|
||||
Program: "Pump",
|
||||
Event: "sell",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: amount1,
|
||||
Token1AmountUint64: amount2,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
408
pkg/shreder/program_dflow.go
Normal file
408
pkg/shreder/program_dflow.go
Normal file
@@ -0,0 +1,408 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
bin "github.com/gagliardetto/binary"
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var (
|
||||
dflowProgramID = solana.MustPublicKeyFromBase58("DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH")
|
||||
dflowProgramString = dflowProgramID.String()
|
||||
|
||||
dflowSwapDisc = []byte{248, 198, 158, 145, 225, 117, 135, 200}
|
||||
dflowSwap2Disc = []byte{65, 75, 63, 76, 235, 91, 91, 136}
|
||||
dflowSwapWithDestinationDisc = []byte{168, 172, 24, 77, 197, 156, 135, 101}
|
||||
dflowSwapWithDestinationNative = []byte{205, 77, 127, 108, 241, 32, 196, 195}
|
||||
dflowSwap2WithDestinationDisc = []byte{95, 123, 213, 246, 122, 1, 86, 231}
|
||||
dflowSwap2WithDestinationNative = []byte{222, 100, 184, 146, 186, 196, 105, 165}
|
||||
|
||||
wrappedSOL = solana.MustPublicKeyFromBase58("So11111111111111111111111111111111111111112")
|
||||
)
|
||||
|
||||
// Action enum tags (0-based, per dflow_idl Action variants)
|
||||
const (
|
||||
ActWhirlpoolsSwap uint8 = iota
|
||||
ActClearpoolsSwap
|
||||
ActRaydiumAmmSwap
|
||||
ActLifinityV2Swap
|
||||
ActMeteoraDlmmSwap
|
||||
ActRaydiumClmmSwap
|
||||
ActRaydiumClmmSwapV2
|
||||
ActPhoenixSwap
|
||||
ActPumpFunBuy
|
||||
ActPumpFunSell
|
||||
ActGammaSwap
|
||||
ActObricV2Swap
|
||||
ActPumpFunAmmBuy
|
||||
ActPumpFunAmmSell
|
||||
ActSolFiSwap
|
||||
ActRubiconSwap
|
||||
ActMeteoraDammV1Swap
|
||||
ActRaydiumCpSwap
|
||||
ActStabbleStableSwap
|
||||
ActTesseraVSwap
|
||||
ActMeteoraDammV2Swap
|
||||
ActRaydiumLaunchlabSwap
|
||||
ActMeteoraDbcSwap
|
||||
ActHumidiFiSwap
|
||||
ActWhirlpoolsSwapV2
|
||||
ActMeteoraDlmmSwapV2
|
||||
ActZeroFiSwap
|
||||
ActAlphaQSwap
|
||||
ActTokenSwap
|
||||
ActSolFiV2Swap
|
||||
ActMozartSwap
|
||||
ActDFlowDynamicRouteV1
|
||||
ActHeavenSwap
|
||||
ActNexusSwap
|
||||
ActSarosDlmmSwap
|
||||
ActTransferFee
|
||||
ActTransferFeeWithMint
|
||||
ActRecordId
|
||||
ActRecordId2
|
||||
ActManifestSwap
|
||||
ActBisonFiSwap
|
||||
ActSanctumInfinitySwap
|
||||
ActSanctumInfinityLiquidity
|
||||
ActOpenPredictionsOrder
|
||||
ActScorchSwap
|
||||
ActIncludeAccount
|
||||
)
|
||||
|
||||
// DynamicRouteV1CandidateAction tags
|
||||
const (
|
||||
drv1SolFi uint8 = iota
|
||||
drv1Rubicon
|
||||
drv1TesseraV
|
||||
drv1HumidiFi
|
||||
drv1SolFiV2
|
||||
drv1Mozart
|
||||
drv1ObricV2
|
||||
drv1Nexus
|
||||
)
|
||||
|
||||
// PumpFun*Options { amount: u64, orchestrator_flags: OrchestratorFlags{flags u8} }
|
||||
type pumpFunAction struct {
|
||||
Amount uint64
|
||||
Flags uint8
|
||||
}
|
||||
|
||||
type dflowAction struct {
|
||||
Tag uint8
|
||||
Pump *pumpFunAction
|
||||
}
|
||||
|
||||
type dflowSwapParams struct {
|
||||
Actions []dflowAction
|
||||
}
|
||||
|
||||
// bytes to skip for Action variants; only PumpFun* actions are decoded.
|
||||
func skipDflowAction(dec *bin.Decoder, tag uint8) (*pumpFunAction, error) {
|
||||
switch tag {
|
||||
case ActWhirlpoolsSwap, ActClearpoolsSwap, ActWhirlpoolsSwapV2:
|
||||
// amount u64 + bool + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1 + 1)
|
||||
case ActRaydiumAmmSwap, ActLifinityV2Swap, ActObricV2Swap,
|
||||
ActSolFiSwap, ActRubiconSwap, ActMeteoraDammV1Swap, ActRaydiumCpSwap,
|
||||
ActStabbleStableSwap, ActTesseraVSwap, ActMeteoraDammV2Swap, ActRaydiumLaunchlabSwap,
|
||||
ActZeroFiSwap, ActAlphaQSwap, ActTokenSwap, ActSolFiV2Swap, ActMozartSwap, ActHeavenSwap,
|
||||
ActNexusSwap, ActSarosDlmmSwap, ActManifestSwap, ActBisonFiSwap:
|
||||
// amount u64 + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1)
|
||||
case ActMeteoraDlmmSwap, ActRaydiumClmmSwap, ActRaydiumClmmSwapV2, ActMeteoraDlmmSwapV2:
|
||||
// amount u64 + u8 + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1 + 1)
|
||||
case ActPhoenixSwap:
|
||||
// amount u64 + side u8 + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1 + 1)
|
||||
case ActGammaSwap:
|
||||
// amount u64 + endorsed bool + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1 + 1)
|
||||
case ActPumpFunAmmSell, ActPumpFunAmmBuy, ActPumpFunBuy, ActPumpFunSell:
|
||||
amt, err := dec.ReadUint64(binary.LittleEndian)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
flg, err := dec.ReadUint8()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pumpFunAction{Amount: amt, Flags: flg}, nil
|
||||
case ActMeteoraDbcSwap:
|
||||
// amount u64 + is_rate_limiter_applied bool + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1 + 1)
|
||||
case ActHumidiFiSwap:
|
||||
// amount u64 + swap_id u64 + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 8 + 1)
|
||||
case ActDFlowDynamicRouteV1:
|
||||
// candidate_actions Vec<DynamicRouteV1CandidateAction> + amount u64 + orchestrator_flags u8
|
||||
ln, err := dec.ReadUint32(binary.LittleEndian)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for j := uint32(0); j < ln; j++ {
|
||||
t, err := dec.ReadUint8()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if t == drv1HumidiFi {
|
||||
if err := dec.SkipBytes(8); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
// other variants carry no payload
|
||||
}
|
||||
if err := dec.SkipBytes(8); err != nil { // amount
|
||||
return nil, err
|
||||
}
|
||||
return nil, dec.SkipBytes(1) // orchestrator_flags
|
||||
case ActTransferFee, ActTransferFeeWithMint:
|
||||
return nil, dec.SkipBytes(8)
|
||||
case ActRecordId:
|
||||
return nil, dec.SkipBytes(76)
|
||||
case ActRecordId2:
|
||||
return nil, dec.SkipBytes(4)
|
||||
case ActSanctumInfinitySwap:
|
||||
// amount u64 + src_lst_value_calc_accs u8 + dst_lst_value_calc_accs u8 + src_lst_index u32 + dst_lst_index u32 + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1 + 1 + 4 + 4 + 1)
|
||||
case ActSanctumInfinityLiquidity:
|
||||
// amount u64 + lst_value_calc_accs u8 + lst_index u32 + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 1 + 4 + 1)
|
||||
case ActOpenPredictionsOrder:
|
||||
// nonce u64 + order_outcome u8 + quoted_out_amount u64 + slippage_bps u16 + platform_fee_recipient_vault pubkey(32) + platform_fee_scale u16
|
||||
return nil, dec.SkipBytes(8 + 1 + 8 + 2 + 32 + 2)
|
||||
case ActScorchSwap:
|
||||
// amount u64 + id u128 + orchestrator_flags u8
|
||||
return nil, dec.SkipBytes(8 + 16 + 1)
|
||||
case ActIncludeAccount:
|
||||
return nil, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported action tag %d", tag)
|
||||
}
|
||||
}
|
||||
|
||||
// SwapParams: actions Vec<Action>, quoted_out_amount u64, slippage_bps u16, platform_fee_bps u16
|
||||
func decodeSwapParams(data []byte) (*dflowSwapParams, error) {
|
||||
dec := bin.NewBorshDecoder(data)
|
||||
out := &dflowSwapParams{}
|
||||
ln, err := dec.ReadUint32(binary.LittleEndian)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.Actions = make([]dflowAction, 0, ln)
|
||||
for i := uint32(0); i < ln; i++ {
|
||||
tag, err := dec.ReadUint8()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("actions[%d] tag: %w", i, err)
|
||||
}
|
||||
pump, err := skipDflowAction(dec, tag)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("actions[%d]: %w", i, err)
|
||||
}
|
||||
out.Actions = append(out.Actions, dflowAction{Tag: tag, Pump: pump})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Swap2Params: actions Vec<Action>, quoted_out_amount u64, slippage_bps u16, platform_fee_bps u16, positive_slippage_fee_limit_pct u8
|
||||
func decodeSwap2Params(data []byte) (*dflowSwapParams, error) {
|
||||
dec := bin.NewBorshDecoder(data)
|
||||
out := &dflowSwapParams{}
|
||||
ln, err := dec.ReadUint32(binary.LittleEndian)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.Actions = make([]dflowAction, 0, ln)
|
||||
for i := uint32(0); i < ln; i++ {
|
||||
tag, err := dec.ReadUint8()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("actions[%d] tag: %w", i, err)
|
||||
}
|
||||
pump, err := skipDflowAction(dec, tag)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("actions[%d]: %w", i, err)
|
||||
}
|
||||
out.Actions = append(out.Actions, dflowAction{Tag: tag, Pump: pump})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func findDflowPumpAmmMints(tx VersionedTransaction, accounts []uint8) (solana.PublicKey, solana.PublicKey, bool, error) {
|
||||
for i, acctIdx := range accounts {
|
||||
key, err := tx.GetAccount(int(acctIdx))
|
||||
if err != nil {
|
||||
return solana.PublicKey{}, solana.PublicKey{}, false, err
|
||||
}
|
||||
if !key.Equals(pumpAmmProgramID) {
|
||||
continue
|
||||
}
|
||||
baseIdx := i + 4
|
||||
quoteIdx := i + 5
|
||||
if baseIdx >= len(accounts) || quoteIdx >= len(accounts) {
|
||||
return solana.PublicKey{}, solana.PublicKey{}, false, nil
|
||||
}
|
||||
baseMint, err := tx.GetAccount(int(accounts[baseIdx]))
|
||||
if err != nil {
|
||||
return solana.PublicKey{}, solana.PublicKey{}, false, err
|
||||
}
|
||||
quoteMint, err := tx.GetAccount(int(accounts[quoteIdx]))
|
||||
if err != nil {
|
||||
return solana.PublicKey{}, solana.PublicKey{}, false, err
|
||||
}
|
||||
return baseMint, quoteMint, true, nil
|
||||
}
|
||||
return solana.PublicKey{}, solana.PublicKey{}, false, nil
|
||||
}
|
||||
|
||||
func parseDFlowInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
ix := tx.Instructions[instructionIndex]
|
||||
if len(ix.Data) < 8 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var err error
|
||||
disc := ix.Data[:8]
|
||||
payload := ix.Data[8:]
|
||||
|
||||
var params *dflowSwapParams
|
||||
switch {
|
||||
case bytes.Equal(disc, dflowSwapDisc), bytes.Equal(disc, dflowSwapWithDestinationDisc), bytes.Equal(disc, dflowSwapWithDestinationNative):
|
||||
params, err = decodeSwapParams(payload)
|
||||
case bytes.Equal(disc, dflowSwap2Disc), bytes.Equal(disc, dflowSwap2WithDestinationDisc), bytes.Equal(disc, dflowSwap2WithDestinationNative):
|
||||
params, err = decodeSwap2Params(payload)
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if params == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var (
|
||||
pumpAmmBuy *pumpFunAction
|
||||
pumpAmmSell *pumpFunAction
|
||||
pumpBuy *pumpFunAction
|
||||
pumpSell *pumpFunAction
|
||||
)
|
||||
for _, act := range params.Actions {
|
||||
if act.Pump == nil {
|
||||
continue
|
||||
}
|
||||
switch act.Tag {
|
||||
case ActPumpFunAmmSell:
|
||||
pumpAmmSell = act.Pump
|
||||
case ActPumpFunAmmBuy:
|
||||
pumpAmmBuy = act.Pump
|
||||
case ActPumpFunBuy:
|
||||
pumpBuy = act.Pump
|
||||
case ActPumpFunSell:
|
||||
pumpSell = act.Pump
|
||||
}
|
||||
}
|
||||
|
||||
out := make(TxSignalBatch, 0, 2)
|
||||
if pumpAmmSell != nil || pumpAmmBuy != nil {
|
||||
event := "sell"
|
||||
amt := pumpAmmSell
|
||||
isBuy := false
|
||||
if amt == nil {
|
||||
event = "buy"
|
||||
isBuy = true
|
||||
amt = pumpAmmBuy
|
||||
}
|
||||
baseMint, quoteMint, ok, err := findDflowPumpAmmMints(tx, ix.Accounts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ok && quoteMint.Equals(solana.WrappedSol) {
|
||||
var (
|
||||
token0Amount decimal.Decimal
|
||||
token1Amount decimal.Decimal
|
||||
token0AmountUint64 uint64
|
||||
token1AmountUint64 uint64
|
||||
exactSol bool
|
||||
)
|
||||
if isBuy {
|
||||
exactSol = true
|
||||
token1Amount = formatSolAmount(amt.Amount)
|
||||
token1AmountUint64 = amt.Amount
|
||||
} else {
|
||||
token0Amount = formatTokenAmount(amt.Amount)
|
||||
token0AmountUint64 = amt.Amount
|
||||
}
|
||||
out = append(out, &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Maker: tx.StaticAccountKeys[0].String(),
|
||||
Program: "PumpAMM",
|
||||
Event: event,
|
||||
Token0Address: baseMint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: token0Amount,
|
||||
Token1Amount: token1Amount,
|
||||
ExactSOL: exactSol,
|
||||
Token0AmountUint64: token0AmountUint64,
|
||||
Token1AmountUint64: token1AmountUint64,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if pumpSell != nil || pumpBuy != nil {
|
||||
event := "sell"
|
||||
amt := pumpSell
|
||||
isBuy := false
|
||||
if amt == nil {
|
||||
event = "buy"
|
||||
isBuy = true
|
||||
amt = pumpBuy
|
||||
}
|
||||
mint, ok, err := findPumpFunMint(tx, ix.Accounts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ok {
|
||||
var (
|
||||
token0Amount decimal.Decimal
|
||||
token1Amount decimal.Decimal
|
||||
token0AmountUint64 uint64
|
||||
token1AmountUint64 uint64
|
||||
exactSol bool
|
||||
)
|
||||
if isBuy {
|
||||
exactSol = true
|
||||
token1Amount = formatSolAmount(amt.Amount)
|
||||
token1AmountUint64 = amt.Amount
|
||||
} else {
|
||||
token0Amount = formatTokenAmount(amt.Amount)
|
||||
token0AmountUint64 = amt.Amount
|
||||
}
|
||||
out = append(out, &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Maker: tx.StaticAccountKeys[0].String(),
|
||||
Program: "Pump",
|
||||
Event: event,
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: token0Amount,
|
||||
Token1Amount: token1Amount,
|
||||
ExactSOL: exactSol,
|
||||
Token0AmountUint64: token0AmountUint64,
|
||||
Token1AmountUint64: token1AmountUint64,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if len(out) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
227
pkg/shreder/program_dlmm.go
Normal file
227
pkg/shreder/program_dlmm.go
Normal file
@@ -0,0 +1,227 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
// For Metaora dlmm
|
||||
var dlmmProgramID = solana.MustPublicKeyFromBase58("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo")
|
||||
var (
|
||||
dlmmSwapIX = []byte{248, 198, 158, 145, 225, 117, 135, 200}
|
||||
dlmmSwap2IX = []byte{65, 75, 63, 76, 235, 91, 91, 136}
|
||||
dlmmSwapExactOutIX = []byte{250, 73, 101, 33, 38, 207, 75, 184}
|
||||
dlmmSwapExactOut2IX = []byte{43, 215, 247, 132, 137, 60, 243, 81}
|
||||
dlmmSwapPriceImpactIX = []byte{56, 173, 230, 208, 173, 228, 156, 205}
|
||||
dlmmSwapPriceImpact2IX = []byte{74, 98, 192, 214, 177, 51, 75, 51}
|
||||
)
|
||||
|
||||
type dlmmParsedArgs struct {
|
||||
AmountIn uint64
|
||||
AmountOut uint64
|
||||
ExactIn bool
|
||||
ExactOut bool
|
||||
ActiveBin int32
|
||||
MaxPriceImpactBps uint16
|
||||
}
|
||||
|
||||
func dlmmTokenOrder(tokenX, tokenY solana.PublicKey) (solana.PublicKey, solana.PublicKey) {
|
||||
switch {
|
||||
case tokenX.Equals(solana.WrappedSol):
|
||||
return tokenY, tokenX
|
||||
case tokenY.Equals(solana.WrappedSol):
|
||||
return tokenX, tokenY
|
||||
default:
|
||||
return tokenX, tokenY
|
||||
}
|
||||
}
|
||||
|
||||
func parseDlmmSwapArgs(disc []byte, payload []byte) (*dlmmParsedArgs, error) {
|
||||
switch {
|
||||
case bytes.Equal(disc, dlmmSwapIX), bytes.Equal(disc, dlmmSwap2IX):
|
||||
if len(payload) < 16 {
|
||||
return nil, fmt.Errorf("data too short for dlmm swap args, len=%d", len(payload))
|
||||
}
|
||||
return &dlmmParsedArgs{
|
||||
AmountIn: binary.LittleEndian.Uint64(payload[0:8]),
|
||||
AmountOut: binary.LittleEndian.Uint64(payload[8:16]),
|
||||
ExactIn: true,
|
||||
}, nil
|
||||
case bytes.Equal(disc, dlmmSwapExactOutIX), bytes.Equal(disc, dlmmSwapExactOut2IX):
|
||||
if len(payload) < 16 {
|
||||
return nil, fmt.Errorf("data too short for dlmm swap exact out args, len=%d", len(payload))
|
||||
}
|
||||
return &dlmmParsedArgs{
|
||||
AmountIn: binary.LittleEndian.Uint64(payload[0:8]),
|
||||
AmountOut: binary.LittleEndian.Uint64(payload[8:16]),
|
||||
ExactOut: true,
|
||||
}, nil
|
||||
case bytes.Equal(disc, dlmmSwapPriceImpactIX), bytes.Equal(disc, dlmmSwapPriceImpact2IX):
|
||||
if len(payload) < 11 {
|
||||
return nil, fmt.Errorf("data too short for dlmm swap with price impact args, len=%d", len(payload))
|
||||
}
|
||||
amountIn := binary.LittleEndian.Uint64(payload[0:8])
|
||||
idx := 8
|
||||
if len(payload) < idx+1 {
|
||||
return nil, fmt.Errorf("data too short for dlmm swap with price impact args, len=%d", len(payload))
|
||||
}
|
||||
activeBinTag := payload[idx]
|
||||
idx++
|
||||
var activeBin int32
|
||||
if activeBinTag == 1 {
|
||||
if len(payload) < idx+4 {
|
||||
return nil, fmt.Errorf("data too short for dlmm swap with price impact args, len=%d", len(payload))
|
||||
}
|
||||
activeBin = int32(binary.LittleEndian.Uint32(payload[idx : idx+4]))
|
||||
idx += 4
|
||||
} else if activeBinTag != 0 {
|
||||
return nil, fmt.Errorf("invalid active_id tag %d", activeBinTag)
|
||||
}
|
||||
if len(payload) < idx+2 {
|
||||
return nil, fmt.Errorf("data too short for dlmm swap with price impact args, len=%d", len(payload))
|
||||
}
|
||||
return &dlmmParsedArgs{
|
||||
AmountIn: amountIn,
|
||||
ExactIn: true,
|
||||
ActiveBin: activeBin,
|
||||
MaxPriceImpactBps: binary.LittleEndian.Uint16(payload[idx : idx+2]),
|
||||
}, nil
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
func parseDlmmInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) < 8 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
if len(instruction.Accounts) < 13 {
|
||||
return nil, nil // fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
disc := instruction.Data[:8]
|
||||
payload := instruction.Data[8:]
|
||||
|
||||
args, err := parseDlmmSwapArgs(disc, payload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if args == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
userTokenIn, err := tx.GetAccount(int(instruction.Accounts[4]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
userTokenOut, err := tx.GetAccount(int(instruction.Accounts[5]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tokenX, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tokenY, err := tx.GetAccount(int(instruction.Accounts[7]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[10]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tokenXProgram, err := tx.GetAccount(int(instruction.Accounts[11]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tokenYProgram, err := tx.GetAccount(int(instruction.Accounts[12]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
token0Mint, token1Mint := dlmmTokenOrder(tokenX, tokenY)
|
||||
var (
|
||||
token0AmountUint64 uint64
|
||||
token1AmountUint64 uint64
|
||||
)
|
||||
if !tokenX.Equals(solana.WrappedSol) && !tokenY.Equals(solana.WrappedSol) {
|
||||
return nil, nil
|
||||
}
|
||||
wsolProgram := tokenXProgram
|
||||
if tokenY.Equals(solana.WrappedSol) {
|
||||
wsolProgram = tokenYProgram
|
||||
}
|
||||
wsolAta, _, err := findAssociatedTokenAddressWithTokenProgram(user, solana.WrappedSol, wsolProgram)
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
wsolIn := userTokenIn.Equals(wsolAta)
|
||||
wsolOut := userTokenOut.Equals(wsolAta)
|
||||
if !wsolIn && !wsolOut {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
event := "sell"
|
||||
if wsolIn {
|
||||
event = "buy"
|
||||
}
|
||||
exactSol := (args.ExactIn && wsolIn) || (args.ExactOut && wsolOut)
|
||||
|
||||
if wsolIn {
|
||||
if args.ExactIn {
|
||||
token1AmountUint64 = args.AmountIn
|
||||
}
|
||||
if args.ExactOut {
|
||||
token0AmountUint64 = args.AmountOut
|
||||
}
|
||||
} else {
|
||||
if args.ExactOut {
|
||||
token1AmountUint64 = args.AmountOut
|
||||
}
|
||||
if args.ExactIn {
|
||||
token0AmountUint64 = args.AmountIn
|
||||
}
|
||||
}
|
||||
|
||||
token0Amount := formatTokenAmount(token0AmountUint64)
|
||||
if token0Mint.Equals(solana.WrappedSol) {
|
||||
token0Amount = formatSolAmount(token0AmountUint64)
|
||||
}
|
||||
token1Amount := decimal.Zero
|
||||
if token1AmountUint64 > 0 {
|
||||
if token1Mint.Equals(solana.WrappedSol) {
|
||||
token1Amount = formatSolAmount(token1AmountUint64)
|
||||
} else {
|
||||
token1Amount = formatTokenAmount(token1AmountUint64)
|
||||
}
|
||||
}
|
||||
|
||||
return TxSignalBatch{&TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "dlmm",
|
||||
Maker: user.String(),
|
||||
Token0Address: token0Mint.String(),
|
||||
Token1Address: token1Mint.String(),
|
||||
Token0Amount: token0Amount,
|
||||
Token1Amount: token1Amount,
|
||||
Program: "MeteoraDLMM",
|
||||
Event: event,
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: exactSol,
|
||||
ActiveBin: args.ActiveBin,
|
||||
MaxPriceImpactBps: args.MaxPriceImpactBps,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: token0AmountUint64,
|
||||
Token1AmountUint64: token1AmountUint64,
|
||||
}}, nil
|
||||
}
|
||||
72
pkg/shreder/program_f5tf.go
Normal file
72
pkg/shreder/program_f5tf.go
Normal file
@@ -0,0 +1,72 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
)
|
||||
|
||||
// only buy function with pump program
|
||||
var f5tfProgramID = solana.MustPublicKeyFromBase58("F5tfvbLog9VdGUPqBDTT8rgXvTTcq7e5UiGnupL1zvBq")
|
||||
var (
|
||||
f5tfBuyTokensIX = []byte{0}
|
||||
)
|
||||
|
||||
type f5tfBuyArgs struct {
|
||||
SolAmount uint64
|
||||
TokenAmount uint64
|
||||
}
|
||||
|
||||
func parseF5tfInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
if !matchMethod(instruction.Data, f5tfBuyTokensIX) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 7 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(instruction.Data) < 2 {
|
||||
return nil, fmt.Errorf("data too short for f5tf buy args len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
var args f5tfBuyArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)
|
||||
}
|
||||
|
||||
return TxSignalBatch{&TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "f5tf",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.TokenAmount),
|
||||
Token1Amount: formatSolAmount(args.SolAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.TokenAmount,
|
||||
Token1AmountUint64: args.SolAmount,
|
||||
}}, nil
|
||||
}
|
||||
71
pkg/shreder/program_fjsz.go
Normal file
71
pkg/shreder/program_fjsz.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
)
|
||||
|
||||
// only buy function with pump program
|
||||
var fjszProgramID = solana.MustPublicKeyFromBase58("FJsZbftBqRLfF7uqUKpm4s2goDr6xsQ5Q3mN7AFJB6hK")
|
||||
var (
|
||||
fjszBuyTokensIX = []byte{0xe7, 0x3f, 0x99, 0x83, 0xf3, 0xed, 0xe3, 0x3c}
|
||||
)
|
||||
|
||||
type fjszBuyArgs struct {
|
||||
SolAmount uint64
|
||||
TokenAmount uint64
|
||||
}
|
||||
|
||||
func parseFjszInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
|
||||
if !matchMethod(instruction.Data, fjszBuyTokensIX) {
|
||||
return nil, nil
|
||||
}
|
||||
if len(instruction.Accounts) < 7 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 16 {
|
||||
return nil, fmt.Errorf("data too short for fjzs buy args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var args fjszBuyArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[8:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)
|
||||
}
|
||||
|
||||
return TxSignalBatch{&TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "fjsz",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.TokenAmount),
|
||||
Token1Amount: formatSolAmount(args.SolAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.TokenAmount,
|
||||
Token1AmountUint64: args.SolAmount,
|
||||
}}, nil
|
||||
}
|
||||
218
pkg/shreder/program_flas.go
Normal file
218
pkg/shreder/program_flas.go
Normal file
@@ -0,0 +1,218 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var flasProgramID = solana.MustPublicKeyFromBase58("FLASHX8DrLbgeR8FcfNV1F5krxYcYMUdBkrP1EPBtxB9")
|
||||
var (
|
||||
flasBuyTokensIX = []byte{0x00, 0x1, 0x4}
|
||||
flasSellTokensIX = []byte{0x01, 0x1, 0x3}
|
||||
flasAmmBuyTokensIX = []byte{0x00, 0x2, 0x2}
|
||||
flasAmmSellTokensIX = []byte{0x01, 0x2, 0x2}
|
||||
)
|
||||
|
||||
type flasArgs struct {
|
||||
Amount1 uint64
|
||||
Amount2 uint64
|
||||
Placeholder [3]uint8
|
||||
}
|
||||
|
||||
func parseFlasInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
if len(instruction.Data) == 10 && instruction.Data[0] == 1 {
|
||||
return nil, nil
|
||||
}
|
||||
if len(instruction.Data) < 20 {
|
||||
return nil, fmt.Errorf("data too short for args flas instruction, len: %d", len(instruction.Data))
|
||||
}
|
||||
methodData := instruction.Data[17:20]
|
||||
//if !matchMethod(methodData, flasBuyTokensIX) {
|
||||
// return nil, nil
|
||||
//}
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
if matchMethod(methodData, flasBuyTokensIX) {
|
||||
txSignal, err = parseFlasBuy(tx, instructionIndex)
|
||||
} else if matchMethod(methodData, flasSellTokensIX) {
|
||||
txSignal, err = parseFlasSell(tx, instructionIndex)
|
||||
} else if matchMethod(methodData, flasAmmBuyTokensIX) {
|
||||
txSignal, err = parseFlasAmmBuy(tx, instructionIndex)
|
||||
} else if matchMethod(methodData, flasAmmSellTokensIX) {
|
||||
txSignal, err = parseFlasAmmSell(tx, instructionIndex)
|
||||
}
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func parseFlasAmmSell(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 10 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[9]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "flas",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.Amount1),
|
||||
Token1Amount: formatSolAmount(args.Amount2),
|
||||
Program: "PumpAMM",
|
||||
Event: "sell",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.Amount1,
|
||||
Token1AmountUint64: args.Amount2,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseFlasAmmBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 10 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[9]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "flas",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: decimal.Zero,
|
||||
Token1Amount: formatSolAmount(args.Amount1),
|
||||
Program: "PumpAMM",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: 0,
|
||||
Token1AmountUint64: args.Amount1,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseFlasSell(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 9 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[8]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "flas",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.Amount1),
|
||||
Token1Amount: formatSolAmount(args.Amount2),
|
||||
Program: "Pump",
|
||||
Event: "sell",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.Amount1,
|
||||
Token1AmountUint64: args.Amount2,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseFlasBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 9 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[8]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(instruction.Data) > 20 {
|
||||
instruction.Data = instruction.Data[:20]
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "flas",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.Amount2),
|
||||
Token1Amount: formatSolAmount(args.Amount1),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.Amount2,
|
||||
Token1AmountUint64: args.Amount1,
|
||||
}, nil
|
||||
}
|
||||
78
pkg/shreder/program_gmgn.go
Normal file
78
pkg/shreder/program_gmgn.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
)
|
||||
|
||||
var gmgnProgramID = solana.MustPublicKeyFromBase58("GMgnVFR8Jb39LoXsEVzb3DvBy3ywCmdmJquHUy1Lrkqb")
|
||||
var (
|
||||
gmgnBuyTokensIX = []byte{0x66, 0x06, 0x3d, 0x12, 0x01, 0xda, 0xeb, 0xea}
|
||||
)
|
||||
|
||||
func parseGMGNInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
if len(instruction.Data) < 8 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
if matchMethod(instruction.Data, gmgnBuyTokensIX) {
|
||||
txSignal, err = parseGMGNBuy(tx, instruction)
|
||||
}
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func parseGMGNBuy(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 24 {
|
||||
return nil, fmt.Errorf("data too short for gmgn buy args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
solAmount := binary.LittleEndian.Uint64(instruction.Data[8:16])
|
||||
tokenAmount := binary.LittleEndian.Uint64(instruction.Data[16:24])
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "gmgn",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(tokenAmount),
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
}, nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
367
pkg/shreder/program_okxonchainlab.go
Normal file
367
pkg/shreder/program_okxonchainlab.go
Normal file
@@ -0,0 +1,367 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
bin "github.com/gagliardetto/binary"
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var (
|
||||
okxDexRouteV2ProgramID = solana.MustPublicKeyFromBase58("proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u")
|
||||
okxDexRouteV2ProgramIDString = okxDexRouteV2ProgramID.String()
|
||||
|
||||
okxSwapTobDisc = []byte{170, 41, 85, 177, 132, 80, 31, 53}
|
||||
okxSwapTobWithReceiverDisc = []byte{223, 170, 216, 234, 204, 6, 241, 25}
|
||||
okxSwapTocDisc = []byte{187, 201, 212, 51, 16, 155, 236, 60}
|
||||
okxSwapTocV2Disc = []byte{127, 214, 107, 189, 23, 90, 47, 104}
|
||||
)
|
||||
|
||||
// IDL: SwapArgs { order_id:u64, amount_in:u64, expect_amount_out:u64, slippage:u16, routes: Vec<Route> }
|
||||
// IDL: Route { dex: Dex(enum), weight:u16, index:u8 }
|
||||
|
||||
type OkxV2Route struct {
|
||||
Dex OkxV2SwapKind
|
||||
Weight uint16
|
||||
Index uint8
|
||||
}
|
||||
|
||||
type OkxV2SwapArgs struct {
|
||||
OrderID uint64
|
||||
AmountIn uint64
|
||||
ExpectAmountOut uint64
|
||||
Slippage uint16
|
||||
Routes []OkxV2Route
|
||||
}
|
||||
|
||||
type OkxV2SwapKind uint8
|
||||
|
||||
const (
|
||||
OKCV2_SplTokenSwap OkxV2SwapKind = iota
|
||||
OKCV2_StableSwap
|
||||
OKCV2_Whirlpool
|
||||
OKCV2_MeteoraDynamicpool
|
||||
OKCV2_RaydiumSwap
|
||||
OKCV2_RaydiumStableSwap
|
||||
OKCV2_RaydiumClmmSwap
|
||||
OKCV2_AldrinExchangeV1
|
||||
OKCV2_AldrinExchangeV2
|
||||
OKCV2_LifinityV1
|
||||
OKCV2_LifinityV2
|
||||
OKCV2_RaydiumClmmSwapV2
|
||||
OKCV2_FluxBeam
|
||||
OKCV2_MeteoraDlmm
|
||||
OKCV2_RaydiumCpmmSwap
|
||||
OKCV2_OpenBookV2
|
||||
OKCV2_WhirlpoolV2
|
||||
OKCV2_Phoenix
|
||||
OKCV2_ObricV2
|
||||
OKCV2_SanctumAddLiq
|
||||
OKCV2_SanctumRemoveLiq
|
||||
OKCV2_SanctumNonWsolSwap
|
||||
OKCV2_SanctumWsolSwap
|
||||
OKCV2_PumpfunBuy
|
||||
OKCV2_PumpfunSell
|
||||
OKCV2_StabbleSwap
|
||||
OKCV2_SanctumRouter
|
||||
OKCV2_MeteoraVaultDeposit
|
||||
OKCV2_MeteoraVaultWithdraw
|
||||
OKCV2_Saros
|
||||
OKCV2_MeteoraLst
|
||||
OKCV2_Solfi
|
||||
OKCV2_QualiaSwap
|
||||
OKCV2_Zerofi
|
||||
OKCV2_PumpfunammBuy
|
||||
OKCV2_PumpfunammSell
|
||||
OKCV2_Virtuals
|
||||
OKCV2_VertigoBuy
|
||||
OKCV2_VertigoSell
|
||||
OKCV2_PerpetualsAddLiq
|
||||
OKCV2_PerpetualsRemoveLiq
|
||||
OKCV2_PerpetualsSwap
|
||||
OKCV2_RaydiumLaunchpad
|
||||
OKCV2_LetsBonkFun
|
||||
OKCV2_Woofi
|
||||
OKCV2_MeteoraDbc
|
||||
OKCV2_MeteoraDlmmSwap2
|
||||
OKCV2_MeteoraDAMMV2
|
||||
OKCV2_Gavel
|
||||
OKCV2_BoopfunBuy
|
||||
OKCV2_BoopfunSell
|
||||
OKCV2_MeteoraDbc2
|
||||
OKCV2_GooseFX
|
||||
OKCV2_Dooar
|
||||
OKCV2_Numeraire
|
||||
OKCV2_SaberDecimalWrapperDeposit
|
||||
OKCV2_SaberDecimalWrapperWithdraw
|
||||
OKCV2_SarosDlmm
|
||||
OKCV2_OneDexSwap
|
||||
OKCV2_Manifest
|
||||
OKCV2_ByrealClmm
|
||||
OKCV2_PancakeSwapV3Swap
|
||||
OKCV2_PancakeSwapV3SwapV2
|
||||
OKCV2_Tessera
|
||||
OKCV2_SolRfq
|
||||
OKCV2_Humidifi
|
||||
OKCV2_HeavenBuy
|
||||
OKCV2_HeavenSell
|
||||
OKCV2_SolfiV2
|
||||
OKCV2_Goonfi
|
||||
OKCV2_MoonitBuy
|
||||
OKCV2_MoonitSell
|
||||
OKCV2_RaydiumSwapV2
|
||||
OKCV2_Whalestreet
|
||||
OKCV2_SugarMoneyBuy
|
||||
OKCV2_SugarMoneySell
|
||||
OKCV2_MeteoraDAMMV2Swap2
|
||||
OKCV2_AlphaQ
|
||||
OKCV2_FutarchyAmm
|
||||
OKCV2_PumpfunBuy2
|
||||
OKCV2_PumpfunSell2
|
||||
OKCV2_HumidifiSwap2
|
||||
OKCV2_Scorch
|
||||
OKCV2_JupiterLendDeposit
|
||||
OKCV2_JupiterLendRedeem
|
||||
OKCV2_TokkaAmm
|
||||
)
|
||||
|
||||
func decodeOkxSwapTobSwapArgs(data []byte) (*OkxV2SwapArgs, error) {
|
||||
dec := bin.NewBorshDecoder(data)
|
||||
return decodeOkxV2SwapArgs(dec)
|
||||
}
|
||||
|
||||
func decodeOkxSwapTobWithReceiverSwapArgs(data []byte) (*OkxV2SwapArgs, error) {
|
||||
dec := bin.NewBorshDecoder(data)
|
||||
return decodeOkxV2SwapArgs(dec)
|
||||
}
|
||||
|
||||
func decodeOkxSwapTocSwapArgs(data []byte) (*OkxV2SwapArgs, error) {
|
||||
dec := bin.NewBorshDecoder(data)
|
||||
return decodeOkxV2SwapArgs(dec)
|
||||
}
|
||||
|
||||
func decodeOkxSwapTocV2SwapArgs(data []byte) (*OkxV2SwapArgs, error) {
|
||||
dec := bin.NewBorshDecoder(data)
|
||||
return decodeOkxV2SwapArgs(dec)
|
||||
}
|
||||
|
||||
func skipOkxV2DexPayload(dec *bin.Decoder, dex OkxV2SwapKind) error {
|
||||
// IMPORTANT: In IDL, Dex is an enum. Most variants have no fields, but some carry payload.
|
||||
// We only need to keep decoding aligned for SwapArgs.routes.
|
||||
switch dex {
|
||||
case OKCV2_SolRfq:
|
||||
// fields: 6*u64 + 2*bool
|
||||
// rfq_id, expected_maker_amount, expected_taker_amount, maker_send_amount,
|
||||
// taker_send_amount, expiry, maker_use_native_sol, taker_use_native_sol
|
||||
if err := dec.SkipBytes(8 * 6); err != nil {
|
||||
return err
|
||||
}
|
||||
return dec.SkipBytes(2)
|
||||
case OKCV2_SugarMoneyBuy, OKCV2_SugarMoneySell:
|
||||
// fields: u8 + u8
|
||||
return dec.SkipBytes(2)
|
||||
case OKCV2_HumidifiSwap2:
|
||||
// fields: u64
|
||||
return dec.SkipBytes(8)
|
||||
case OKCV2_Scorch:
|
||||
// fields: u128 => 16 bytes
|
||||
return dec.SkipBytes(16)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func decodeOkxV2SwapArgs(dec *bin.Decoder) (*OkxV2SwapArgs, error) {
|
||||
out := &OkxV2SwapArgs{}
|
||||
var err error
|
||||
|
||||
if out.OrderID, err = dec.ReadUint64(binary.LittleEndian); err != nil {
|
||||
return nil, fmt.Errorf("read order_id: %w", err)
|
||||
}
|
||||
if out.AmountIn, err = dec.ReadUint64(binary.LittleEndian); err != nil {
|
||||
return nil, fmt.Errorf("read amount_in: %w", err)
|
||||
}
|
||||
if out.ExpectAmountOut, err = dec.ReadUint64(binary.LittleEndian); err != nil {
|
||||
return nil, fmt.Errorf("read expect_amount_out: %w", err)
|
||||
}
|
||||
if out.Slippage, err = dec.ReadUint16(binary.LittleEndian); err != nil {
|
||||
return nil, fmt.Errorf("read slippage: %w", err)
|
||||
}
|
||||
|
||||
// routes: Vec<Route>
|
||||
routesLen, err := dec.ReadUint32(binary.LittleEndian)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read routes len: %w", err)
|
||||
}
|
||||
out.Routes = make([]OkxV2Route, 0, routesLen)
|
||||
for i := uint32(0); i < routesLen; i++ {
|
||||
// Route { dex: Dex(enum tag u8 [+ payload]), weight: u16, index: u8 }
|
||||
tag, err := dec.ReadUint8()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read routes[%d].dex: %w", i, err)
|
||||
}
|
||||
dex := OkxV2SwapKind(tag)
|
||||
if err := skipOkxV2DexPayload(dec, dex); err != nil {
|
||||
return nil, fmt.Errorf("skip routes[%d].dex payload (%d): %w", i, tag, err)
|
||||
}
|
||||
weight, err := dec.ReadUint16(binary.LittleEndian)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read routes[%d].weight: %w", i, err)
|
||||
}
|
||||
idx, err := dec.ReadUint8()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read routes[%d].index: %w", i, err)
|
||||
}
|
||||
out.Routes = append(out.Routes, OkxV2Route{Dex: dex, Weight: weight, Index: idx})
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type OkxV2SwapSolRfq struct {
|
||||
RfqId uint64
|
||||
expectedMakerAmount uint64
|
||||
expectedTakerAmount uint64
|
||||
makerSendAmount uint64
|
||||
takerSendAmount uint64
|
||||
expiry uint64
|
||||
makerUseNativeSol bool
|
||||
takerUseNativeSol bool
|
||||
}
|
||||
type OkxV2SwapSugarMoney struct {
|
||||
BondingCurveBump uint8
|
||||
|
||||
BondingCurveSolAssociatedAccountBump uint8
|
||||
}
|
||||
|
||||
type OkxV2SwapHumidifiSwap2 struct {
|
||||
SwapId uint64
|
||||
}
|
||||
|
||||
type OkxV2SwapScorch struct {
|
||||
Id [16]byte
|
||||
}
|
||||
|
||||
func parseOkxDexRouteV2Instruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
ix := tx.Instructions[instructionIndex]
|
||||
if len(ix.Data) < 8 {
|
||||
return nil, nil
|
||||
}
|
||||
disc := ix.Data[:8]
|
||||
data := ix.Data[8:]
|
||||
|
||||
var (
|
||||
args *OkxV2SwapArgs
|
||||
err error
|
||||
)
|
||||
switch {
|
||||
case bytes.Equal(disc, okxSwapTobDisc):
|
||||
args, err = decodeOkxSwapTobSwapArgs(data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode swap_tob args: %w", err)
|
||||
}
|
||||
|
||||
case bytes.Equal(disc, okxSwapTobWithReceiverDisc):
|
||||
args, err = decodeOkxSwapTobWithReceiverSwapArgs(data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode swap_tob_with_receiver args: %w", err)
|
||||
}
|
||||
case bytes.Equal(disc, okxSwapTocDisc):
|
||||
args, err = decodeOkxSwapTocSwapArgs(data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode swap_toc args: %w", err)
|
||||
}
|
||||
|
||||
case bytes.Equal(disc, okxSwapTocV2Disc):
|
||||
args, err = decodeOkxSwapTocV2SwapArgs(data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode swap_toc_v2 args: %w", err)
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
if len(ix.Accounts) < 15 {
|
||||
return nil, fmt.Errorf("invalid account count: %d", len(ix.Accounts))
|
||||
}
|
||||
var (
|
||||
inputAmount uint64
|
||||
routeCount int
|
||||
)
|
||||
for _, route := range args.Routes {
|
||||
if route.Index == 1 && (route.Dex == OKCV2_PumpfunammSell ||
|
||||
route.Dex == OKCV2_PumpfunSell2) {
|
||||
routeCount++
|
||||
inputAmount = args.AmountIn * uint64(route.Weight) / 10000
|
||||
}
|
||||
}
|
||||
if routeCount > 1 {
|
||||
logger.Warn("pumpSwapSell at inputIdx=0: multiple instances found", "tx", tx.Signatures[0].String(), "routeCount", routeCount)
|
||||
return nil, nil
|
||||
}
|
||||
if inputAmount == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
srcMint, err := tx.GetAccount(int(ix.Accounts[3]))
|
||||
|
||||
var (
|
||||
srcIdx uint8
|
||||
)
|
||||
if len(ix.Accounts) <= 15 {
|
||||
return nil, nil
|
||||
}
|
||||
accounts := ix.Accounts[14:]
|
||||
for i, acctIdx := range accounts {
|
||||
key, err := tx.GetAccount(int(acctIdx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if key.Equals(pumpAmmProgramID) {
|
||||
srcIdx = uint8(i + 6)
|
||||
break
|
||||
}
|
||||
}
|
||||
if srcIdx == 0 || int(srcIdx+1) >= len(accounts) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
baseMint, err := tx.GetAccount(int(accounts[srcIdx]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !baseMint.Equals(srcMint) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
quoteMint, err := tx.GetAccount(int(accounts[srcIdx+1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !quoteMint.Equals(solana.WrappedSol) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return TxSignalBatch{&TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Maker: tx.StaticAccountKeys[0].String(),
|
||||
Token0Address: baseMint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(inputAmount),
|
||||
Token1Amount: decimal.Zero,
|
||||
Event: "sell",
|
||||
Program: "PumpAMM",
|
||||
IsProcessed: false,
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: false,
|
||||
Token0AmountUint64: inputAmount,
|
||||
Token1AmountUint64: 0,
|
||||
}}, nil
|
||||
}
|
||||
156
pkg/shreder/program_photon.go
Normal file
156
pkg/shreder/program_photon.go
Normal file
@@ -0,0 +1,156 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
)
|
||||
|
||||
// only pump.fun function
|
||||
var photonProgramID = solana.MustPublicKeyFromBase58("BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW")
|
||||
var (
|
||||
photonBuyPumpTokensIX = []byte{0x52, 0xe1, 0x77, 0xe7, 0x4e, 0x1d, 0x2d, 0x46}
|
||||
photonSwapPumpAmmIX = []byte{0x2c, 0x77, 0xaf, 0xda, 0xc7, 0x4d, 0xc4, 0xeb}
|
||||
)
|
||||
|
||||
type photonBuyPumpArgs struct {
|
||||
Timestamp uint64
|
||||
SolAmount uint64
|
||||
TokenAmount uint64
|
||||
Fee uint64
|
||||
}
|
||||
|
||||
type photonSwapPumpAmmArgs struct {
|
||||
FromAmount uint64
|
||||
ToAmount uint64
|
||||
}
|
||||
|
||||
func parsePhotonInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
if len(instruction.Data) < 8 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
switch {
|
||||
case bytes.Equal(instruction.Data[:8], photonBuyPumpTokensIX):
|
||||
txSignal, err = parsePhotonBuy(tx, instruction)
|
||||
case bytes.Equal(instruction.Data[:8], photonSwapPumpAmmIX):
|
||||
txSignal, err = parsePhotonSwap(tx, instruction)
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func parsePhotonBuy(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 16 {
|
||||
return nil, fmt.Errorf("data too short for photon buy args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[7]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var args photonBuyPumpArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[8:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)
|
||||
}
|
||||
|
||||
solAmount := args.SolAmount * (100000000 - 1234568) / 100000000
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "photon",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.TokenAmount),
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.TokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parsePhotonSwap(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 16 {
|
||||
return nil, fmt.Errorf("data too short for swap args for photon. len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
base, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
quote, err := tx.GetAccount(int(instruction.Accounts[4]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !quote.Equals(solana.WrappedSol) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
buyer, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var args photonSwapPumpAmmArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[8:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse swap pump amm tokens args: %w", err)
|
||||
}
|
||||
|
||||
if args.FromAmount > args.ToAmount {
|
||||
// sell; ignore
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
solAmount := args.FromAmount * (100000000 - 1234568) / 100000000
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "photon",
|
||||
Maker: buyer.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.ToAmount),
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "PumpAMM",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.ToAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
}, nil
|
||||
}
|
||||
256
pkg/shreder/program_pump.go
Normal file
256
pkg/shreder/program_pump.go
Normal file
@@ -0,0 +1,256 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var pumpProgramID = solana.MustPublicKeyFromBase58("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P")
|
||||
var (
|
||||
pumpCreateCoinIX = []byte{24, 30, 200, 40, 5, 28, 7, 119}
|
||||
pumpCreateCoinV2IX = []byte{214, 144, 76, 236, 95, 139, 49, 180}
|
||||
pumpExtendedSellIX = []byte{51, 230, 133, 164, 1, 127, 131, 173}
|
||||
pumpBuyTokensIX = []byte{102, 6, 61, 18, 1, 218, 235, 234}
|
||||
pumpBuyV2TokensIX = []byte{56, 252, 116, 8, 158, 223, 205, 95}
|
||||
)
|
||||
|
||||
type pumpExtendedSellArgs struct {
|
||||
Amount uint64
|
||||
MinSolOutput uint64
|
||||
}
|
||||
|
||||
type pumpBuyArgs struct {
|
||||
Amount uint64
|
||||
MaxSolCost uint64
|
||||
}
|
||||
|
||||
type pumpCreateCoinV2Args struct {
|
||||
Name string
|
||||
Symbol string
|
||||
Uri string
|
||||
Creator solana.PublicKey
|
||||
IsMayhemMode bool
|
||||
}
|
||||
|
||||
func parsePumpInstruction(msg VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
|
||||
instruction := msg.Instructions[instructionIndex]
|
||||
if len(instruction.Data) < 8 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
if matchMethod(instruction.Data[0:8], pumpBuyV2TokensIX) || matchMethod(instruction.Data[0:8], pumpBuyTokensIX) {
|
||||
txSignal, err = parsePumpBuy(msg, instruction)
|
||||
} else if matchMethod(instruction.Data[0:8], pumpExtendedSellIX) {
|
||||
txSignal, err = parsePumpSell(msg, instruction)
|
||||
} else if matchMethod(instruction.Data[0:8], pumpCreateCoinIX) {
|
||||
txSignal, err = parsePumpCreate(msg, instruction)
|
||||
} else if matchMethod(instruction.Data[0:8], pumpCreateCoinV2IX) {
|
||||
txSignal, err = parsePumpCreateV2(msg, instruction)
|
||||
}
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
return nil, err
|
||||
|
||||
}
|
||||
|
||||
func parsePumpCreate(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
creator, err := tx.GetAccount(int(instruction.Accounts[7]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "pump",
|
||||
Maker: creator.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: decimal.Zero,
|
||||
Token1Amount: decimal.Zero,
|
||||
Program: "Pump",
|
||||
Event: "create",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: 0,
|
||||
Token1AmountUint64: 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parsePumpCreateV2(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 8 {
|
||||
return nil, fmt.Errorf("data too short for pump create v2 args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tokenProgramKey, err := tx.GetAccount(int(instruction.Accounts[7]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var args pumpCreateCoinV2Args
|
||||
if err := borsh.Deserialize(&args, instruction.Data[8:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse create coin v2 args: %w", err)
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "pump",
|
||||
Maker: args.Creator.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: decimal.Zero,
|
||||
Token1Amount: decimal.Zero,
|
||||
Program: "Pump",
|
||||
Event: "create",
|
||||
IsToken2022: tokenProgramKey.String() != tokenProgram,
|
||||
IsMayhemMode: args.IsMayhemMode,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: 0,
|
||||
Token1AmountUint64: 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func decodePumpBuyArgs(data []byte) (uint64, uint64, error) {
|
||||
if len(data) < 9 {
|
||||
return 0, 0, fmt.Errorf("data too short for pump buy buy args, len=%d", len(data))
|
||||
}
|
||||
|
||||
var args pumpBuyArgs
|
||||
if err := borsh.Deserialize(&args, data[8:]); err == nil {
|
||||
return args.Amount, args.MaxSolCost, nil
|
||||
}
|
||||
|
||||
if len(data) >= 24 {
|
||||
amount := binary.LittleEndian.Uint64(data[8:16])
|
||||
maxSol := binary.LittleEndian.Uint64(data[16:24])
|
||||
return amount, maxSol, nil
|
||||
}
|
||||
|
||||
return 0, 0, fmt.Errorf("failed to parse buy tokens args")
|
||||
}
|
||||
|
||||
func parsePumpBuy(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
amount, sol, err := decodePumpBuyArgs(instruction.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
exactIn := false
|
||||
if matchMethod(instruction.Data, pumpBuyV2TokensIX) {
|
||||
temp := amount
|
||||
amount = sol
|
||||
sol = temp
|
||||
exactIn = true
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 7 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
buyer, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "pump",
|
||||
Maker: buyer.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amount),
|
||||
Token1Amount: formatSolAmount(sol),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
ExactSOL: exactIn,
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: amount,
|
||||
Token1AmountUint64: sol,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func decodePumpSellArgs(data []byte) (uint64, uint64, error) {
|
||||
if len(data) < 9 {
|
||||
return 0, 0, fmt.Errorf("data too short for pump sell sell args, len=%d", len(data))
|
||||
}
|
||||
|
||||
var args pumpExtendedSellArgs
|
||||
if err := borsh.Deserialize(&args, data[8:]); err == nil {
|
||||
return args.Amount, args.MinSolOutput, nil
|
||||
}
|
||||
|
||||
if len(data) >= 24 {
|
||||
amount := binary.LittleEndian.Uint64(data[8:16])
|
||||
minSol := binary.LittleEndian.Uint64(data[16:24])
|
||||
return amount, minSol, nil
|
||||
}
|
||||
|
||||
return 0, 0, fmt.Errorf("failed to parse sell tokens args")
|
||||
}
|
||||
|
||||
func parsePumpSell(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
amount, minSol, err := decodePumpSellArgs(instruction.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 7 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
seller, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "pump",
|
||||
Maker: seller.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amount),
|
||||
Token1Amount: formatSolAmount(minSol),
|
||||
Program: "Pump",
|
||||
Event: "sell",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: amount,
|
||||
Token1AmountUint64: minSol,
|
||||
}, nil
|
||||
}
|
||||
166
pkg/shreder/program_pumpamm.go
Normal file
166
pkg/shreder/program_pumpamm.go
Normal file
@@ -0,0 +1,166 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
)
|
||||
|
||||
var pumpAmmProgramID = solana.MustPublicKeyFromBase58("pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA")
|
||||
var (
|
||||
pumpAmmBuyTokensV2IX = []byte{198, 46, 21, 82, 180, 217, 232, 112}
|
||||
pumpAmmBuyTokensIX = []byte{102, 6, 61, 18, 1, 218, 235, 234}
|
||||
pumpAmmSellTokensIX = []byte{51, 230, 133, 164, 1, 127, 131, 173}
|
||||
)
|
||||
|
||||
type pumpAmmBuyArgs struct {
|
||||
Amount uint64
|
||||
MaxSolCost uint64
|
||||
}
|
||||
|
||||
func parsePumpAmmInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
if matchMethod(instruction.Data, pumpAmmBuyTokensIX) || matchMethod(instruction.Data, pumpAmmBuyTokensV2IX) {
|
||||
txSignal, err = parsePumpAmmBuy(tx, instruction)
|
||||
} else if matchMethod(instruction.Data, pumpAmmSellTokensIX) {
|
||||
txSignal, err = parsePumpAmmSell(tx, instruction)
|
||||
}
|
||||
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
|
||||
return nil, err
|
||||
|
||||
}
|
||||
|
||||
func decodePumpAmmBuyArgs(data []byte) (uint64, uint64, error) {
|
||||
if len(data) < 9 {
|
||||
return 0, 0, fmt.Errorf("data too short for pump amm buy args, len=%d", len(data))
|
||||
}
|
||||
|
||||
var args pumpAmmBuyArgs
|
||||
if err := borsh.Deserialize(&args, data[8:]); err == nil {
|
||||
return args.Amount, args.MaxSolCost, nil
|
||||
}
|
||||
|
||||
if len(data) >= 24 {
|
||||
amount := binary.LittleEndian.Uint64(data[8:16])
|
||||
maxSol := binary.LittleEndian.Uint64(data[16:24])
|
||||
return amount, maxSol, nil
|
||||
}
|
||||
|
||||
return 0, 0, fmt.Errorf("failed to parse buy tokens args")
|
||||
}
|
||||
|
||||
func parsePumpAmmBuy(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
amount, maxSol, err := decodePumpAmmBuyArgs(instruction.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
exactIn := false
|
||||
if matchMethod(instruction.Data, pumpAmmBuyTokensV2IX) {
|
||||
temp := amount
|
||||
amount = maxSol
|
||||
maxSol = temp
|
||||
exactIn = true
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 7 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
base, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
quote, err := tx.GetAccount(int(instruction.Accounts[4]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !quote.Equals(solana.WrappedSol) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
buyer, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "pumpamm",
|
||||
Maker: buyer.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amount),
|
||||
Token1Amount: formatSolAmount(maxSol),
|
||||
Program: "PumpAMM",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: exactIn,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: amount,
|
||||
Token1AmountUint64: maxSol,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parsePumpAmmSell(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
amount, minSol, err := decodePumpAmmBuyArgs(instruction.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 7 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
base, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
quote, err := tx.GetAccount(int(instruction.Accounts[4]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !quote.Equals(solana.WrappedSol) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
buyer, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "pumpamm",
|
||||
Maker: buyer.String(),
|
||||
Token0Address: base.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(amount),
|
||||
Token1Amount: formatSolAmount(minSol),
|
||||
Program: "PumpAMM",
|
||||
Event: "sell",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: amount,
|
||||
Token1AmountUint64: minSol,
|
||||
}, nil
|
||||
}
|
||||
166
pkg/shreder/program_qtkv.go
Normal file
166
pkg/shreder/program_qtkv.go
Normal file
@@ -0,0 +1,166 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/near/borsh-go"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var qtkvProgramID = solana.MustPublicKeyFromBase58("qtkvapJEvRWWrB7i5K6RaA1kvq5x3qmMKZ98ad71XQ7")
|
||||
var (
|
||||
qtkvBuyTokensIX = []byte{0x02}
|
||||
qtkvSellTokensIX = []byte{0x03}
|
||||
qtkvAmmSellTokensIX = []byte{0x05}
|
||||
)
|
||||
|
||||
type qtkvBuyArgs struct {
|
||||
Placeholder uint64
|
||||
TokenNumber uint64
|
||||
SolAmount uint64
|
||||
}
|
||||
|
||||
func parseQtkvInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
if matchMethod(instruction.Data, qtkvBuyTokensIX) {
|
||||
txSignal, err = parseQtkvBuy(tx, instructionIndex)
|
||||
} else if matchMethod(instruction.Data, qtkvAmmSellTokensIX) {
|
||||
txSignal, err = parseQtkvAmmSell(tx, instructionIndex)
|
||||
} else if matchMethod(instruction.Data, qtkvSellTokensIX) {
|
||||
txSignal, err = parseQtkvSell(tx, instructionIndex)
|
||||
}
|
||||
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func parseQtkvSell(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 11 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 24 {
|
||||
return nil, fmt.Errorf("data too short for qtkv sell args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[10]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// in sell, sol amount is not directly provided, so we set it to 0
|
||||
tokenAmount := binary.LittleEndian.Uint64(instruction.Data[19:25])
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "qtkv",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(tokenAmount),
|
||||
Token1Amount: decimal.Zero,
|
||||
Program: "Pump",
|
||||
Event: "sell",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseQtkvAmmSell(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 11 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
if len(instruction.Data) < 24 {
|
||||
return nil, fmt.Errorf("data too short for qtkv amm sell args, len=%d", len(instruction.Data))
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[10]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// in sell, sol amount is not directly provided, so we set it to 0
|
||||
tokenAmount := binary.LittleEndian.Uint64(instruction.Data[19:25])
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "qtkv",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(tokenAmount),
|
||||
Token1Amount: decimal.Zero,
|
||||
Program: "PumpAMM",
|
||||
Event: "sell",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseQtkvBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var args qtkvBuyArgs
|
||||
if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "qtkv",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(args.TokenNumber),
|
||||
Token1Amount: formatSolAmount(args.SolAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: args.TokenNumber,
|
||||
Token1AmountUint64: args.SolAmount,
|
||||
}, nil
|
||||
}
|
||||
155
pkg/shreder/program_term.go
Normal file
155
pkg/shreder/program_term.go
Normal file
@@ -0,0 +1,155 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
)
|
||||
|
||||
var terminalProgramID = solana.MustPublicKeyFromBase58("term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3")
|
||||
var (
|
||||
terminalBuyTokensIX = []byte{0xa6, 0x54, 0x14, 0x96, 0x9f, 0x77, 0x59, 0xca}
|
||||
terminalSellTokensIX = []byte{0xbe, 0x84, 0xa2, 0x96, 0x93, 0x7c, 0xf8, 0x6b}
|
||||
terminalAmmSellTokensIX = []byte{0x40, 0x64, 0x97, 0xb9, 0x16, 0xfa, 0xec, 0xb1}
|
||||
)
|
||||
|
||||
func parseTermInstruction(tx VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
if instructionIndex >= len(tx.Instructions) {
|
||||
return nil, fmt.Errorf("instruction index out of bounds")
|
||||
}
|
||||
|
||||
instruction := tx.Instructions[instructionIndex]
|
||||
if len(instruction.Data) == 0 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
}
|
||||
if len(instruction.Data) < 24 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
txSignal *TxSignal
|
||||
)
|
||||
switch {
|
||||
case bytes.Equal(instruction.Data[:8], terminalBuyTokensIX):
|
||||
txSignal, err = parseTermBuy(tx, instruction)
|
||||
case bytes.Equal(instruction.Data[:8], terminalSellTokensIX):
|
||||
txSignal, err = parseTermSell(tx, instruction)
|
||||
case bytes.Equal(instruction.Data[:8], terminalAmmSellTokensIX):
|
||||
txSignal, err = parseTermAmmSell(tx, instruction)
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if txSignal != nil {
|
||||
return TxSignalBatch{txSignal}, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func parseTermAmmSell(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[1]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
solAmount := binary.LittleEndian.Uint64(instruction.Data[8:16])
|
||||
tokenAmount := binary.LittleEndian.Uint64(instruction.Data[16:24])
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "term",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(tokenAmount),
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseTermBuy(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
solAmount := binary.LittleEndian.Uint64(instruction.Data[8:16])
|
||||
tokenAmount := binary.LittleEndian.Uint64(instruction.Data[16:24])
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "term",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(tokenAmount),
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parseTermSell(tx VersionedTransaction, instruction Instructions) (*TxSignal, error) {
|
||||
if len(instruction.Accounts) < 8 {
|
||||
return nil, fmt.Errorf("accounts too short")
|
||||
}
|
||||
mint, err := tx.GetAccount(int(instruction.Accounts[2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := tx.GetAccount(int(instruction.Accounts[6]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tokenAmount := binary.LittleEndian.Uint64(instruction.Data[8:16])
|
||||
solAmount := binary.LittleEndian.Uint64(instruction.Data[16:24])
|
||||
|
||||
return &TxSignal{
|
||||
TxHash: tx.Signatures[0].String(),
|
||||
Label: "term",
|
||||
Maker: user.String(),
|
||||
Token0Address: mint.String(),
|
||||
Token1Address: wsolMint,
|
||||
Token0Amount: formatTokenAmount(tokenAmount),
|
||||
Token1Amount: formatSolAmount(solAmount),
|
||||
Program: "Pump",
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
}, nil
|
||||
}
|
||||
@@ -48,15 +48,18 @@ type TxSignal struct {
|
||||
|
||||
ExactSOL bool `json:"exact_in"`
|
||||
|
||||
//Just for metaora DLMM
|
||||
// ActiveBin is the active bin id provided by swap_with_price_impact(2).
|
||||
ActiveBin int32 `json:"active_bin"`
|
||||
// MaxPriceImpactBps is the price impact guard for swap_with_price_impact(2).
|
||||
MaxPriceImpactBps uint16 `json:"max_price_impact_bps"`
|
||||
|
||||
// parsed values
|
||||
Token0AmountUint64 uint64 `json:"-"`
|
||||
Token1AmountUint64 uint64 `json:"-"`
|
||||
}
|
||||
|
||||
func (t *TxSignal) Parse() *TxSignal {
|
||||
t.Token0AmountUint64 = t.Token0Amount.Mul(decimal.New(1, TokenDecimals)).BigInt().Uint64()
|
||||
t.Token1AmountUint64 = t.Token1Amount.Mul(decimal.New(1, SolDecimals)).BigInt().Uint64()
|
||||
return t
|
||||
ParseStart time.Time `json:"parse_start"`
|
||||
ParseEnd time.Time `json:"parse_end"`
|
||||
}
|
||||
|
||||
type TxSignalBatch = []*TxSignal
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
437
pkg/shreder/txparser_test.go
Normal file
437
pkg/shreder/txparser_test.go
Normal file
@@ -0,0 +1,437 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
"github.com/gagliardetto/solana-go/rpc"
|
||||
"github.com/near/borsh-go"
|
||||
)
|
||||
|
||||
func TestDecodeAxiomArgs(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
hexData string
|
||||
}{
|
||||
{
|
||||
name: "pump amm sell Test 0",
|
||||
hexData: "00686f08bb1b0000007eb4ac020000000001020200183c",
|
||||
},
|
||||
{
|
||||
name: "pump amm buy Test 1",
|
||||
hexData: "00c09ee6050000000001c94d882600000000020200323c",
|
||||
},
|
||||
{
|
||||
name: "pump buy Test 2",
|
||||
hexData: "00d8d3bc0000000000bb7c53f009000000000104185a",
|
||||
},
|
||||
{
|
||||
name: "pump sell Test 3",
|
||||
hexData: "009bbf69ec08080000830bc61200000000010103a000",
|
||||
},
|
||||
{
|
||||
name: "pump swap sell Test 4",
|
||||
hexData: "00c98ea7588b0000009adf3b010000000001020200283c",
|
||||
},
|
||||
{
|
||||
name: "pump swap sell Test 5",
|
||||
hexData: "00d3727f9301000000f9a50b0100000000010202001e00",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
data, err := hex.DecodeString(tt.hexData)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to decode hex string: %v", err)
|
||||
return
|
||||
}
|
||||
var args flasArgs
|
||||
if err := borsh.Deserialize(&args, data[1:]); err != nil {
|
||||
t.Fatalf("failed to decode Axiom args: %v", err)
|
||||
return
|
||||
}
|
||||
t.Logf("Decoded Axiom Args: %+v", args)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func toUpdata(slot uint64, tx *solana.Transaction) *SubscribeUpdateTransaction {
|
||||
signatures := make([][]byte, len(tx.Signatures))
|
||||
for i, sig := range tx.Signatures {
|
||||
signatures[i] = sig[:]
|
||||
}
|
||||
|
||||
accountKeys := make([][]byte, len(tx.Message.AccountKeys))
|
||||
for i, key := range tx.Message.AccountKeys {
|
||||
accountKeys[i] = key[:]
|
||||
}
|
||||
|
||||
instructions := make([]*CompiledInstruction, len(tx.Message.Instructions))
|
||||
for i, instr := range tx.Message.Instructions {
|
||||
accounts := make([]byte, len(instr.Accounts))
|
||||
for j, acc := range instr.Accounts {
|
||||
accounts[j] = byte(acc)
|
||||
}
|
||||
instructions[i] = &CompiledInstruction{
|
||||
ProgramIdIndex: uint32(instr.ProgramIDIndex),
|
||||
Accounts: accounts,
|
||||
Data: instr.Data[:],
|
||||
}
|
||||
}
|
||||
|
||||
addressTableLookups := make([]*MessageAddressTableLookup, len(tx.Message.AddressTableLookups))
|
||||
for i, lookup := range tx.Message.AddressTableLookups {
|
||||
writable := make([]byte, len(lookup.WritableIndexes))
|
||||
for j, idx := range lookup.WritableIndexes {
|
||||
writable[j] = byte(idx)
|
||||
}
|
||||
readonly := make([]byte, len(lookup.ReadonlyIndexes))
|
||||
for j, idx := range lookup.ReadonlyIndexes {
|
||||
readonly[j] = byte(idx)
|
||||
}
|
||||
addressTableLookups[i] = &MessageAddressTableLookup{
|
||||
AccountKey: lookup.AccountKey[:],
|
||||
WritableIndexes: writable,
|
||||
ReadonlyIndexes: readonly,
|
||||
}
|
||||
}
|
||||
|
||||
return &SubscribeUpdateTransaction{
|
||||
Transaction: &Transaction{
|
||||
Signatures: signatures,
|
||||
Message: &Message{
|
||||
Header: &MessageHeader{
|
||||
NumRequiredSignatures: uint32(tx.Message.Header.NumRequiredSignatures),
|
||||
NumReadonlySignedAccounts: uint32(tx.Message.Header.NumReadonlySignedAccounts),
|
||||
NumReadonlyUnsignedAccounts: uint32(tx.Message.Header.NumReadonlyUnsignedAccounts),
|
||||
},
|
||||
AccountKeys: accountKeys,
|
||||
RecentBlockhash: nil, // TODO
|
||||
Instructions: instructions,
|
||||
Versioned: false, // TODO
|
||||
AddressTableLookups: addressTableLookups,
|
||||
},
|
||||
},
|
||||
Slot: slot,
|
||||
}
|
||||
}
|
||||
|
||||
func getTransaction(t *testing.T, client *rpc.Client, signature string) *SubscribeUpdateTransaction {
|
||||
version := uint64(0)
|
||||
tx, err := client.GetTransaction(
|
||||
context.Background(),
|
||||
solana.MustSignatureFromBase58(signature),
|
||||
&rpc.GetTransactionOpts{
|
||||
Commitment: rpc.CommitmentFinalized,
|
||||
MaxSupportedTransactionVersion: &version,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get transaction: %v", err)
|
||||
}
|
||||
|
||||
_tx, err := tx.Transaction.GetTransaction()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get transaction: %v", err)
|
||||
}
|
||||
|
||||
return toUpdata(tx.Slot, _tx)
|
||||
}
|
||||
|
||||
func TestParseTermBuy(t *testing.T) {
|
||||
rpcUrl := os.Getenv("SOL_RPC_URL")
|
||||
if rpcUrl == "" {
|
||||
t.Fatalf("SOL_RPC_URL is not set")
|
||||
}
|
||||
|
||||
client := rpc.New(rpcUrl)
|
||||
ch := make(chan TxSignal)
|
||||
closed := make(chan struct{})
|
||||
go func() {
|
||||
ParseTransactionForSubscribe(
|
||||
context.Background(),
|
||||
getTransaction(t, client, "5Gz1fa4Qhb35bkg9QCMXpxCX5uuNr7WcjcmrwajGZA7kXsvNS9pDnYe12ggWeSqf1nwZbVPob6DkX6fcwbE9ofBR"),
|
||||
nil,
|
||||
ch,
|
||||
closed,
|
||||
)
|
||||
}()
|
||||
signals := make([]TxSignal, 0)
|
||||
for signal := range ch {
|
||||
signals = append(signals, signal)
|
||||
}
|
||||
if len(signals) != 1 {
|
||||
t.Fatalf("expected 1 signal, got %d", len(signals))
|
||||
}
|
||||
|
||||
signal := signals[0]
|
||||
if signal.Label != "terminal" {
|
||||
t.Fatalf("expected terminal signal, got %s", signal.Label)
|
||||
}
|
||||
if signal.Event != "buy" {
|
||||
t.Fatalf("expected buy event, got %s", signal.Event)
|
||||
}
|
||||
if signal.Maker != "BaLxyjXzATAnfm7cc5AFhWBpiwnsb71THcnofDLTWAPK" {
|
||||
t.Fatalf("expected maker BaLxyjXzATAnfm7cc5AFhWBpiwnsb71THcnofDLTWAPK, got %s", signal.Maker)
|
||||
}
|
||||
if signal.Token0Address != "5Wgv54peXRKDHYHapAELzgNKEPEh9E5Bf3hUR3sTpump" {
|
||||
t.Fatalf("expected token0 address 5Wgv54peXRKDHYHapAELzgNKEPEh9E5Bf3hUR3sTpump, got %s", signal.Token0Address)
|
||||
}
|
||||
if signal.Token0AmountUint64 != 6952026214256 {
|
||||
t.Fatalf("expected token0 amount 6952026214256, got %d", signal.Token0AmountUint64)
|
||||
}
|
||||
if signal.Token1AmountUint64 != 653333333 {
|
||||
t.Fatalf("expected token1 amount 653333333, got %d", signal.Token1AmountUint64)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseBonkBuy(t *testing.T) {
|
||||
rpcUrl := os.Getenv("SOL_RPC_URL")
|
||||
if rpcUrl == "" {
|
||||
t.Fatalf("SOL_RPC_URL is not set")
|
||||
}
|
||||
|
||||
client := rpc.New(rpcUrl)
|
||||
|
||||
ch := make(chan TxSignal)
|
||||
closed := make(chan struct{})
|
||||
go func() {
|
||||
ParseTransactionForSubscribe(
|
||||
context.Background(),
|
||||
getTransaction(t, client, "3gHF3TA2aA8rpjdmoEs2vA89vrq9J9NnTTUSXHfE6uXcaYP9cJgLtEUjCmsK9EWAyHEg7cEiepehQf4GFv1272jW"),
|
||||
nil,
|
||||
ch,
|
||||
closed,
|
||||
)
|
||||
}()
|
||||
signals := make([]TxSignal, 0)
|
||||
for signal := range ch {
|
||||
signals = append(signals, signal)
|
||||
}
|
||||
|
||||
if len(signals) != 1 {
|
||||
t.Fatalf("expected 1 signal, got %d", len(signals))
|
||||
}
|
||||
|
||||
signal := signals[0]
|
||||
if signal.Label != "bonk" {
|
||||
t.Fatalf("expected bonk signal, got %s", signal.Label)
|
||||
}
|
||||
if signal.Event != "buy" {
|
||||
t.Fatalf("expected buy event, got %s", signal.Event)
|
||||
}
|
||||
if signal.Maker != "BFobdhAbdBteBuDvHUdBthsQqJyMuWnG9SGUheW1Ni2C" {
|
||||
t.Fatalf("expected maker BFobdhAbdBteBuDvHUdBthsQqJyMuWnG9SGUheW1Ni2C, got %s", signal.Maker)
|
||||
}
|
||||
if signal.Token0Address != "Awupo9Jxe1fsc7eEtCEcN9D3PoyReQhc9WEuEAHXpump" {
|
||||
t.Fatalf("expected token0 address Awupo9Jxe1fsc7eEtCEcN9D3PoyReQhc9WEuEAHXpump, got %s", signal.Token0Address)
|
||||
}
|
||||
if signal.Token0AmountUint64 != 8616799656436 {
|
||||
t.Fatalf("expected token0 amount 8616799656436, got %d", signal.Token0AmountUint64)
|
||||
}
|
||||
if signal.Token1AmountUint64 != 495000000 {
|
||||
t.Fatalf("expected token1 amount 495000000, got %d", signal.Token1AmountUint64)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseBonkSell(t *testing.T) {
|
||||
rpcUrl := os.Getenv("SOL_RPC_URL")
|
||||
if rpcUrl == "" {
|
||||
t.Fatalf("SOL_RPC_URL is not set")
|
||||
}
|
||||
|
||||
client := rpc.New(rpcUrl)
|
||||
ch := make(chan TxSignal)
|
||||
closed := make(chan struct{})
|
||||
go func() {
|
||||
ParseTransactionForSubscribe(
|
||||
context.Background(),
|
||||
getTransaction(t, client, "3XNi6b3j69SSStqLLRQVH5BNGVfEoFxGCzmpdd5FvrY4kmC8T644WGdEhCH9fAdrxWuR2Mtzgywq8K7qetu5MGyb"),
|
||||
nil,
|
||||
ch,
|
||||
closed,
|
||||
)
|
||||
}()
|
||||
signals := make([]TxSignal, 0)
|
||||
for signal := range ch {
|
||||
signals = append(signals, signal)
|
||||
}
|
||||
|
||||
if len(signals) != 1 {
|
||||
t.Fatalf("expected 1 signal, got %d", len(signals))
|
||||
}
|
||||
|
||||
signal := signals[0]
|
||||
if signal.Label != "bonk" {
|
||||
t.Fatalf("expected bonk signal, got %s", signal.Label)
|
||||
}
|
||||
if signal.Event != "sell" {
|
||||
t.Fatalf("expected sell event, got %s", signal.Event)
|
||||
}
|
||||
if signal.Maker != "2xTT7XXCEYSCrRb3G4Egc4ZwpCe78qq6r7w6ChZhbTXc" {
|
||||
t.Fatalf("expected maker 2xTT7XXCEYSCrRb3G4Egc4ZwpCe78qq6r7w6ChZhbTXc, got %s", signal.Maker)
|
||||
}
|
||||
if signal.Token0Address != "8pgpJDYuojYXvb8KE4Hv7DCty12FrkqpKChgfHzspump" {
|
||||
t.Fatalf("expected token0 address 8pgpJDYuojYXvb8KE4Hv7DCty12FrkqpKChgfHzspump, got %s", signal.Token0Address)
|
||||
}
|
||||
if signal.Token0AmountUint64 != 6235736929390 {
|
||||
t.Fatalf("expected token0 amount 6235736929390, got %d", signal.Token0AmountUint64)
|
||||
}
|
||||
if signal.Token1AmountUint64 != 1379707703 {
|
||||
t.Fatalf("expected token1 amount 1379707703, got %d", signal.Token1AmountUint64)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParsePhotonBuy(t *testing.T) {
|
||||
rpcUrl := os.Getenv("SOL_RPC_URL")
|
||||
if rpcUrl == "" {
|
||||
t.Fatalf("SOL_RPC_URL is not set")
|
||||
}
|
||||
|
||||
client := rpc.New(rpcUrl)
|
||||
|
||||
ch := make(chan TxSignal)
|
||||
closed := make(chan struct{})
|
||||
go func() {
|
||||
ParseTransactionForSubscribe(
|
||||
context.Background(),
|
||||
getTransaction(t, client, "4DCEcXAWBxagXoUNGhWsJ7qfxq5SuE5BG2cBDBqAY7sCHkBopaMJu33ZnXnFHqzPMmWxVxq6666KRF4hMHVB33Ux"),
|
||||
nil,
|
||||
ch,
|
||||
closed,
|
||||
)
|
||||
}()
|
||||
signals := make([]TxSignal, 0)
|
||||
for signal := range ch {
|
||||
signals = append(signals, signal)
|
||||
}
|
||||
|
||||
if len(signals) != 1 {
|
||||
t.Fatalf("expected 1 signal, got %d", len(signals))
|
||||
}
|
||||
|
||||
signal := signals[0]
|
||||
if signal.Label != "photon" {
|
||||
t.Fatalf("expected terminal signal, got %s", signal.Label)
|
||||
}
|
||||
if signal.Event != "buy" {
|
||||
t.Fatalf("expected buy event, got %s", signal.Event)
|
||||
}
|
||||
if signal.Maker != "8sUm7sLf3Steu6oVyVQqoA9GpFcMRz6YhrAidd4x7g7a" {
|
||||
t.Fatalf("expected maker 8sUm7sLf3Steu6oVyVQqoA9GpFcMRz6YhrAidd4x7g7a, got %s", signal.Maker)
|
||||
}
|
||||
if signal.Token0Address != "jx4PF2MwC7AK9S8dTeYm29hM3vAN8Rtfs2VX4Vz5UVj" {
|
||||
t.Fatalf("expected token0 address jx4PF2MwC7AK9S8dTeYm29hM3vAN8Rtfs2VX4Vz5UVj, got %s", signal.Token0Address)
|
||||
}
|
||||
if signal.Token0AmountUint64 != 1796593710706 {
|
||||
t.Fatalf("expected token0 amount 1796593710706, got %d", signal.Token0AmountUint64)
|
||||
}
|
||||
if signal.Token1AmountUint64 != 1955555553 {
|
||||
t.Fatalf("expected token1 amount 1955555553, got %d", signal.Token1AmountUint64)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseJupiterV6PumpFunBuy(t *testing.T) {
|
||||
rpcUrl := os.Getenv("SOL_RPC_URL")
|
||||
if rpcUrl == "" {
|
||||
t.Fatalf("SOL_RPC_URL is not set")
|
||||
}
|
||||
|
||||
client := rpc.New(rpcUrl)
|
||||
ch := make(chan TxSignal)
|
||||
closed := make(chan struct{})
|
||||
go func() {
|
||||
ParseTransactionForSubscribe(
|
||||
context.Background(),
|
||||
getTransaction(t, client, "4QF5whXwjx234fMXeH3HrJCy5knFJmKPtgbXys8xKGz1pZypqPvXBr4BoAqXfYn8jLL4HXPY1pcvxCCW1XREFNxd"),
|
||||
nil,
|
||||
ch,
|
||||
closed,
|
||||
)
|
||||
}()
|
||||
signals := make([]TxSignal, 0)
|
||||
for signal := range ch {
|
||||
signals = append(signals, signal)
|
||||
}
|
||||
|
||||
if len(signals) != 1 {
|
||||
t.Fatalf("expected 1 signal, got %d", len(signals))
|
||||
}
|
||||
|
||||
signal := signals[0]
|
||||
if signal.Label != "jupiterv6" {
|
||||
t.Fatalf("expected jupiterv6 signal, got %s", signal.Label)
|
||||
}
|
||||
if signal.Event != "buy" {
|
||||
t.Fatalf("expected buy event, got %s", signal.Event)
|
||||
}
|
||||
if signal.Maker != "92ySgsZs3rsrUAq2aeEqYacXQQGmz6e4xHPrRGxLDJXb" {
|
||||
t.Fatalf("expected maker 92ySgsZs3rsrUAq2aeEqYacXQQGmz6e4xHPrRGxLDJXb, got %s", signal.Maker)
|
||||
}
|
||||
if signal.Token0Address != "5kSWidFwDKPZiNf52TfincpVn8ufvkAfEzZ9pk8Dpump" {
|
||||
t.Fatalf("expected token0 address 5kSWidFwDKPZiNf52TfincpVn8ufvkAfEzZ9pk8Dpump, got %s", signal.Token0Address)
|
||||
}
|
||||
if signal.Token0AmountUint64 != 2410530637576 {
|
||||
t.Fatalf("expected token0 amount 2410530637576, got %d", signal.Token0AmountUint64)
|
||||
}
|
||||
if signal.Token1AmountUint64 != 380000000 {
|
||||
t.Fatalf("expected token1 amount 380000000, got %d", signal.Token1AmountUint64)
|
||||
}
|
||||
if !signal.ExactSOL {
|
||||
t.Fatalf("expected ExactSOL true, got false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseJupiterV6PumpFunSell(t *testing.T) {
|
||||
rpcUrl := os.Getenv("SOL_RPC_URL")
|
||||
if rpcUrl == "" {
|
||||
t.Fatalf("SOL_RPC_URL is not set")
|
||||
}
|
||||
|
||||
client := rpc.New(rpcUrl)
|
||||
ch := make(chan TxSignal)
|
||||
closed := make(chan struct{})
|
||||
go func() {
|
||||
ParseTransactionForSubscribe(
|
||||
context.Background(),
|
||||
getTransaction(t, client, "yCnE7ZA8dqB5iAZtwpSN2ar5HXh3gBjgaG2xtnwXDPFyHAm5XFU8642uTZTH5A2iPQ6G9hrj5eEPAJiWrfe38gM"),
|
||||
nil,
|
||||
ch,
|
||||
closed,
|
||||
)
|
||||
}()
|
||||
signals := make([]TxSignal, 0)
|
||||
for signal := range ch {
|
||||
signals = append(signals, signal)
|
||||
}
|
||||
if len(signals) != 1 {
|
||||
t.Fatalf("expected 1 signal, got %d", len(signals))
|
||||
}
|
||||
|
||||
signal := signals[0]
|
||||
if signal.Label != "jupiterv6" {
|
||||
t.Fatalf("expected jupiterv6 signal, got %s", signal.Label)
|
||||
}
|
||||
if signal.Event != "sell" {
|
||||
t.Fatalf("expected sell event, got %s", signal.Event)
|
||||
}
|
||||
if signal.Maker != "CGfWcKKcVQNBCL1vpxXdg6rvfYpQmnS3WkyA22Lk5XnZ" {
|
||||
t.Fatalf("expected maker CGfWcKKcVQNBCL1vpxXdg6rvfYpQmnS3WkyA22Lk5XnZ, got %s", signal.Maker)
|
||||
}
|
||||
if signal.Token0Address != "wp8Mwxy7btAD9hNWsfJyoPNJnjXS9fuNG4mnhQZpump" {
|
||||
t.Fatalf("expected token0 address wp8Mwxy7btAD9hNWsfJyoPNJnjXS9fuNG4mnhQZpump, got %s", signal.Token0Address)
|
||||
}
|
||||
if signal.Token0AmountUint64 != 127531720509990 {
|
||||
t.Fatalf("expected token0 amount 127531720509990, got %d", signal.Token0AmountUint64)
|
||||
}
|
||||
if signal.Token1AmountUint64 != 5296451290 {
|
||||
t.Fatalf("expected token1 amount 5296451290, got %d", signal.Token1AmountUint64)
|
||||
}
|
||||
if signal.ExactSOL {
|
||||
t.Fatalf("expected ExactSOL false, got true")
|
||||
}
|
||||
}
|
||||
62
pkg/shreder/versioned.go
Normal file
62
pkg/shreder/versioned.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package shreder
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
)
|
||||
|
||||
type AccountNotFoundError struct {
|
||||
Index int
|
||||
Len int
|
||||
}
|
||||
|
||||
func NewAccountNotFoundError(i, l int) error {
|
||||
return &AccountNotFoundError{i, l}
|
||||
}
|
||||
|
||||
func (e AccountNotFoundError) Error() string {
|
||||
return fmt.Sprintf("account index %d out of range, len=%d", e.Index, e.Len)
|
||||
}
|
||||
|
||||
type Instructions struct {
|
||||
ProgramIDIndex uint8
|
||||
Accounts []uint8
|
||||
Data []byte
|
||||
}
|
||||
|
||||
type AddressTableLookup struct {
|
||||
AccountKey solana.PublicKey
|
||||
WritableIndexes []uint8
|
||||
ReadonlyIndexes []uint8
|
||||
}
|
||||
|
||||
type VersionedTransaction struct {
|
||||
Signatures []solana.Signature
|
||||
|
||||
StaticAccountKeys []solana.PublicKey
|
||||
Instructions []Instructions
|
||||
AddressTableLookups []AddressTableLookup
|
||||
|
||||
Block uint64
|
||||
Time time.Time
|
||||
}
|
||||
|
||||
func (vt VersionedTransaction) GetSignature() string {
|
||||
if len(vt.Signatures) == 0 {
|
||||
return ""
|
||||
}
|
||||
return vt.Signatures[0].String()
|
||||
}
|
||||
|
||||
func (vtp *VersionedTransaction) FillAccount(account solana.PublicKey) {
|
||||
vtp.StaticAccountKeys = append(vtp.StaticAccountKeys, account)
|
||||
}
|
||||
|
||||
func (vt VersionedTransaction) GetAccount(idx int) (solana.PublicKey, error) {
|
||||
if idx < len(vt.StaticAccountKeys) {
|
||||
return vt.StaticAccountKeys[idx], nil
|
||||
}
|
||||
return solana.PublicKey{}, NewAccountNotFoundError(idx, len(vt.StaticAccountKeys))
|
||||
}
|
||||
205
pkg/swqos/clients/soyas_client.go
Normal file
205
pkg/swqos/clients/soyas_client.go
Normal file
@@ -0,0 +1,205 @@
|
||||
package clients
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/ed25519"
|
||||
"crypto/rand"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
|
||||
"github.com/mr-tron/base58"
|
||||
"github.com/quic-go/quic-go"
|
||||
)
|
||||
|
||||
const (
|
||||
alpnTPUProtocolID = "solana-tpu"
|
||||
defaultServerName = "soyas-landing"
|
||||
defaultKeepAlive = 25 * time.Second
|
||||
defaultIdleTimeout = 5 * time.Minute
|
||||
)
|
||||
|
||||
type SoyasClient struct {
|
||||
endpointAddr string
|
||||
tlsConfig *tls.Config
|
||||
quicConfig *quic.Config
|
||||
|
||||
connMu sync.RWMutex
|
||||
conn *quic.Conn
|
||||
reconnectMu sync.Mutex
|
||||
}
|
||||
|
||||
// Connect creates a client using the whitelisted Solana keypair (base58-encoded secret key) as the mutual-TLS client identity.
|
||||
func NewSoyasClient(ctx context.Context, url string) *SoyasClient {
|
||||
cert, err := x509CertificateFromSolanaBase58Key("2ketcrBU1kBvr68sPVYdBdn5ztgg3VBKZP1xa1o5B8w47wemBXH73ZALdmj3ukcGzkxh6DhzLq3myu45XUwW1eNC")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
tlsConfig := &tls.Config{
|
||||
Certificates: []tls.Certificate{cert},
|
||||
ServerName: defaultServerName,
|
||||
InsecureSkipVerify: true,
|
||||
NextProtos: []string{alpnTPUProtocolID},
|
||||
MinVersion: tls.VersionTLS13,
|
||||
}
|
||||
|
||||
quicConfig := &quic.Config{
|
||||
KeepAlivePeriod: defaultKeepAlive,
|
||||
MaxIdleTimeout: defaultIdleTimeout,
|
||||
}
|
||||
|
||||
client := &SoyasClient{
|
||||
endpointAddr: url,
|
||||
tlsConfig: tlsConfig,
|
||||
quicConfig: quicConfig,
|
||||
}
|
||||
|
||||
if err = client.reconnect(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Close closes the underlying QUIC connection (if any). Safe to call multiple times.
|
||||
func (c *SoyasClient) Close() error {
|
||||
c.reconnectMu.Lock()
|
||||
defer c.reconnectMu.Unlock()
|
||||
|
||||
c.connMu.Lock()
|
||||
conn := c.conn
|
||||
c.conn = nil
|
||||
c.connMu.Unlock()
|
||||
|
||||
if conn == nil {
|
||||
return nil
|
||||
}
|
||||
return conn.CloseWithError(0, "")
|
||||
}
|
||||
|
||||
// SendTransaction sends a signed Solana transaction payload to Soyas.
|
||||
// The payload should be the raw wire bytes (for example, from solana-go's tx.MarshalBinary()).
|
||||
// If sending fails, it reconnects once and retries.
|
||||
func (c *SoyasClient) SendTransaction(ctx context.Context, tx *solana.Transaction) error {
|
||||
if c.endpointAddr == "" {
|
||||
return fmt.Errorf("send tx url is empty")
|
||||
}
|
||||
|
||||
raw, err := tx.MarshalBinary()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
conn := c.getConn()
|
||||
if conn != nil {
|
||||
if err := trySendBytes(ctx, conn, raw); err == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.reconnect(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
conn = c.getConn()
|
||||
if conn == nil {
|
||||
return errors.New("missing QUIC connection")
|
||||
}
|
||||
return trySendBytes(ctx, conn, raw)
|
||||
}
|
||||
|
||||
func (c *SoyasClient) SendBundle(ctx context.Context, txs []*solana.Transaction) error {
|
||||
return fmt.Errorf("soyas client not support send bundle")
|
||||
}
|
||||
|
||||
func (c *SoyasClient) getConn() *quic.Conn {
|
||||
c.connMu.RLock()
|
||||
defer c.connMu.RUnlock()
|
||||
return c.conn
|
||||
}
|
||||
|
||||
func (c *SoyasClient) reconnect(ctx context.Context) error {
|
||||
c.reconnectMu.Lock()
|
||||
defer c.reconnectMu.Unlock()
|
||||
|
||||
if existing := c.getConn(); existing != nil && existing.Context().Err() == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
conn, err := quic.DialAddr(ctx, c.endpointAddr, c.tlsConfig, c.quicConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.connMu.Lock()
|
||||
old := c.conn
|
||||
c.conn = conn
|
||||
c.connMu.Unlock()
|
||||
|
||||
if old != nil {
|
||||
_ = old.CloseWithError(0, "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func trySendBytes(ctx context.Context, conn *quic.Conn, payload []byte) error {
|
||||
stream, err := conn.OpenUniStreamSync(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := stream.Write(payload); err != nil {
|
||||
_ = stream.Close()
|
||||
return err
|
||||
}
|
||||
return stream.Close()
|
||||
}
|
||||
|
||||
// x509CertificateFromSolanaBase58Key creates a short-lived self-signed X.509
|
||||
// certificate whose public key is derived from the provided Solana Ed25519 key.
|
||||
// The Soyas ingress extracts this public key to identify/allowlist the client.
|
||||
func x509CertificateFromSolanaBase58Key(apiKeyBase58 string) (tls.Certificate, error) {
|
||||
raw, err := base58.Decode(apiKeyBase58)
|
||||
if err != nil {
|
||||
return tls.Certificate{}, err
|
||||
}
|
||||
|
||||
var seed []byte
|
||||
switch len(raw) {
|
||||
case ed25519.SeedSize:
|
||||
seed = raw
|
||||
case ed25519.PrivateKeySize:
|
||||
seed = raw[:ed25519.SeedSize]
|
||||
default:
|
||||
return tls.Certificate{}, errors.New("api key must decode to 32 (seed) or 64 (secret) bytes")
|
||||
}
|
||||
|
||||
priv := ed25519.NewKeyFromSeed(seed)
|
||||
pub := priv.Public().(ed25519.PublicKey)
|
||||
|
||||
serial, err := rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), 128))
|
||||
if err != nil {
|
||||
return tls.Certificate{}, err
|
||||
}
|
||||
|
||||
template := &x509.Certificate{
|
||||
SerialNumber: serial,
|
||||
NotBefore: time.Now().Add(-5 * time.Minute),
|
||||
NotAfter: time.Now().Add(365 * 24 * time.Hour),
|
||||
KeyUsage: x509.KeyUsageDigitalSignature,
|
||||
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
|
||||
}
|
||||
|
||||
der, err := x509.CreateCertificate(rand.Reader, template, template, pub, priv)
|
||||
if err != nil {
|
||||
return tls.Certificate{}, err
|
||||
}
|
||||
|
||||
return tls.Certificate{
|
||||
Certificate: [][]byte{der},
|
||||
PrivateKey: priv,
|
||||
}, nil
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/samlior/libsam/pkg/enum"
|
||||
"github.com/samlior/libsam/pkg/swqos/clients"
|
||||
"github.com/samlior/libsam/v2/pkg/enum"
|
||||
"github.com/samlior/libsam/v2/pkg/swqos/clients"
|
||||
)
|
||||
|
||||
func NewSWQoSClient(ctx context.Context, config *SWQoSClientConfig) (SWQoSClient, error) {
|
||||
@@ -24,6 +24,8 @@ func NewSWQoSClient(ctx context.Context, config *SWQoSClientConfig) (SWQoSClient
|
||||
client = clients.NewAstralaneClient(config.SendTxUrl)
|
||||
case enum.SWQoSAgentBlocxRoute:
|
||||
client = clients.NewBloxrouteClient(config.SendTxUrl)
|
||||
case enum.SWQoSAgentSoyas:
|
||||
client = clients.NewSoyasClient(ctx, config.SendTxUrl)
|
||||
case enum.SWQoSAgent0slot, enum.SWQoSAgentJito, enum.SWQoSAgentHelius, enum.SWQoSAgentNozomi, enum.SWQoSAgentStellium:
|
||||
client = clients.NewHttpClient(config.SendTxUrl, config.SendBundleUrl)
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user