ETH Price: $1,817.90 (+0.29%)
Gas: 30 Gwei
 

Overview

ETH Balance

0.16223783 ETH

Eth Value

$294.93 (@ $1,817.90/ETH)

Token Holdings

Sponsored

Transaction Hash
Method
Block
From
To
Value
Open Lootbox63435332018-09-16 17:28:011707 days 5 hrs ago1537118881IN
0xa44e46...33460430
0.005 ETH0.0225963100
Withdraw To Addr...60337572018-07-26 14:09:211759 days 9 hrs ago1532614161IN
0xa44e46...33460430
0 ETH0.000084624
Withdraw To Addr...60337232018-07-26 14:01:391759 days 9 hrs ago1532613699IN
0xa44e46...33460430
0 ETH0.000081933
Forge Items60252212018-07-25 3:16:031760 days 19 hrs ago1532488563IN
0xa44e46...33460430
0 ETH0.0008852820
Put On60160292018-07-23 13:28:351762 days 9 hrs ago1532352515IN
0xa44e46...33460430
0 ETH0.00051076
Put On60160232018-07-23 13:27:281762 days 9 hrs ago1532352448IN
0xa44e46...33460430
0 ETH0.00051076
Open Lootbox59983462018-07-20 13:48:011765 days 9 hrs ago1532094481IN
0xa44e46...33460430
0.005 ETH0.000542973
Open Lootbox59982912018-07-20 13:33:441765 days 9 hrs ago1532093624IN
0xa44e46...33460430
0.005 ETH0.000361922
Change Champs Na...59978182018-07-20 11:37:061765 days 11 hrs ago1532086626IN
0xa44e46...33460430
0 ETH0.000088582
Open Lootbox59978172018-07-20 11:36:571765 days 11 hrs ago1532086617IN
0xa44e46...33460430
0.005 ETH0.000421872
Create Champ59973382018-07-20 9:41:411765 days 13 hrs ago1532079701IN
0xa44e46...33460430
0.005 ETH0.000869833
Open Lootbox59875542018-07-18 17:29:151767 days 5 hrs ago1531934955IN
0xa44e46...33460430
0.005 ETH0.0048997525
Buy Item59875542018-07-18 17:29:151767 days 5 hrs ago1531934955IN
0xa44e46...33460430
0.01 ETH0.0011181220
Open Lootbox59875522018-07-18 17:28:481767 days 5 hrs ago1531934928IN
0xa44e46...33460430
0.005 ETH0.0195936100
Open Lootbox59875522018-07-18 17:28:481767 days 5 hrs ago1531934928IN
0xa44e46...33460430
0.005 ETH0.01945062107.5
Buy Item59875522018-07-18 17:28:481767 days 5 hrs ago1531934928IN
0xa44e46...33460430
0.0112 ETH0.00978355175
Buy Item59875522018-07-18 17:28:481767 days 5 hrs ago1531934928IN
0xa44e46...33460430
0.037 ETH0.003545350
Change Champs Na...59875502018-07-18 17:28:261767 days 5 hrs ago1531934906IN
0xa44e46...33460430
0 ETH0.0022964752
Create Champ59875472018-07-18 17:28:181767 days 5 hrs ago1531934898IN
0xa44e46...33460430
0.005 ETH0.0054988820
Change Players N...59875472018-07-18 17:28:181767 days 5 hrs ago1531934898IN
0xa44e46...33460430
0 ETH0.000043421
Create Champ59007022018-07-03 22:31:011782 days 38 mins ago1530657061IN
0xa44e46...33460430
0.005 ETH0.0030494410
Withdraw To Addr...58769382018-06-29 21:05:531786 days 2 hrs ago1530306353IN
0xa44e46...33460430
0 ETH0.0010676441
Withdraw Champ58751842018-06-29 14:03:481786 days 9 hrs ago1530281028IN
0xa44e46...33460430
0 ETH0.000041371
Create Champ58612432018-06-27 4:16:461788 days 18 hrs ago1530073006IN
0xa44e46...33460430
0.005 ETH0.002199558
Create Champ58601882018-06-26 23:45:021788 days 23 hrs ago1530056702IN
0xa44e46...33460430
0.005 ETH0.0028994410
View all transactions

Latest 16 internal transactions

Advanced mode:
Parent Txn Hash Block From To Value
60337572018-07-26 14:09:211759 days 9 hrs ago1532614161
0xa44e46...33460430
0.023082 ETH
60337232018-07-26 14:01:391759 days 9 hrs ago1532613699
0xa44e46...33460430
0.06778017 ETH
58769382018-06-29 21:05:531786 days 2 hrs ago1530306353
0xa44e46...33460430
0.18415 ETH
58635612018-06-27 13:53:271788 days 9 hrs ago1530107607
0xa44e46...33460430
0.005 ETH
58621902018-06-27 8:11:101788 days 14 hrs ago1530087070
0xa44e46...33460430
0.005 ETH
58563902018-06-26 8:02:451789 days 15 hrs ago1530000165
0xa44e46...33460430
0.005 ETH
58561522018-06-26 7:05:441789 days 16 hrs ago1529996744
0xa44e46...33460430
0.005 ETH
58560512018-06-26 6:38:391789 days 16 hrs ago1529995119
0xa44e46...33460430
0.005 ETH
58550002018-06-26 2:11:181789 days 20 hrs ago1529979078
0xa44e46...33460430
0.005 ETH
58547572018-06-26 1:08:031789 days 22 hrs ago1529975283
0xa44e46...33460430
0.005 ETH
58546102018-06-26 0:27:491789 days 22 hrs ago1529972869
0xa44e46...33460430
0.005 ETH
58527332018-06-25 16:30:251790 days 6 hrs ago1529944225
0xa44e46...33460430
0.005 ETH
56557652018-05-22 5:04:431824 days 18 hrs ago1526965483
0xa44e46...33460430
0.0025 ETH
56207592018-05-16 0:31:311830 days 22 hrs ago1526430691
0xa44e46...33460430
0.01625 ETH
56139242018-05-14 19:54:261832 days 3 hrs ago1526327666
0xa44e46...33460430
0.0297 ETH
56114492018-05-14 9:16:111832 days 13 hrs ago1526289371
0xa44e46...33460430
0.0225 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MyCryptoChampCore

Compiler Version
v0.4.23+commit.124ca40d

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-05-14
*/

pragma solidity 0.4.23;


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {
  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address internal contractOwner;

  constructor () internal {
    if(contractOwner == address(0)){
      contractOwner = msg.sender;
    }
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == contractOwner);
    _;
  }
  

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    contractOwner = newOwner;
  }

}


/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is Ownable {
  bool private paused = false;

  /**
   * @dev Modifier to allow actions only when the contract IS paused
     @dev If is paused msg.value is send back
   */
  modifier whenNotPaused() {
    if(paused == true && msg.value > 0){
      msg.sender.transfer(msg.value);
    }
    require(!paused);
    _;
  }


  /**
   * @dev Called by the owner to pause, triggers stopped state
   */
  function triggerPause() onlyOwner external {
    paused = !paused;
  }

}


