Get Pancake Pool's of a specific token

The following query gives all the pools of pancake v1 and v2 for a specific token. Here we took 0xa184088a740c695e156f91f5cc086a06bb78b827 as an example.

{
  ethereum(network: bsc) {
    arguments(
      smartContractAddress: {in: ["0xBCfCcbde45cE874adCB698cC183deBcF17952812",
      "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"]}
      smartContractEvent: {is: "PairCreated"}
      options: {asc: "block.height", limit: 10}
    ) {
      block {
        height
      }
      any(
        of: argument_value
        argument: {in: ["token0", "token1"]}
        value: {is: "0xa184088a740c695e156f91f5cc086a06bb78b827"}
      )
      pair: any(of: argument_value, argument: {is: "pair"})
      token1: any(of: argument_value, argument: {is: "token1"})
      token0: any(of: argument_value, argument: {is: "token0"})
    }
  }
}

Hi, I was looking for exact this query. However, it does not seem to work properly. To test the query, I tried to find the LP Pool of the SAFEMOON token (address 0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3) on Pancake Swap, but the results of the above query seem weird. Not only do I get many wrong Pairs that have nothing to do with SAFEMOON, but also when I take out the options and the part with the block height, it gives just one wrong result. I played around with the value filter and tried to put it in the first block etc. but I could not find any working solution yet. Any suggestions?
Thanks.

It seems as if the following part is not working properly:

any(
of: argument_value
argument: {in: [“token0”, “token1”]}
value: {in: “0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3”}
)

More specifically, the value-filter does not seem to work.

1 Like

Hey, has this been solved? How to find [your_token]/BNB LP BNB Holdings in USD?

1 Like

Sorry not yet resolved, we have raised this again with the dev team.

DexTrades API can be used to get pool tokens for a given currency, check the following query

{
  ethereum(network: bsc) {
    dexTrades(
      baseCurrency: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}
      options: {desc: "trades"}
    ) {
      poolToken: smartContract {
        address {
          address
        }
      }
      exchange {
        fullName
      }
      pair: quoteCurrency {
        symbol
      }
      trades: count
    }
  }
}

Hey,

I just tested it with a new tokens : 0xa8656f71EE80573Ed11719a7957Bd83fa320250B

As you will Poocoin have data about their LP but from the API I’m getting “no result”
https://poocoin.app/tokens/0xa8656f71ee80573ed11719a7957bd83fa320250b

I just would like to know why it happens for being able to handle this issue.
Thank you

You need the latest trades for this (0xa8656f71EE80573Ed11719a7957Bd83fa320250B) token right?

Check this query

{
  ethereum(network: bsc) {
    dexTrades(
      baseCurrency: {is: "0xa8656f71EE80573Ed11719a7957Bd83fa320250B"}
      quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
      options: {desc: ["transaction.index"], limit: 10}
    ) {
      transaction {
        index
        gas
        gasPrice
        gasValue
      }
      gasPrice
      gas
      exchange {
        name
      }
      baseCurrency {
        symbol
      }
      quoteCurrency {
        symbol
      }
      quotePrice
    }
  }
}