Created
July 21, 2018 19:56
-
-
Save vasa-develop/b7724a85b68600e2c688da0b233313b8 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.
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
contract Roulette { | |
uint public pastBlockTime; // Forces one bet per block | |
constructor() public payable {} // initially fund contract | |
// fallback function used to make a bet | |
function () public payable { | |
require(msg.value == 10 ether); // must send 10 ether to play | |
require(now != pastBlockTime); // only 1 transaction per block | |
pastBlockTime = now; | |
if(now % 15 == 0) { // winner | |
msg.sender.transfer(this.balance); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment