Using python 3.10, web3 v5.31.1

Given only the contract address for a single token (tokenA), is there a method from PancakeSwap to return liquidity pool (LP) details?

Mainly given only the address of tokenA, how can I find out what LP is set up for tokenA?

Furthermore, assuming I want to buy tokenA with BNB, but tokenA has a LP with some other token, tokenB, but tokenB has an LP with BNB, I can swap via BNB -> tokenB -> tokenA.

How do dApps such as https://poocoin.app find these routes to trade. The image below shows that the dApp found a valid route BNB -> BUSD -> USDT -> token. How is this accomplished?

screenshot of poocoin.app swap example

I am new to coding web3 so example code would be greatly appreciated; thank you for help!

1 Answer 1


You can check PAIRS_TO_CHECK_TRADE_AGAINS addresses. Check within the factory if there's pairs between your token and WBNB, BUSD, TETHER and USDC. Maybe WBTC.

You can check calling getPool() from the pancake factory, pass the address of your token and the addresses of those tokens. With the address the pool you can do everything else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.