Created
December 20, 2016 22:02
Revisions
-
Ryan F Venter created this gist
Dec 20, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ contract Gamble { function Gamble() { owner = msg.sender; address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2; nameReg.callstring32string32("register", "UltimateGamble"); } function gamble(uint luckyNumber) { value = value+ msg.value; hash randomness = sha3(block.prevhash ^ hash(msg.sender) ^ luckyNumber); if (msg.value >= 1000000000000000000 && ((randomness & 0xff) < hash(0x20))) { lostValue = lostValue + value / 2; msg.sender.send(value - (value / 2)); value = 0; } } function withdraw() { owner.send(lostValue); lostValue = 0; } uint value; }