Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0eb1628119 | ||
|
|
c25c856a47 | ||
|
|
b4906a2c20 | ||
|
|
21692c2ecc | ||
|
|
6b4cadb118 | ||
|
|
b76d2efc88 | ||
|
|
16b7461ac7 | ||
|
|
6bc84ce126 | ||
|
|
8128a325a9 |
208
checking.go
208
checking.go
@@ -173,6 +173,8 @@ func checkBonkGmgnBuy(rawTx *RawTx) bool {
|
||||
|
||||
var (
|
||||
axiomTxLoopupTable = solana.MustPublicKeyFromBase58("7RKtfATWCe98ChuwecNq8XCzAzfoK3DtZTprFsPMGtio")
|
||||
axiomProgramID = solana.MustPublicKeyFromBase58("AxiomfHaWDemCFBLBayqnEnNwE6b7B2Qz3UmzMpgbMG6")
|
||||
gmgnProgramID = solana.MustPublicKeyFromBase58("GMgnVFR8Jb39LoXsEVzb3DvBy3ywCmdmJquHUy1Lrkqb")
|
||||
)
|
||||
|
||||
func checkBonkAxiomBuy(rawTx *RawTx) bool {
|
||||
@@ -366,3 +368,209 @@ func checkBonkAxiomBuy(rawTx *RawTx) bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func checkPumpFunAxiomBuy(rawTx *RawTx) bool {
|
||||
|
||||
// 检查交易版本
|
||||
if rawTx.Version == "legacy" || len(rawTx.Transaction.Message.AddressTableLookups) != 1 {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查 addressLookupTable 是否是 Axiom 的
|
||||
if rawTx.Transaction.Message.AddressTableLookups[0].AccountKey != axiomTxLoopupTable {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查交易指令数量
|
||||
if len(rawTx.Transaction.Message.Instructions) != 6 {
|
||||
return false
|
||||
}
|
||||
|
||||
accountList := rawTx.getAccountList()
|
||||
// 检查 cu limit
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[0]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.ComputeBudget {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) != 1 {
|
||||
return false
|
||||
}
|
||||
|
||||
accountId := accountList[instruction.Accounts[0]].String()
|
||||
if !strings.HasPrefix(accountId, "jitodontfront") || !strings.HasSuffix(accountId, "TradeWithAxiomDotTrade") {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 cu price
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[1]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.ComputeBudget {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 ata.createIdempotent
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[2]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.SPLAssociatedTokenAccountProgramID {
|
||||
return false
|
||||
}
|
||||
|
||||
if instruction.Data.String() != "2" {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 4 {
|
||||
return false
|
||||
}
|
||||
|
||||
// axiom 会先创建 token 账户, 而不是 wsol 账户
|
||||
accountId := accountList[instruction.Accounts[3]]
|
||||
if accountId == solana.WrappedSol {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查调用axiom合约
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[3]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != axiomProgramID {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 transfer
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[4]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.SystemProgramID {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Data) == 0 || instruction.Data[0] != 2 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 transfer
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[5]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.SystemProgramID {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Data) == 0 || instruction.Data[0] != 2 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func checkPumpFunGmgnBuy(rawTx *RawTx) bool {
|
||||
|
||||
// 检查交易版本
|
||||
if rawTx.Version != "legacy" {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查交易指令数量
|
||||
if len(rawTx.Transaction.Message.Instructions) != 6 {
|
||||
return false
|
||||
}
|
||||
|
||||
accountList := rawTx.getAccountList()
|
||||
// 检查 cu limit
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[0]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.ComputeBudget {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) != 1 {
|
||||
return false
|
||||
}
|
||||
|
||||
accountId := accountList[instruction.Accounts[0]].String()
|
||||
if !strings.HasPrefix(accountId, "jitodontfront1111111111151111111111111655") {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 cu price
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[1]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.ComputeBudget {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 ata.createIdempotent
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[2]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.SPLAssociatedTokenAccountProgramID {
|
||||
return false
|
||||
}
|
||||
|
||||
if instruction.Data.String() != "2" {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Accounts) < 4 {
|
||||
return false
|
||||
}
|
||||
|
||||
accountId := accountList[instruction.Accounts[3]]
|
||||
if accountId == solana.WrappedSol {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查调用 gmgn 合约
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[3]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != gmgnProgramID {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 transfer
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[4]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.SystemProgramID {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Data) == 0 || instruction.Data[0] != 2 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检查 transfer
|
||||
{
|
||||
instruction := rawTx.Transaction.Message.Instructions[5]
|
||||
programId := accountList[instruction.ProgramIDIndex]
|
||||
if programId != solana.SystemProgramID {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(instruction.Data) == 0 || instruction.Data[0] != 2 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
40
consts.go
40
consts.go
@@ -48,6 +48,14 @@ var platformFeeAddresses = map[solana.PublicKey]string{
|
||||
solana.MustPublicKeyFromBase58("MaestroUL88UBnZr3wfoN7hqmNWFi3ZYCGqZoJJHE36"): PlatformMaestro,
|
||||
solana.MustPublicKeyFromBase58("ZG98FUCjb8mJ824Gbs6RsgVmr1FhXb2oNiJHa2dwmPd"): PlatformBonkBot,
|
||||
solana.MustPublicKeyFromBase58("J5XGHmzrRmnYWbmw45DbYkdZAU2bwERFZ11qCDXPvFB5"): PlatformPadre,
|
||||
solana.MustPublicKeyFromBase58("5vPNE6VFyXmCmzmWotdxmRk57LEWiXxuAfZL3hKbi2LH"): PlatformAxiom,
|
||||
solana.MustPublicKeyFromBase58("ECDrSz47nXihe5kyK4oWEePPsPi9qz6u5d6Fa2sDj3uM"): PlatformAxiom,
|
||||
solana.MustPublicKeyFromBase58("EqGzowSp6cKAsMSRyyrFTaBxnZEVeNY81LC18YFy8Cx9"): PlatformAxiom,
|
||||
solana.MustPublicKeyFromBase58("3Tu1Y9aNveLFN4WTAwnAwXL6tbUp5MMe3RxyybG4jTAS"): PlatformAxiom,
|
||||
solana.MustPublicKeyFromBase58("3PvqoztjnRxaAiFmLuEfqZkU4GSbjUareks8S2xCZaTa"): PlatformAxiom,
|
||||
solana.MustPublicKeyFromBase58("HkJYryz2BNeMQfuuSWDYktWt5fZLV26eK6nqu7EJycoG"): PlatformAxiom,
|
||||
solana.MustPublicKeyFromBase58("BfFX9rUm8qTZiZjmeq9BktWVTNuG3YWMc5AvkrCKJike"): PlatformAxiom,
|
||||
solana.MustPublicKeyFromBase58("2ApLdwLrGayEmxgpLX9BTR47Q2QprfMg5SpjrLeaK8s7"): PlatformAxiom,
|
||||
}
|
||||
|
||||
var mevAgentFeeAddresses = map[solana.PublicKey]string{
|
||||
@@ -161,6 +169,33 @@ var mevAgentFeeAddresses = map[solana.PublicKey]string{
|
||||
solana.MustPublicKeyFromBase58("BnGKHAC386n4Qmv9xtpBVbRaUTKixjBe3oagkPFKtoy6"): MevAgentBlockRazor,
|
||||
solana.MustPublicKeyFromBase58("Dd7K2Fp7AtoN8xCghKDRmyqr5U169t48Tw5fEd3wT9mq"): MevAgentBlockRazor,
|
||||
solana.MustPublicKeyFromBase58("AP6qExwrbRgBAVaehg4b5xHENX815sMabtBzUzVB4v8S"): MevAgentBlockRazor,
|
||||
solana.MustPublicKeyFromBase58("soyas4s6L8KWZ8rsSk1mF3d1mQScoTGGAgjk98bF8nP"): MevAgentSoyas,
|
||||
solana.MustPublicKeyFromBase58("soyascXFW5wEEYiwfEmHy2pNwomqzvggJosGVD6TJdY"): MevAgentSoyas,
|
||||
solana.MustPublicKeyFromBase58("soyasDBdKjADwPz3xk82U3TNPRDKEWJj7wWLajNHZ1L"): MevAgentSoyas,
|
||||
solana.MustPublicKeyFromBase58("soyasE2abjBAynmHbGWgEwk4ctBy7JMTUCNrMbjcnyH"): MevAgentSoyas,
|
||||
solana.MustPublicKeyFromBase58("ste11JV3MLMM7x7EJUM2sXcJC1H7F4jBLnP9a9PG8PH"): MevAgentStellium,
|
||||
solana.MustPublicKeyFromBase58("ste11MWPjXCRfQryCshzi86SGhuXjF4Lv6xMXD2AoSt"): MevAgentStellium,
|
||||
solana.MustPublicKeyFromBase58("ste11p5x8tJ53H1NbNQsRBg1YNRd4GcVpxtDw8PBpmb"): MevAgentStellium,
|
||||
solana.MustPublicKeyFromBase58("ste11p7e2KLYou5bwtt35H7BM6uMdo4pvioGjJXKFcN"): MevAgentStellium,
|
||||
solana.MustPublicKeyFromBase58("ste11TMV68LMi1BguM4RQujtbNCZvf1sjsASpqgAvSX"): MevAgentStellium,
|
||||
solana.MustPublicKeyFromBase58("astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("astra9xWY93QyfG6yM8zwsKsRodscjQ2uU2HKNL5prk"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("astraRVUuTHjpwEVvNBeQEgwYx9w9CFyfxjYoobCZhL"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("astrazznxsGUhWShqgNtAdfrzP2G83DzcWVJDxwV9bF"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("ASde6y8pBCU1aityWHRpqT7pEAcEonjCgFUMeh5egRes"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("ASUv6G8Cj6zt71UAqD1aVtDC3CRn6FFddqF17ZiegrES"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("ASY4mvCtrACKFK8Jiuvqcu8fad9gGTzvfm5zp4megRes"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("astraEJ2fEj8Xmy6KLG7B3VfbKfsHXhHrNdCQx7iGJK"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("B1ooMsWjc4SUVVuLyCu1ig2RdomQnHKgMzBMfmSo3DK"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("B1ooMZfUJmAvppzc5cr7eYG8Cenig4FbQGBytr4DGCh"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("b1ooMDLjzz4QqecNsJ8bBXzJTzfAPDCP3CxijTS2K93"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("b1oomst2baE3FqxFPHaA9JwhXgFG9HdTLmbNKDen1kK"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("b1ooMngj7WbNPMZpWpnYRjxQ96RcDZ9ZFpRfjw1g7tg"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("B1oomgV9SAeiUc7GMEg9WhqkZJGccJuHAnh15DbezcN"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("b1oom3jaRNoyJzvSdSVbvSbth5uB4rRYtbjHXT5c1eW"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("B1ooMauwuJPhHsXqt3uj7B92CAFG8kaD1Q2iGEmGYnx"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("B1ooMdjcY7zemxDWiH8jVZPxEMdHnE5AraWPHdHQoPj"): MevAgentAstralane,
|
||||
solana.MustPublicKeyFromBase58("B1ooMKzu6siJzQutP6a6oLiY3fpzgQnBZsAjxuAm9qo"): MevAgentAstralane,
|
||||
}
|
||||
|
||||
var entryContractAddresses = map[solana.PublicKey]string{
|
||||
@@ -196,6 +231,11 @@ var entryContractAddresses = map[solana.PublicKey]string{
|
||||
solana.MustPublicKeyFromBase58("MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e"): EntryContractMayhem,
|
||||
solana.MustPublicKeyFromBase58("proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u"): EntryContractOKXDexRouterV2,
|
||||
solana.MustPublicKeyFromBase58("term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3"): EntryContractTerm,
|
||||
solana.MustPublicKeyFromBase58("DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH"): EntryContractDFlow,
|
||||
solana.MustPublicKeyFromBase58("MaestroAAe9ge5HTc64VbBQZ6fP77pwvrhM8i1XWSAx"): EntryContractMaestroBot,
|
||||
solana.MustPublicKeyFromBase58("BBRouter1cVunVXvkcqeKkZQcBK7ruan37PPm3xzWaXD"): EntryContractBonkBot,
|
||||
solana.MustPublicKeyFromBase58("B3111yJCeHBcA1bizdJjUFPALfhAfSRnAbJzGUtnt56A"): EntryContractBinanceWallet,
|
||||
solana.MustPublicKeyFromBase58("FLASHX8DrLbgeR8FcfNV1F5krxYcYMUdBkrP1EPBtxB9"): EntryContractAxiom,
|
||||
}
|
||||
|
||||
var okxDexRoutersV2 = solana.MustPublicKeyFromBase58("proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u")
|
||||
|
||||
7
enum.go
7
enum.go
@@ -11,6 +11,9 @@ const (
|
||||
MevAgentFlashBlock = "flashBlock"
|
||||
MevAgentUnknown = "unknown"
|
||||
MevAgentBlockRazor = "blockrazor"
|
||||
MevAgentSoyas = "soyas"
|
||||
MevAgentStellium = "stellium"
|
||||
MevAgentAstralane = "astralane"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -42,6 +45,10 @@ const (
|
||||
EntryContractFluxbeamDEX = "fluxbeamDEX"
|
||||
EntryContractNovaBotsProgram = "novaBotsProgram"
|
||||
EntryContractTaggedSearcher = "taggedSearcher"
|
||||
EntryContractDFlow = "dflow"
|
||||
EntryContractMaestroBot = "maestroBot"
|
||||
EntryContractBonkBot = "bonkBot"
|
||||
EntryContractBinanceWallet = "binanceWallet"
|
||||
EntryContractMayhem = "pumpMayhem"
|
||||
EntryContractTerm = "term"
|
||||
EntryContractUnknown = "unknown"
|
||||
|
||||
25
meta.go
25
meta.go
@@ -37,6 +37,9 @@ var pumpBuyEventDiscriminator = [8]byte{189, 219, 127, 211, 78, 230, 97, 238}
|
||||
var (
|
||||
pumpAmmProgram = solana.MustPublicKeyFromBase58("pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA")
|
||||
wSolMint = solana.MustPublicKeyFromBase58("So11111111111111111111111111111111111111112")
|
||||
usdcMint = solana.MustPublicKeyFromBase58("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
|
||||
usd1Mint = solana.MustPublicKeyFromBase58("USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB")
|
||||
meteoraDlmmProgram = solana.MustPublicKeyFromBase58("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo")
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -63,6 +66,26 @@ var (
|
||||
pumpAmmDepositEventDiscriminator = calculateDiscriminator("event:DepositEvent")
|
||||
)
|
||||
|
||||
var (
|
||||
meteoraDlmmSwapDiscriminator = calculateDiscriminator("global:swap")
|
||||
meteoraDlmmSwap2Discriminator = calculateDiscriminator("global:swap2")
|
||||
meteoraDlmmSwapExactOutDiscriminator = calculateDiscriminator("global:swap_exact_out")
|
||||
meteoraDlmmSwapExactOut2Discriminator = calculateDiscriminator("global:swap_exact_out2")
|
||||
meteoraDlmmSwapWithPriceImpactDiscriminator = calculateDiscriminator("global:swap_with_price_impact")
|
||||
meteoraDlmmSwapWithPriceImpact2Discriminator = calculateDiscriminator("global:swap_with_price_impact2")
|
||||
meteoraDlmmSwapEventDiscriminator = calculateDiscriminator("event:Swap")
|
||||
meteoraDlmmAddLiquidityDiscriminator = calculateDiscriminator("global:add_liquidity")
|
||||
meteoraDlmmAddLiquidity2Discriminator = calculateDiscriminator("global:add_liquidity2")
|
||||
meteoraDlmmAddLiquidityByStrategyDiscriminator = calculateDiscriminator("global:add_liquidity_by_strategy")
|
||||
meteoraDlmmAddLiquidityByStrategy2Discriminator = calculateDiscriminator("global:add_liquidity_by_strategy2")
|
||||
meteoraDlmmRemoveLiquidityDiscriminator = calculateDiscriminator("global:remove_liquidity")
|
||||
meteoraDlmmRemoveLiquidity2Discriminator = calculateDiscriminator("global:remove_liquidity2")
|
||||
meteoraDlmmRemoveLiquidityByRangeDiscriminator = calculateDiscriminator("global:remove_liquidity_by_range")
|
||||
meteoraDlmmRemoveLiquidityByRange2Discriminator = calculateDiscriminator("global:remove_liquidity_by_range2")
|
||||
meteoraDlmmAddLiquidityEventDiscriminator = calculateDiscriminator("event:AddLiquidity")
|
||||
meteoraDlmmRemoveLiquidityEventDiscriminator = calculateDiscriminator("event:RemoveLiquidity")
|
||||
)
|
||||
|
||||
// Program PumpAmm program ID
|
||||
|
||||
var budgGetProgram = solana.MustPublicKeyFromBase58("ComputeBudget111111111111111111111111111111")
|
||||
@@ -75,3 +98,5 @@ var createAccountWithSeedDiscriminator = uint32(3)
|
||||
var systemProgram = solana.MustPublicKeyFromBase58("11111111111111111111111111111111")
|
||||
|
||||
var raydiumLaunchLabProgramID = solana.MustPublicKeyFromBase58("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj")
|
||||
|
||||
var eventDiscriminator = [8]byte{228, 69, 165, 46, 81, 203, 154, 29}
|
||||
|
||||
1188
metaoradlmm.go
Normal file
1188
metaoradlmm.go
Normal file
File diff suppressed because it is too large
Load Diff
44
parser.go
44
parser.go
@@ -8,11 +8,38 @@ import (
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var swapPrograms = map[solana.PublicKey]swapParser{
|
||||
var defaultSwapPrograms = map[solana.PublicKey]swapParser{
|
||||
pumpAmmProgram: pumpAmmParser,
|
||||
pumpProgram: pumpParser,
|
||||
}
|
||||
|
||||
var swapPrograms = cloneSwapPrograms(defaultSwapPrograms)
|
||||
|
||||
type ParserOption func(*parserConfig)
|
||||
|
||||
type parserConfig struct {
|
||||
enableMeteoraDlmm bool
|
||||
}
|
||||
|
||||
func InitParser(opts ...ParserOption) {
|
||||
cfg := parserConfig{}
|
||||
for _, opt := range opts {
|
||||
opt(&cfg)
|
||||
}
|
||||
|
||||
programs := cloneSwapPrograms(defaultSwapPrograms)
|
||||
if cfg.enableMeteoraDlmm {
|
||||
programs[meteoraDlmmProgram] = metaoradlmmParser
|
||||
}
|
||||
swapPrograms = programs
|
||||
}
|
||||
|
||||
func WithMeteoraDlmm() ParserOption {
|
||||
return func(cfg *parserConfig) {
|
||||
cfg.enableMeteoraDlmm = true
|
||||
}
|
||||
}
|
||||
|
||||
var actionPrograms = map[solana.PublicKey]actionParser{
|
||||
systemProgram: systemParser,
|
||||
budgGetProgram: budgetParser,
|
||||
@@ -34,6 +61,13 @@ func (tx *Tx) Parser() error {
|
||||
return errors.New("rawTx is nil")
|
||||
}
|
||||
accountList := tx.rawTx.getAccountList()
|
||||
if tx.rawTx.Meta.Err == nil {
|
||||
for _, acc := range tx.rawTx.Transaction.Message.Instructions {
|
||||
if accountList[acc.ProgramIDIndex] == solana.VoteProgramID {
|
||||
tx.Vote = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tx.TxHash = (*[64]byte)((tx.rawTx.Transaction.Signatures[0][:]))
|
||||
tx.Signer = tx.rawTx.GetSigner()
|
||||
@@ -117,3 +151,11 @@ func (tx *Tx) Parser() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func cloneSwapPrograms(src map[solana.PublicKey]swapParser) map[solana.PublicKey]swapParser {
|
||||
dst := make(map[solana.PublicKey]swapParser, len(src))
|
||||
for k, v := range src {
|
||||
dst[k] = v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func TransferParser(result *RawTx, instruction Instruction, offset [2]uint, tx *
|
||||
to := result.accountList[instruction.Accounts[1]]
|
||||
|
||||
if offset[1] == 0 {
|
||||
tx.Transfer = append(tx.Transfer, SolTransfer{
|
||||
tx.SolTransfer = append(tx.SolTransfer, SolTransfer{
|
||||
From: from,
|
||||
To: to,
|
||||
Amount: decimal.NewFromInt(int64(lamports)), // solana decimals
|
||||
|
||||
59
tx.go
59
tx.go
@@ -33,6 +33,18 @@ type Swap struct {
|
||||
UserBaseBalance decimal.Decimal
|
||||
UserQuoteBalance decimal.Decimal
|
||||
EntryContract solana.PublicKey
|
||||
|
||||
//For meteora dlmm
|
||||
StartBinId int32
|
||||
EndBinId int32
|
||||
BinChanges []DlmmBinLiquidityChange
|
||||
}
|
||||
|
||||
type DlmmBinLiquidityChange struct {
|
||||
BinId int32
|
||||
AmountX decimal.Decimal
|
||||
AmountY decimal.Decimal
|
||||
BpsToRemove uint16
|
||||
}
|
||||
|
||||
type platformInfo struct {
|
||||
@@ -53,6 +65,7 @@ type SolTransfer struct {
|
||||
|
||||
type Tx struct {
|
||||
rawTx *RawTx
|
||||
Vote bool
|
||||
Signer solana.PublicKey
|
||||
Err interface{} `json:"err,omitempty"`
|
||||
Swaps []Swap `json:"swaps,omitempty"`
|
||||
@@ -79,6 +92,10 @@ type Tx struct {
|
||||
// todo pool info ??
|
||||
}
|
||||
|
||||
func (tx *Tx) GetRawTx() *RawTx {
|
||||
return tx.rawTx
|
||||
}
|
||||
|
||||
func (tx *Tx) SetRawTx(t *RawTx) {
|
||||
tx.rawTx = t
|
||||
}
|
||||
@@ -124,7 +141,9 @@ func (tx *Tx) CheckPlatform(swap Swap) (string, decimal.Decimal) {
|
||||
platformFee = info.PlatformFee
|
||||
break
|
||||
}
|
||||
if swap.Event == "buy" && swap.Program == SolProgramRaydiumLaunchLabBonk {
|
||||
if swap.Event == "buy" {
|
||||
switch swap.Program {
|
||||
case SolProgramRaydiumLaunchLabBonk:
|
||||
for _, p := range tx.Platform {
|
||||
switch p.Platform {
|
||||
case PlatformAxiom:
|
||||
@@ -137,6 +156,21 @@ func (tx *Tx) CheckPlatform(swap Swap) (string, decimal.Decimal) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if swap.Program == SolProgramRaydiumLaunchLabBonk {
|
||||
for _, p := range tx.Platform {
|
||||
switch p.Platform {
|
||||
case PlatformAxiom:
|
||||
if !checkPumpFunAxiomBuy(rawTx) {
|
||||
platform = PlatformFake
|
||||
}
|
||||
case PlatformGMGN:
|
||||
if !checkPumpFunGmgnBuy(rawTx) {
|
||||
platform = PlatformFake
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -184,6 +218,29 @@ func (s Swap) CheckEntryContract() string {
|
||||
return EntryContractUnknown
|
||||
}
|
||||
|
||||
func (tx *Tx) LoadAfterSOLBalance(swap Swap) decimal.Decimal {
|
||||
if swap.User.Equals(tx.Signer) {
|
||||
return tx.AfterSOLBalance
|
||||
}
|
||||
|
||||
found := false
|
||||
makerIndex := 0
|
||||
for i, account := range tx.rawTx.getAccountList() {
|
||||
if account == swap.User {
|
||||
found = true
|
||||
makerIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if found && makerIndex < len(tx.rawTx.Meta.PostBalances) {
|
||||
return decimal.NewFromInt(
|
||||
int64(tx.rawTx.Meta.PostBalances[makerIndex]),
|
||||
).Div(decimal.NewFromInt(1000000000)) // sol decimals
|
||||
}
|
||||
return decimal.Zero
|
||||
}
|
||||
|
||||
func (s Swap) CheckEntryContractV2() string {
|
||||
name, ok := entryContractAddresses[s.EntryContract]
|
||||
if ok {
|
||||
|
||||
Reference in New Issue
Block a user