mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11684 from j05u3/patch-1
[documentation improvement proposal] tx.origin pointing where exactly is the bug
This commit is contained in:
commit
e35b39b6fe
@ -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 {
|
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);
|
require(tx.origin == owner);
|
||||||
dest.transfer(amount);
|
dest.transfer(amount);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user