Contract 0xb9cc7c7a3f7081fe7e48d64ce1df9a21fd00ab13

Contract Overview

Balance:
0 Ether
Txn Hash
Block
From
To
Value
0xdaa85d3c483c17b24a2dab300f23fec530005d4a4a677aa257841a616033153317572252017-09-27 13:50:071251 days 11 hrs ago0x0718197b9ac69127381ed0c4b5d0f724f857c4d1 IN  Contract Creation0 Ether0.1207296440
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Tug

Compiler Version
v0.4.11+commit.68ef5810

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2017-09-27
*/

/* Copyright (C) Etherplay <[email protected]> - All Rights Reserved */
pragma solidity 0.4.11;

contract Tug {

/////////////////////////////////////////////////////////////////// DATA /////////////////////////////////////////////////////////////
    struct Game{
        bytes32 hash;
        
        address shadow1;
        
        uint32 minSzabo;
        uint32 maxSzabo;
        uint16 periodInMinutes;
        uint8 feePerThousand;

        address shadow2;

        address p1; //could use shadow instead and shadow will send the reward back
        address p2; //could use shadow instead and shadow will send the reward back

        uint64 lastTime; 
        uint8 p1NumUnits;
        uint8 p2NumUnits;
        uint8 turn;
        int8 position;
        uint8 move1;
        uint8 move2;
    }
    
    mapping (bytes32 => Game) games; 

  
    struct Conf{
        uint8 minFeePerThousand;
        address organizer;     
    }

    Conf conf;

    function Tug(){
        conf.minFeePerThousand = 0;
        conf.organizer = msg.sender;
    }
    
    function setOrganizer(address newOrganizer){
    if(msg.sender == conf.organizer){
            conf.organizer = newOrganizer;    
        }else{
            throw;
        }
    }

    function setMinFee(uint8 minFeePerThousand){
        if(msg.sender == conf.organizer){
            conf.minFeePerThousand = minFeePerThousand;  
        }else{
            throw;
        }
    }

    function getMinFee() constant returns (uint8 minFeePerThousand){
        minFeePerThousand = conf.minFeePerThousand;
    }

    function getOrganizer() constant returns (address organizer){
        organizer = conf.organizer;
    }
    

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////// EVENTS /////////////////////////////////////////////////////////////

    event Create(
     address creator, uint64 time, bytes32 slot, uint32 minSzabo, uint32 maxSzabo, uint8 numUnits, uint16 periodInMinutes, uint8 feePerThousand
     // bytes32 codeHash // the sha256 of the game code as used by the player
    );

    event CreateInvite(
     address creator, uint64 time, bytes32 slot, address indexed otherPlayer, uint32 minSzabo, uint32 maxSzabo, uint8 numUnits, uint16 periodInMinutes, uint8 feePerThousand
    );

    event Start(
     address starter, bytes32 indexed slot, uint32 szaboPaid, uint8 numUnits, uint16 periodInMinutes, uint8 feePerThousand
    );

    event Error(
        int code
    );

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    function create_game(bytes32 slot, uint32 minSzabo, uint32 maxSzabo, uint8 numUnits, uint16 periodInMinutes, uint8 feePerThousand, address shadow, uint256 allowance, bool broadcast) payable {
        
        uint256 value = msg.value - allowance; //compute the value used by substratcing allowance that pay for the shadow
        
        if(games[slot].turn == 0 //should not have a game there
        && maxSzabo < 2147483647 //max szabo allowed uint max divided by 2 player
        && value == uint256(maxSzabo) * 1 szabo   //should paid enough to cover the maxprice 
        && numUnits > 4 && numUnits < 127
        && feePerThousand >= conf.minFeePerThousand
        ){
            games[slot] = Game({
                minSzabo : minSzabo,
                maxSzabo : maxSzabo,
                periodInMinutes : periodInMinutes,
                p1NumUnits : numUnits, 
                p2NumUnits : numUnits, 
                position : 0,
                turn : 1,
                lastTime : uint64(now),
                move1 : 0,
                move2 : 0,
                hash : 0,  
                shadow1 : shadow,
                shadow2 : 0,
                p1:msg.sender,
                p2 : 0,
                feePerThousand : feePerThousand
            });

            shadowAllowance(shadow,allowance);
            
            if(broadcast){
                Create(msg.sender,uint64(now),slot,minSzabo,maxSzabo,numUnits,periodInMinutes,feePerThousand);   
            }
            

        }else{
            if(msg.value>0){msg.sender.send(msg.value);}
            if(!(games[slot].turn == 0)){
                Error(101);
            }else if(!(maxSzabo < 2147483647) ){
                Error(102);
            }else if(!(value == uint256(maxSzabo) * 1 szabo) ){
                Error(103);
            }else if(!(numUnits > 4 && numUnits < 127) ){
                Error(103);
            }else if(!(feePerThousand >= conf.minFeePerThousand) ){
                Error(104);
            }else{
                Error(105);
            }
        }
    }
    
    function shadowAllowance(address shadow, uint256 allowance)  internal{
        if(allowance > 0){
            shadow.transfer(allowance);
        }
    }
    
    function create_game_invite(bytes32 slot, address otherPlayer, uint32 minSzabo, uint32 maxSzabo, uint8 numUnits, uint16 periodInMinutes, uint8 feePerThousand, address shadow, uint256 allowance) payable {
        
        uint256 value = msg.value - allowance; //compute the value used by substratcing allowance that pay for the shadow
        
        if(games[slot].turn == 0 //should not have a game there
        && maxSzabo < 2147483647 //max szabo allowed uint max divided by 2 player
        && value == uint256(maxSzabo) * 1 szabo   //should paid enough to cover the maxprice 
        && numUnits > 4 && numUnits < 127
        && feePerThousand >= conf.minFeePerThousand
        ){
            games[slot] = Game({
                minSzabo : minSzabo,
                maxSzabo : maxSzabo,
                periodInMinutes : periodInMinutes,
                p1NumUnits : numUnits, 
                p2NumUnits : numUnits, 
                position : 0,
                turn : 1,
                lastTime : uint64(now),
                move1 : 0,
                move2 : 0,
                hash : 0, 
                shadow1 : shadow,
                shadow2 : 0,// could be used for  invite if p1/p2 removed
                p1:msg.sender,
                p2 : otherPlayer,
                feePerThousand : feePerThousand
            });

            shadowAllowance(shadow,allowance);

            CreateInvite(msg.sender,uint64(now),slot,otherPlayer,minSzabo,maxSzabo,numUnits,periodInMinutes,feePerThousand);
            
        }else{
            if(msg.value>0){msg.sender.send(msg.value);}
             if(!(games[slot].turn == 0)){
                Error(201);
            }else if(!(maxSzabo < 2147483647) ){
                Error(202);
            }else if(!(value == uint256(maxSzabo) * 1 szabo) ){
                Error(203);
            }else if(!(numUnits > 4 && numUnits < 127) ){
                Error(203);
            }else if(!(feePerThousand >= conf.minFeePerThousand) ){
                Error(204);
            }else{
                Error(205);
            }
        }
    }
    
    function start_game(bytes32 slot, uint8 numUnits, uint32 szaboPaid, uint16 periodInMinutes, address shadow, uint256 allowance, uint8 feePerThousand) payable {
        
        uint256 value = msg.value - allowance; //compute the value used by substratcing allowance that pay for the shadow
        var game = games[slot];

        if(game.shadow1 != shadow //do not allow player to play with itself (not supported and pointless)
        && game.turn == 1 //game should have been created but not have started    
        && (game.p2 == 0 || game.p2 == msg.sender) //no player invited or invite match
        && game.p1NumUnits == numUnits // check condition match
        && game.periodInMinutes == periodInMinutes // check condition match
        && value == uint256(szaboPaid) * 1 szabo 
        && game.minSzabo <= (value/ 1 szabo) // check condition match
        && game.maxSzabo >= (value/ 1 szabo) // check condition match
        && now - game.lastTime < game.periodInMinutes*60 // in the allowed period
        && feePerThousand == game.feePerThousand //agree on the same fee
        ){
            game.p2 = msg.sender; //TODO only if p2 is zero
            game.shadow2 = shadow; 
            game.turn = 2;
            game.lastTime = uint64(now);
            var paid = uint256(game.maxSzabo) * 1 szabo;
            if(paid > value){
                game.p1.transfer(paid - value); //send extra ether to creator
            }
            game.maxSzabo = uint32(value / 1 szabo) * 2; // save the value paid by both players
            
            shadowAllowance(shadow,allowance);

            Start(msg.sender,slot,szaboPaid,numUnits,periodInMinutes,feePerThousand);
        }else{
            if(msg.value>0){msg.sender.send(msg.value);}
            if(!(game.shadow1 != shadow)){
                Error(301);//Error(msg.sender,"start_game","game.shadow1 != shadow");
            }else if(!(game.turn == 1) ){
                Error(302);//Error(msg.sender,"start_game","game.turn == 1");
            }else if(!((game.p2 == 0 || game.p2 == msg.sender)) ){
                Error(303);//Error(msg.sender,"start_game","(game.p2 == 0 || game.p2 == msg.sender)");
            }else if(!(game.p1NumUnits == numUnits) ){
                Error(304);//Error(msg.sender,"start_game","game.p1NumUnits == numUnits");
            }else if(!(game.periodInMinutes == periodInMinutes) ){
                Error(305);//Error(msg.sender,"start_game","game.periodInMinutes == periodInMinutes");
            }else if(!(value == uint256(szaboPaid) * 1 szabo ) ){
                Error(306);//Error(msg.sender,"start_game","value == szaboPaid * 1 szabo ");
            }else if(!(game.minSzabo <= (value/ 1 szabo)) ){
                Error(307);//Error(msg.sender,"start_game","game.minSzabo <= (value/ 1 szabo)");
            }else if(!(game.maxSzabo >= (value/ 1 szabo)) ){
                Error(308);//Error(msg.sender,"start_game","game.maxSzabo >= (value/ 1 szabo)");
            }else if(!(now - game.lastTime < game.periodInMinutes*60) ){
                Error(309);//Error(msg.sender,"start_game","now - game.lastTime < game.periodInMinutes*60");
            }else if(!(feePerThousand == game.feePerThousand) ){
                Error(310);
            }else{
                Error(311);//Error(msg.sender,"start_game","unknown");
            }
        }
    }
    
    function move(bytes32  slot, bytes32 hash){ 
        var game = games[slot]; 

        if(game.turn == 2 // if game just started
        && (game.shadow2 == msg.sender || game.p2 == msg.sender) //only player 2
        && now - game.lastTime < game.periodInMinutes*60 // in the allowed period
        ){ 
            game.turn = 3; //first move done
            game.hash = hash;
            game.lastTime = uint64(now);
        }else{
            if(!(game.turn == 2)){
                Error(401);
            }else if(!((game.shadow2 == msg.sender || game.p2 == msg.sender))){
                Error(402);
            }else if(!(now - game.lastTime < game.periodInMinutes*60)){
                Error(403);
            }else{
                Error(404);
            }
        }
    }
    
    function move_reveal(bytes32  slot, uint8 move){ //after a move or reveal_move
        var game = games[slot]; 
        
        if(game.turn < 253 && game.turn >= 3 && game.turn % 2 == 1 // move done
        && (game.shadow1 == msg.sender || game.p1 == msg.sender) // only player 1
        && now - game.lastTime < game.periodInMinutes*60 // in the allowed period
        ){ 
            if((game.p1NumUnits > 0 && move == 0) || move > game.p1NumUnits){
                Error(505);
            }else{
                game.move1 = move;
                game.turn ++; //move_reveal done
                game.lastTime = uint64(now);    
            }
        }else{
            if(!(game.turn < 253 && game.turn >= 3 && game.turn % 2 == 1)){
                Error(501);
            }else if(!((game.shadow1 == msg.sender || game.p1 == msg.sender))){
                Error(502);
            }else if(!(now - game.lastTime < game.periodInMinutes*60)){
                Error(503);
            }else{
                Error(504);
            }
        }
    }

    function reveal_move(bytes32  slot, uint8 move, bytes32 secret, bytes32 hash) payable{ //after a move_reveal
        var game = games[slot]; 
        
        if(game.turn < 253 && game.turn >= 4 && game.turn % 2 == 0
        && (game.shadow2 == msg.sender || game.p2 == msg.sender) //only player 2
        && now - game.lastTime < game.periodInMinutes*60 // in the allowed period
        && sha3(secret, game.p2, move) == game.hash //secret match + move match previous hash
        ){ 
            game.turn ++;
            game.lastTime = uint64(now);
            
            if((game.p2NumUnits > 0 && move == 0) || move > game.p2NumUnits){ //do not allow invalid move 
                if(msg.value>0){msg.sender.send(msg.value);}
                Error(606);
                return;
            }
            game.move2 = move; 
            game.hash = hash; 

            uint8 p1Move = game.move1;

            game.p1NumUnits -= p1Move; 
            game.p2NumUnits -= move; 

            if(p1Move < move){
                game.position --; 
            }else if(p1Move > move){
                game.position ++; 
            }

            if(game.position < -2){
                win(slot,game.p2,255);
            }else if(game.position > 2){
                win(slot,game.p1,255);
            }else if(game.p2NumUnits == 0 && game.p1NumUnits == 0){
                if(game.position < 0){
                    win(slot,game.p2,255);
                }else if(game.position > 0){
                    win(slot,game.p1,255);
                }else{
                    draw(slot);
                }
            }else{
                //deal with the case of someone reaching zero before the other : auto win in that case, no point forcing players with zero units to play
                //keep the old position though so we can recompute the actual values for the interface
                if(game.p1NumUnits == 0 && game.p2NumUnits > 0){
                    if(game.position - int8(game.p2NumUnits) < 0){
                        win(slot,game.p2,255);
                    }else if(game.position - int8(game.p2NumUnits) > 0){
                        win(slot,game.p1,255);
                    }else{
                        draw(slot);
                    }
                }else if(game.p1NumUnits > 0 && game.p2NumUnits == 0){
                    if(game.position + int8(game.p1NumUnits) < 0){
                        win(slot,game.p2,255);
                    }else if(game.position + int8(game.p1NumUnits) > 0){
                        win(slot,game.p1,255);
                    }else{
                        draw(slot);
                    }
                }
            }

             
        }else{
            if(msg.value>0){msg.sender.send(msg.value);}
            if(!(game.turn < 253 && game.turn >= 4 && game.turn % 2 == 0)){
                Error(601);
            }else if(!((game.shadow2 == msg.sender || game.p2 == msg.sender))){
                Error(602);
            }else if(!(now - game.lastTime < game.periodInMinutes*60)){
                Error(603);
            }else if(!(sha3(secret, game.p2, move) == game.hash)){
                Error(604);
            }else{
                Error(605);
            }
        }
    }
    
    function win(bytes32 gameSlot, address winner, uint8 turn) internal{
        var game = games[gameSlot];
        game.turn = turn;

        uint256 pot = uint256(game.maxSzabo) * 1 szabo;
        if(game.feePerThousand > 0){
            uint256 forOrganizer = (pot * game.feePerThousand)/1000;
            pot = pot - forOrganizer;
            if(!conf.organizer.send(forOrganizer)){
                pot = pot + forOrganizer;
            }
        }
        winner.send(pot);
        forwardMsgValue(gameSlot);
    }

    function refund(bytes32 gameSlot) internal{
        var game = games[gameSlot];
        game.turn = 253;
        game.p1.send(uint256(game.maxSzabo) * 1 szabo);
        forwardMsgValue(gameSlot);
    }
    
    function draw(bytes32 gameSlot) internal{
        var game = games[gameSlot];
        game.turn = 255;

        var creator = game.p1;
        var starter = game.p2;
        var starterPrize = (uint256(game.maxSzabo) * 1 szabo) /2;
        starter.send(starterPrize);
        creator.send( (uint256(game.maxSzabo) * 1 szabo) - starterPrize);
        forwardMsgValue(gameSlot);
    }

    
    function forwardMsgValue(bytes32 gameSlot) internal{
        var game = games[gameSlot];
        if(msg.value > 0){
            if(msg.sender == game.shadow2){
                game.p2.send(msg.value);
            }else if(msg.sender == game.shadow1){
                game.p1.send(msg.value);
            }
        }
    }
    
  
    function collect(bytes32  slot) payable{ //to get the prize //can only be called by winning player //TODO could allow anyone ?
        var game = games[slot];
        
        if(game.turn < 253 && now - game.lastTime > game.periodInMinutes*60 //can collect after no move from other player
        ){
            if(game.turn == 1 && (msg.sender == game.p1 || msg.sender == game.shadow1)){ // nobodyJoined (turn == 1)
                refund(slot);
            }else if( (game.turn >= 2 && game.turn % 2 == 0)  && (msg.sender == game.p1 || msg.sender == game.shadow1)){ //player 2 late 
                win(slot, game.p1,253);
            }else if((game.turn >= 3 && game.turn % 2 == 1) && (msg.sender == game.p2 || msg.sender == game.shadow2)){ //player 1 late
                win(slot, game.p2,254);
            }else{
                if(msg.value>0){msg.sender.send(msg.value);}
                Error(702); 
            }
        }else{
            if(msg.value>0){msg.sender.send(msg.value);}
            Error(701);
        }
    }
    

    function getGame(bytes32 slot) constant returns (
        uint16 period, 
        uint32 szaboInPlay, 
        uint8 p1NumUnits, 
        uint8 p2NumUnits,
        int8 position,
        uint8 turn,
        address p1,
        address p2,
        uint8 move1,
        uint8 move2,
        uint64 lastTime,
        uint64 blockTime,
        uint64 blockNumber
        ){
        period = games[slot].periodInMinutes;
        szaboInPlay = games[slot].maxSzabo;
        p1NumUnits = games[slot].p1NumUnits;
        p2NumUnits = games[slot].p2NumUnits;
        position = games[slot].position;
        turn = games[slot].turn;
        p1 = games[slot].p1;
        p2 = games[slot].p2;
        move1 = games[slot].move1;
        move2 = games[slot].move2;
        lastTime = games[slot].lastTime;
        blockTime = uint64(now);
        blockNumber = uint64(block.number);
    }

    function getStartParams(bytes32 slot) constant returns (
        uint8 turn,
        uint16 period, 
        uint32 minSzabo,
        uint32 maxSzabo,
        uint8 numUnits,
        address p1,
        address p2,
        uint64 lastTime,
        uint8 feePerThousand
        ){
        turn = games[slot].turn;    
        period = games[slot].periodInMinutes;
        minSzabo = games[slot].minSzabo;
        maxSzabo = games[slot].maxSzabo;
        numUnits = games[slot].p1NumUnits;
        p1 = games[slot].p1;
        p2 = games[slot].p2;
        lastTime = games[slot].lastTime;
        feePerThousand = games[slot].feePerThousand;
    }
}

Contract ABI

[{"constant":false,"inputs":[{"name":"slot","type":"bytes32"},{"name":"move","type":"uint8"}],"name":"move_reveal","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"bytes32"}],"name":"getStartParams","outputs":[{"name":"turn","type":"uint8"},{"name":"period","type":"uint16"},{"name":"minSzabo","type":"uint32"},{"name":"maxSzabo","type":"uint32"},{"name":"numUnits","type":"uint8"},{"name":"p1","type":"address"},{"name":"p2","type":"address"},{"name":"lastTime","type":"uint64"},{"name":"feePerThousand","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"slot","type":"bytes32"}],"name":"collect","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"slot","type":"bytes32"},{"name":"move","type":"uint8"},{"name":"secret","type":"bytes32"},{"name":"hash","type":"bytes32"}],"name":"reveal_move","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"getMinFee","outputs":[{"name":"minFeePerThousand","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"slot","type":"bytes32"},{"name":"minSzabo","type":"uint32"},{"name":"maxSzabo","type":"uint32"},{"name":"numUnits","type":"uint8"},{"name":"periodInMinutes","type":"uint16"},{"name":"feePerThousand","type":"uint8"},{"name":"shadow","type":"address"},{"name":"allowance","type":"uint256"},{"name":"broadcast","type":"bool"}],"name":"create_game","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"bytes32"}],"name":"getGame","outputs":[{"name":"period","type":"uint16"},{"name":"szaboInPlay","type":"uint32"},{"name":"p1NumUnits","type":"uint8"},{"name":"p2NumUnits","type":"uint8"},{"name":"position","type":"int8"},{"name":"turn","type":"uint8"},{"name":"p1","type":"address"},{"name":"p2","type":"address"},{"name":"move1","type":"uint8"},{"name":"move2","type":"uint8"},{"name":"lastTime","type":"uint64"},{"name":"blockTime","type":"uint64"},{"name":"blockNumber","type":"uint64"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"minFeePerThousand","type":"uint8"}],"name":"setMinFee","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOrganizer","type":"address"}],"name":"setOrganizer","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"slot","type":"bytes32"},{"name":"hash","type":"bytes32"}],"name":"move","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getOrganizer","outputs":[{"name":"organizer","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"slot","type":"bytes32"},{"name":"otherPlayer","type":"address"},{"name":"minSzabo","type":"uint32"},{"name":"maxSzabo","type":"uint32"},{"name":"numUnits","type":"uint8"},{"name":"periodInMinutes","type":"uint16"},{"name":"feePerThousand","type":"uint8"},{"name":"shadow","type":"address"},{"name":"allowance","type":"uint256"}],"name":"create_game_invite","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"slot","type":"bytes32"},{"name":"numUnits","type":"uint8"},{"name":"szaboPaid","type":"uint32"},{"name":"periodInMinutes","type":"uint16"},{"name":"shadow","type":"address"},{"name":"allowance","type":"uint256"},{"name":"feePerThousand","type":"uint8"}],"name":"start_game","outputs":[],"payable":true,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"creator","type":"address"},{"indexed":false,"name":"time","type":"uint64"},{"indexed":false,"name":"slot","type":"bytes32"},{"indexed":false,"name":"minSzabo","type":"uint32"},{"indexed":false,"name":"maxSzabo","type":"uint32"},{"indexed":false,"name":"numUnits","type":"uint8"},{"indexed":false,"name":"periodInMinutes","type":"uint16"},{"indexed":false,"name":"feePerThousand","type":"uint8"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"creator","type":"address"},{"indexed":false,"name":"time","type":"uint64"},{"indexed":false,"name":"slot","type":"bytes32"},{"indexed":true,"name":"otherPlayer","type":"address"},{"indexed":false,"name":"minSzabo","type":"uint32"},{"indexed":false,"name":"maxSzabo","type":"uint32"},{"indexed":false,"name":"numUnits","type":"uint8"},{"indexed":false,"name":"periodInMinutes","type":"uint16"},{"indexed":false,"name":"feePerThousand","type":"uint8"}],"name":"CreateInvite","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"starter","type":"address"},{"indexed":true,"name":"slot","type":"bytes32"},{"indexed":false,"name":"szaboPaid","type":"uint32"},{"indexed":false,"name":"numUnits","type":"uint8"},{"indexed":false,"name":"periodInMinutes","type":"uint16"},{"indexed":false,"name":"feePerThousand","type":"uint8"}],"name":"Start","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"code","type":"int256"}],"name":"Error","type":"event"}]

