tx.origin pointing where exactly is the bug

Clarification for preventing more bugs of this kind that have been shown recently.
This commit is contained in:
Josué 2021-07-23 14:11:35 -05:00 committed by hrkrshnn
parent 6d6c9e6e4f
commit 71d6e8da2d

View File

@ -211,6 +211,7 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
}
function transferTo(address payable dest, uint amount) public {
// THE BUG IS RIGHT HERE, you must use msg.sender instead of tx.origin
require(tx.origin == owner);
dest.transfer(amount);
}