Skip to content

Instantly share code, notes, and snippets.

@bartubozkurt
Created February 2, 2023 11:50
Show Gist options
  • Save bartubozkurt/03f010f2ec1b9659d826f3339771273e to your computer and use it in GitHub Desktop.
Save bartubozkurt/03f010f2ec1b9659d826f3339771273e to your computer and use it in GitHub Desktop.
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