6060604052341561000c57fe5b5b60018054600160a860020a03191661010033600160a060020a0316021790555b5b612b448061003d6000396000f300606060405236156100a95763ffffffff60e060020a60003504166308f75d1781146100ab5780632e9c91a8146100c6578063497777d5146101465780635598c576146101535780635cf34bcf1461016c5780636a7bf76a1461019257806373931bbf146101d757806387287fd71461028157806389d61d7714610299578063a361b184146102b7578063c2def3b9146102cf578063e4083daf146102fb578063f223446c14610345575bfe5b34156100b357fe5b6100c460043560ff60243516610381565b005b34156100ce57fe5b6100d960043561069a565b6040805160ff9a8b16815261ffff90991660208a015263ffffffff978816898201529590961660608801529287166080870152600160a060020a0391821660a08701521660c085015267ffffffffffffffff1660e084015292166101008201529051908190036101200190f35b6100c4600435610726565b005b6100c460043560ff602435166044356064356109b5565b005b341561017457fe5b61017c6111e4565b6040805160ff9092168252519081900360200190f35b6100c460043563ffffffff6024358116906044351660ff60643581169061ffff608435169060a43516600160a060020a0360c4351660e4356101043515156111ee565b005b34156101df57fe5b6101ea6004356117e6565b6040805161ffff909e168e5263ffffffff909c1660208e015260ff9a8b168d8d0152988a1660608d0152600097880b90970b60808c015294881660a08b0152600160a060020a0393841660c08b01529190921660e089015290851661010088015290931661012086015267ffffffffffffffff92831661014086015282166101608501521661018083015251908190036101a00190f35b341561028957fe5b6100c460ff6004351661188f565b005b34156102a157fe5b6100c4600160a060020a03600435166118c9565b005b34156102bf57fe5b6100c4600435602435611921565b005b34156102d757fe5b6102df611b47565b60408051600160a060020a039092168252519081900360200190f35b6100c4600435600160a060020a0360243581169063ffffffff6044358116916064359091169060ff60843581169161ffff60a435169160c435169060e4351661010435611b5c565b005b6100c460043560ff60243581169063ffffffff604435169061ffff6064351690600160a060020a03608435169060a4359060c43516612152565b005b6000828152602081905260409020600481015460fd60f060020a90910460ff161080156103be57506004810154600360f060020a90910460ff1610155b80156103e05750600481015460029060f060020a900460ff165b0660ff166001145b80156104165750600181015433600160a060020a03908116911614806104165750600381015433600160a060020a039081169116145b5b801561045057506001810154600482015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff164203105b15610534576004810154600060e060020a90910460ff16118015610475575060ff8216155b806104915750600481015460ff60e060020a9091048116908316115b156104be57604080516101f981529051600080516020612af98339815191529181900360200190a161052f565b60058101805460ff191660ff8481169190911790915560048201805460f060020a60ff0219811660f060020a91829004841660010190931602919091177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a4267ffffffffffffffff16021790555b610691565b600481015460fd60f060020a90910460ff1610801561056357506004810154600360f060020a90910460ff1610155b80156105855750600481015460029060f060020a900460ff165b0660ff166001145b15156105b357604080516101f581529051600080516020612af98339815191529181900360200190a1610691565b600181015433600160a060020a03908116911614806105e25750600381015433600160a060020a039081169116145b151561061057604080516101f681529051600080516020612af98339815191529181900360200190a1610691565b6001810154600482015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff1642031061066d57604080516101f781529051600080516020612af98339815191529181900360200190a1610691565b604080516101f881529051600080516020612af98339815191529181900360200190a15b5b5b5b5b505050565b60008181526020819052604090206004810154600182015460039092015460f060020a80830460ff9081169460e060020a80820461ffff169560a060020a80840463ffffffff9081169760c060020a860490911696938304861695600160a060020a0391821695918416949290930467ffffffffffffffff1692919004165b9193959799909294969850565b6000818152602081905260409020600481015460fd60f060020a90910460ff1610801561078057506001810154600482015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff164203115b1561095e57600481015460f060020a900460ff1660011480156107cd5750600381015433600160a060020a03908116911614806107cd5750600181015433600160a060020a039081169116145b5b156107e1576107dc82612794565b610957565b6004810154600260f060020a90910460ff16108015906108175750600481015460029060f060020a900460ff165b0660ff166000145b801561084d5750600381015433600160a060020a039081169116148061084d5750600181015433600160a060020a039081169116145b5b156108735760038101546107dc908390600160a060020a031660fd61282c565b610957565b6004810154600360f060020a90910460ff16108015906108a95750600481015460029060f060020a900460ff165b0660ff166001145b80156108df5750600481015433600160a060020a03908116911614806108df5750600281015433600160a060020a039081169116145b5b156109055760048101546107dc908390600160a060020a031660fe61282c565b610957565b600034111561093357604051600160a060020a033316903480156108fc02916000818181858888f150505050505b604080516102be81529051600080516020612af98339815191529181900360200190a15b5b5b6109b0565b600034111561098c57604051600160a060020a033316903480156108fc02916000818181858888f150505050505b604080516102bd81529051600080516020612af98339815191529181900360200190a15b5b5050565b6000848152602081905260408120600481015490919060fd60f060020a90910460ff161080156109f3575060048281015460f060020a900460ff1610155b8015610a155750600482015460029060f060020a900460ff165b0660ff166000145b8015610a4b5750600282015433600160a060020a0390811691161480610a4b5750600482015433600160a060020a039081169116145b5b8015610a8557506001820154600483015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff164203105b8015610ad7575081546004830154604080518781526c01000000000000000000000000600160a060020a0390931692909202602083015260f860020a60ff891602603483015251908190036035019020145b15610fd85760048201805460f060020a60ff0219811660f060020a9182900460ff9081166001018116909202177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a4267ffffffffffffffff16021791829055600060e860020a90920416118015610b52575060ff8516155b80610b6e5750600482015460ff60e860020a9091048116908616115b15610bc9576000341115610ba157604051600160a060020a033316903480156108fc02916000818181858888f150505050505b6040805161025e81529051600080516020612af98339815191529181900360200190a16111d7565b5060058101805460ff808716610100810261ff0019909316929092179283905584845560048401805460e860020a94831660e060020a80830485168290038516027fffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffff9092169190911785810484168a90039093169094027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055811015610cbb576004820180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811660ff60f860020a92839004600090810b60001901900b16909102179055610d0e565b8460ff168160ff161115610d0e576004820180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811660ff60f860020a92839004600090810b600101900b169091021790555b5b600482015460011960f860020a909104600090810b900b1215610d4c576004820154610d47908790600160a060020a031660ff61282c565b610fcc565b6004820154600260f860020a909104600090810b900b1315610d88576003820154610d47908790600160a060020a031660ff61282c565b610fcc565b600482015460e860020a900460ff16158015610db05750600482015460e060020a900460ff16155b15610e37576004820154600060f860020a909104810b810b1215610dee576004820154610de9908790600160a060020a031660ff61282c565b610d47565b6004820154600060f860020a909104810b810b1315610e27576003820154610de9908790600160a060020a031660ff61282c565b610d47565b610d4786612917565b5b5b610fcc565b600482015460e060020a900460ff16158015610e6257506004820154600060e860020a90910460ff16115b15610f05576004820154600060ff60e860020a83041660f860020a909204810b91909103810b1215610eae576004820154610de9908790600160a060020a031660ff61282c565b610d47565b6004820154600060ff60e860020a83041660f860020a909204810b91909103810b1315610e27576003820154610de9908790600160a060020a031660ff61282c565b610d47565b610d4786612917565b5b5b610fcc565b6004820154600060e060020a90910460ff16118015610f305750600482015460e860020a900460ff16155b15610fcc576004820154600060e060020a820460ff1660f860020a909204810b91909101810b1215610f7c576004820154610d47908790600160a060020a031660ff61282c565b610fcc565b6004820154600060e060020a820460ff1660f860020a909204810b91909101810b1315610fc3576003820154610d47908790600160a060020a031660ff61282c565b610fcc565b610fcc86612917565b5b5b5b5b5b5b5b6111d7565b600034111561100657604051600160a060020a033316903480156108fc02916000818181858888f150505050505b600482015460fd60f060020a90910460ff16108015611033575060048281015460f060020a900460ff1610155b80156110555750600482015460029060f060020a900460ff165b0660ff166000145b1515611083576040805161025981529051600080516020612af98339815191529181900360200190a16111d7565b600282015433600160a060020a03908116911614806110b25750600482015433600160a060020a039081169116145b15156110e0576040805161025a81529051600080516020612af98339815191529181900360200190a16111d7565b6001820154600483015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff1642031061113d576040805161025b81529051600080516020612af98339815191529181900360200190a16111d7565b81546004830154604080518781526c01000000000000000000000000600160a060020a0390931692909202602083015260f860020a60ff891602603483015251908190036035019020146111b3576040805161025c81529051600080516020612af98339815191529181900360200190a16111d7565b6040805161025d81529051600080516020612af98339815191529181900360200190a15b5b5b5b5b5b505050505050565b60015460ff165b90565b600089815260208190526040902060040154348390039060f060020a900460ff161580156112255750637fffffff8863ffffffff16105b801561123d57508763ffffffff1664e8d4a510000281145b801561124c575060048760ff16115b801561125b5750607f8760ff16105b8015611270575060015460ff90811690861610155b1561164d5761020060405190810160405280600060010260001916815260200185600160a060020a031681526020018a63ffffffff1681526020018963ffffffff1681526020018761ffff1681526020018660ff1681526020016000600160a060020a0316815260200133600160a060020a031681526020016000600160a060020a031681526020014267ffffffffffffffff1681526020018860ff1681526020018860ff168152602001600160ff168152602001600060000b8152602001600060ff168152602001600060ff16815250600060008c600019166000191681526020019081526020016000206000820151816000019060001916905560208201518160010160006101000a815481600160a060020a030219169083600160a060020a0316021790555060408201518160010160146101000a81548163ffffffff021916908363ffffffff16021790555060608201518160010160186101000a81548163ffffffff021916908363ffffffff160217905550608082015181600101601c6101000a81548161ffff021916908361ffff16021790555060a082015181600101601e6101000a81548160ff021916908360ff16021790555060c08201518160020160006101000a815481600160a060020a030219169083600160a060020a0316021790555060e08201518160030160006101000a815481600160a060020a030219169083600160a060020a031602179055506101008201518160040160006101000a815481600160a060020a030219169083600160a060020a031602179055506101208201518160040160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555061014082015181600401601c6101000a81548160ff021916908360ff16021790555061016082015181600401601d6101000a81548160ff021916908360ff16021790555061018082015181600401601e6101000a81548160ff021916908360ff1602179055506101a082015181600401601f6101000a81548160ff021916908360000b60ff1602179055506101c08201518160050160006101000a81548160ff021916908360ff1602179055506101e08201518160050160016101000a81548160ff021916908360ff1602179055509050506115bf8484612a12565b81156116485760408051600160a060020a033316815267ffffffffffffffff421660208201528082018c905263ffffffff808c1660608301528a16608082015260ff808a1660a083015261ffff891660c0830152871660e082015290517f5737d0798efc39d6eba43d0201c81b8dbf5f32e3c52ff50273f636402509924b918190036101000190a15b6117d4565b600034111561167b57604051600160a060020a033316903480156108fc02916000818181858888f150505050505b60008a81526020819052604090206004015460f060020a900460ff16156116c35760408051606581529051600080516020612af98339815191529181900360200190a16117d4565b637fffffff63ffffffff8916106116fb5760408051606681529051600080516020612af98339815191529181900360200190a16117d4565b64e8d4a5100063ffffffff89160281146117365760408051606781529051600080516020612af98339815191529181900360200190a16117d4565b60048760ff1611801561174c5750607f8760ff16105b15156117795760408051606781529051600080516020612af98339815191529181900360200190a16117d4565b60015460ff90811690861610156117b15760408051606881529051600080516020612af98339815191529181900360200190a16117d4565b60408051606981529051600080516020612af98339815191529181900360200190a15b5b5b5b5b5b5b50505050505050505050565b600081815260208190526040812060018101546004820154600383015460059093015460e060020a80840461ffff169560c060020a90940463ffffffff169490830460ff9081169460e860020a850482169460f860020a810490910b9360f060020a8204831693600160a060020a0390811693908316928183169261010090049091169060a060020a900467ffffffffffffffff1642435b91939597999b9d90929496989a9c50565b60015433600160a060020a039081166101009092041614156118bf576001805460ff191660ff83161790556118c5565b60006000fd5b5b50565b60015433600160a060020a039081166101009092041614156118bf576001805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a038416021790556118c5565b60006000fd5b5b50565b6000828152602081905260409020600481015460f060020a900460ff1660021480156119775750600281015433600160a060020a03908116911614806119775750600481015433600160a060020a039081169116145b5b80156119b157506001810154600482015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff164203105b15611a225760048101805483835560f060020a60ff0219167e03000000000000000000000000000000000000000000000000000000000000177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a4267ffffffffffffffff1602179055610691565b600481015460f060020a900460ff16600214611a60576040805161019181529051600080516020612af98339815191529181900360200190a1610691565b600281015433600160a060020a0390811691161480611a8f5750600481015433600160a060020a039081169116145b1515611abd576040805161019281529051600080516020612af98339815191529181900360200190a1610691565b6001810154600482015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff16420310611b1a576040805161019381529051600080516020612af98339815191529181900360200190a1610691565b6040805161019481529051600080516020612af98339815191529181900360200190a15b5b5b5b5b505050565b6001546101009004600160a060020a03165b90565b600089815260208190526040902060040154348290039060f060020a900460ff16158015611b935750637fffffff8763ffffffff16105b8015611bab57508663ffffffff1664e8d4a510000281145b8015611bba575060048660ff16115b8015611bc95750607f8660ff16105b8015611bde575060015460ff90811690851610155b15611fb95761020060405190810160405280600060010260001916815260200184600160a060020a031681526020018963ffffffff1681526020018863ffffffff1681526020018661ffff1681526020018560ff1681526020016000600160a060020a0316815260200133600160a060020a031681526020018a600160a060020a031681526020014267ffffffffffffffff1681526020018760ff1681526020018760ff168152602001600160ff168152602001600060000b8152602001600060ff168152602001600060ff16815250600060008c600019166000191681526020019081526020016000206000820151816000019060001916905560208201518160010160006101000a815481600160a060020a030219169083600160a060020a0316021790555060408201518160010160146101000a81548163ffffffff021916908363ffffffff16021790555060608201518160010160186101000a81548163ffffffff021916908363ffffffff160217905550608082015181600101601c6101000a81548161ffff021916908361ffff16021790555060a082015181600101601e6101000a81548160ff021916908360ff16021790555060c08201518160020160006101000a815481600160a060020a030219169083600160a060020a0316021790555060e08201518160030160006101000a815481600160a060020a030219169083600160a060020a031602179055506101008201518160040160006101000a815481600160a060020a030219169083600160a060020a031602179055506101208201518160040160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555061014082015181600401601c6101000a81548160ff021916908360ff16021790555061016082015181600401601d6101000a81548160ff021916908360ff16021790555061018082015181600401601e6101000a81548160ff021916908360ff1602179055506101a082015181600401601f6101000a81548160ff021916908360000b60ff1602179055506101c08201518160050160006101000a81548160ff021916908360ff1602179055506101e08201518160050160016101000a81548160ff021916908360ff160217905550905050611f2c8383612a12565b6040805133600160a060020a03908116825267ffffffffffffffff421660208301528183018d905263ffffffff808c1660608401528a16608083015260ff808a1660a084015261ffff891660c0840152871660e08301529151918b16917f13257928657174a36ad3ecc8958888769c7bfa7821d4eea26e69ce97f04fbb95918190036101000190a26117d4565b6000341115611fe757604051600160a060020a033316903480156108fc02916000818181858888f150505050505b60008a81526020819052604090206004015460f060020a900460ff161561202f576040805160c981529051600080516020612af98339815191529181900360200190a16117d4565b637fffffff63ffffffff881610612067576040805160ca81529051600080516020612af98339815191529181900360200190a16117d4565b64e8d4a5100063ffffffff88160281146120a2576040805160cb81529051600080516020612af98339815191529181900360200190a16117d4565b60048660ff161180156120b85750607f8660ff16105b15156120e5576040805160cb81529051600080516020612af98339815191529181900360200190a16117d4565b60015460ff908116908516101561211d576040805160cc81529051600080516020612af98339815191529181900360200190a16117d4565b6040805160cd81529051600080516020612af98339815191529181900360200190a15b5b5b5b5b5b5b50505050505050505050565b60008781526020819052604081206001810154348590039290600160a060020a038781169116148015906121945750600482015460f060020a900460ff166001145b80156121c557506004820154600160a060020a031615806121c55750600482015433600160a060020a039081169116145b5b80156121e25750600482015460ff8a811660e060020a90920416145b80156121ff5750600182015461ffff88811660e060020a90920416145b801561221757508763ffffffff1664e8d4a510000283145b8015612245575064e8d4a51000835b048260010160149054906101000a900463ffffffff1663ffffffff1611155b8015612273575064e8d4a51000835b048260010160189054906101000a900463ffffffff1663ffffffff1610155b80156122ac57506001820154600483015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff164203105b80156122c85750600182015460ff85811660f060020a90920416145b15612463575060048101805460028301805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a038a811691909117909255909116339091161760f060020a60ff0219167e02000000000000000000000000000000000000000000000000000000000000177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a4267ffffffffffffffff1602179055600181015460c060020a900463ffffffff1664e8d4a5100002828111156123c0576003820154604051600160a060020a039091169084830380156108fc02916000818181858888f1935050505015156123c057fe5b5b64e8d4a51000835b046002028260010160186101000a81548163ffffffff021916908363ffffffff1602179055506123f98686612a12565b60408051600160a060020a033316815263ffffffff8a16602082015260ff808c168284015261ffff8a1660608301528616608082015290518b917f5b5948bd88c09f07863610f3bca002791c37626dd82c326c5ff8e8ad986f6fab919081900360a00190a26117d4565b600034111561249157604051600160a060020a033316903480156108fc02916000818181858888f150505050505b6001820154600160a060020a03878116911614156124d1576040805161012d81529051600080516020612af98339815191529181900360200190a16117d4565b600482015460f060020a900460ff1660011461250f576040805161012e81529051600080516020612af98339815191529181900360200190a16117d4565b6004820154600160a060020a031615806125395750600482015433600160a060020a039081169116145b1515612567576040805161012f81529051600080516020612af98339815191529181900360200190a16117d4565b600482015460ff8a811660e060020a90920416146125a7576040805161013081529051600080516020612af98339815191529181900360200190a16117d4565b600182015461ffff88811660e060020a90920416146125e8576040805161013181529051600080516020612af98339815191529181900360200190a16117d4565b64e8d4a5100063ffffffff8916028314612624576040805161013281529051600080516020612af98339815191529181900360200190a16117d4565b64e8d4a51000835b600184015491900460a060020a90910463ffffffff161115612670576040805161013381529051600080516020612af98339815191529181900360200190a16117d4565b64e8d4a51000835b600184015491900460c060020a90910463ffffffff1610156126bc576040805161013481529051600080516020612af98339815191529181900360200190a16117d4565b6001820154600483015460e060020a90910461ffff908116603c021660a060020a90910467ffffffffffffffff16420310612719576040805161013581529051600080516020612af98339815191529181900360200190a16117d4565b600182015460ff85811660f060020a9092041614612759576040805161013681529051600080516020612af98339815191529181900360200190a16117d4565b6040805161013781529051600080516020612af98339815191529181900360200190a15b5b5b5b5b5b5b5b5b5b5b5b50505050505050505050565b60008181526020819052604080822060048101805460f060020a60ff0219167efd0000000000000000000000000000000000000000000000000000000000001790556003810154600182015492519193600160a060020a03909116926108fc60c060020a90910463ffffffff1664e8d4a5100002801591909102929091818181858888f19350505050506109b082612a4e565b5b5050565b600083815260208190526040812060048101805460f060020a60ff02191660f060020a60ff8681168202929092179092556001830154929360c060020a840463ffffffff1664e8d4a5100002939092900416819011156128de5760018301546103e89060f060020a900460ff1683025b60015460405192909104938490039392506101009004600160a060020a0316906108fc8315029083906000818181858888f1935050505015156128de57908101905b5b604051600160a060020a0386169083156108fc029084906000818181858888f19350505050506111d786612a4e565b5b505050505050565b60008181526020819052604081206004810180547eff00000000000000000000000000000000000000000000000000000000000060f060020a60ff02199091161790819055600382015460018301549293600160a060020a039182169391909216919060029060c060020a900463ffffffff1664e8d4a51000025b6040519190049150600160a060020a0383169082156108fc029083906000818181858888f1505050506001850154604051600160a060020a03861692506108fc60c060020a90920463ffffffff1664e8d4a510000284900380159290920291906000818181858888f1935050505050612a0a85612a4e565b5b5050505050565b60008111156109b057604051600160a060020a0383169082156108fc029083906000818181858888f1935050505015156109b057fe5b5b5b5050565b6000818152602081905260408120903411156109b057600281015433600160a060020a0390811691161415612aad576004810154604051600160a060020a03909116903480156108fc02916000818181858888f19350505050506109b0565b600181015433600160a060020a03908116911614156109b0576003810154604051600160a060020a03909116903480156108fc02916000818181858888f150505050505b5b5b5b5050560061ae744460330c100f3fed9aab830d7b96b79502dfbf7588e010e0b03c7b5df3a165627a7a72305820416ad9ee11c19269bc07ddaad222c4d6d1c79811901558368aa225285b6e17dc0029

Swarm Source

bzzr://416ad9ee11c19269bc07ddaad222c4d6d1c79811901558368aa225285b6e17dc
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading