新Dapp《币神争霸》申请上线



  • 1.游戏名称: 币神争霸
    币神争霸是一款预测类竞猜游戏,通过观察BTC价格走势图进行比特币价格预测竞猜。

    2.规则介绍:
    每期预测时长为2分钟,前一分钟为竞猜时间,后一分钟为等待开奖时间。用户通过竞猜当前的预测数值与2分钟末开奖数值的高低/开奖数值尾数单双/开奖数值尾数数值/这三种预测类型进行下注,并通过调用智能合约进行开奖和奖励分发,中奖概率公平公开。

    3.上线状态:否

    4.Dapp合约地址:vite_f28701574a794a5d9d8fad9c92de8c67b8f19b777a75d0cf64

    5.合约代码如下:

    contract CoinWar {
        address owner;
        event Bet(address indexed from, uint value, tokenId tokenid, uint id, uint gameCode);
        event Reward(address indexed from, uint value, uint id, uint gameCode);
    
        constructor() public {
            owner = msg.sender;
        }
    
        onMessage transferOwner(address newOwner) {
            require(owner == msg.sender, "Only owner can call this.");
            owner = newOwner;
        }
    
        onMessage drawMoney(uint amount) {
            require(owner == msg.sender, "Only owner can call this.");
            require(amount <= balance(msg.tokenid));
            msg.sender.transfer(msg.tokenid, amount);
        }
    
        onMessage reward(address winner, uint val, uint id, uint gameCode) {
            require(owner == msg.sender, "Only owner can call this.");
            require(winner != address(0) && val > 0 && id > 0 && gameCode > 0, "reward error.");
            winner.transfer(msg.tokenid, val);
            emit Reward(winner, val, id, gameCode);
        }
    
    
        onMessage bet(uint id, uint gameCode) payable {
            uint betAmount = msg.amount;
            address betAddr = msg.sender;
            tokenId tokenid = msg.tokenid;
    
            require(betAmount > 0 && id > 0 && gameCode > 0, "bet error.");
    
            emit Bet(betAddr, betAmount, tokenid, id, gameCode);
        }
    }
    

Log in to reply
 

Suggested Topics