pragma solidity ^0.4.18; contract CoinFlip { address owner uint payPercentaje = 90; event Status(string _msg, address user, uint amount); function CoinFlip() payable{ owner = msg.sender; } function FlipCoin() payable { if((block.timestamp % 2 ) == 0){ if(this.balance < ((msg.value*payPercentaje)/100)) { status('Congratulations, you won! Sry we didnt have enought money, we will pay you soon', msg.sender, this.balance); msg.sender.trasnfer(this.balance); } else{ status('Congratulatios, you WON!', msg.sender, msg.value * (100 + payPercentaje)/100); msg.sender.transfer(msg.value * (100 + payPercentaje)/100); } } { status ('We are sorry, you lose, try again to recover your money', msg.sender, msg.value); } } function kill() onlyOwner { status('Contrated killed, not longer avaiable to use', msg.sender, this.balance); } modifier onlyOwner { if (msg.sender != owner){ throw(); } else { _; } } }
0.4.18