I wrote a contract A that uses msg.sender
for authentication: When A creates an item it stores msg.sender
in itemsOwners
mapping (itemOwners[itemId] = msg.sender;
). Later A compares msg.sender
to itemOwners[itemId]
to check access rights.
Now I have the trouble that I cannot use my contract B to wrap calls to A, because A wrongly assumes that the item owner is the contract B, when B calls A. So it stores a wrong item owner that should be a user, not contract B.
Should I replace msg.sender
by tx.origin
in A? Or what to do? It was not recommended to use tx.origin
. So?
I ask not what is the difference between msg.sender
and tx.origin
, but what to do?