Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subscribeToOpenBookMarkets seems to be unable to receive new token from pump.fun #116

Closed
icaca opened this issue May 19, 2024 · 9 comments
Closed
Labels
help wanted Extra attention is needed

Comments

@icaca
Copy link

icaca commented May 19, 2024

Pump was attacked by hackers a few days ago. I don’t know what adjustments they made. I couldn’t receive any notifications from them about pool events. It was ok before that.

@fdundjer fdundjer added the help wanted Extra attention is needed label May 22, 2024
@icaca
Copy link
Author

icaca commented May 23, 2024

pump.fun uses this wallet(39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg) to publish new coins to Raydium and add liquidity
I monitored his wallet and sniped it. I tried printing the pool events, but it never seemed to prompt that the sniped currency appeared.

@UZzhu
Copy link

UZzhu commented May 31, 2024

i dont get your point. the bot listened from solscan, so every new token should be lietened no matter if it is published on pump.fun

@icaca
Copy link
Author

icaca commented May 31, 2024

Thank you for your feedback

I wrote a small piece of code to explain my recent troubles
I want to get the pool information from getProgramAccounts. This mint has added liquidity in raydium

base = new PublicKey('PUPS8ZgJ5po4UmNDfqtDMCPP6M1KP3EEzG9Zufcwzrg')

AmmV4= new PublicKey('675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'),


      let baseAccounts = await this.connection.getProgramAccounts(AmmV4, {
        commitment,
        filters: [
          { dataSize: LIQUIDITY_STATE_LAYOUT_V4.span },
          {
            memcmp: {
              offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf("baseMint"),
              bytes: base.toBase58(),
            },
          },
          {
            memcmp: {
              offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf("quoteMint"),
              bytes: quote.mint.toBase58(),
            },
          },
        ],
      });

@icaca
Copy link
Author

icaca commented May 31, 2024

I found that the obtained basemint and quotemint are opposite

status: "06"
nonce: "fe"
maxOrder: "07"
depth: "03"
baseDecimal: "09"
quoteDecimal: "06"
state: "01"
resetFlag: "00"
minSize: "989680"
volMaxCutRatio: "01f4"
amountWaveRatio: "4c4b40"
baseLotSize: "989680"
quoteLotSize: "989680"
minPriceMultiplier: "01"
maxPriceMultiplier: "3b9aca00"
systemDecimalValue: "3b9aca00"
minSeparateNumerator: "05"
minSeparateDenominator: "2710"
tradeFeeNumerator: "19"
tradeFeeDenominator: "2710"
pnlNumerator: "0c"
pnlDenominator: "64"
swapFeeNumerator: "19"
swapFeeDenominator: "2710"
baseNeedTakePnl: "00"
quoteNeedTakePnl: "00"
quoteTotalPnl: "00"
baseTotalPnl: "00"
poolOpenTime: "00"
punishPcAmount: "00"
punishCoinAmount: "00"
orderbookToInitTime: "00"
swapBaseInAmount: "3d43a479f3"
swapQuoteOutAmount: "0652e9d0b7a45a"
swapBase2QuoteFee: "04b0cf564f64"
swapQuoteInAmount: "075443f6db3472"
swapBaseOutAmount: "47af45cedc"
swapQuote2BaseFee: "27358803"
baseVault: "DQATWdgELBfpRJxGRrndodbEs8yGZCnzLUPpUa2rDVT"
quoteVault: "FF4DCs7yjA3SEjpeKsiKCEFMVscuYPdnrWJQVuUAx9gg"
baseMint: "So11111111111111111111111111111111111111112"
quoteMint: "4PhoH7mG9m1MrKeAu2f5Mp9ccYT8Jn1oNaqVYXEApump"
lpMint: "HeifFbDr4k1HaLmCRnDh9ZdbammDq3JVr3kciWTToSjL"
openOrders: "C8n8S6fu4aZhqMuBNEBYmHP6iKJStjVui2Jcr9vNm241"
marketId: "F9rYSFpSnGgBdmn3V5LvABVCL8bJt62EtUnrhE8fjgMz"
marketProgramId: "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"
targetOrders: "835mCzyMZv4oxNZ2CY32opEqANQCieUrCLpzghM31CyF"
withdrawQueue: "11111111111111111111111111111111"
lpVault: "11111111111111111111111111111111"
owner: "GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ"
lpReserve: "03ad583b4424"
padding: [
  "00",
  "00",
  "00"
]

