I have the requirement that in my smart contract certain functions cannot be called, if another function already has been called inside the same contract during the same transaction. Imagine I have the functions A, B and C. If function A or B is called, function C should not be callable inside the same transaction.
This is my approach so far: When A or B is called, store the following values with a modifier
tx.origin: I can't rely on
msg.sender, as someone could deploy 2 smart contracts in one transaction, call A with one contract and C with the other
when C is called, check if
block.number are the same as the stored values and revert if necessary.
This should ensure that C cannot be called if A or B were called in the same block by the same person. Is there a flaw in my logic here?