I have a token contract that will exclusively use Pancakeswap as trading platform. How can I tell in the contract if a transfer represents someone buying the token or someone selling it?

1 Answer 1


You can check msg.sender in transferFrom().

  • How though? I see that contracts interact with a router, but sometimes the're a middleman inbetween (wallet -> middleman -> router)
    – Brobbry
    Commented Apr 21, 2021 at 10:05

Your Answer

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

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