Created
February 2, 2023 11:50
-
-
Save bartubozkurt/03f010f2ec1b9659d826f3339771273e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
address owner; | |
/* Bad */ | |
function sendTo(address receiver, uint amount) public { | |
require(tx.origin == owner); | |
receiver.transfer(amount); | |
} | |
/* Better */ | |
function sendTo(address receiver, uint amount) public { | |
require(msg.sender == owner); | |
receiver.transfer(amount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment