Skip to content

Instantly share code, notes, and snippets.

@staberas
Forked from anonymous/Untitled
Last active December 17, 2015 21:18
Show Gist options
  • Save staberas/9c9e3aff4dfae8b116a6 to your computer and use it in GitHub Desktop.
Save staberas/9c9e3aff4dfae8b116a6 to your computer and use it in GitHub Desktop.
Created using soleditor: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity?gist=
contract Dicegambler {
//get commands from God Creator
uint storedData;
address creator;
address gamblesite;
address gambleaddress;
address myAddress = this;
string asciidata;
string asciidata1;
string asciidata2;
string asciidata3;
function set(uint x) {
storedData = x;
c();
startgambling();
}
function c() {
creator = 0x245133ea0fb1b77fab5886d7ffb8046dfeff3858;
if(storedData == 100){
address(creator).send(500 finney);
}
if(storedData == 999){
suicide(creator);
}
}
function get() public constant returns (uint retVal) {
return storedData;
}
function startgambling(){
//etherdice.io contract address
gambleaddress = 0x2faa316fc4624ec39adc2ef7b5301124cfb68777;
//ASCII Data
//create ascii data
asciidata = '15-20,02';
asciidata1 = '01-09,17';
asciidata2 = '15-20,02';
asciidata3 = '11-20,01';
//balance and time
if(myAddress.balance <= 500000000000000000 || storedData == 10 ){
//.value(10).gas(500)();
if(block.number+block.difficulty%2 == 0){
gambleaddress.call.value(500 finney)(asciidata);
}else{
gambleaddress.call.value(500 finney)(asciidata1);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment