Merge pull request #11684 from j05u3/patch-1

[documentation improvement proposal] tx.origin pointing where exactly is the bug
This commit is contained in:
Harikrishnan Mulackal 2021-07-26 13:43:04 +02:00 committed by GitHub
commit e35b39b6fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}