/// @title A contract for creating new champs and making withdrawals
contract ChampFactory is Pausable{

    event NewChamp(uint256 champID, address owner);

    using SafeMath for uint; //SafeMath for overflow prevention

    /*
     * Variables
     */
    struct Champ {
        uint256 id; //same as position in Champ[]
        uint256 attackPower;
        uint256 defencePower;
        uint256 cooldownTime; //how long does it take to be ready attack again
        uint256 readyTime; //if is smaller than block.timestamp champ is ready to fight
        uint256 winCount;
        uint256 lossCount;
        uint256 position; //position in leaderboard. subtract 1 and you got position in leaderboard[]
        uint256 price; //selling price
        uint256 withdrawCooldown; //if you one of the 800 best champs and withdrawCooldown is less as block.timestamp then you get ETH reward
        uint256 eq_sword; 
        uint256 eq_shield; 
        uint256 eq_helmet; 
        bool forSale; //is champ for sale?
    }
    
    struct AddressInfo {
        uint256 withdrawal;
        uint256 champsCount;
        uint256 itemsCount;
        string name;
    }

    //Item struct
    struct Item {
        uint8 itemType; // 1 - Sword | 2 - Shield | 3 - Helmet
        uint8 itemRarity; // 1 - Common | 2 - Uncommon | 3 - Rare | 4 - Epic | 5 - Legendery | 6 - Forged
        uint256 attackPower;
        uint256 defencePower;
        uint256 cooldownReduction;
        uint256 price;
        uint256 onChampId; //can not be used to decide if item is on champ, because champ's id can be 0, 'bool onChamp' solves it.
        bool onChamp; 
        bool forSale; //is item for sale?
    }
    
    mapping (address => AddressInfo) public addressInfo;
    mapping (uint256 => address) public champToOwner;
    mapping (uint256 => address) public itemToOwner;
    mapping (uint256 => string) public champToName;
    
    Champ[] public champs;
    Item[] public items;
    uint256[] public leaderboard;
    
    uint256 internal createChampFee = 5 finney;
    uint256 internal lootboxFee = 5 finney;
    uint256 internal pendingWithdrawal = 0;
    uint256 private randNonce = 0; //being used in generating random numbers
    uint256 public champsForSaleCount;
    uint256 public itemsForSaleCount;
    

    /*
     * Modifiers
     */
    /// @dev Checks if msg.sender is owner of champ
    modifier onlyOwnerOfChamp(uint256 _champId) {
        require(msg.sender == champToOwner[_champId]);
        _;
    }
    

    /// @dev Checks if msg.sender is NOT owner of champ
    modifier onlyNotOwnerOfChamp(uint256 _champId) {
        require(msg.sender != champToOwner[_champId]);
        _;
    }
    

    /// @notice Checks if amount was sent
    modifier isPaid(uint256 _price){
        require(msg.value >= _price);
        _;
    }


    /// @notice People are allowed to withdraw only if min. balance (0.01 gwei) is reached
    modifier contractMinBalanceReached(){
        require( (address(this).balance).sub(pendingWithdrawal) > 1000000 );
        _;
    }


    /// @notice Checks if withdraw cooldown passed 
    modifier isChampWithdrawReady(uint256 _id){
        require(champs[_id].withdrawCooldown < block.timestamp);
        _;
    }


    /// @notice Distribute input funds between contract owner and players
    modifier distributeInput(address _affiliateAddress){

        //contract owner
        uint256 contractOwnerWithdrawal = (msg.value / 100) * 50; // 50%
        addressInfo[contractOwner].withdrawal += contractOwnerWithdrawal;
        pendingWithdrawal += contractOwnerWithdrawal;

        //affiliate
        //checks if _affiliateAddress is set & if affiliate address is not buying player
        if(_affiliateAddress != address(0) && _affiliateAddress != msg.sender){
            uint256 affiliateBonus = (msg.value / 100) * 25; //provision is 25%
            addressInfo[_affiliateAddress].withdrawal += affiliateBonus;
            pendingWithdrawal += affiliateBonus;
        }

        _;
    }



    /*
     * View
     */
    /// @notice Gets champs by address
    /// @param _owner Owner address
    function getChampsByOwner(address _owner) external view returns(uint256[]) {
        uint256[] memory result = new uint256[](addressInfo[_owner].champsCount);
        uint256 counter = 0;
        for (uint256 i = 0; i < champs.length; i++) {
            if (champToOwner[i] == _owner) {
                result[counter] = i;
                counter++;
            }
        }
        return result;
    }


    /// @notice Gets total champs count
    function getChampsCount() external view returns(uint256){
        return champs.length;
    }
    

    /// @notice Gets champ's reward in wei
    function getChampReward(uint256 _position) public view returns(uint256) {
        if(_position <= 800){
            //percentageMultipier = 10,000
            //maxReward = 2000 = .2% * percentageMultipier
            //subtractPerPosition = 2 = .0002% * percentageMultipier
            //2000 - (2 * (_position - 1))
            uint256 rewardPercentage = uint256(2000).sub(2 * (_position - 1));

            //available funds are all funds - already pending
            uint256 availableWithdrawal = address(this).balance.sub(pendingWithdrawal);

            //calculate reward for champ's position
            //1000000 = percentageMultipier * 100
            return availableWithdrawal / 1000000 * rewardPercentage;
        }else{
            return uint256(0);
        }
    }


    /*
     * Internal
     */
    /// @notice Generates random modulus
    /// @param _modulus Max random modulus
    function randMod(uint256 _modulus) internal returns(uint256) {
        randNonce++;
        return uint256(keccak256(randNonce, blockhash(block.number - 1))) % _modulus;
    }
    


    /*
     * External
     */
    /// @notice Creates new champ
    /// @param _affiliateAddress Affiliate address (optional)
    function createChamp(address _affiliateAddress) external payable 
    whenNotPaused
    isPaid(createChampFee) 
    distributeInput(_affiliateAddress) 
    {

        /* 
        Champ memory champ = Champ({
             id: 0,
             attackPower: 2 + randMod(4),
             defencePower: 1 + randMod(4),
             cooldownTime: uint256(1 days) - uint256(randMod(9) * 1 hours),
             readyTime: 0,
             winCount: 0,
             lossCount: 0,
             position: leaderboard.length + 1, //Last place in leaderboard is new champ's position. Used in new champ struct bellow. +1 to avoid zero position.
             price: 0,
             withdrawCooldown: uint256(block.timestamp), 
             eq_sword: 0,
             eq_shield: 0, 
             eq_helmet: 0, 
             forSale: false 
        });   
        */

        // This line bellow is about 30k gas cheaper than lines above. They are the same. Lines above are just more readable.
        uint256 id = champs.push(Champ(0, 2 + randMod(4), 1 + randMod(4), uint256(1 days)  - uint256(randMod(9) * 1 hours), 0, 0, 0, leaderboard.length + 1, 0, uint256(block.timestamp), 0,0,0, false)) - 1;     
        
        
        champs[id].id = id; //sets id in Champ struct  
        leaderboard.push(id); //push champ on the last place in leaderboard  
        champToOwner[id] = msg.sender; //sets owner of this champ - msg.sender
        addressInfo[msg.sender].champsCount++;

        emit NewChamp(id, msg.sender);

    }


    /// @notice Change "CreateChampFee". If ETH price will grow up it can expensive to create new champ.
    /// @param _fee New "CreateChampFee"
    /// @dev Only owner of contract can change "CreateChampFee"
    function setCreateChampFee(uint256 _fee) external onlyOwner {
        createChampFee = _fee;
    }
    

    /// @notice Change champ's name
    function changeChampsName(uint _champId, string _name) external 
    onlyOwnerOfChamp(_champId){
        champToName[_champId] = _name;
    }


    /// @notice Change players's name
    function changePlayersName(string _name) external {
        addressInfo[msg.sender].name = _name;
    }


    /// @notice Withdraw champ's reward
    /// @param _id Champ id
    /// @dev Move champ reward to pending withdrawal to his wallet. 
    function withdrawChamp(uint _id) external 
    onlyOwnerOfChamp(_id) 
    contractMinBalanceReached  
    isChampWithdrawReady(_id) 
    whenNotPaused {
        Champ storage champ = champs[_id];
        require(champ.position <= 800);

        champ.withdrawCooldown = block.timestamp + 1 days; //one withdrawal 1 per day

        uint256 withdrawal = getChampReward(champ.position);
        addressInfo[msg.sender].withdrawal += withdrawal;
        pendingWithdrawal += withdrawal;
    }
    

    /// @dev Send all pending funds of caller's address
    function withdrawToAddress(address _address) external 
    whenNotPaused {
        address playerAddress = _address;
        if(playerAddress == address(0)){ playerAddress = msg.sender; }
        uint256 share = addressInfo[playerAddress].withdrawal; //gets pending funds
        require(share > 0); //is it more than 0?

        //first sets players withdrawal pending to 0 and subtract amount from playerWithdrawals then transfer funds to avoid reentrancy
        addressInfo[playerAddress].withdrawal = 0; //set player's withdrawal pendings to 0 
        pendingWithdrawal = pendingWithdrawal.sub(share); //subtract share from total pendings 
        
        playerAddress.transfer(share); //transfer
    }
    
}



/// @title  Moderates items and creates new ones
contract Items is ChampFactory {

    event NewItem(uint256 itemID, address owner);

    constructor () internal {
        //item -> nothing
        items.push(Item(0, 0, 0, 0, 0, 0, 0, false, false));
    }

    /*
     * Modifiers
     */
    /// @notice Checks if sender is owner of item
    modifier onlyOwnerOfItem(uint256 _itemId) {
        require(_itemId != 0);
        require(msg.sender == itemToOwner[_itemId]);
        _;
    }
    

    /// @notice Checks if sender is NOT owner of item
    modifier onlyNotOwnerOfItem(uint256 _itemId) {
        require(msg.sender != itemToOwner[_itemId]);
        _;
    }


    /*
     * View
     */
    ///@notice Check if champ has something on
    ///@param _type Sword, shield or helmet
    function hasChampSomethingOn(uint _champId, uint8 _type) internal view returns(bool){
        Champ storage champ = champs[_champId];
        if(_type == 1){
            return (champ.eq_sword == 0) ? false : true;
        }
        if(_type == 2){
            return (champ.eq_shield == 0) ? false : true;
        }
        if(_type == 3){
            return (champ.eq_helmet == 0) ? false : true;
        }
    }


    /// @notice Gets items by address
    /// @param _owner Owner address
    function getItemsByOwner(address _owner) external view returns(uint256[]) {
        uint256[] memory result = new uint256[](addressInfo[_owner].itemsCount);
        uint256 counter = 0;
        for (uint256 i = 0; i < items.length; i++) {
            if (itemToOwner[i] == _owner) {
                result[counter] = i;
                counter++;
            }
        }
        return result;
    }


    /*
     * Public
     */
    ///@notice Takes item off champ
    function takeOffItem(uint _champId, uint8 _type) public 
        onlyOwnerOfChamp(_champId) {
            uint256 itemId;
            Champ storage champ = champs[_champId];
            if(_type == 1){
                itemId = champ.eq_sword; //Get item ID
                if (itemId > 0) { //0 = nothing
                    champ.eq_sword = 0; //take off sword
                }
            }
            if(_type == 2){
                itemId = champ.eq_shield; //Get item ID
                if(itemId > 0) {//0 = nothing
                    champ.eq_shield = 0; //take off shield
                }
            }
            if(_type == 3){
                itemId = champ.eq_helmet; //Get item ID
                if(itemId > 0) { //0 = nothing
                    champ.eq_helmet = 0; //take off 
                }
            }
            if(itemId > 0){
                items[itemId].onChamp = false; //item is free to use, is not on champ
            }
    }



    /*
     * External
     */
    ///@notice Puts item on champ
    function putOn(uint256 _champId, uint256 _itemId) external 
        onlyOwnerOfChamp(_champId) 
        onlyOwnerOfItem(_itemId) {
            Champ storage champ = champs[_champId];
            Item storage item = items[_itemId];

            //checks if items is on some other champ
            if(item.onChamp){
                takeOffItem(item.onChampId, item.itemType); //take off from champ
            }

            item.onChamp = true; //item is on champ
            item.onChampId = _champId; //champ's id

            //put on
            if(item.itemType == 1){
                //take off actual sword 
                if(champ.eq_sword > 0){
                    takeOffItem(champ.id, 1);
                }
                champ.eq_sword = _itemId; //put on sword
            }
            if(item.itemType == 2){
                //take off actual shield 
                if(champ.eq_shield > 0){
                    takeOffItem(champ.id, 2);
                }
                champ.eq_shield = _itemId; //put on shield
            }
            if(item.itemType == 3){
                //take off actual helmet 
                if(champ.eq_helmet > 0){
                    takeOffItem(champ.id, 3);
                }
                champ.eq_helmet = _itemId; //put on helmet
            }
    }



    /// @notice Opens loot box and generates new item
    function openLootbox(address _affiliateAddress) external payable 
    whenNotPaused
    isPaid(lootboxFee) 
    distributeInput(_affiliateAddress) {

        uint256 pointToCooldownReduction;
        uint256 randNum = randMod(1001); //random number <= 1000
        uint256 pointsToShare; //total points given
        uint256 itemID;

        //sets up item
        Item memory item = Item({
            itemType: uint8(uint256(randMod(3) + 1)), //generates item type - max num is 2 -> 0 + 1 SWORD | 1 + 1 SHIELD | 2 + 1 HELMET;
            itemRarity: uint8(0),
            attackPower: 0,
            defencePower: 0,
            cooldownReduction: 0,
            price: 0,
            onChampId: 0,
            onChamp: false,
            forSale: false
        });
        
        // Gets Rarity of item
        // 45% common
        // 27% uncommon
        // 19% rare
        // 7%  epic
        // 2%  legendary
        if(450 > randNum){
            pointsToShare = 25 + randMod(9); //25 basic + random number max to 8
            item.itemRarity = uint8(1);
        }else if(720 > randNum){
            pointsToShare = 42 + randMod(17); //42 basic + random number max to 16
            item.itemRarity = uint8(2);
        }else if(910 > randNum){
            pointsToShare = 71 + randMod(25); //71 basic + random number max to 24
            item.itemRarity = uint8(3);
        }else if(980 > randNum){
            pointsToShare = 119 + randMod(33); //119 basic + random number max to 32
            item.itemRarity = uint8(4);
        }else{
            pointsToShare = 235 + randMod(41); //235 basic + random number max to 40
            item.itemRarity = uint8(5);
        }
        

        //Gets type of item
        if(item.itemType == uint8(1)){ //ITEM IS SWORDS
            item.attackPower = pointsToShare / 10 * 7; //70% attackPower
            pointsToShare -= item.attackPower; //points left;
                
            item.defencePower = pointsToShare / 10 * randMod(6); //up to 15% defencePower
            pointsToShare -= item.defencePower; //points left;
                
            item.cooldownReduction = pointsToShare * uint256(1 minutes); //rest of points is cooldown reduction
            item.itemType = uint8(1);
        }
        
        if(item.itemType == uint8(2)){ //ITEM IS SHIELD
            item.defencePower = pointsToShare / 10 * 7; //70% defencePower
            pointsToShare -= item.defencePower; //points left;
                
            item.attackPower = pointsToShare / 10 * randMod(6); //up to 15% attackPowerPower
            pointsToShare -= item.attackPower; //points left;
                
            item.cooldownReduction = pointsToShare * uint256(1 minutes); //rest of points is cooldown reduction
            item.itemType = uint8(2);
        }
        
        if(item.itemType == uint8(3)){ //ITEM IS HELMET
            pointToCooldownReduction = pointsToShare / 10 * 7; //70% cooldown reduction
            item.cooldownReduction = pointToCooldownReduction * uint256(1 minutes); //points to time
            pointsToShare -= pointToCooldownReduction; //points left;
                
            item.attackPower = pointsToShare / 10 * randMod(6); //up to 15% attackPower
            pointsToShare -= item.attackPower; //points left;
                
            item.defencePower = pointsToShare; //rest of points is defencePower
            item.itemType = uint8(3);
        }

        itemID = items.push(item) - 1;
        
        itemToOwner[itemID] = msg.sender; //sets owner of this item - msg.sender
        addressInfo[msg.sender].itemsCount++; //every address has count of items    

        emit NewItem(itemID, msg.sender);    

    }

    /// @notice Change "lootboxFee". 
    /// @param _fee New "lootboxFee"
    /// @dev Only owner of contract can change "lootboxFee"
    function setLootboxFee(uint _fee) external onlyOwner {
        lootboxFee = _fee;
    }
}



