one more doubt :
uint balance = balances[tx.origin];
What is means of tx.origin.
Can I use msg.sender instead of tx.origin ?
Apr 12, 2018, 6:50 AM
I am reading the same answer.
But thing is that : its good practise to use tx.origin instaed of msg.sender ?
But thing is that : its good practise to use tx.origin instaed of msg.sender ?
Apr 12, 2018, 6:52 AM
Tx.origin is unsafe in certain uses.. ie require(tx.origin == owner);
If A contract can maliciously get the owner to send it funds then trigger fallback function that calls the function in that contract will then pass that require(tx.origin == owner) check... Msg.sender in this case is safer.
If A contract can maliciously get the owner to send it funds then trigger fallback function that calls the function in that contract will then pass that require(tx.origin == owner) check... Msg.sender in this case is safer.
Apr 14, 2018, 3:48 AM