@icaca
Copy link
Author

icaca commented Jun 1, 2024

someone is fixing this issue bot.ts

@UZzhu
Copy link

UZzhu commented Jun 2, 2024

hey mate do you know how to listen new token on pump dot fun? I tried this guy's bot.ts but it still did not work.

@icaca
Copy link
Author

icaca commented Jun 2, 2024

I have not tried to monitor their liquidity events recently. Instead, I monitor the transers of certain wallets, and then filter out transactions for purchasing tokens, and then trigger the purchase of the pool.

The following code can be used to query the mint of the pump.fun, but its basemint and quoteVault are reversed. Then I used the purchase method in his code.

  private async getPoolID(baseString: string): Promise<any> {
    let base = new PublicKey(baseString);
    const quote = getToken(QUOTE_MINT);
    const commitment: Commitment = "confirmed";
  
    const id = new PublicKey(baseString)

    // const accountInfo = await this.connection.getAccountInfo(id)
    // logger.info(accountInfo)
    // if (accountInfo === null) throw Error(' get pool info error ')

    // const poolData = PoolInfoLayout.decode(accountInfo.data)
    // logger.info(poolData)

    // const metadataPDA = getPdaMetadataKey(base);
    // const metadataAccount = await this.connection.getAccountInfo(metadataPDA.publicKey, this.connection.commitment);
    
    // var name =''
    // if (metadataAccount && metadataAccount.data){
    //   logger.info(metadataAccount)
    //   const deserialize = this.metadataSerializer.deserialize(metadataAccount.data);
    //   logger.info(deserialize);
    //   name = `${deserialize[0].name} (${deserialize[0].symbol}) `
    // }

    try {
  
      // First try with base

      logger.trace(`Fetching pool for ${base.toBase58()}`)

      let baseAccounts = await this.connection.getProgramAccounts(MAINNET_PROGRAM_ID.AmmV4, {
        commitment,
        filters: [
          { dataSize: LIQUIDITY_STATE_LAYOUT_V4.span },
          {
            memcmp: {
              offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf("baseMint"),
              bytes: base.toBase58(),
            },
          },
          {
            memcmp: {
              offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf("quoteMint"),
              bytes: quote.mint.toBase58(),
            },
          },
        ],
      });

      // logger.info(baseAccounts)

      if (!baseAccounts || baseAccounts.length == 0) {
        baseAccounts = await this.connection.getProgramAccounts(MAINNET_PROGRAM_ID.AmmV4, {
          commitment,
          filters: [
            { dataSize: LIQUIDITY_STATE_LAYOUT_V4.span },
            {
              memcmp: {
                offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf("baseMint"),
                bytes: quote.mint.toBase58(),
              },
            },
            {
              memcmp: {
                offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf("quoteMint"),
                bytes: base.toBase58(),
              },
            },
          ],
        });
      //   // logger.info(baseAccounts)

      }


      logger.trace(`Found ${baseAccounts.length} pools for ${base.toBase58()}`)

      if (baseAccounts.length > 0) {
        // const accountInfo = LIQUIDITY_STATE_LAYOUT_V4.decode(baseAccounts[0].account.data);
        // const accountId = baseAccounts[0].pubkey;
        // logger.info(accountId)
       
        return baseAccounts[0];
      }
    
      return null;
    } catch (error) {
      logger.error(error);
      return null;
    }
  }

@icaca
Copy link
Author

icaca commented Jun 2, 2024

getProgramAccounts and onProgramAccountChange have similar filtering parameters and return values. I hope this helps.

@soltasc
Copy link

soltasc commented Jun 3, 2024

I need only pump coins, as I understand I need to make changes in the listeners.ts Any ideas?

@icaca icaca closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants