4

I plan on creating some tokens and want to create code that will execute if the one of the tokens is used within a smart contract. Is this possible?

eth
  • 85,679
  • 53
  • 285
  • 406
JHSmith
  • 41
  • 2

1 Answers1

2

You can compare msg.sender and tx.origin; if the two are different, your code is being called by another contract. That other contract could be someone's wallet, however - or just about anything else - and it's probably a bad idea to make decisions on that basis.

Nick Johnson
  • 8,144
  • 1
  • 28
  • 35