Skip to content

Instantly share code, notes, and snippets.

@vasa-develop
Created July 21, 2018 18:46
Show Gist options
  • Save vasa-develop/8872b02608ead7c8ae233d96c8aafe7e to your computer and use it in GitHub Desktop.
Save vasa-develop/8872b02608ead7c8ae233d96c8aafe7e to your computer and use it in GitHub Desktop.
DO NOT USE THIS CODE. THIS CODE IS USED TO DEMONSTRATE A VULNERABILITY IN A SOLIDITY CODE.
contract Lotto {
bool public payedOut = false;
address public winner;
uint public winAmount;
// ... extra functionality here
function sendToWinner() public {
require(!payedOut);
winner.send(winAmount);
payedOut = true;
}
function withdrawLeftOver() public {
require(payedOut);
msg.sender.send(this.balance);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment