0

I'm playing with solidity on BSC network...if I want to fetch the price of my test token, which service could I use? Can I write a function inside the smart contract of my token that retrieve the price or should I use some external API? It's important for me to retrieve the price as soon as the token is launched.

0

assuming your token is tradeable on pancakeswap you can get your token price interacting with the corresponding pancakePair contract.

2
  • Thank you for your answer..where can I find the corresponding pancakePair contract after that my token is tradable on pancakeswap? Also, I need to implement this function on my smart contract right?
    – Nicola
    Sep 20 at 9:51
  • You can get it from pancakeFactory using the pairFor (or getPair or something like that, dont remember lol) function. And yes i guess you need to put this into your smart contract, that depends what you're trying to do with your price though.
    – Foxxxey
    Sep 24 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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