/// @title Moderates buying and selling items
contract ItemMarket is Items {

    event TransferItem(address from, address to, uint256 itemID);

    /*
     * Modifiers
     */
    ///@notice Checks if item is for sale
    modifier itemIsForSale(uint256 _id){
        require(items[_id].forSale);
        _;
    }

    ///@notice Checks if item is NOT for sale
    modifier itemIsNotForSale(uint256 _id){
        require(items[_id].forSale == false);
        _;
    }

    ///@notice If item is for sale then cancel sale
    modifier ifItemForSaleThenCancelSale(uint256 _itemID){
      Item storage item = items[_itemID];
      if(item.forSale){
          _cancelItemSale(item);
      }
      _;
    }


    ///@notice Distribute sale eth input
    modifier distributeSaleInput(address _owner) { 
        uint256 contractOwnerCommision; //1%
        uint256 playerShare; //99%
        
        if(msg.value > 100){
            contractOwnerCommision = (msg.value / 100);
            playerShare = msg.value - contractOwnerCommision;
        }else{
            contractOwnerCommision = 0;
            playerShare = msg.value;
        }

        addressInfo[_owner].withdrawal += playerShare;
        addressInfo[contractOwner].withdrawal += contractOwnerCommision;
        pendingWithdrawal += playerShare + contractOwnerCommision;
        _;
    }



    /*
     * View
     */
    function getItemsForSale() view external returns(uint256[]){
        uint256[] memory result = new uint256[](itemsForSaleCount);
        if(itemsForSaleCount > 0){
            uint256 counter = 0;
            for (uint256 i = 0; i < items.length; i++) {
                if (items[i].forSale == true) {
                    result[counter]=i;
                    counter++;
                }
            }
        }
        return result;
    }
    
     /*
     * Private
     */
    ///@notice Cancel sale. Should not be called without checking if item is really for sale.
    function _cancelItemSale(Item storage item) private {
      //No need to overwrite item's price
      item.forSale = false;
      itemsForSaleCount--;
    }


    /*
     * Internal
     */
    /// @notice Transfer item
    function transferItem(address _from, address _to, uint256 _itemID) internal 
      ifItemForSaleThenCancelSale(_itemID) {
        Item storage item = items[_itemID];

        //take off      
        if(item.onChamp && _to != champToOwner[item.onChampId]){
          takeOffItem(item.onChampId, item.itemType);
        }

        addressInfo[_to].itemsCount++;
        addressInfo[_from].itemsCount--;
        itemToOwner[_itemID] = _to;

        emit TransferItem(_from, _to, _itemID);
    }



    /*
     * Public
     */
    /// @notice Calls transfer item
    /// @notice Address _from is msg.sender. Cannot be used is market, bc msg.sender is buyer
    function giveItem(address _to, uint256 _itemID) public 
      onlyOwnerOfItem(_itemID) {
        transferItem(msg.sender, _to, _itemID);
    }
    

    /// @notice Calcels item's sale
    function cancelItemSale(uint256 _id) public 
    itemIsForSale(_id) 
    onlyOwnerOfItem(_id){
      Item storage item = items[_id];
       _cancelItemSale(item);
    }


    /*
     * External
     */
    /// @notice Sets item for sale
    function setItemForSale(uint256 _id, uint256 _price) external 
      onlyOwnerOfItem(_id) 
      itemIsNotForSale(_id) {
        Item storage item = items[_id];
        item.forSale = true;
        item.price = _price;
        itemsForSaleCount++;
    }
    
    
    /// @notice Buys item
    function buyItem(uint256 _id) external payable 
      whenNotPaused 
      onlyNotOwnerOfItem(_id) 
      itemIsForSale(_id) 
      isPaid(items[_id].price) 
      distributeSaleInput(itemToOwner[_id]) 
      {
        transferItem(itemToOwner[_id], msg.sender, _id);
    }
    
}



/// @title Manages forging
contract ItemForge is ItemMarket {

	event Forge(uint256 forgedItemID);

	///@notice Forge items together
	function forgeItems(uint256 _parentItemID, uint256 _childItemID) external 
	onlyOwnerOfItem(_parentItemID) 
	onlyOwnerOfItem(_childItemID) 
	ifItemForSaleThenCancelSale(_parentItemID) 
	ifItemForSaleThenCancelSale(_childItemID) {

		//checks if items are not the same
        require(_parentItemID != _childItemID);
        
		Item storage parentItem = items[_parentItemID];
		Item storage childItem = items[_childItemID];

		//take child item off, because child item will be burned
		if(childItem.onChamp){
			takeOffItem(childItem.onChampId, childItem.itemType);
		}

		//update parent item
		parentItem.attackPower = (parentItem.attackPower > childItem.attackPower) ? parentItem.attackPower : childItem.attackPower;
		parentItem.defencePower = (parentItem.defencePower > childItem.defencePower) ? parentItem.defencePower : childItem.defencePower;
		parentItem.cooldownReduction = (parentItem.cooldownReduction > childItem.cooldownReduction) ? parentItem.cooldownReduction : childItem.cooldownReduction;
		parentItem.itemRarity = uint8(6);

		//burn child item
		transferItem(msg.sender, address(0), _childItemID);

		emit Forge(_parentItemID);
	}

}


/// @title Manages attacks in game
contract ChampAttack is ItemForge {
    
    event Attack(uint256 winnerChampID, uint256 defeatedChampID, bool didAttackerWin);

    /*
     * Modifiers
     */
     /// @notice Is champ ready to fight again?
    modifier isChampReady(uint256 _champId) {
      require (champs[_champId].readyTime <= block.timestamp);
      _;
    }


    /// @notice Prevents from self-attack
    modifier notSelfAttack(uint256 _champId, uint256 _targetId) {
        require(_champId != _targetId); 
        _;
    }


    /// @notice Checks if champ does exist
    modifier targetExists(uint256 _targetId){
        require(champToOwner[_targetId] != address(0)); 
        _;
    }


    /*
     * View
     */
    /// @notice Gets champ's attack power, defence power and cooldown reduction with items on
    function getChampStats(uint256 _champId) public view returns(uint256,uint256,uint256){
        Champ storage champ = champs[_champId];
        Item storage sword = items[champ.eq_sword];
        Item storage shield = items[champ.eq_shield];
        Item storage helmet = items[champ.eq_helmet];

        //AP
        uint256 totalAttackPower = champ.attackPower + sword.attackPower + shield.attackPower + helmet.attackPower; //Gets champs AP

        //DP
        uint256 totalDefencePower = champ.defencePower + sword.defencePower + shield.defencePower + helmet.defencePower; //Gets champs  DP

        //CR
        uint256 totalCooldownReduction = sword.cooldownReduction + shield.cooldownReduction + helmet.cooldownReduction; //Gets  CR

        return (totalAttackPower, totalDefencePower, totalCooldownReduction);
    }


    /*
     * Pure
     */
    /// @notice Subtracts ability points. Helps to not cross minimal attack ability points -> 2
    /// @param _playerAttackPoints Actual player's attack points
    /// @param _x Amount to subtract 
    function subAttack(uint256 _playerAttackPoints, uint256 _x) internal pure returns (uint256) {
        return (_playerAttackPoints <= _x + 2) ? 2 : _playerAttackPoints - _x;
    }
    

    /// @notice Subtracts ability points. Helps to not cross minimal defence ability points -> 1
    /// @param _playerDefencePoints Actual player's defence points
    /// @param _x Amount to subtract 
    function subDefence(uint256 _playerDefencePoints, uint256 _x) internal pure returns (uint256) {
        return (_playerDefencePoints <= _x) ? 1 : _playerDefencePoints - _x;
    }
    

    /*
     * Private
     */
    /// @dev Is called from from Attack function after the winner is already chosen
    /// @dev Updates abilities, champ's stats and swaps positions
    function _attackCompleted(Champ storage _winnerChamp, Champ storage _defeatedChamp, uint256 _pointsGiven, uint256 _pointsToAttackPower) private {
        /*
         * Updates abilities after fight
         */
        //winner abilities update
        _winnerChamp.attackPower += _pointsToAttackPower; //increase attack power
        _winnerChamp.defencePower += _pointsGiven - _pointsToAttackPower; //max point that was given - already given to AP
                
        //defeated champ's abilities update
        //checks for not cross minimal AP & DP points
        _defeatedChamp.attackPower = subAttack(_defeatedChamp.attackPower, _pointsToAttackPower); //decrease attack power
        _defeatedChamp.defencePower = subDefence(_defeatedChamp.defencePower, _pointsGiven - _pointsToAttackPower); // decrease defence power



        /*
         * Update champs' wins and losses
         */
        _winnerChamp.winCount++;
        _defeatedChamp.lossCount++;
            


        /*
         * Swap positions
         */
        if(_winnerChamp.position > _defeatedChamp.position) { //require loser to has better (lower) postion than attacker
            uint256 winnerPosition = _winnerChamp.position;
            uint256 loserPosition = _defeatedChamp.position;
        
            _defeatedChamp.position = winnerPosition;
            _winnerChamp.position = loserPosition;
        
            //position in champ struct is always one point bigger than in leaderboard array
            leaderboard[winnerPosition - 1] = _defeatedChamp.id;
            leaderboard[loserPosition - 1] = _winnerChamp.id;
        }
    }
    
    
    /// @dev Gets pointsGiven and pointsToAttackPower
    function _getPoints(uint256 _pointsGiven) private returns (uint256 pointsGiven, uint256 pointsToAttackPower){
        return (_pointsGiven, randMod(_pointsGiven+1));
    }



    /*
     * External
     */
    /// @notice Attack function
    /// @param _champId Attacker champ
    /// @param _targetId Target champ
    function attack(uint256 _champId, uint256 _targetId) external 
    onlyOwnerOfChamp(_champId) 
    isChampReady(_champId) 
    notSelfAttack(_champId, _targetId) 
    targetExists(_targetId) {
        Champ storage myChamp = champs[_champId]; 
        Champ storage enemyChamp = champs[_targetId]; 
        uint256 pointsGiven; //total points that will be divided between AP and DP
        uint256 pointsToAttackPower; //part of points that will be added to attack power, the rest of points go to defence power
        uint256 myChampAttackPower;  
        uint256 enemyChampDefencePower; 
        uint256 myChampCooldownReduction;
        
        (myChampAttackPower,,myChampCooldownReduction) = getChampStats(_champId);
        (,enemyChampDefencePower,) = getChampStats(_targetId);


        //if attacker's AP is more than target's DP then attacker wins
        if (myChampAttackPower > enemyChampDefencePower) {
            
            //this should demotivate players from farming on way weaker champs than they are
            //the bigger difference between AP & DP is, the reward is smaller
            if(myChampAttackPower - enemyChampDefencePower < 5){
                
                //big experience - 3 ability points
                (pointsGiven, pointsToAttackPower) = _getPoints(3);
                
                
            }else if(myChampAttackPower - enemyChampDefencePower < 10){
                
                //medium experience - 2 ability points
                (pointsGiven, pointsToAttackPower) = _getPoints(2);
                
            }else{
                
                //small experience - 1 ability point to random ability (attack power or defence power)
                (pointsGiven, pointsToAttackPower) = _getPoints(1);
                
            }
            
            _attackCompleted(myChamp, enemyChamp, pointsGiven, pointsToAttackPower);

            emit Attack(myChamp.id, enemyChamp.id, true);

        } else {
            
            //1 ability point to random ability (attack power or defence power)
            (pointsGiven, pointsToAttackPower) = _getPoints(1);

            _attackCompleted(enemyChamp, myChamp, pointsGiven, pointsToAttackPower);

            emit Attack(enemyChamp.id, myChamp.id, false);
             
        }
        
        //Trigger cooldown for attacker
        myChamp.readyTime = uint256(block.timestamp + myChamp.cooldownTime - myChampCooldownReduction);

    }
    
}


/// @title Moderates buying and selling champs
contract ChampMarket is ChampAttack {

    event TransferChamp(address from, address to, uint256 champID);

    /*
     * Modifiers
     */
    ///@notice Require champ to be sale
    modifier champIsForSale(uint256 _id){
        require(champs[_id].forSale);
        _;
    }
    

    ///@notice Require champ NOT to be for sale
    modifier champIsNotForSale(uint256 _id){
        require(champs[_id].forSale == false);
        _;
    }
    

    ///@notice If champ is for sale then cancel sale
    modifier ifChampForSaleThenCancelSale(uint256 _champID){
      Champ storage champ = champs[_champID];
      if(champ.forSale){
          _cancelChampSale(champ);
      }
      _;
    }
    

    /*
     * View
     */
    ///@notice Gets all champs for sale
    function getChampsForSale() view external returns(uint256[]){
        uint256[] memory result = new uint256[](champsForSaleCount);
        if(champsForSaleCount > 0){
            uint256 counter = 0;
            for (uint256 i = 0; i < champs.length; i++) {
                if (champs[i].forSale == true) {
                    result[counter]=i;
                    counter++;
                }
            }
        }
        return result;
    }
    
    
    /*
     * Private
     */
     ///@dev Cancel sale. Should not be called without checking if champ is really for sale.
     function _cancelChampSale(Champ storage champ) private {
        //cancel champ's sale
        //no need waste gas to overwrite his price.
        champ.forSale = false;
        champsForSaleCount--;
     }
     

    /*
     * Internal
     */
    /// @notice Transfer champ
    function transferChamp(address _from, address _to, uint256 _champId) internal ifChampForSaleThenCancelSale(_champId){
        Champ storage champ = champs[_champId];

        //transfer champ
        addressInfo[_to].champsCount++;
        addressInfo[_from].champsCount--;
        champToOwner[_champId] = _to;

        //transfer items
        if(champ.eq_sword != 0) { transferItem(_from, _to, champ.eq_sword); }
        if(champ.eq_shield != 0) { transferItem(_from, _to, champ.eq_shield); }
        if(champ.eq_helmet != 0) { transferItem(_from, _to, champ.eq_helmet); }

        emit TransferChamp(_from, _to, _champId);
    }



    /*
     * Public
     */
    /// @notice Champ is no more for sale
    function cancelChampSale(uint256 _id) public 
      champIsForSale(_id) 
      onlyOwnerOfChamp(_id) {
        Champ storage champ = champs[_id];
        _cancelChampSale(champ);
    }


    /*
     * External
     */
    /// @notice Gift champ
    /// @dev Address _from is msg.sender
    function giveChamp(address _to, uint256 _champId) external 
      onlyOwnerOfChamp(_champId) {
        transferChamp(msg.sender, _to, _champId);
    }


    /// @notice Sets champ for sale
    function setChampForSale(uint256 _id, uint256 _price) external 
      onlyOwnerOfChamp(_id) 
      champIsNotForSale(_id) {
        Champ storage champ = champs[_id];
        champ.forSale = true;
        champ.price = _price;
        champsForSaleCount++;
    }
    
    
    /// @notice Buys champ
    function buyChamp(uint256 _id) external payable 
      whenNotPaused 
      onlyNotOwnerOfChamp(_id) 
      champIsForSale(_id) 
      isPaid(champs[_id].price) 
      distributeSaleInput(champToOwner[_id]) {
        transferChamp(champToOwner[_id], msg.sender, _id);
    }
    
}



/// @title Only used for deploying all contracts
contract MyCryptoChampCore is ChampMarket {
	/* 
		© Copyright 2018 - Patrik Mojzis
		Redistributing and modifying is prohibited.
		
		https://mycryptochamp.io/

		What is MyCryptoChamp?
		- Blockchain game about upgrading champs by fighting, getting better items,
		  trading them and the best 800 champs are daily rewarded by real Ether.

		Feel free to ask any questions
		[email protected]
	*/
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"getItemsForSale","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"itemsForSaleCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"itemToOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"champsForSaleCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addressInfo","outputs":[{"name":"withdrawal","type":"uint256"},{"name":"champsCount","type":"uint256"},{"name":"itemsCount","type":"uint256"},{"name":"name","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"getItemsByOwner","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getChampsCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_affiliateAddress","type":"address"}],"name":"openLootbox","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"}],"name":"withdrawChamp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_parentItemID","type":"uint256"},{"name":"_childItemID","type":"uint256"}],"name":"forgeItems","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_champId","type":"uint256"}],"name":"getChampStats","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_champId","type":"uint256"},{"name":"_itemId","type":"uint256"}],"name":"putOn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getChampsForSale","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"}],"name":"cancelChampSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"}],"name":"buyChamp","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"}],"name":"changePlayersName","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_champId","type":"uint256"}],"name":"giveChamp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"triggerPause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"champToName","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_affiliateAddress","type":"address"}],"name":"createChamp","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_position","type":"uint256"}],"name":"getChampReward","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"withdrawToAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_price","type":"uint256"}],"name":"setItemForSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_champId","type":"uint256"},{"name":"_name","type":"string"}],"name":"changeChampsName","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"leaderboard","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"items","outputs":[{"name":"itemType","type":"uint8"},{"name":"itemRarity","type":"uint8"},{"name":"attackPower","type":"uint256"},{"name":"defencePower","type":"uint256"},{"name":"cooldownReduction","type":"uint256"},{"name":"price","type":"uint256"},{"name":"onChampId","type":"uint256"},{"name":"onChamp","type":"bool"},{"name":"forSale","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"}],"name":"cancelItemSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"champs","outputs":[{"name":"id","type":"uint256"},{"name":"attackPower","type":"uint256"},{"name":"defencePower","type":"uint256"},{"name":"cooldownTime","type":"uint256"},{"name":"readyTime","type":"uint256"},{"name":"winCount","type":"uint256"},{"name":"lossCount","type":"uint256"},{"name":"position","type":"uint256"},{"name":"price","type":"uint256"},{"name":"withdrawCooldown","type":"uint256"},{"name":"eq_sword","type":"uint256"},{"name":"eq_shield","type":"uint256"},{"name":"eq_helmet","type":"uint256"},{"name":"forSale","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setCreateChampFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_itemID","type":"uint256"}],"name":"giveItem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_champId","type":"uint256"},{"name":"_type","type":"uint8"}],"name":"takeOffItem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setLootboxFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_champId","type":"uint256"},{"name":"_targetId","type":"uint256"}],"name":"attack","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"}],"name":"buyItem","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_price","type":"uint256"}],"name":"setChampForSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"getChampsByOwner","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"champToOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"champID","type":"uint256"}],"name":"TransferChamp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"winnerChampID","type":"uint256"},{"indexed":false,"name":"defeatedChampID","type":"uint256"},{"indexed":false,"name":"didAttackerWin","type":"bool"}],"name":"Attack","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"forgedItemID","type":"uint256"}],"name":"Forge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"itemID","type":"uint256"}],"name":"TransferItem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"itemID","type":"uint256"},{"indexed":false,"name":"owner","type":"address"}],"name":"NewItem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"champID","type":"uint256"},{"indexed":false,"name":"owner","type":"address"}],"name":"NewChamp","type":"event"}]

