If you like me to create more gambling smart contracts please donate at 0xA01F32b1898Ea5c0079997D28bF00D441Ad0883c ,or contact me via PM for custom smart contracts for eth or tokens (erc20 etc) + safemath + security check + bug fixes .
Will post more smart contracts in time ... also post your gambling smart contracts ideas here if you want them to become real.
Thank You!
contract P2PBettingContrat {
address public thejudge;
address public zbetter;
uint public betwinnings;
uint public betwinningsfee;
mapping (address => uint) public thebetamount;
mapping (address => address) public thebetjudge;
mapping (address => address) public better;
mapping (address => address) public eventmaker;
mapping (address => uint) public isbetactive;
mapping (address => uint) public betwinlose;
mapping (address => uint) public thejudgefee;
function CreateEvent(uint betamount,address persontobetagainst,address betjudge,uint judgefee) public payable {
require(betamount == msg.value);
require(persontobetagainst != msg.sender);
require(betjudge != msg.sender || betjudge != persontobetagainst);
require(isbetactive[msg.sender] == 0);
thebetamount[msg.sender] = msg.value;
thebetjudge[msg.sender] = betjudge;
better[msg.sender] = persontobetagainst;
isbetactive[msg.sender] = 0;
eventmaker[msg.sender] = msg.sender;
betwinlose[msg.sender] = 1;
thejudgefee[msg.sender] = judgefee;
}
function BetonEvent(address eventcreator) public payable {
require(isbetactive[eventcreator] == 0);
require(better[msg.sender] == msg.sender);
require(thebetamount[eventcreator] == msg.value);
isbetactive[eventcreator] == 1;
}
function EventCreatorCancelsBet(address eventcreator) external {
require(isbetactive[eventcreator] == 0);
require(eventmaker[eventcreator] == msg.sender);
eventcreator.transfer(thebetamount[eventcreator]);
}
function JudgeDecidedBetWinner(uint winner,address eventcreator) external {
require(isbetactive[eventcreator] == 1);
require(thebetjudge[eventcreator] == msg.sender);
betwinnings = thebetamount[eventcreator] + thebetamount[eventcreator];
betwinningsfee = betwinnings - thejudgefee[eventcreator];
thejudge = thebetjudge[eventcreator];
zbetter = better[eventcreator];
if(betwinlose[eventcreator] == winner){
eventcreator.transfer(betwinningsfee);
thejudge.transfer(thejudgefee[eventcreator]);
}else{
zbetter.transfer(betwinningsfee);
thejudge.transfer(thejudgefee[eventcreator]);
}
}
}