-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCasino.sol
37 lines (32 loc) · 1.08 KB
/
Casino.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
pragma solidity ^0.4.0;
contract CoinFlip{
address owner;
uint payPercentage = 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*payPercentage)/100)){
Status("Congratulation You won!,But we dont have enough money, So we are transfering your balance",msg.sender,msg.value);
msg.sender.transfer(this.balance);
}
else{
msg.sender.transfer(msg.value *(100 + payPercentage)/100);
Status("Congratulation You won!,We are transfering your balance",msg.sender,msg.value * (100 + payPercentage)/100);
}
}
else{
Status("We are sorry try agian to make some money!",msg.sender,msg.value);
}
}
modifier OnlyOwner{
if(msg.sender != owner){
revert();
}
else{
_;
}
}
}