608060405260008060146101000a81548160ff0219169083151502179055506611c37937e080006008556611c37937e080006009556000600a556000600b55600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156100d557336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600661012060405190810160405280600060ff168152602001600060ff1681526020016000815260200160008152602001600081526020016000815260200160008152602001600015158152602001600015158152509080600181540180825580915050906001820390600052602060002090600702016000909192909190915060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e08201518160060160006101000a81548160ff0219169083151502179055506101008201518160060160016101000a81548160ff02191690831515021790555050505061458a8061021d6000396000f3006080604052600436106101d8576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063064ddd04146101dd578063132ac1dd146102495780631a4d96cd146102745780631abd409d146102e15780632126fcb21461030c5780632c67a8e5146103dd578063317ab6dc1461047557806333dddc3a146104a057806333fb1e05146104d657806341d9cc431461050357806344f06bc71461053a5780634506e64d1461058957806346d6b1e8146105c05780634a800b981461062c5780634f72e1c31461065957806354c9cc44146106795780635e1d832d146106b45780636833f60d14610701578063736e077b14610718578063780bbe60146107be57806394b5c9f3146107f4578063a92bd72c14610835578063acf50f5514610878578063bcb98ba2146108af578063bf368399146108f4578063bfb231d214610935578063bfc38592146109c2578063c5af6257146109ef578063d0220b1c14610a8f578063d86afbbb14610abc578063db9f16a814610b09578063dcf219f214610b43578063e1fa763814610b70578063e7fb74c714610ba7578063ef2d44c314610bc7578063f0c41bb214610bfe578063f2fde38b14610c96578063f81b25c914610cd9575b600080fd5b3480156101e957600080fd5b506101f2610d46565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561023557808201518184015260208101905061021a565b505050509050019250505060405180910390f35b34801561025557600080fd5b5061025e610e18565b6040518082815260200191505060405180910390f35b34801561028057600080fd5b5061029f60048036038101908080359060200190929190505050610e1e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102ed57600080fd5b506102f6610e51565b6040518082815260200191505060405180910390f35b34801561031857600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e57565b6040518085815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561039f578082015181840152602081019050610384565b50505050905090810190601f1680156103cc5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156103e957600080fd5b5061041e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610461578082015181840152602081019050610446565b505050509050019250505060405180910390f35b34801561048157600080fd5b5061048a611054565b6040518082815260200191505060405180910390f35b6104d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611061565b005b3480156104e257600080fd5b5061050160048036038101908080359060200190929190505050611761565b005b34801561050f57600080fd5b506105386004803603810190808035906020019092919080359060200190929190505050611981565b005b34801561054657600080fd5b5061056560048036038101908080359060200190929190505050611c6c565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561059557600080fd5b506105be6004803603810190808035906020019092919080359060200190929190505050611d5f565b005b3480156105cc57600080fd5b506105d5611fbd565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106185780820151818401526020810190506105fd565b505050509050019250505060405180910390f35b34801561063857600080fd5b506106576004803603810190808035906020019092919050505061208f565b005b61067760048036038101908080359060200190929190505050612167565b005b34801561068557600080fd5b506106b2600480360381019080803590602001908201803590602001919091929391929390505050612447565b005b3480156106c057600080fd5b506106ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061249d565b005b34801561070d57600080fd5b5061071661251b565b005b34801561072457600080fd5b50610743600480360381019080803590602001909291905050506125a2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610783578082015181840152602081019050610768565b50505050905090810190601f1680156107b05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6107f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612652565b005b34801561080057600080fd5b5061081f60048036038101908080359060200190929190505050612b4a565b6040518082815260200191505060405180910390f35b34801561084157600080fd5b50610876600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612bc9565b005b34801561088457600080fd5b506108ad6004803603810190808035906020019092919080359060200190929190505050612d97565b005b3480156108bb57600080fd5b506108f260048036038101908080359060200190929190803590602001908201803590602001919091929391929390505050612eb6565b005b34801561090057600080fd5b5061091f60048036038101908080359060200190929190505050612f4d565b6040518082815260200191505060405180910390f35b34801561094157600080fd5b5061096060048036038101908080359060200190929190505050612f70565b604051808a60ff1660ff1681526020018960ff1660ff1681526020018881526020018781526020018681526020018581526020018481526020018315151515815260200182151515158152602001995050505050505050505060405180910390f35b3480156109ce57600080fd5b506109ed60048036038101908080359060200190929190505050613001565b005b3480156109fb57600080fd5b50610a1a600480360381019080803590602001909291905050506130e9565b604051808f81526020018e81526020018d81526020018c81526020018b81526020018a8152602001898152602001888152602001878152602001868152602001858152602001848152602001838152602001821515151581526020019e50505050505050505050505050505060405180910390f35b348015610a9b57600080fd5b50610aba60048036038101908080359060200190929190505050613171565b005b348015610ac857600080fd5b50610b07600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506131d6565b005b348015610b1557600080fd5b50610b4160048036038101908080359060200190929190803560ff169060200190929190505050613264565b005b348015610b4f57600080fd5b50610b6e600480360381019080803590602001909291905050506133b6565b005b348015610b7c57600080fd5b50610ba5600480360381019080803590602001909291908035906020019092919050505061341b565b005b610bc560048036038101908080359060200190929190505050613700565b005b348015610bd357600080fd5b50610bfc60048036038101908080359060200190929190803590602001909291905050506139e0565b005b348015610c0a57600080fd5b50610c3f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613aef565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610c82578082015181840152602081019050610c67565b505050509050019250505060405180910390f35b348015610ca257600080fd5b50610cd7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613c24565b005b348015610ce557600080fd5b50610d0460048036038101908080359060200190929190505050613cfe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b606080600080600d54604051908082528060200260200182016040528015610d7d5781602001602082028038833980820191505090505b5092506000600d541115610e0f5760009150600090505b600680549050811015610e0e5760011515600682815481101515610db457fe5b906000526020600020906007020160060160019054906101000a900460ff1615151415610e0157808383815181101515610dea57fe5b906020019060200201818152505081806001019250505b8080600101915050610d94565b5b82935050505090565b600d5481565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c5481565b6001602052806000526040600020600091509050806000015490806001015490806002015490806003018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f155780601f10610eea57610100808354040283529160200191610f15565b820191906000526020600020905b815481529060010190602001808311610ef857829003601f168201915b5050505050905084565b606080600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154604051908082528060200260200182016040528015610f965781602001602082028038833980820191505090505b50925060009150600090505b600680549050811015611049578473ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561103c5780838381518110151561102557fe5b906020019060200201818152505081806001019250505b8080600101915050610fa2565b829350505050919050565b6000600580549050905090565b60008060008061106f614462565b60011515600060149054906101000a900460ff1615151480156110925750600034115b156110df573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156110dd573d6000803e3d6000fd5b505b600060149054906101000a900460ff161515156110fb57600080fd5b60095480341015151561110d57600080fd5b86600080603260643481151561111f57fe5b0402915081600160008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555081600a60008282540192505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561120d57503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561128557601960643481151561122057fe5b0402905080600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555080600a600082825401925050819055505b6112906103e9613d31565b97506101206040519081016040528060016112ab6003613d31565b0160ff168152602001600060ff1681526020016000815260200160008152602001600081526020016000815260200160008152602001600015158152602001600015158152509450876101c21115611324576113076009613d31565b60190196506001856020019060ff16908160ff16815250506113dd565b876102d01115611355576113386011613d31565b602a0196506002856020019060ff16908160ff16815250506113dc565b8761038e1115611386576113696019613d31565b60470196506003856020019060ff16908160ff16815250506113db565b876103d411156113b75761139a6021613d31565b60770196506004856020019060ff16908160ff16815250506113da565b6113c16029613d31565b60eb0196506005856020019060ff16908160ff16815250505b5b5b5b600160ff16856000015160ff16141561145d576007600a888115156113fe57fe5b040285604001818152505084604001518703965061141c6006613d31565b600a8881151561142857fe5b0402856060018181525050846060015187039650603c87028560800181815250506001856000019060ff16908160ff16815250505b600260ff16856000015160ff1614156114dd576007600a8881151561147e57fe5b040285606001818152505084606001518703965061149c6006613d31565b600a888115156114a857fe5b0402856040018181525050846040015187039650603c87028560800181815250506002856000019060ff16908160ff16815250505b600360ff16856000015160ff16141561155c576007600a888115156114fe57fe5b04029850603c8902856080018181525050888703965061151e6006613d31565b600a8881151561152a57fe5b0402856040018181525050846040015187039650868560600181815250506003856000019060ff16908160ff16815250505b60016006869080600181540180825580915050906001820390600052602060002090600702016000909192909190915060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e08201518160060160006101000a81548160ff0219169083151502179055506101008201518160060160016101000a81548160ff0219169083151502179055505050039550336003600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600081548092919060010191905055507f0c4ad8244c49e226fa47310564e3a7d0bb97b9808742e9159b5fd2e62033f8848633604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a150505050505050505050565b600080826002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117d257600080fd5b620f4240611802600a543073ffffffffffffffffffffffffffffffffffffffff1631613d8790919063ffffffff16565b11151561180e57600080fd5b834260058281548110151561181f57fe5b90600052602060002090600e02016009015410151561183d57600080fd5b60011515600060149054906101000a900460ff1615151480156118605750600034115b156118ad573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156118ab573d6000803e3d6000fd5b505b600060149054906101000a900460ff161515156118c957600080fd5b6005858154811015156118d857fe5b90600052602060002090600e020193506103208460070154111515156118fd57600080fd5b62015180420184600901819055506119188460070154612b4a565b925082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555082600a600082825401925050819055505050505050565b600080836000811415151561199557600080fd5b6003600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a0257600080fd5b8360008114151515611a1357600080fd5b6003600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a8057600080fd5b856000600682815481101515611a9257fe5b906000526020600020906007020190508060060160019054906101000a900460ff1615611ac357611ac281613da0565b5b866000600682815481101515611ad557fe5b906000526020600020906007020190508060060160019054906101000a900460ff1615611b0657611b0581613da0565b5b888a14151515611b1557600080fd5b60068a815481101515611b2457fe5b90600052602060002090600702019750600689815481101515611b4357fe5b906000526020600020906007020196508660060160009054906101000a900460ff1615611b8a57611b8987600501548860000160009054906101000a900460ff16613264565b5b8660010154886001015411611ba3578660010154611ba9565b87600101545b88600101819055508660020154886002015411611bca578660020154611bd0565b87600201545b88600201819055508660030154886003015411611bf1578660030154611bf7565b87600301545b886003018190555060068860000160016101000a81548160ff021916908360ff160217905550611c293360008b613dd3565b7f97ae4fc518063fd36c075c2181bd907a5da869f4647d8ccba298121925f100d48a6040518082815260200191505060405180910390a150505050505050505050565b60008060008060008060008060008060058b815481101515611c8a57fe5b90600052602060002090600e02019650600687600a0154815481101515611cad57fe5b90600052602060002090600702019550600687600b0154815481101515611cd057fe5b90600052602060002090600702019450600687600c0154815481101515611cf357fe5b90600052602060002090600702019350836001015485600101548760010154896001015401010192508360020154856002015487600201548960020154010101915083600301548560030154876003015401019050828282995099509950505050505050509193909250565b600080836002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611dd057600080fd5b8360008114151515611de157600080fd5b6003600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e4e57600080fd5b600586815481101515611e5d57fe5b90600052602060002090600e02019350600685815481101515611e7c57fe5b906000526020600020906007020192508260060160009054906101000a900460ff1615611ec357611ec283600501548460000160009054906101000a900460ff16613264565b5b60018360060160006101000a81548160ff02191690831515021790555085836005018190555060018360000160009054906101000a900460ff1660ff161415611f2d57600084600a01541115611f2357611f2284600001546001613264565b5b8484600a01819055505b60028360000160009054906101000a900460ff1660ff161415611f7157600084600b01541115611f6757611f6684600001546002613264565b5b8484600b01819055505b60038360000160009054906101000a900460ff1660ff161415611fb557600084600c01541115611fab57611faa84600001546003613264565b5b8484600c01819055505b505050505050565b606080600080600c54604051908082528060200260200182016040528015611ff45781602001602082028038833980820191505090505b5092506000600c5411156120865760009150600090505b600580549050811015612085576001151560058281548110151561202b57fe5b90600052602060002090600e0201600d0160009054906101000a900460ff16151514156120785780838381518110151561206157fe5b906020019060200201818152505081806001019250505b808060010191505061200b565b5b82935050505090565b6000816005818154811015156120a157fe5b90600052602060002090600e0201600d0160009054906101000a900460ff1615156120cb57600080fd5b826002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561213957600080fd5b60058481548110151561214857fe5b90600052602060002090600e020192506121618361407b565b50505050565b60011515600060149054906101000a900460ff16151514801561218a5750600034115b156121d7573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156121d5573d6000803e3d6000fd5b505b600060149054906101000a900460ff161515156121f357600080fd5b806002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561226257600080fd5b8160058181548110151561227257fe5b90600052602060002090600e0201600d0160009054906101000a900460ff16151561229c57600080fd5b6005838154811015156122ab57fe5b90600052602060002090600e0201600801548034101515156122cc57600080fd5b6002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660008060643411156123255760643481151561231857fe5b049150813403905061232d565b600091503490505b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555081600160008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282540192505081905550818101600a6000828254019250508190555061243e6002600089815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633896140ae565b50505050505050565b8181600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030191906124989291906144b9565b505050565b806002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561250b57600080fd5b6125163384846140ae565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561257657600080fd5b600060149054906101000a900460ff1615600060146101000a81548160ff021916908315150217905550565b60046020528060005260406000206000915090508054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561264a5780601f1061261f5761010080835404028352916020019161264a565b820191906000526020600020905b81548152906001019060200180831161262d57829003601f168201915b505050505081565b600060011515600060149054906101000a900460ff1615151480156126775750600034115b156126c4573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156126c2573d6000803e3d6000fd5b505b600060149054906101000a900460ff161515156126e057600080fd5b6008548034101515156126f257600080fd5b82600080603260643481151561270457fe5b0402915081600160008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555081600a60008282540192505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156127f257503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561286a57601960643481151561280557fe5b0402905080600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555080600a600082825401925050819055505b600160056101c0604051908101604052806000815260200161288c6004613d31565b600201815260200161289e6004613d31565b6001018152602001610e106128b36009613d31565b0262015180038152602001600081526020016000815260200160008152602001600160078054905001815260200160008152602001428152602001600081526020016000815260200160008152602001600015158152509080600181540180825580915050906001820390600052602060002090600e020160009091929091909150600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b015561018082015181600c01556101a082015181600d0160006101000a81548160ff0219169083151502179055505050039450846005868154811015156129f257fe5b90600052602060002090600e0201600001819055506007859080600181540180825580915050906001820390600052602060002001600090919290919091505550336002600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600081548092919060010191905055507fc4021e7d72ad98c7d297782bf366036d8785ee293ef5867de13b1962643004d98533604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1505050505050565b600080600061032084111515612bbd57612b75600185036002026107d0613d8790919063ffffffff16565b9150612ba3600a543073ffffffffffffffffffffffffffffffffffffffff1631613d8790919063ffffffff16565b905081620f424082811515612bb457fe5b04029250612bc2565b600092505b5050919050565b60008060011515600060149054906101000a900460ff161515148015612bef5750600034115b15612c3c573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015612c3a573d6000803e3d6000fd5b505b600060149054906101000a900460ff16151515612c5857600080fd5b829150600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c94573391505b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050600081111515612ce857600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550612d4581600a54613d8790919063ffffffff16565b600a819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612d91573d6000803e3d6000fd5b50505050565b60008260008114151515612daa57600080fd5b6003600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e1757600080fd5b8360001515600682815481101515612e2b57fe5b906000526020600020906007020160060160019054906101000a900460ff161515141515612e5857600080fd5b600685815481101515612e6757fe5b9060005260206000209060070201925060018360060160016101000a81548160ff021916908315150217905550838360040181905550600d600081548092919060010191905055505050505050565b826002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612f2457600080fd5b8282600460008781526020019081526020016000209190612f469291906144b9565b5050505050565b600781815481101515612f5c57fe5b906000526020600020016000915090505481565b600681815481101515612f7f57fe5b90600052602060002090600702016000915090508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16908060010154908060020154908060030154908060040154908060050154908060060160009054906101000a900460ff16908060060160019054906101000a900460ff16905089565b60008160068181548110151561301357fe5b906000526020600020906007020160060160019054906101000a900460ff16151561303d57600080fd5b826000811415151561304e57600080fd5b6003600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156130bb57600080fd5b6006848154811015156130ca57fe5b906000526020600020906007020192506130e383613da0565b50505050565b6005818154811015156130f857fe5b90600052602060002090600e020160009150905080600001549080600101549080600201549080600301549080600401549080600501549080600601549080600701549080600801549080600901549080600a01549080600b01549080600c01549080600d0160009054906101000a900460ff1690508e565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156131cc57600080fd5b8060088190555050565b80600081141515156131e757600080fd5b6003600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561325457600080fd5b61325f338484613dd3565b505050565b600080836002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156132d557600080fd5b6005858154811015156132e457fe5b90600052602060002090600e0201915060018460ff16141561331c5781600a01549250600083111561331b57600082600a01819055505b5b60028460ff1614156133445781600b01549250600083111561334357600082600b01819055505b5b60038460ff16141561336c5781600c01549250600083111561336b57600082600c01819055505b5b60008311156133af57600060068481548110151561338657fe5b906000526020600020906007020160060160006101000a81548160ff0219169083151502179055505b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561341157600080fd5b8060098190555050565b6000806000806000806000886002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561349457600080fd5b89426005828154811015156134a557fe5b90600052602060002090600e020160040154111515156134c457600080fd5b8a8a8082141515156134d557600080fd5b8b600073ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561354557600080fd5b60058e81548110151561355457fe5b90600052602060002090600e02019b5060058d81548110151561357357fe5b90600052602060002090600e02019a5061358c8e611c6c565b9050809750819950505061359f8d611c6c565b90915050809750508688111561366c57600587890310156135d1576135c4600361430a565b809a50819b505050613607565b600a87890310156135f3576135e6600261430a565b809a50819b505050613606565b6135fd600161430a565b809a50819b5050505b5b6136138c8c8c8c614323565b7fa4fd22ab9dc45ec5d5abb406c0c43532ee37edc55234f85bf926ebc1b900d85a8c600001548c6000015460016040518084815260200183815260200182151515158152602001935050505060405180910390a16136df565b613676600161430a565b809a50819b50505061368a8b8d8c8c614323565b7fa4fd22ab9dc45ec5d5abb406c0c43532ee37edc55234f85bf926ebc1b900d85a8b600001548d6000015460006040518084815260200183815260200182151515158152602001935050505060405180910390a15b858c600301544201038c600401819055505050505050505050505050505050565b60011515600060149054906101000a900460ff1615151480156137235750600034115b15613770573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561376e573d6000803e3d6000fd5b505b600060149054906101000a900460ff1615151561378c57600080fd5b806003600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156137fb57600080fd5b8160068181548110151561380b57fe5b906000526020600020906007020160060160019054906101000a900460ff16151561383557600080fd5b60068381548110151561384457fe5b90600052602060002090600702016004015480341015151561386557600080fd5b6003600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660008060643411156138be576064348115156138b157fe5b04915081340390506138c6565b600091503490505b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555081600160008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282540192505081905550818101600a600082825401925050819055506139d76003600089815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163389613dd3565b50505050505050565b6000826002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613a5057600080fd5b8360001515600582815481101515613a6457fe5b90600052602060002090600e0201600d0160009054906101000a900460ff161515141515613a9157600080fd5b600585815481101515613aa057fe5b90600052602060002090600e02019250600183600d0160006101000a81548160ff021916908315150217905550838360080181905550600c600081548092919060010191905055505050505050565b606080600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154604051908082528060200260200182016040528015613b665781602001602082028038833980820191505090505b50925060009150600090505b600580549050811015613c19578473ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415613c0c57808383815181101515613bf557fe5b906020019060200201818152505081806001019250505b8080600101915050613b72565b829350505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613c7f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515613cbb57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b6000815480929190600101919050555081600b54600143034060405180838152602001826000191660001916815260200192505050604051809103902060019004811515613d7f57fe5b069050919050565b6000828211151515613d9557fe5b818303905092915050565b60008160060160016101000a81548160ff021916908315150217905550600d600081548092919060019003919050555050565b6000816000600682815481101515613de757fe5b906000526020600020906007020190508060060160019054906101000a900460ff1615613e1857613e1781613da0565b5b600684815481101515613e2757fe5b906000526020600020906007020192508260060160009054906101000a900460ff168015613eb85750600260008460050154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15613edd57613edc83600501548460000160009054906101000a900460ff16613264565b5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160008154809291906001019190505550600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815480929190600190039190505550846003600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd9833a6b8a219b001f51805a4733ebf47fafa146ef3ce10ede12f261055bb79d868686604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050505050565b600081600d0160006101000a81548160ff021916908315150217905550600c600081548092919060019003919050555050565b60008160006005828154811015156140c257fe5b90600052602060002090600e0201905080600d0160009054906101000a900460ff16156140f3576140f28161407b565b5b60058481548110151561410257fe5b90600052602060002090600e02019250600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008154809291906001019190505550600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000815480929190600190039190505550846002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600083600a015414151561422757614226868685600a0154613dd3565b5b600083600b015414151561424557614244868685600b0154613dd3565b5b600083600c015414151561426357614262868685600c0154613dd3565b5b7f8397af45df792784806b4427cbf9f8c23cb2cf57bb43ae8e30d27ca199e4e279868686604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050505050565b6000808261431a60018501613d31565b91509150915091565b600080828660010160008282540192505081905550828403866002016000828254019250508190555061435a856001015484614425565b85600101819055506143728560020154848603614445565b85600201819055508560050160008154809291906001019190505550846006016000815480929190600101919050555084600701548660070154111561441d57856007015491508460070154905081856007018190555080866007018190555084600001546007600184038154811015156143e957fe5b9060005260206000200181905550856000015460076001830381548110151561440e57fe5b90600052602060002001819055505b505050505050565b60006002820183111561443a5781830361443d565b60025b905092915050565b6000818311156144575781830361445a565b60015b905092915050565b61012060405190810160405280600060ff168152602001600060ff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106144fa57803560ff1916838001178555614528565b82800160010185558215614528579182015b8281111561452757823582559160200191906001019061450c565b5b5090506145359190614539565b5090565b61455b91905b8082111561455757600081600090555060010161453f565b5090565b905600a165627a7a72305820b40dade8f6c0f614133fbc9a2d5060fc8b354bf797f111499f7c4e0652842dec0029

Swarm Source

bzzr://b40dade8f6c0f614133fbc9a2d5060fc8b354bf797f111499f7c4e0652842dec

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.