Skip to content

Instantly share code, notes, and snippets.

@vasa-develop
Created July 21, 2018 19:56
Show Gist options
  • Save vasa-develop/b7724a85b68600e2c688da0b233313b8 to your computer and use it in GitHub Desktop.
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.
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