Sponsored Link:   WELL – WORKING HEALTHCARE U.S. PLATFORM - RAISED $3M IN PRE-ICO – JOIN NOW WITH 40% BONUS
Contract Overview
ETH Balance: 16.180907803569380501 Ether
ETH USD Value: $15,382.54 (@ $950.66/ETH)
No Of Transactions: 34768 txns
  Latest 25 txns from a total Of 34768 transactions (+10 PendingTxns) View All

TxHash Age From To Value [TxFee]
0x233088982de3b95ed70c865f236fb815c32000e683408bea719464ed117d793c(pending)4 mins ago0xaea543da9d996cc9a4cf7e6d2b073b40e28f0cfd  IN  0x141766882733cafa9033e8707548fdcac908db220.003 Ether(pending)
0xb5d90acd78251118323528b9dc24550673986df0de365dc66ae596c34751edc9(pending)4 mins ago0xaea543da9d996cc9a4cf7e6d2b073b40e28f0cfd  IN  0x141766882733cafa9033e8707548fdcac908db220.004 Ether(pending)
0xf0aaa7a3f938a1c8df93f1ee0dbf360410ec13adf1ae348a002041a476baab8d(pending)10 mins ago0x3797a91961420d62311bb493b80f4923bb0d05d6  IN  0x141766882733cafa9033e8707548fdcac908db220.004 Ether(pending)
0xf380ea4935e8201f4e84e2c3b19f017d83b60d72bbc386effe8e0c94236ca74c(pending)11 mins ago0xfaab7542d6f0e3188be45160d30b61bd8b2dace3  IN  0x141766882733cafa9033e8707548fdcac908db220 Ether(pending)
0x284c828d8b554527abd77aebea9bb778b3214f5227284f4bb74be99df98ac5d8(pending)16 mins ago0x004889f70832ae3664ba73628a7e69b8a9f3a34b  IN  0x141766882733cafa9033e8707548fdcac908db220.004 Ether(pending)
0x588b8efdad657e5c8a4ef8f97881ab6526f2d02d68dc7c3698580df6fa6abc33(pending)16 mins ago0x004889f70832ae3664ba73628a7e69b8a9f3a34b  IN  0x141766882733cafa9033e8707548fdcac908db220.004 Ether(pending)
0x99db3e4c1dcec1252fcebb3a8069da599979555133e89c065c5f2ca358173269(pending)23 mins ago0xe141249645c8f42f45d582a37f0b0b7a86d3c37a  IN  0x141766882733cafa9033e8707548fdcac908db220.003 Ether(pending)
0x38f29f7720ac826998e9c82e40ccba8011c1f1173c690658f778fd8ffe880eaf(pending)23 mins ago0xe141249645c8f42f45d582a37f0b0b7a86d3c37a  IN  0x141766882733cafa9033e8707548fdcac908db220 Ether(pending)
0xd0770626042deedcfbf6fd2151e9534221507ec76f78a1f8437044cbb4152a7a(pending)28 mins ago0x228d69cda292a297bf97e1924058e88d3f705391  IN  0x141766882733cafa9033e8707548fdcac908db220.008 Ether(pending)
0xf92a09fba77f6c6e970a710a7e63c3f847ad30aba135613df25ccc3f231f03a8(pending)28 mins ago0xd5768cb94634dea639f32078c4e82b5161a081fc  IN  0x141766882733cafa9033e8707548fdcac908db220.001 Ether(pending)
0x0c1d79bf7759b5f4a748f9499af464f075e879abbd6a90dc3d191e06c934fd0d7 mins ago0x41f29054e7c0bc59a8af10f3a6e7c0e53b334e05  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0008142677
0x3cc92953da86666e526c40621a8383dd2317ffbbb19053d4926774ea38cd8da07 mins ago0x75691c629acb48f8907889e515806f86d10d212b  IN   0x141766882733cafa9033e8707548fdcac908db220 Ether0.000128645
0x77e63b4546f347073f81d476388df3958f7f93341bac81d4863f6e0226a2bc928 mins ago0xe02fb1fc5b75c1682453383d22ca444484b062ba  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.00398157
0x033620dbefa013d488f140f2db8a2b47f30428791a145298dc45634b2c4a6ce68 mins ago0xe6c58f8e459fe570afff5b4622990ea1744f0e28  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0008263794
0x4bc9fa7e37f065af93bd7248c52a57a8eb601d6b4c3a143012d998f290d080f89 mins ago0xb434be1d87e648600b4a99ec0087419c82411f66  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0008122217
0x9ad95b379cdb8b236e48b1c616b1ff6f7bdc494d7143c672d724bcaa7e64783b9 mins ago0x494952f01a30547d269aaf147e6226f940f5b041  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0013362357
0x56eecb95db2f7b03a0febf6c210907b63306a3d32d6c5c587889a96b895ed3949 mins ago0x494952f01a30547d269aaf147e6226f940f5b041  IN   0x141766882733cafa9033e8707548fdcac908db220.032 Ether0.0006570512
0xf4ace8eb02e166276c488b942691355e1c11deac3e866fc66b44d41265afdf3613 mins ago0x494952f01a30547d269aaf147e6226f940f5b041  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.000553308
0x97880e60f5cd6099aae411b6d24caba6660c718d04fa284938df6e611b2e670a13 mins ago0xe02fb1fc5b75c1682453383d22ca444484b062ba  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0005534088
0xd4ccda979dfec4a67549d4a60c49a6ed60ca47d082bf221a3d02ae3c2061cc7113 mins ago0xe6c58f8e459fe570afff5b4622990ea1744f0e28  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0008699654
0x1bce20664836f87613c0f6c70183b888de70f54010340ae6c1d99c1d9f1cbb1914 mins ago0xb434be1d87e648600b4a99ec0087419c82411f66  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0016117908
0xe0c17f697f57cb571a549d2b80afb163a3b459de8b416ade9270e3b134282be415 mins ago0xb434be1d87e648600b4a99ec0087419c82411f66  IN   0x141766882733cafa9033e8707548fdcac908db220.008 Ether0.00105355578
0xfc4cc3f983539fb6a2a94cb85554d39681b9d9f6ba4e2f1e615a4190f2be18b519 mins ago0x522273122b20212fe255875a4737b6f50cc72006  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.000266536
0x3641f3d1b57649808e29d5f3e4b9f8f691b641847820a99fb03bfd09d846062e19 mins ago0x494952f01a30547d269aaf147e6226f940f5b041  IN   0x141766882733cafa9033e8707548fdcac908db220.004 Ether0.0008137872
0x2104063faf2debb532e1bbf4cbe0890200379cd5e0e93430c6c5d6936751285620 mins ago0x494952f01a30547d269aaf147e6226f940f5b041  IN   0x141766882733cafa9033e8707548fdcac908db220.032 Ether0.0006249476
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
  Latest 25 Internal Txns, Click here to View More View All
ParentTxHash Block Age From To Value
0x3cc92953da86666e526c40621a8383dd2317ffbbb19053d4926774ea38cd8da051218737 mins ago0x141766882733cafa9033e8707548fdcac908db220x75691c629acb48f8907889e515806f86d10d212b0.221899906260410019 Ether
0x4b14ddbaaa1093f3b7547566405047fb34d31e46732c770296b05445e390764f512182220 mins ago0x141766882733cafa9033e8707548fdcac908db220xe6c58f8e459fe570afff5b4622990ea1744f0e280.089192205603321391 Ether
0x8547032142bdec4142500e77b3e3cc5efe4a7edda5847901aed15917f3014a31512175036 mins ago0x141766882733cafa9033e8707548fdcac908db220xefc8384ef4a3caa804bff08a7e0aed3e235b8ed80.013251905670441186 Ether
0x7417568b1e17f6a943e2bba8e92c244f87b09e1eb90dd20e06948caaaeeae7b6512172146 mins ago0x141766882733cafa9033e8707548fdcac908db220x494952f01a30547d269aaf147e6226f940f5b0410.096583115959905403 Ether
0xd21130c47a0c31036e9a9b0cf710c54e717be3e9789e3de0dbb581311529085a51216451 hr 3 mins ago0x141766882733cafa9033e8707548fdcac908db220x2caf3bd38c2ed142e4730b83f818aec4e979fccc0.001316178136429789 Ether
0x3370aeb4f1f4cc1119f0f239de305438fc31a6ce0ad584831ac8ce3b0fd2784951216071 hr 11 mins ago0x141766882733cafa9033e8707548fdcac908db220xcde993b6cc5cf39a3087fa166a81769f924146f60.020777787128656366 Ether
0xeb4cc275f1a42b4f736e64274926f2d2d80ed39ffa4deeb1dbe9513596ef680b51215721 hr 21 mins ago0x141766882733cafa9033e8707548fdcac908db220xf0a1003ec54bd889ba3cf22fe0179a32f51affd80.01877858637112621 Ether
0xdbe04597657c882e78cfd50e0831ea382758f4a1aa242e06fda269b5f79e86ef51215521 hr 26 mins ago0x141766882733cafa9033e8707548fdcac908db220x5960445372dac7a507de91ca373c39771ab7a9c10.020183822646221409 Ether
0x8ccd2eccf2baeae4fc996c3e52c90dd7eef9a0a6a9bfe33f14f03cee2374f5eb51213812 hrs 9 mins ago0x141766882733cafa9033e8707548fdcac908db220xb434be1d87e648600b4a99ec0087419c82411f660.217846083379849816 Ether
0xcf9f4dca08a04c307bdddb155cc8623cdfb7905c5a199a9198388950c02655ad51213662 hrs 11 mins ago0x141766882733cafa9033e8707548fdcac908db220x4808bf96254e625787d05707acebdd6f287c10900.05819796426474869 Ether
0x57a03dcb10cbcd4492d621a3b95971dd0f140bf185cff3ceb4d389a48357a0c551213572 hrs 14 mins ago0x141766882733cafa9033e8707548fdcac908db220x7e35d275bb9885f6ac91aa75d1b7367341df0b1d0.020582073759737091 Ether
0x13e05f55fa59f9c0e200fc7c7a058b4e04562aa90b05c3d99b3962edc4fd493a51213282 hrs 21 mins ago0x141766882733cafa9033e8707548fdcac908db220x5fbb6e7a153db2fd161d8d6f115e2226457b9b390.006465674857251604 Ether
0xfc8a4efdfcf2850e6712055c574951142263ef9e1879747679b11ea15343b98851213102 hrs 26 mins ago0x141766882733cafa9033e8707548fdcac908db220xd88a02c8f433d689e5cf8ff0737e2c2efdc65fef0.00130316141805283 Ether
0x597451849ecbf1f285d191ff33374842c79650d4dabe490fa206c1daf467046751212272 hrs 45 mins ago0x141766882733cafa9033e8707548fdcac908db220x04d60d84fb099048a9aa3f1691fad206e668162e0.001280644991850512 Ether
0xe24bc4bdc095fa84be83f99cf2a39b2ec9123d09b6854b2349b932009fb299d351210583 hrs 27 mins ago0x141766882733cafa9033e8707548fdcac908db220x4808bf96254e625787d05707acebdd6f287c10900.080138251614237134 Ether
0x1c57e0e6d511b23ed6ad7d5519be773e83839039bcf27016b9c0267f60096c4951209693 hrs 45 mins ago0x141766882733cafa9033e8707548fdcac908db220x494952f01a30547d269aaf147e6226f940f5b0410.224920084299359511 Ether
0xa4038442154dd725856be8744e2897317f623207f6d11d20d7df66bba5e9b63051209413 hrs 53 mins ago0x141766882733cafa9033e8707548fdcac908db220xe6c58f8e459fe570afff5b4622990ea1744f0e280.043847944456842526 Ether
0x175e6f0690d4c127b40e1e2f89e4be2a170979be152e853f75656105497c7b0051209153 hrs 59 mins ago0x141766882733cafa9033e8707548fdcac908db220x1e9d91f5ac43822aeef374f4cde47f5a672bcccc0.275302245360349671 Ether
0x4ceee51c52ddcbb1c8e2b0462bb2c39d57e4743b6277007b2e9e73c83631f31e51209123 hrs 59 mins ago0x141766882733cafa9033e8707548fdcac908db220x3797a91961420d62311bb493b80f4923bb0d05d60.124319200092737682 Ether
0x209ab6fcfc15121401478ecf7d07fd6effc39f54366b102214d3c4ed46639c3a51208564 hrs 15 mins ago0x141766882733cafa9033e8707548fdcac908db220x522273122b20212fe255875a4737b6f50cc720060.066869551482636191 Ether
0x4237c3d092141465631485ae25fb2e302b26513082a1444f89cd228ab3e623e151208554 hrs 16 mins ago0x141766882733cafa9033e8707548fdcac908db220xe6c58f8e459fe570afff5b4622990ea1744f0e280.105704463283693662 Ether
0x173167ed7185ee77666e444b84919d6c01888b5e7d34447754f9366f5bade17f51207994 hrs 27 mins ago0x141766882733cafa9033e8707548fdcac908db220xd6d48727d8835b73f8dc511a5baaf3445a6f65c90.01308535771986666 Ether
0x797b86453c900b4c79c5a67227c9a14385812afbe373ae2000b69aebf9815ca251207844 hrs 30 mins ago0x141766882733cafa9033e8707548fdcac908db220x66a12b0086e0320f2e6e26c6ff93157c0c365cfb0.153284292414981707 Ether
0x5933bdc0aed8409f709a8e5295a10995567b0f6cda7e80fae90a8a8c2e5a54d451207494 hrs 37 mins ago0x141766882733cafa9033e8707548fdcac908db220x17963388d8289ee2fde89abeecd4494eb3d671570.002951324489543809 Ether
0xdabffc9c11d3f7faca1a8ba241d887256f5c6a7ad13c555d3c68150f69d0c76b51207494 hrs 37 mins ago0x141766882733cafa9033e8707548fdcac908db220x4808bf96254e625787d05707acebdd6f287c10900.022397508844026886 Ether
[ Download CSV Export  ] 
Contract Source Code Verified
Contract Name: DungeonCoreBeta
Compiler Version: v0.4.19+commit.c4cbbb05
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.19;

/**
 * @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 public owner;

  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Ownable() public {
    owner = msg.sender;
  }

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

  /**
   * @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) onlyOwner public {
    require(newOwner != address(0));
    OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}

/**
 * @title EjectableOwnable
 * @dev The EjectableOwnable contract provides the function to remove the ownership of the contract.
 */
contract EjectableOwnable is Ownable {

    /**
     * @dev Remove the ownership by setting the owner address to null,
     * after calling this function, all onlyOwner function will be be able to be called by anyone anymore,
     * the contract will achieve truly decentralisation.
    */
    function removeOwnership() onlyOwner public {
        owner = 0x0;
    }

}

/**
 * @title JointOwnable
 * @dev Extension for the Ownable contract, where the owner can assign at most 2 other addresses
 *  to manage some functions of the contract, using the eitherOwner modifier.
 *  Note that onlyOwner modifier would still be accessible only for the original owner.
 */
contract JointOwnable is Ownable {

  event AnotherOwnerAssigned(address indexed anotherOwner);

  address public anotherOwner1;
  address public anotherOwner2;

  /**
   * @dev Throws if called by any account other than the owner or anotherOwner.
   */
  modifier eitherOwner() {
    require(msg.sender == owner || msg.sender == anotherOwner1 || msg.sender == anotherOwner2);
    _;
  }

  /**
   * @dev Allows the current owner to assign another owner.
   * @param _anotherOwner The address to another owner.
   */
  function assignAnotherOwner1(address _anotherOwner) onlyOwner public {
    require(_anotherOwner != 0);
    AnotherOwnerAssigned(_anotherOwner);
    anotherOwner1 = _anotherOwner;
  }

  /**
   * @dev Allows the current owner to assign another owner.
   * @param _anotherOwner The address to another owner.
   */
  function assignAnotherOwner2(address _anotherOwner) onlyOwner public {
    require(_anotherOwner != 0);
    AnotherOwnerAssigned(_anotherOwner);
    anotherOwner2 = _anotherOwner;
  }

}

/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is Ownable {

  event Pause();
  event Unpause();

  bool public paused = false;

  /**
   * @dev Modifier to make a function callable only when the contract is not paused.
   */
  modifier whenNotPaused() {
    require(!paused);
    _;
  }

  /**
   * @dev Modifier to make a function callable only when the contract is paused.
   */
  modifier whenPaused() {
    require(paused);
    _;
  }

  /**
   * @dev called by the owner to pause, triggers stopped state
   */
  function pause() onlyOwner whenNotPaused public {
    paused = true;
    Pause();
  }

  /**
   * @dev called by the owner to unpause, returns to normal state
   */
  function unpause() onlyOwner whenPaused public {
    paused = false;
    Unpause();
  }

}

/**
 * @title Destructible
 * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
 */
contract Destructible is Ownable {

  function Destructible() public payable { }

  /**
   * @dev Transfers the current balance to the owner and terminates the contract.
   */
  function destroy() onlyOwner public {
    selfdestruct(owner);
  }

  function destroyAndSend(address _recipient) onlyOwner public {
    selfdestruct(_recipient);
  }

}

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  /**
  * @dev Substracts 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 PullPayment
 * @dev Base contract supporting async send for pull payments. Inherit from this
 * contract and use asyncSend instead of send.
 */
contract PullPayment {

  using SafeMath for uint256;

  mapping(address => uint256) public payments;
  uint256 public totalPayments;

  /**
   * @dev withdraw accumulated balance, called by payee.
   */
  function withdrawPayments() public {
    address payee = msg.sender;
    uint256 payment = payments[payee];

    require(payment != 0);
    require(this.balance >= payment);

    totalPayments = totalPayments.sub(payment);
    payments[payee] = 0;

    assert(payee.send(payment));
  }

  /**
   * @dev Called by the payer to store the sent amount as credit to be pulled.
   * @param dest The destination address of the funds.
   * @param amount The amount to transfer.
   */
  function asyncSend(address dest, uint256 amount) internal {
    payments[dest] = payments[dest].add(amount);
    totalPayments = totalPayments.add(amount);
  }

}

/**
 * @title A simplified interface of ERC-721, but without approval functions
 */
contract ERC721 {

    // Events
    event Transfer(address indexed from, address indexed to, uint tokenId);

    // ERC20 compatible functions
    // function name() public view returns (string);
    // function symbol() public view returns (string);
    function totalSupply() public view returns (uint);
    function balanceOf(address _owner) public view returns (uint);

    // Functions that define ownership
    function ownerOf(uint _tokenId) external view returns (address);
    function transfer(address _to, uint _tokenId) external;

}

contract DungeonStructs {

    /**
     * @dev The main Dungeon struct. Every dungeon in the game is represented by this structure.
     * A dungeon is consists of an unlimited number of floors for your heroes to challenge,
     * the power level of a dungeon is encoded in the floorGenes. Some dungeons are in fact more "challenging" than others,
     * the secret formula for that is left for user to find out.
     *
     * Each dungeon also has a "training area", heroes can perform trainings and upgrade their stat,
     * and some dungeons are more effective in the training, which is also a secret formula!
     *
     * When player challenge or do training in a dungeon, the fee will be collected as the dungeon rewards,
     * which will be rewarded to the player who successfully challenged the current floor.
     *
     * Each dungeon fits in fits into three 256-bit words.
     */
    struct Dungeon {

        // Each dungeon has an ID which is the index in the storage array.

        // The timestamp of the block when this dungeon is created.
        uint32 creationTime;

        // The status of the dungeon, each dungeon can have 5 status, namely:
        // 0: Active | 1: Transport Only | 2: Challenge Only | 3: Train Only | 4: InActive
        uint8 status;

        // The dungeon's difficulty, the higher the difficulty,
        // normally, the "rarer" the seedGenes, the higher the diffculty,
        // and the higher the contribution fee it is to challenge, train, and transport to the dungeon,
        // the formula for the contribution fee is in DungeonChallenge and DungeonTraining contracts.
        // A dungeon's difficulty never change.
        uint8 difficulty;

        // The dungeon's capacity, maximum number of players allowed to stay on this dungeon.
        // The capacity of the newbie dungeon (Holyland) is set at 0 (which is infinity).
        // Using 16-bit unsigned integers can have a maximum of 65535 in capacity.
        // A dungeon's capacity never change.
        uint16 capacity;

        // The current floor number, a dungeon is consists of an umlimited number of floors,
        // when there is heroes successfully challenged a floor, the next floor will be
        // automatically generated. Using 32-bit unsigned integer can have a maximum of 4 billion floors.
        uint32 floorNumber;

        // The timestamp of the block when the current floor is generated.
        uint32 floorCreationTime;

        // Current accumulated rewards, successful challenger will get a large proportion of it.
        uint128 rewards;

        // The seed genes of the dungeon, it is used as the base gene for first floor,
        // some dungeons are rarer and some are more common, the exact details are,
        // of course, top secret of the game!
        // A dungeon's seedGenes never change.
        uint seedGenes;

        // The genes for current floor, it encodes the difficulty level of the current floor.
        // We considered whether to store the entire array of genes for all floors, but
        // in order to save some precious gas we're willing to sacrifice some functionalities with that.
        uint floorGenes;

    }

    /**
     * @dev The main Hero struct. Every hero in the game is represented by this structure.
     */
    struct Hero {

        // Each hero has an ID which is the index in the storage array.

        // The timestamp of the block when this dungeon is created.
        uint64 creationTime;

        // The timestamp of the block where a challenge is performed, used to calculate when a hero is allowed to engage in another challenge.
        uint64 cooldownStartTime;

        // Every time a hero challenge a dungeon, its cooldown index will be incremented by one.
        uint32 cooldownIndex;

        // The seed of the hero, the gene encodes the power level of the hero.
        // This is another top secret of the game! Hero's gene can be upgraded via
        // training in a dungeon.
        uint genes;

    }

}

/**
 * @title The ERC-721 compliance token contract for the Dungeon tokens.
 * @dev See the DungeonStructs contract to see the details of the Dungeon token data structure.
 */
contract DungeonToken is ERC721, DungeonStructs, Pausable, JointOwnable {

    /**
     * @notice Limits the number of dungeons the contract owner can ever create.
     */
    uint public constant DUNGEON_CREATION_LIMIT = 1024;

    /**
     * @dev The Mint event is fired whenever a new dungeon is created.
     */
    event Mint(address indexed owner, uint newTokenId, uint difficulty, uint capacity, uint seedGenes);

    /**
     * @dev The NewDungeonFloor event is fired whenever a new dungeon floor is added.
     */
    event NewDungeonFloor(uint timestamp, uint indexed dungeonId, uint32 newFloorNumber, uint128 newRewards , uint newFloorGenes);

    /**
     * @dev Transfer event as defined in current draft of ERC721. Emitted every time a token
     *  ownership (Dungeon Master) is assigned, including token creation.
     */
    event Transfer(address indexed from, address indexed to, uint tokenId);

    /**
     * @dev Name of token.
     */
    string public constant name = "Dungeon";

    /**
     * @dev Symbol of token.
     */
    string public constant symbol = "DUNG";

    /**
     * @dev An array containing the Dungeon struct, which contains all the dungeons in existance.
     *  The ID for each dungeon is the index of this array.
     */
    Dungeon[] public dungeons;

    /**
     * @dev A mapping from token IDs to the address that owns them.
     */
    mapping(uint => address) tokenIndexToOwner;

    /**
     * @dev A mapping from owner address to count of tokens that address owns.
     */
    mapping(address => uint) ownershipTokenCount;

    /**
     * Each non-fungible token owner can own more than one token at one time.
     * Because each token is referenced by its unique ID, however,
     * it can get difficult to keep track of the individual tokens that a user may own.
     * To do this, the contract keeps a record of the IDs of each token that each user owns.
     */
    mapping(address => uint[]) public ownerTokens;

    /**
     * @dev Returns the total number of tokens currently in existence.
     */
    function totalSupply() public view returns (uint) {
        return dungeons.length;
    }

    /**
     * @dev Returns the number of tokens owned by a specific address.
     * @param _owner The owner address to check.
     */
    function balanceOf(address _owner) public view returns (uint) {
        return ownershipTokenCount[_owner];
    }

    /**
     * @dev Checks if a given address is the current owner of a particular token.
     * @param _claimant The address we are validating against.
     * @param _tokenId Token ID
     */
    function _owns(address _claimant, uint _tokenId) internal view returns (bool) {
        return tokenIndexToOwner[_tokenId] == _claimant;
    }

    /**
     * @dev Returns the address currently assigned ownership of a given token.
     */
    function ownerOf(uint _tokenId) external view returns (address) {
        require(tokenIndexToOwner[_tokenId] != address(0));

        return tokenIndexToOwner[_tokenId];
    }

    /**
     * @dev Assigns ownership of a specific token to an address.
     */
    function _transfer(address _from, address _to, uint _tokenId) internal {
        // Increment the ownershipTokenCount.
        ownershipTokenCount[_to]++;

        // Transfer ownership.
        tokenIndexToOwner[_tokenId] = _to;

        // Add the _tokenId to ownerTokens[_to]
        ownerTokens[_to].push(_tokenId);

        // When creating new token, _from is 0x0, but we can't account that address.
        if (_from != address(0)) {
            ownershipTokenCount[_from]--;

            // Remove the _tokenId from ownerTokens[_from]
            uint[] storage fromTokens = ownerTokens[_from];
            bool iFound = false;

            for (uint i = 0; i < fromTokens.length - 1; i++) {
                if (iFound) {
                    fromTokens[i] = fromTokens[i + 1];
                } else if (fromTokens[i] == _tokenId) {
                    iFound = true;
                    fromTokens[i] = fromTokens[i + 1];
                }
            }

            fromTokens.length--;
        }

        // Emit the Transfer event.
        Transfer(_from, _to, _tokenId);
    }

    /**
     * @dev External function to transfers a token to another address.
     * @param _to The address of the recipient, can be a user or contract.
     * @param _tokenId The ID of the token to transfer.
     */
    function transfer(address _to, uint _tokenId) whenNotPaused external {
        // Safety check to prevent against an unexpected 0x0 default.
        require(_to != address(0));

        // Disallow transfers to this contract to prevent accidental misuse.
        require(_to != address(this));

        // You can only send your own token.
        require(_owns(msg.sender, _tokenId));

        // Reassign ownership, clear pending approvals, emit Transfer event.
        _transfer(msg.sender, _to, _tokenId);
    }

    /**
     * @dev Get an array of IDs of each token that an user owns.
     */
    function getOwnerTokens(address _owner) external view returns(uint[]) {
        return ownerTokens[_owner];
    }

    /**
     * @dev The external function that creates a new dungeon and stores it, only contract owners
     *  can create new token, and will be restricted by the DUNGEON_CREATION_LIMIT.
     *  Will generate a Mint event, a  NewDungeonFloor event, and a Transfer event.
     * @param _difficulty The difficulty of the new dungeon.
     * @param _capacity The capacity of the new dungeon.
     * @param _seedGenes The seed genes of the new dungeon.
     * @param _firstFloorGenes The genes of the first dungeon floor.
     * @return The dungeon ID of the new dungeon.
     */
    function createDungeon(uint _difficulty, uint _capacity, uint _seedGenes, uint _firstFloorGenes, address _owner) eitherOwner external returns (uint) {
        // Ensure the total supply is within the fixed limit.
        require(totalSupply() < DUNGEON_CREATION_LIMIT);

        // UPDATE STORAGE
        // Create a new dungeon.
        dungeons.push(Dungeon(uint32(now), 0, uint8(_difficulty), uint16(_capacity), 0, 0, 0, _seedGenes, 0));

        // Token id is the index in the storage array.
        uint newTokenId = dungeons.length - 1;

        // Emit the token mint event.
        Mint(_owner, newTokenId, _difficulty, _capacity, _seedGenes);

        // Initialize the fist floor, this will emit the NewDungeonFloor event.
        addDungeonNewFloor(newTokenId, 0, _firstFloorGenes);

        // This will assign ownership, and also emit the Transfer event.
        _transfer(0, _owner, newTokenId);

        return newTokenId;
    }

    /**
     * @dev The external function to set dungeon status by its ID,
     *  refer to DungeonStructs for more information about dungeon status.
     *  Only contract owners can alter dungeon state.
     */
    function setDungeonStatus(uint _id, uint _newStatus) eitherOwner tokenExists(_id) external {
        dungeons[_id].status = uint8(_newStatus);
    }

    /**
     * @dev The external function to add additional dungeon rewards by its ID,
     *  only contract owners can alter dungeon state.
     */
    function addDungeonRewards(uint _id, uint _additinalRewards) eitherOwner tokenExists(_id) external {
        dungeons[_id].rewards += uint128(_additinalRewards);
    }

    /**
     * @dev The external function to add another dungeon floor by its ID,
     *  only contract owners can alter dungeon state.
     *  Will generate both a NewDungeonFloor event.
     */
    function addDungeonNewFloor(uint _id, uint _newRewards, uint _newFloorGenes) eitherOwner tokenExists(_id) public {
        Dungeon storage dungeon = dungeons[_id];

        dungeon.floorNumber++;
        dungeon.floorCreationTime = uint32(now);
        dungeon.rewards = uint128(_newRewards);
        dungeon.floorGenes = _newFloorGenes;

        // Emit the NewDungeonFloor event.
        NewDungeonFloor(now, _id, dungeon.floorNumber, dungeon.rewards, dungeon.floorGenes);
    }


    /* ======== MODIFIERS ======== */

    /**
     * @dev Throws if _dungeonId is not created yet.
     */
    modifier tokenExists(uint _tokenId) {
        require(_tokenId < totalSupply());
        _;
    }

}

/**
 * @title The ERC-721 compliance token contract for the Hero tokens.
 * @dev See the DungeonStructs contract to see the details of the Hero token data structure.
 */
contract HeroToken is ERC721, DungeonStructs, Pausable, JointOwnable {

    /**
     * @dev The Mint event is fired whenever a new hero is created.
     */
    event Mint(address indexed owner, uint newTokenId, uint _genes);

    /**
     * @dev Transfer event as defined in current draft of ERC721. Emitted every time a token
     *  ownership is assigned, including token creation.
     */
    event Transfer(address indexed from, address indexed to, uint tokenId);

    /**
     * @dev Name of token.
     */
    string public constant name = "Hero";

    /**
     * @dev Symbol of token.
     */
    string public constant symbol = "HERO";

    /**
     * @dev An array containing the Hero struct, which contains all the heroes in existance.
     *  The ID for each hero is the index of this array.
     */
    Hero[] public heroes;

    /**
     * @dev A mapping from token IDs to the address that owns them.
     */
    mapping(uint => address) tokenIndexToOwner;

    /**
     * @dev A mapping from owner address to count of tokens that address owns.
     */
    mapping(address => uint) ownershipTokenCount;

    /**
     * Each non-fungible token owner can own more than one token at one time.
     * Because each token is referenced by its unique ID, however,
     * it can get difficult to keep track of the individual tokens that a user may own.
     * To do this, the contract keeps a record of the IDs of each token that each user owns.
     */
    mapping(address => uint[]) public ownerTokens;

    /**
     * @dev Returns the total number of tokens currently in existence.
     */
    function totalSupply() public view returns (uint) {
        return heroes.length;
    }

    /**
     * @dev Returns the number of tokens owned by a specific address.
     * @param _owner The owner address to check.
     */
    function balanceOf(address _owner) public view returns (uint) {
        return ownershipTokenCount[_owner];
    }

    /**
     * @dev Checks if a given address is the current owner of a particular token.
     * @param _claimant The address we are validating against.
     * @param _tokenId Token ID
     */
    function _owns(address _claimant, uint _tokenId) internal view returns (bool) {
        return tokenIndexToOwner[_tokenId] == _claimant;
    }

    /**
     * @dev Returns the address currently assigned ownership of a given token.
     */
    function ownerOf(uint _tokenId) external view returns (address) {
        require(tokenIndexToOwner[_tokenId] != address(0));

        return tokenIndexToOwner[_tokenId];
    }

    /**
     * @dev Assigns ownership of a specific token to an address.
     */
    function _transfer(address _from, address _to, uint _tokenId) internal {
        // Increment the ownershipTokenCount.
        ownershipTokenCount[_to]++;

        // Transfer ownership.
        tokenIndexToOwner[_tokenId] = _to;

        // Add the _tokenId to ownerTokens[_to]
        ownerTokens[_to].push(_tokenId);

        // When creating new token, _from is 0x0, but we can't account that address.
        if (_from != address(0)) {
            ownershipTokenCount[_from]--;

            // Remove the _tokenId from ownerTokens[_from]
            uint[] storage fromTokens = ownerTokens[_from];
            bool iFound = false;

            for (uint i = 0; i < fromTokens.length - 1; i++) {
                if (iFound) {
                    fromTokens[i] = fromTokens[i + 1];
                } else if (fromTokens[i] == _tokenId) {
                    iFound = true;
                    fromTokens[i] = fromTokens[i + 1];
                }
            }

            fromTokens.length--;
        }

        // Emit the Transfer event.
        Transfer(_from, _to, _tokenId);
    }

    /**
     * @dev External function to transfers a token to another address.
     * @param _to The address of the recipient, can be a user or contract.
     * @param _tokenId The ID of the token to transfer.
     */
    function transfer(address _to, uint _tokenId) whenNotPaused external {
        // Safety check to prevent against an unexpected 0x0 default.
        require(_to != address(0));

        // Disallow transfers to this contract to prevent accidental misuse.
        require(_to != address(this));

        // You can only send your own token.
        require(_owns(msg.sender, _tokenId));

        // Reassign ownership, clear pending approvals, emit Transfer event.
        _transfer(msg.sender, _to, _tokenId);
    }

    /**
     * @dev Get an array of IDs of each token that an user owns.
     */
    function getOwnerTokens(address _owner) external view returns(uint[]) {
        return ownerTokens[_owner];
    }

    /**
     * @dev An external function that creates a new hero and stores it,
     *  only contract owners can create new token.
     *  method doesn't do any checking and should only be called when the
     *  input data is known to be valid.
     * @param _genes The gene of the new hero.
     * @param _owner The inital owner of this hero.
     * @return The hero ID of the new hero.
     */
    function createHero(uint _genes, address _owner) eitherOwner external returns (uint) {
        // UPDATE STORAGE
        // Create a new hero.
        heroes.push(Hero(uint64(now), 0, 0, _genes));

        // Token id is the index in the storage array.
        uint newTokenId = heroes.length - 1;

        // Emit the token mint event.
        Mint(_owner, newTokenId, _genes);

        // This will assign ownership, and also emit the Transfer event.
        _transfer(0, _owner, newTokenId);

        return newTokenId;
    }

    /**
     * @dev The external function to set the hero genes by its ID,
     *  only contract owners can alter hero state.
     */
    function setHeroGenes(uint _id, uint _newGenes) eitherOwner tokenExists(_id) external {
        heroes[_id].genes = _newGenes;
    }

    /**
     * @dev Set the cooldownStartTime for the given hero. Also increments the cooldownIndex.
     */
    function triggerCooldown(uint _id) eitherOwner tokenExists(_id) external {
        Hero storage hero = heroes[_id];

        hero.cooldownStartTime = uint64(now);
        hero.cooldownIndex++;
    }


    /* ======== MODIFIERS ======== */

    /**
     * @dev Throws if _dungeonId is not created yet.
     */
    modifier tokenExists(uint _tokenId) {
        require(_tokenId < totalSupply());
        _;
    }

}

/**
 * SECRET
 */
contract ChallengeScienceInterface {

    /**
     * @dev given genes of current floor and dungeon seed, return a genetic combination - may have a random factor.
     * @param _floorGenes Genes of floor.
     * @param _seedGenes Seed genes of dungeon.
     * @return The resulting genes.
     */
    function mixGenes(uint _floorGenes, uint _seedGenes) external returns (uint);

}

/**
 * SECRET
 */
contract TrainingScienceInterface {

    /**
     * @dev given genes of hero and current floor, return a genetic combination - may have a random factor.
     * @param _heroGenes Genes of hero.
     * @param _floorGenes Genes of current floor.
     * @param _equipmentId Equipment index to train for, 0 is train all attributes.
     * @return The resulting genes.
     */
    function mixGenes(uint _heroGenes, uint _floorGenes, uint _equipmentId) external returns (uint);

}

/**
 * @title DungeonBase
 * @dev Base contract for Ether Dungeon. It implements all necessary sub-classes,
 * holds all the base storage variables, and some commonly used functions.
 */
contract DungeonBase is EjectableOwnable, Pausable, PullPayment, DungeonStructs {

    /* ======== TOKEN CONTRACTS ======== */

    /**
     * @dev The address of the ERC721 token contract managing all Dungeon tokens.
     */
    DungeonToken public dungeonTokenContract;

    /**
     * @dev The address of the ERC721 token contract managing all Hero tokens.
     */
    HeroToken public heroTokenContract;


    /* ======== CLOSED SOURCE CONTRACTS ======== */

    /**
     * @dev The address of the ChallengeScience contract that handles the floor generation mechanics after challenge success.
     */
    ChallengeScienceInterface challengeScienceContract;

    /**
     * @dev The address of the TrainingScience contract that handles the hero training mechanics.
     */
    TrainingScienceInterface trainingScienceContract;


    /* ======== CONSTANTS ======== */

    uint16[32] EQUIPMENT_POWERS = [
        1, 2, 4, 5, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0,
        4, 16, 32, 33, 0, 0, 0, 0, 32, 64, 0, 0, 128, 0, 0, 0
    ];

    uint SUPER_HERO_MULTIPLIER = 32;

    /* ======== SETTER FUNCTIONS ======== */

    /**
     * @dev Set the address of the dungeon token contract.
     * @param _newDungeonTokenContract An address of a DungeonToken contract.
     */
    function setDungeonTokenContract(address _newDungeonTokenContract) onlyOwner external {
        dungeonTokenContract = DungeonToken(_newDungeonTokenContract);
    }

    /**
     * @dev Set the address of the hero token contract.
     * @param _newHeroTokenContract An address of a HeroToken contract.
     */
    function setHeroTokenContract(address _newHeroTokenContract) onlyOwner external {
        heroTokenContract = HeroToken(_newHeroTokenContract);
    }

    /**
     * @dev Set the address of the secret dungeon challenge formula contract.
     * @param _newChallengeScienceAddress An address of a ChallengeScience contract.
     */
    function setChallengeScienceContract(address _newChallengeScienceAddress) onlyOwner external {
        challengeScienceContract = ChallengeScienceInterface(_newChallengeScienceAddress);
    }

    /**
     * @dev Set the address of the secret hero training formula contract.
     * @param _newTrainingScienceAddress An address of a TrainingScience contract.
     */
    function setTrainingScienceContract(address _newTrainingScienceAddress) onlyOwner external {
        trainingScienceContract = TrainingScienceInterface(_newTrainingScienceAddress);
    }


    /* ======== MODIFIERS ======== */

    /**
     * @dev Throws if _dungeonId is not created yet.
     */
    modifier dungeonExists(uint _dungeonId) {
        require(_dungeonId < dungeonTokenContract.totalSupply());
        _;
    }


    /* ======== HELPER FUNCTIONS ======== */

    /**
     * @dev An internal function to calculate the top 5 heroes power of a player.
     */
    function _getTop5HeroesPower(address _address, uint _dungeonId) internal view returns (uint) {
        uint heroCount = heroTokenContract.balanceOf(_address);

        if (heroCount == 0) {
            return 0;
        }

        // Compute all hero powers for further calculation.
        uint[] memory heroPowers = new uint[](heroCount);

        for (uint i = 0; i < heroCount; i++) {
            uint heroId = heroTokenContract.ownerTokens(_address, i);
            uint genes;
            (,,, genes) = heroTokenContract.heroes(heroId);
            // Power of dungeonId = 0 (no super hero boost).
            heroPowers[i] = _getHeroPower(genes, _dungeonId);
        }

        // Calculate the top 5 heroes power.
        uint result;
        uint curMax;
        uint curMaxIndex;

        for (uint j; j < 5; j++){
            for (uint k = 0; k < heroPowers.length; k++) {
                if (heroPowers[k] > curMax) {
                    curMax = heroPowers[k];
                    curMaxIndex = k;
                }
            }

            result += curMax;
            heroPowers[curMaxIndex] = 0;
            curMax = 0;
            curMaxIndex = 0;
        }

        return result;
    }

    /**
     * @dev An internal function to calculate the power of a hero,
     *  it calculates the base equipment power, stats power, and "Super" multiplier.
     */
    function _getHeroPower(uint _genes, uint _dungeonId) internal view returns (uint) {
        uint difficulty;
        (,, difficulty,,,,,,) = dungeonTokenContract.dungeons(_dungeonId);

        // Calculate total stats power.
        uint statsPower;

        for (uint i = 0; i < 4; i++) {
            statsPower += _genes % 32 + 1;
            _genes /= 32 ** 4;
        }

        // Calculate total equipment power.
        uint equipmentPower;
        uint superRank = _genes % 32;

        for (uint j = 4; j < 12; j++) {
            uint curGene = _genes % 32;
            equipmentPower += EQUIPMENT_POWERS[curGene];
            _genes /= 32 ** 4;

            if (superRank != curGene) {
                superRank = 0;
            }
        }

        // Calculate super power boost.
        bool isSuper = superRank >= 16;
        uint superBoost;

        if (isSuper) {
            superBoost = (difficulty - 1) * SUPER_HERO_MULTIPLIER;
        }

        return statsPower + equipmentPower + superBoost;
    }

    /**
     * @dev An internal function to calculate the difficulty of a dungeon floor.
     */
    function _getDungeonPower(uint _genes) internal view returns (uint) {
        // Calculate total dungeon power.
        uint dungeonPower;

        for (uint j = 0; j < 12; j++) {
            dungeonPower += EQUIPMENT_POWERS[_genes % 32];
            _genes /= 32 ** 4;
        }

        return dungeonPower;
    }

}

contract DungeonTransportation is DungeonBase {

    /**
     * @dev The PlayerTransported event is fired when user transported to another dungeon.
     */
    event PlayerTransported(uint timestamp, address indexed playerAddress, uint indexed originDungeonId, uint indexed destinationDungeonId);


    /* ======== GAME SETTINGS ======== */

    /**
     * @notice The actual fee contribution required to call transport() is calculated by this feeMultiplier,
     *  times the dungeon difficulty of destination dungeon. The payment is accumulated to the rewards of the origin dungeon,
     *  and a large proportion will be claimed by whoever successfully challenged the floor.
     *  1000 szabo = 0.001 ether
     */
    uint public transportationFeeMultiplier = 500 szabo;


    /* ======== STORAGE ======== */


    /**
     * @dev A mapping from token IDs to the address that owns them.
     */
    mapping(address => uint) public playerToDungeonID;

    /**
     * @dev A mapping from owner address to count of tokens that address owns.
     */
    mapping(uint => uint) public dungeonPlayerCount;

    /**
     * @dev The main external function to call when a player transport to another dungeon.
     *  Will generate a PlayerTransported event.
     */
    function transport(uint _destinationDungeonId) whenNotPaused dungeonCanTransport(_destinationDungeonId) external payable {
        uint originDungeonId = playerToDungeonID[msg.sender];

        // Disallow transport to the same dungeon.
        require(_destinationDungeonId != originDungeonId);

        // Get the dungeon details from the token contract.
        uint difficulty;
        uint capacity;
        (,, difficulty, capacity,,,,,) = dungeonTokenContract.dungeons(_destinationDungeonId);

        // Disallow weaker user to transport to "difficult" dungeon.
        uint top5HeroesPower = _getTop5HeroesPower(msg.sender, _destinationDungeonId);
        require(top5HeroesPower >= difficulty * 12);

        // Checks for payment, any exceeding funds will be transferred back to the player.
        uint baseFee = difficulty * transportationFeeMultiplier;
        uint additionalFee = top5HeroesPower / 48 * transportationFeeMultiplier;
        uint requiredFee = baseFee + additionalFee;
        require(msg.value >= requiredFee);

        // ** STORAGE UPDATE **
        // Increment the accumulated rewards for the dungeon.
        dungeonTokenContract.addDungeonRewards(originDungeonId, requiredFee);

        // Calculate any excess funds and make it available to be withdrawed by the player.
        asyncSend(msg.sender, msg.value - requiredFee);

        _transport(originDungeonId, _destinationDungeonId);
    }

    /**
     * Private function to assigns location of a player
     */
    function _transport(uint _originDungeonId, uint _destinationDungeonId) private {
        // If a player do not have any hero, claim first hero.
        if (heroTokenContract.balanceOf(msg.sender) == 0) {
            claimHero();
        }

        // ** STORAGE UPDATE **
        // Update the ownershipTokenCount.
        dungeonPlayerCount[_originDungeonId]--;
        dungeonPlayerCount[_destinationDungeonId]++;

        // ** STORAGE UPDATE **
        // Update player location.
        playerToDungeonID[msg.sender] = _destinationDungeonId;

        // Emit the DungeonChallenged event.
        PlayerTransported(now, msg.sender, _originDungeonId, _destinationDungeonId);
    }


    /* ======== OWNERSHIP FUNCTIONS ======== */

    /**
     * @notice Used in transport, challenge and train, to get the genes of a specific hero,
     *  a claim a hero if didn't have any.
     */
    function _getHeroGenesOrClaimFirstHero(uint _heroId) internal returns (uint heroId, uint heroGenes) {
        heroId = _heroId;

        // If a player do not have any hero, claim first hero first.
        if (heroTokenContract.balanceOf(msg.sender) == 0) {
            heroId = claimHero();
        }

        (,,,heroGenes) = heroTokenContract.heroes(heroId);
    }

    /**
     * @dev Claim a new hero with empty genes.
     */
    function claimHero() public returns (uint) {
        // If a player do not tranport to any dungeon yet, and it is the first time claiming the hero,
        // set the dungeon location, increment the #0 Holyland player count by 1.
        if (playerToDungeonID[msg.sender] == 0 && heroTokenContract.balanceOf(msg.sender) == 0) {
            dungeonPlayerCount[0]++;
        }

        return heroTokenContract.createHero(0, msg.sender);
    }


    /* ======== SETTER FUNCTIONS ======== */

    /**
     * @dev Updates the fee contribution multiplier required for calling transport().
     */
    function setTransportationFeeMultiplier(uint _newTransportationFeeMultiplier) onlyOwner external {
        transportationFeeMultiplier = _newTransportationFeeMultiplier;
    }


    /* ======== MODIFIERS ======== */

    /**
     * @dev Throws if dungeon status do not allow transportation, also check for dungeon existence.
     *  Also check if the capacity of the destination dungeon is reached.
     */
    modifier dungeonCanTransport(uint _destinationDungeonId) {
        require(_destinationDungeonId < dungeonTokenContract.totalSupply());
        uint status;
        uint capacity;
        (,status,,capacity,,,,,) = dungeonTokenContract.dungeons(_destinationDungeonId);
        require(status == 0 || status == 1);

        // Check if the capacity of the destination dungeon is reached.
        // Capacity 0 = Infinity
        require(capacity == 0 || dungeonPlayerCount[_destinationDungeonId] < capacity);
        _;
    }

}

contract DungeonChallenge is DungeonTransportation {

    /**
     * @dev The DungeonChallenged event is fired when user finished a dungeon challenge.
     */
    event DungeonChallenged(uint timestamp, address indexed playerAddress, uint indexed dungeonId, uint indexed heroId, uint heroGenes, uint floorNumber, uint floorGenes, bool success, uint newFloorGenes, uint successRewards, uint masterRewards);


    /* ======== GAME SETTINGS ======== */

    /**
     * @notice The actual fee contribution required to call challenge() is calculated by this feeMultiplier,
     *  times the dungeon difficulty. The payment is accumulated to the dungeon rewards,
     *  and a large proportion will be claimed by whoever successfully challenged the floor.
     *  1 finney = 0.001 ether
     */
    uint public challengeFeeMultiplier = 1 finney;

    /**
     * @dev The percentage for which successful challenger be rewarded of the dungeons' accumulated rewards.
     *  The remaining rewards subtract dungeon master rewards will be used as the base rewards for new floor.
     */
    uint public challengeRewardsPercent = 64;

    /**
     * @dev The developer fee for owner
     *  Note that when Ether Dungeon becomes truly decentralised, contract ownership will be ejected,
     *  and the master rewards will be rewarded to the dungeon owner (Dungeon Masters).
     */
    uint public masterRewardsPercent = 8;

    /**
     * @dev The cooldown time period where a hero can engage in challenge again.
     *  This settings will likely be changed to 20 minutes when multiple heroes system is launched in Version 1.
     */
    uint public challengeCooldownTime = 3 minutes;

    /**
     * @dev The preparation time period where a new dungeon is created, before it can be challenged.
     *  This settings will likely be changed to a smaller period (e.g. 20-30 minutes) .
     */
    uint public dungeonPreparationTime = 60 minutes;

    /**
     * @dev The challenge rewards percentage used right after the preparation period.
     */
    uint public rushTimeChallengeRewardsPercent = 30;

    /**
     * @dev The number of floor in which the rushTimeChallengeRewardsPercent be applied.
     */
    uint public rushTimeFloorCount = 30;

    /**
     * @dev The main external function to call when a player challenge a dungeon,
     *  it determines whether if the player successfully challenged the current floor.
     *  Will generate a DungeonChallenged event.
     */
    function challenge(uint _dungeonId, uint _heroId) whenNotPaused dungeonCanChallenge(_dungeonId) heroAllowedToChallenge(_heroId) external payable {
        // Get the dungeon details from the token contract.
        uint difficulty;
        uint seedGenes;
        (,, difficulty,,,,, seedGenes,) = dungeonTokenContract.dungeons(_dungeonId);

        // Checks for payment, any exceeding funds will be transferred back to the player.
        uint requiredFee = difficulty * challengeFeeMultiplier;
        require(msg.value >= requiredFee);

        // ** STORAGE UPDATE **
        // Increment the accumulated rewards for the dungeon.
        dungeonTokenContract.addDungeonRewards(_dungeonId, requiredFee);

        // Calculate any excess funds and make it available to be withdrawed by the player.
        asyncSend(msg.sender, msg.value - requiredFee);

        // Split the challenge function into multiple parts because of stack too deep error.
        _challengePart2(_dungeonId, _heroId);
    }

    /**
     * Split the challenge function into multiple parts because of stack too deep error.
     */
    function _challengePart2(uint _dungeonId, uint _heroId) private {
        uint floorNumber;
        uint rewards;
        uint floorGenes;
        (,,,, floorNumber,, rewards,, floorGenes) = dungeonTokenContract.dungeons(_dungeonId);

        // Get the hero gene, or claim first hero.
        uint heroGenes;
        (_heroId, heroGenes) = _getHeroGenesOrClaimFirstHero(_heroId);

        bool success = _getChallengeSuccess(heroGenes, _dungeonId, floorGenes);

        uint newFloorGenes;
        uint masterRewards;
        uint successRewards;
        uint newRewards;

        // Whether a challenge is success or not is determined by a simple comparison between hero power and floor power.
        if (success) {
            newFloorGenes = _getNewFloorGene(_dungeonId);

            masterRewards = rewards * masterRewardsPercent / 100;

            if (floorNumber < rushTimeFloorCount) { // rush time right after prepration period
                successRewards = rewards * rushTimeChallengeRewardsPercent / 100;

                // The dungeon rewards for new floor as total rewards - challenge rewards - devleoper fee.
                newRewards = rewards * (100 - rushTimeChallengeRewardsPercent - masterRewardsPercent) / 100;
            } else {
                successRewards = rewards * challengeRewardsPercent / 100;
                newRewards = rewards * (100 - challengeRewardsPercent - masterRewardsPercent) / 100;
            }

            // TRIPLE CONFIRM sanity check.
            require(successRewards + masterRewards + newRewards <= rewards);

            // ** STORAGE UPDATE **
            // Add new floor with the new floor genes and new rewards.
            dungeonTokenContract.addDungeonNewFloor(_dungeonId, newRewards, newFloorGenes);

            // Mark the challenge rewards available to be withdrawed by the player.
            asyncSend(msg.sender, successRewards);

            // Mark the master rewards available to be withdrawed by the dungeon master.
            asyncSend(dungeonTokenContract.ownerOf(_dungeonId), masterRewards);
        }

        // ** STORAGE UPDATE **
        // Trigger the cooldown for the hero.
        heroTokenContract.triggerCooldown(_heroId);

        // Emit the DungeonChallenged event.
        DungeonChallenged(now, msg.sender, _dungeonId, _heroId, heroGenes, floorNumber, floorGenes, success, newFloorGenes, successRewards, masterRewards);
    }

    /**
     * Split the challenge function into multiple parts because of stack too deep error.
     */
    function _getChallengeSuccess(uint _heroGenes, uint _dungeonId, uint _floorGenes) private view returns (bool) {
        // Determine if the player challenge successfuly the dungeon or not.
        uint heroPower = _getHeroPower(_heroGenes, _dungeonId);
        uint floorPower = _getDungeonPower(_floorGenes);

        return heroPower > floorPower;
    }

    /**
     * Split the challenge function into multiple parts because of stack too deep error.
     */
    function _getNewFloorGene(uint _dungeonId) private returns (uint) {
        uint seedGenes;
        uint floorGenes;
        (,,,,,, seedGenes, floorGenes) = dungeonTokenContract.dungeons(_dungeonId);

        // Calculate the new floor gene.
        uint floorPower = _getDungeonPower(floorGenes);

        // Call the external closed source secret function that determines the resulting floor "genes".
        uint newFloorGenes = challengeScienceContract.mixGenes(floorGenes, seedGenes);

        uint newFloorPower = _getDungeonPower(newFloorGenes);

        // If the power decreased, rollback to the current floor genes.
        if (newFloorPower < floorPower) {
            newFloorGenes = floorGenes;
        }

        return newFloorGenes;
    }


    /* ======== SETTER FUNCTIONS ======== */

    /**
     * @dev Updates the fee contribution multiplier required for calling challenge().
     */
    function setChallengeFeeMultiplier(uint _newChallengeFeeMultiplier) onlyOwner external {
        challengeFeeMultiplier = _newChallengeFeeMultiplier;
    }

    /**
     * @dev Updates the challenge rewards pecentage.
     */
    function setChallengeRewardsPercent(uint _newChallengeRewardsPercent) onlyOwner external {
        challengeRewardsPercent = _newChallengeRewardsPercent;
    }

    /**
     * @dev Updates the master rewards percentage.
     */
    function setMasterRewardsPercent(uint _newMasterRewardsPercent) onlyOwner external {
        masterRewardsPercent = _newMasterRewardsPercent;
    }

    /**
     * @dev Updates the challenge cooldown time.
     */
    function setChallengeCooldownTime(uint _newChallengeCooldownTime) onlyOwner external {
        challengeCooldownTime = _newChallengeCooldownTime;
    }

    /**
     * @dev Updates the challenge cooldown time.
     */
    function setDungeonPreparationTime(uint _newDungeonPreparationTime) onlyOwner external {
        dungeonPreparationTime = _newDungeonPreparationTime;
    }

    /**
     * @dev Updates the rush time challenge rewards percentage.
     */
    function setRushTimeChallengeRewardsPercent(uint _newRushTimeChallengeRewardsPercent) onlyOwner external {
        rushTimeChallengeRewardsPercent = _newRushTimeChallengeRewardsPercent;
    }

    /**
     * @dev Updates the rush time floor count.
     */
    function setRushTimeFloorCount(uint _newRushTimeFloorCount) onlyOwner external {
        rushTimeFloorCount = _newRushTimeFloorCount;
    }


    /* ======== MODIFIERS ======== */

    /**
     * @dev Throws if dungeon status do not allow challenge, also check for dungeon existence.
     *  Also check if the user is in the dungeon.
     *  Also check if the dungeon is not in preparation period.
     */
    modifier dungeonCanChallenge(uint _dungeonId) {
        require(_dungeonId < dungeonTokenContract.totalSupply());
        uint creationTime;
        uint status;
        (creationTime, status,,,,,,,) = dungeonTokenContract.dungeons(_dungeonId);
        require(status == 0 || status == 2);

        // Check if the user is in the dungeon.
        require(playerToDungeonID[msg.sender] == _dungeonId);

        // Check if the dungeon is not in preparation period.
        require(creationTime + dungeonPreparationTime <= now);
        _;
    }

    /**
     * @dev Throws if player does not own the hero, or it is still in cooldown.
     *  Unless the player does not have any hero yet, which will auto claim one during first challenge / train.
     */
    modifier heroAllowedToChallenge(uint _heroId) {
        if (heroTokenContract.balanceOf(msg.sender) > 0) {
            // You can only challenge with your own hero.
            require(heroTokenContract.ownerOf(_heroId) == msg.sender);

            uint cooldownStartTime;
            (, cooldownStartTime,,) = heroTokenContract.heroes(_heroId);
            require(cooldownStartTime + challengeCooldownTime <= now);
        }
        _;
    }

}

contract DungeonTraining is DungeonChallenge {

    /**
     * @dev The HeroTrained event is fired when user finished a training.
     */
    event HeroTrained(uint timestamp, address indexed playerAddress, uint indexed dungeonId, uint indexed heroId, uint heroGenes, uint floorNumber, uint floorGenes, bool success, uint newHeroGenes);


    /* ======== GAME SETTINGS ======== */

    /**
     * @dev The actual fee contribution required to call trainX() is calculated by this feeMultiplier,
     *  times the dungeon difficulty, times X. The payment is accumulated to the dungeon rewards,
     *  and a large proportion will be claimed by whoever successfully challenged the floor.
     *  1 finney = 0.001 ether
     */
    uint public trainingFeeMultiplier = 2 finney;

    /**
     * @dev The discounted training fee multiplier to be used in the preparation period.
     * 1000 szabo = 0.001 ether
     */
    uint public preparationPeriodTrainingFeeMultiplier = 1800 szabo;

    /**
     * @dev The actual fee contribution required to call trainEquipment() is calculated by this feeMultiplier,
     *  times the dungeon difficulty, times X. The payment is accumulated to the dungeon rewards,
     *  and a large proportion will be claimed by whoever successfully challenged the floor.
     *  (No preparation period discount on equipment training.)
     *  1000 szabo = 0.001 ether
     */
    uint public equipmentTrainingFeeMultiplier = 500 szabo;

    /**
     * @dev The external function to call when a hero train with a dungeon,
     *  it determines whether whether a training is successfully, and the resulting genes.
     *  Will generate a DungeonChallenged event.
     */
    function train1(uint _dungeonId, uint _heroId) whenNotPaused dungeonCanTrain(_dungeonId) heroAllowedToTrain(_heroId) external payable {
        _train(_dungeonId, _heroId, 0, 1);
    }

    function train2(uint _dungeonId, uint _heroId) whenNotPaused dungeonCanTrain(_dungeonId) heroAllowedToTrain(_heroId) external payable {
        _train(_dungeonId, _heroId, 0, 2);
    }

    function train3(uint _dungeonId, uint _heroId) whenNotPaused dungeonCanTrain(_dungeonId) heroAllowedToTrain(_heroId) external payable {
        _train(_dungeonId, _heroId, 0, 3);
    }

    /**
     * @dev The external function to call when a hero train a particular equipment with a dungeon,
     *  it determines whether whether a training is successfully, and the resulting genes.
     *  Will generate a DungeonChallenged event.
     *  _equipmentIndex is the index of equipment: 0 is train all attributes, including equipments and stats.
     *  1: weapon | 2: shield | 3: armor | 4: shoe | 5: helmet | 6: gloves | 7: belt | 8: shawl
     */
    function trainEquipment(uint _dungeonId, uint _heroId, uint _equipmentIndex) whenNotPaused dungeonCanTrain(_dungeonId) heroAllowedToTrain(_heroId) external payable {
        require(_equipmentIndex <= 8);

        _train(_dungeonId, _heroId, _equipmentIndex, 1);
    }

    /**
     * @dev An internal function of a hero train with dungeon,
     *  it determines whether whether a training is successfully, and the resulting genes.
     *  Will generate a DungeonChallenged event.
     */
    function _train(uint _dungeonId, uint _heroId, uint _equipmentIndex, uint _trainingTimes) private {
        // Get the dungeon details from the token contract.
        uint creationTime;
        uint difficulty;
        uint floorNumber;
        uint rewards;
        uint seedGenes;
        uint floorGenes;
        (creationTime,,difficulty,,floorNumber,,rewards,seedGenes,floorGenes) = dungeonTokenContract.dungeons(_dungeonId);

        // Check for _trainingTimes abnormality, we probably won't have any feature that train a hero 10 times with a single call.
        require(_trainingTimes < 10);

        // Checks for payment, any exceeding funds will be transferred back to the player.
        uint requiredFee;

        if (_equipmentIndex > 0) { // train specific equipments
            requiredFee = difficulty * equipmentTrainingFeeMultiplier * _trainingTimes;
        } else if (now < creationTime + dungeonPreparationTime) { // train all attributes, preparation period
            requiredFee = difficulty * preparationPeriodTrainingFeeMultiplier * _trainingTimes;
        } else { // train all attributes, normal period
            requiredFee = difficulty * trainingFeeMultiplier * _trainingTimes;
        }

        require(msg.value >= requiredFee);

        // Get the hero gene, or claim first hero.
        uint heroGenes;
        (_heroId, heroGenes) = _getHeroGenesOrClaimFirstHero(_heroId);

        // ** STORAGE UPDATE **
        // Increment the accumulated rewards for the dungeon.
        dungeonTokenContract.addDungeonRewards(_dungeonId, requiredFee);

        // Calculate any excess funds and make it available to be withdrawed by the player.
        asyncSend(msg.sender, msg.value - requiredFee);

        // Split the _train function into multiple parts because of stack too deep error.
        _trainPart2(_dungeonId, _heroId, heroGenes, _equipmentIndex, _trainingTimes);
    }

    /**
     * Split the _train function into multiple parts because of Stack Too Deep error.
     */
    function _trainPart2(uint _dungeonId, uint _heroId, uint _heroGenes, uint _equipmentIndex, uint _trainingTimes) private {
        // Get the dungeon details from the token contract.
        uint floorNumber;
        uint floorGenes;
        (,,,, floorNumber,,,, floorGenes) = dungeonTokenContract.dungeons(_dungeonId);

        // Determine if the hero training is successful or not, and the resulting genes.
        uint heroPower = _getHeroPower(_heroGenes, _dungeonId);

        uint newHeroGenes = _heroGenes;
        uint newHeroPower = heroPower;

        // Train the hero multiple times according to _trainingTimes,
        // each time if the resulting power is larger, update new hero power.
        for (uint i = 0; i < _trainingTimes; i++) {
            // Call the external closed source secret function that determines the resulting hero "genes".
            uint tmpHeroGenes = trainingScienceContract.mixGenes(newHeroGenes, floorGenes, _equipmentIndex);

            uint tmpHeroPower = _getHeroPower(tmpHeroGenes, _dungeonId);

            if (tmpHeroPower > newHeroPower) {
                newHeroGenes = tmpHeroGenes;
                newHeroPower = tmpHeroPower;
            }
        }

        // Prevent reduced power.
        if (newHeroPower > heroPower) {
            // ** STORAGE UPDATE **
            // Set the upgraded hero genes.
            heroTokenContract.setHeroGenes(_heroId, newHeroGenes);
        }

        // Emit the HeroTrained event.
        HeroTrained(now, msg.sender, _dungeonId, _heroId, _heroGenes, floorNumber, floorGenes, newHeroPower > heroPower, newHeroGenes);
    }


    /* ======== SETTER FUNCTIONS ======== */

    /// @dev Updates the fee contribution multiplier required for calling trainX().
    function setTrainingFeeMultiplier(uint _newTrainingFeeMultiplier) onlyOwner external {
        trainingFeeMultiplier = _newTrainingFeeMultiplier;
    }

    /// @dev Updates the fee contribution multiplier for preparation period required for calling trainX().
    function setPreparationPeriodTrainingFeeMultiplier(uint _newPreparationPeriodTrainingFeeMultiplier) onlyOwner external {
        preparationPeriodTrainingFeeMultiplier = _newPreparationPeriodTrainingFeeMultiplier;
    }

    /// @dev Updates the fee contribution multiplier required for calling trainEquipment().
    function setEquipmentTrainingFeeMultiplier(uint _newEquipmentTrainingFeeMultiplier) onlyOwner external {
        equipmentTrainingFeeMultiplier = _newEquipmentTrainingFeeMultiplier;
    }


    /* ======== MODIFIERS ======== */

    /**
     * @dev Throws if dungeon status do not allow training, also check for dungeon existence.
     *  Also check if the user is in the dungeon.
     */
    modifier dungeonCanTrain(uint _dungeonId) {
        require(_dungeonId < dungeonTokenContract.totalSupply());
        uint status;
        (,status,,,,,,,) = dungeonTokenContract.dungeons(_dungeonId);
        require(status == 0 || status == 3);

        // Also check if the user is in the dungeon.
        require(playerToDungeonID[msg.sender] == _dungeonId);
        _;
    }

    /**
     * @dev Throws if player does not own the hero.
     *  Unless the player does not have any hero yet, which will auto claim one during first challenge / train.
     */
    modifier heroAllowedToTrain(uint _heroId) {
        if (heroTokenContract.balanceOf(msg.sender) > 0) {
            // You can only train with your own hero.
            require(heroTokenContract.ownerOf(_heroId) == msg.sender);
        }
        _;
    }


}

/**
 * @title DungeonCoreBeta
 * @dev Core Contract of Ether Dungeon.
 *  When Version 1 launches, DungeonCoreVersion1 contract will be deployed and DungeonCoreBeta will be destroyed.
 *  Since all dungeons and heroes are stored as tokens in external contracts, they remains immutable.
 */
contract DungeonCoreBeta is Destructible, DungeonTraining {

    /**
     * Initialize the DungeonCore contract with all the required contract addresses.
     */
    function DungeonCoreBeta(
        address _dungeonTokenAddress,
        address _heroTokenAddress,
        address _challengeScienceAddress,
        address _trainingScienceAddress
    ) public {
        dungeonTokenContract = DungeonToken(_dungeonTokenAddress);
        heroTokenContract = HeroToken(_heroTokenAddress);
        challengeScienceContract = ChallengeScienceInterface(_challengeScienceAddress);
        trainingScienceContract = TrainingScienceInterface(_trainingScienceAddress);
    }

    /**
     * @dev The external function to get all the relevant information about a specific dungeon by its ID.
     * @param _id The ID of the dungeon.
     */
    function getDungeonDetails(uint _id) external view returns (uint creationTime, uint status, uint difficulty, uint capacity, bool isReady, uint playerCount) {
        require(_id < dungeonTokenContract.totalSupply());

        // Didn't get the "floorCreationTime" because of Stack Too Deep error.
        (creationTime, status, difficulty, capacity,,,,,) = dungeonTokenContract.dungeons(_id);

        // Dungeon is ready to be challenged (not in preparation mode).
        isReady = creationTime + dungeonPreparationTime <= now;
        playerCount = dungeonPlayerCount[_id];
    }

    /**
     * @dev Split floor related details out of getDungeonDetails, just to avoid Stack Too Deep error.
     * @param _id The ID of the dungeon.
     */
    function getDungeonFloorDetails(uint _id) external view returns (uint floorNumber, uint floorCreationTime, uint rewards, uint seedGenes, uint floorGenes) {
        require(_id < dungeonTokenContract.totalSupply());

        // Didn't get the "floorCreationTime" because of Stack Too Deep error.
        (,,,, floorNumber, floorCreationTime, rewards, seedGenes, floorGenes) = dungeonTokenContract.dungeons(_id);
    }

    /**
     * @dev The external function to get all the relevant information about a specific hero by its ID.
     * @param _id The ID of the hero.
     */
    function getHeroDetails(uint _id) external view returns (uint creationTime, uint cooldownStartTime, uint cooldownIndex, uint genes, bool isReady) {
        require(_id < heroTokenContract.totalSupply());

        (creationTime, cooldownStartTime, cooldownIndex, genes) = heroTokenContract.heroes(_id);

        // Hero is ready to challenge (not in cooldown mode).
        isReady = cooldownStartTime + challengeCooldownTime <= now;
    }

    /**
     * @dev The external function to get all the relevant information about a specific player by its address.
     * @param _address The address of the player.
     */
    function getPlayerDetails(address _address) external view returns (uint dungeonId, uint payment) {
        dungeonId = playerToDungeonID[_address];
        payment = payments[_address];
    }

}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"totalPayments","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newChallengeCooldownTime","type":"uint256"}],"name":"setChallengeCooldownTime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"dungeonPlayerCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dungeonTokenContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rushTimeFloorCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"getDungeonDetails","outputs":[{"name":"creationTime","type":"uint256"},{"name":"status","type":"uint256"},{"name":"difficulty","type":"uint256"},{"name":"capacity","type":"uint256"},{"name":"isReady","type":"bool"},{"name":"playerCount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_dungeonId","type":"uint256"},{"name":"_heroId","type":"uint256"}],"name":"challenge","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_newDungeonPreparationTime","type":"uint256"}],"name":"setDungeonPreparationTime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newRushTimeChallengeRewardsPercent","type":"uint256"}],"name":"setRushTimeChallengeRewardsPercent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newTrainingFeeMultiplier","type":"uint256"}],"name":"setTrainingFeeMultiplier","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_dungeonId","type":"uint256"},{"name":"_heroId","type":"uint256"}],"name":"train1","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"heroTokenContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newTransportationFeeMultiplier","type":"uint256"}],"name":"setTransportationFeeMultiplier","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"transportationFeeMultiplier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newHeroTokenContract","type":"address"}],"name":"setHeroTokenContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"playerToDungeonID","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newDungeonTokenContract","type":"address"}],"name":"setDungeonTokenContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newEquipmentTrainingFeeMultiplier","type":"uint256"}],"name":"setEquipmentTrainingFeeMultiplier","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"getDungeonFloorDetails","outputs":[{"name":"floorNumber","type":"uint256"},{"name":"floorCreationTime","type":"uint256"},{"name":"rewards","type":"uint256"},{"name":"seedGenes","type":"uint256"},{"name":"floorGenes","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdrawPayments","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"getHeroDetails","outputs":[{"name":"creationTime","type":"uint256"},{"name":"cooldownStartTime","type":"uint256"},{"name":"cooldownIndex","type":"uint256"},{"name":"genes","type":"uint256"},{"name":"isReady","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_dungeonId","type":"uint256"},{"name":"_heroId","type":"uint256"}],"name":"train3","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"challengeCooldownTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newMasterRewardsPercent","type":"uint256"}],"name":"setMasterRewardsPercent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"preparationPeriodTrainingFeeMultiplier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_destinationDungeonId","type":"uint256"}],"name":"transport","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newChallengeFeeMultiplier","type":"uint256"}],"name":"setChallengeFeeMultiplier","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_dungeonId","type":"uint256"},{"name":"_heroId","type":"uint256"},{"name":"_equipmentIndex","type":"uint256"}],"name":"trainEquipment","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_newTrainingScienceAddress","type":"address"}],"name":"setTrainingScienceContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"challengeFeeMultiplier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_dungeonId","type":"uint256"},{"name":"_heroId","type":"uint256"}],"name":"train2","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"rushTimeChallengeRewardsPercent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"trainingFeeMultiplier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newChallengeRewardsPercent","type":"uint256"}],"name":"setChallengeRewardsPercent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dungeonPreparationTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newPreparationPeriodTrainingFeeMultiplier","type":"uint256"}],"name":"setPreparationPeriodTrainingFeeMultiplier","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"getPlayerDetails","outputs":[{"name":"dungeonId","type":"uint256"},{"name":"payment","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"claimHero","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"removeOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"payments","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newChallengeScienceAddress","type":"address"}],"name":"setChallengeScienceContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"equipmentTrainingFeeMultiplier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"masterRewardsPercent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newRushTimeFloorCount","type":"uint256"}],"name":"setRushTimeFloorCount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_recipient","type":"address"}],"name":"destroyAndSend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"challengeRewardsPercent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_dungeonTokenAddress","type":"address"},{"name":"_heroTokenAddress","type":"address"},{"name":"_challengeScienceAddress","type":"address"},{"name":"_trainingScienceAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":true,"name":"playerAddress","type":"address"},{"indexed":true,"name":"dungeonId","type":"uint256"},{"indexed":true,"name":"heroId","type":"uint256"},{"indexed":false,"name":"heroGenes","type":"uint256"},{"indexed":false,"name":"floorNumber","type":"uint256"},{"indexed":false,"name":"floorGenes","type":"uint256"},{"indexed":false,"name":"success","type":"bool"},{"indexed":false,"name":"newHeroGenes","type":"uint256"}],"name":"HeroTrained","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":true,"name":"playerAddress","type":"address"},{"indexed":true,"name":"dungeonId","type":"uint256"},{"indexed":true,"name":"heroId","type":"uint256"},{"indexed":false,"name":"heroGenes","type":"uint256"},{"indexed":false,"name":"floorNumber","type":"uint256"},{"indexed":false,"name":"floorGenes","type":"uint256"},{"indexed":false,"name":"success","type":"bool"},{"indexed":false,"name":"newFloorGenes","type":"uint256"},{"indexed":false,"name":"successRewards","type":"uint256"},{"indexed":false,"name":"masterRewards","type":"uint256"}],"name":"DungeonChallenged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":true,"name":"playerAddress","type":"address"},{"indexed":true,"name":"originDungeonId","type":"uint256"},{"indexed":true,"name":"destinationDungeonId","type":"uint256"}],"name":"PlayerTransported","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

  Contract Creation Code Switch To Opcodes View
606060409081526000805460a060020a60ff02191690556104009051908101604090815260018252600260208084019190915260048284018190526005606085015260106080808601829052601160a0870152601260c0870152601360e08701526000610100870181905261012087018190526101408701819052610160870181905261018087018190526101a087018190526101c087018190526101e087018190526102008701939093526102208601919091526102408501839052602161026086015261028085018290526102a085018290526102c085018290526102e085018290526103008501839052610320850193909352610340840181905261036084018190526103808401929092526103a083018290526103c083018290526103e083019190915262000135916007916200022d565b5060206009556601c6bf52634000600a5566038d7ea4c68000600d556040600e556008600f5560b4601055610e10601155601e601255601e60135566071afd498d000060145566066517289880006015556601c6bf5263400060165534156200019d57600080fd5b6040516080806200389d8339810160405280805191906020018051919060200180519190602001805160008054600160a060020a031990811633600160a060020a03908116919091179092556003805482169883169890981790975560048054881696821696909617909555600580548716948616949094179093555050600680549093169116179055620002ee565b600283019183908215620002b75791602002820160005b838211156200028557835183826101000a81548161ffff021916908360ff160217905550926020019260020160208160010104928301926001030262000244565b8015620002b55782816101000a81549061ffff021916905560020160208160010104928301926001030262000285565b505b50620002c5929150620002c9565b5090565b620002eb91905b80821115620002c557805461ffff19168155600101620002d0565b90565b61359f80620002fe6000396000f3006060604052600436106102575763ffffffff60e060020a6000350416625b4487811461025c578063024c764f14610281578063030c3631146102995780630c17d023146102af578063111839d5146102de5780631cfd11d5146102f15780632e414890146103425780633350b91514610350578063368d6b251461036657806336a608911461037c5780633f4ba83a146103925780633fc0234d146103a55780634272f2d5146103b3578063463fbb76146103c6578063496fbeb3146103dc5780634b12416c146103ef57806354bf3a731461040e5780635661ba151461042d5780635a2f71d41461044c5780635c975abb146104625780635ead330c146104895780636103d70b146104d1578063730bdc96146104e4578063761bb70a1461052b578063806bd2b61461053957806383197ef01461054c578063841206451461055f5780638456cb59146105755780638ca84d40146105885780638d1c80481461059b5780638da5cb5b146105a65780639406cf59146105b957806397cdcbfd146105cf578063a71168e3146105e0578063a9e899ef146105ff578063ab702d4814610612578063ae7b162014610620578063b37dcce214610633578063bb828f1114610646578063be523c231461065c578063c5c9e3be1461066f578063c8dd6ce714610685578063c91b46c6146106bc578063d99bb9f7146106cf578063e2982c21146106e2578063e2c2d72c14610701578063ed225a8a14610720578063efb95ced14610733578063f2d93fb014610746578063f2fde38b1461075c578063f5074f411461077b578063fe2450c11461079a575b600080fd5b341561026757600080fd5b61026f6107ad565b60405190815260200160405180910390f35b341561028c57600080fd5b6102976004356107b3565b005b34156102a457600080fd5b61026f6004356107d3565b34156102ba57600080fd5b6102c26107e5565b604051600160a060020a03909116815260200160405180910390f35b34156102e957600080fd5b61026f6107f4565b34156102fc57600080fd5b6103076004356107fa565b604051958652602086019490945260408086019390935260608501919091521515608084015260a083019190915260c0909101905180910390f35b610297600435602435610976565b341561035b57600080fd5b610297600435610dfa565b341561037157600080fd5b610297600435610e1a565b341561038757600080fd5b610297600435610e3a565b341561039d57600080fd5b610297610e5a565b610297600435602435610ed9565b34156103be57600080fd5b6102c2611165565b34156103d157600080fd5b610297600435611174565b34156103e757600080fd5b61026f611194565b34156103fa57600080fd5b610297600160a060020a036004351661119a565b341561041957600080fd5b61026f600160a060020a03600435166111d7565b341561043857600080fd5b610297600160a060020a03600435166111e9565b341561045757600080fd5b610297600435611226565b341561046d57600080fd5b610475611246565b604051901515815260200160405180910390f35b341561049457600080fd5b61049f600435611256565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b34156104dc57600080fd5b6102976113ce565b34156104ef57600080fd5b6104fa600435611467565b60405194855260208501939093526040808501929092526060840152901515608083015260a0909101905180910390f35b61029760043560243561158f565b341561054457600080fd5b61026f611814565b341561055757600080fd5b61029761181a565b341561056a57600080fd5b610297600435611843565b341561058057600080fd5b610297611863565b341561059357600080fd5b61026f6118e7565b6102976004356118ed565b34156105b157600080fd5b6102c2611c19565b34156105c457600080fd5b610297600435611c28565b610297600435602435604435611c48565b34156105eb57600080fd5b610297600160a060020a0360043516611ee2565b341561060a57600080fd5b61026f611f1f565b610297600435602435611f25565b341561062b57600080fd5b61026f6121aa565b341561063e57600080fd5b61026f6121b0565b341561065157600080fd5b6102976004356121b6565b341561066757600080fd5b61026f6121d6565b341561067a57600080fd5b6102976004356121dc565b341561069057600080fd5b6106a4600160a060020a03600435166121fc565b60405191825260208201526040908101905180910390f35b34156106c757600080fd5b61026f612224565b34156106da57600080fd5b610297612371565b34156106ed57600080fd5b61026f600160a060020a036004351661239e565b341561070c57600080fd5b610297600160a060020a03600435166123b0565b341561072b57600080fd5b61026f6123ed565b341561073e57600080fd5b61026f6123f3565b341561075157600080fd5b6102976004356123f9565b341561076757600080fd5b610297600160a060020a0360043516612419565b341561078657600080fd5b610297600160a060020a03600435166124a7565b34156107a557600080fd5b61026f6124ce565b60025481565b60005433600160a060020a039081169116146107ce57600080fd5b601055565b600c6020526000908152604090205481565b600354600160a060020a031681565b60135481565b60035460009081908190819081908190600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561084e57600080fd5b6102c65a03f1151561085f57600080fd5b50505060405180518810905061087457600080fd5b600354600160a060020a031663956e958a886000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b15156108c757600080fd5b6102c65a03f115156108d857600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190508863ffffffff1698508760ff1697508660ff1696508561ffff1695509091929350909192509091509050508096508197508298508399505050505042601154870111159150600c600088815260200190815260200160002054905091939550919395565b600080548190819060a060020a900460ff161561099257600080fd5b60035485906000908190600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109e057600080fd5b6102c65a03f115156109f157600080fd5b505050604051805184109050610a0657600080fd5b600354600160a060020a031663956e958a846000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b1515610a5957600080fd5b6102c65a03f11515610a6a57600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051505063ffffffff90971698505060ff90941695505084159350839250610acb9150505750806002145b1515610ad657600080fd5b600160a060020a0333166000908152600b60205260409020548314610afa57600080fd5b601154429083011115610b0c57600080fd5b60045487906000908190600160a060020a03166370a0823133836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610b6b57600080fd5b6102c65a03f11515610b7c57600080fd5b505050604051805190501115610cb257600454600160a060020a033381169116636352211e8460006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610be157600080fd5b6102c65a03f11515610bf257600080fd5b50505060405180519050600160a060020a0316141515610c1157600080fd5b600454600160a060020a031663a8d4a03b8360006040516080015260405160e060020a63ffffffff84160281526004810191909152602401608060405180830381600087803b1515610c6257600080fd5b6102c65a03f11515610c7357600080fd5b5050506040518051906020018051906020018051906020018051505060105467ffffffffffffffff9092169350504290830111159050610cb257600080fd5b600354600160a060020a031663956e958a8b6000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b1515610d0557600080fd5b6102c65a03f11515610d1657600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519060200180515050600d5460ff9096169f509d505050918c02995050505034879010159050610d7657600080fd5b600354600160a060020a031663a64f829a8b8860405160e060020a63ffffffff851602815260048101929092526024820152604401600060405180830381600087803b1515610dc457600080fd5b6102c65a03f11515610dd557600080fd5b505050610de4338734036124d4565b610dee8a8a612530565b50505050505050505050565b60005433600160a060020a03908116911614610e1557600080fd5b601155565b60005433600160a060020a03908116911614610e3557600080fd5b601255565b60005433600160a060020a03908116911614610e5557600080fd5b601455565b60005433600160a060020a03908116911614610e7557600080fd5b60005460a060020a900460ff161515610e8d57600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60005460a060020a900460ff1615610ef057600080fd5b6003548290600090600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610f3c57600080fd5b6102c65a03f11515610f4d57600080fd5b505050604051805183109050610f6257600080fd5b600354600160a060020a031663956e958a836000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b1515610fb557600080fd5b6102c65a03f11515610fc657600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051505060ff9096169750508615955085945061101e93505050505750806003145b151561102957600080fd5b600160a060020a0333166000908152600b6020526040902054821461104d57600080fd5b6004548390600090600160a060020a03166370a0823133836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156110aa57600080fd5b6102c65a03f115156110bb57600080fd5b50505060405180519050111561115057600454600160a060020a033381169116636352211e8360006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561112057600080fd5b6102c65a03f1151561113157600080fd5b50505060405180519050600160a060020a031614151561115057600080fd5b61115e858560006001612898565b5050505050565b600454600160a060020a031681565b60005433600160a060020a0390811691161461118f57600080fd5b600a55565b600a5481565b60005433600160a060020a039081169116146111b557600080fd5b60048054600160a060020a031916600160a060020a0392909216919091179055565b600b6020526000908152604090205481565b60005433600160a060020a0390811691161461120457600080fd5b60038054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161461124157600080fd5b601655565b60005460a060020a900460ff1681565b6003546000908190819081908190600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156112a857600080fd5b6102c65a03f115156112b957600080fd5b5050506040518051871090506112ce57600080fd5b600354600160a060020a031663956e958a876000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b151561132157600080fd5b6102c65a03f1151561133257600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190509091929394959697509091929394959650909192939495509091929394508463ffffffff1694508363ffffffff169350826fffffffffffffffffffffffffffffffff169250809550819650829750839850849950505050505091939590929450565b33600160a060020a0381166000908152600160205260409020548015156113f457600080fd5b600160a060020a033016318190101561140c57600080fd5b60025461141f908263ffffffff612a8c16565b600255600160a060020a0382166000818152600160205260408082209190915582156108fc0290839051600060405180830381858888f19350505050151561146357fe5b5050565b6004546000908190819081908190600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156114b957600080fd5b6102c65a03f115156114ca57600080fd5b5050506040518051871090506114df57600080fd5b600454600160a060020a031663a8d4a03b8760006040516080015260405160e060020a63ffffffff84160281526004810191909152602401608060405180830381600087803b151561153057600080fd5b6102c65a03f1151561154157600080fd5b505050604051805190602001805190602001805190602001805160105467ffffffffffffffff9586169c949095169a5063ffffffff9092169850909650504291880191909111159350915050565b60005460a060020a900460ff16156115a657600080fd5b6003548290600090600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156115f257600080fd5b6102c65a03f1151561160357600080fd5b50505060405180518310905061161857600080fd5b600354600160a060020a031663956e958a836000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b151561166b57600080fd5b6102c65a03f1151561167c57600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051505060ff909616975050861595508594506116d493505050505750806003145b15156116df57600080fd5b600160a060020a0333166000908152600b6020526040902054821461170357600080fd5b6004548390600090600160a060020a03166370a0823133836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561176057600080fd5b6102c65a03f1151561177157600080fd5b50505060405180519050111561180657600454600160a060020a033381169116636352211e8360006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156117d657600080fd5b6102c65a03f115156117e757600080fd5b50505060405180519050600160a060020a031614151561180657600080fd5b61115e858560006003612898565b60105481565b60005433600160a060020a0390811691161461183557600080fd5b600054600160a060020a0316ff5b60005433600160a060020a0390811691161461185e57600080fd5b600f55565b60005433600160a060020a0390811691161461187e57600080fd5b60005460a060020a900460ff161561189557600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60155481565b60008060008060008060008060149054906101000a900460ff1615151561191357600080fd5b60035488906000908190600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561196157600080fd5b6102c65a03f1151561197257600080fd5b50505060405180518410905061198757600080fd5b600354600160a060020a031663956e958a846000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b15156119da57600080fd5b6102c65a03f115156119eb57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805150505060ff959095169750505061ffff1693505083159150819050611a485750816001145b1515611a5357600080fd5b801580611a6e57506000838152600c60205260409020548190105b1515611a7957600080fd5b600160a060020a0333166000908152600b602052604090205499508a8a1415611aa157600080fd5b600354600160a060020a031663956e958a8c6000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b1515611af457600080fd5b6102c65a03f11515611b0557600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805150505060ff949094169e50505061ffff169a50611b6092503391508d9050612a9e565b9650600c8902871015611b7257600080fd5b600a5489810296506030880402945085850193503484901015611b9457600080fd5b600354600160a060020a031663a64f829a8b8660405160e060020a63ffffffff851602815260048101929092526024820152604401600060405180830381600087803b1515611be257600080fd5b6102c65a03f11515611bf357600080fd5b505050611c02338534036124d4565b611c0c8a8c612d33565b5050505050505050505050565b600054600160a060020a031681565b60005433600160a060020a03908116911614611c4357600080fd5b600d55565b60005460a060020a900460ff1615611c5f57600080fd5b6003548390600090600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611cab57600080fd5b6102c65a03f11515611cbc57600080fd5b505050604051805183109050611cd157600080fd5b600354600160a060020a031663956e958a836000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b1515611d2457600080fd5b6102c65a03f11515611d3557600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051505060ff90961697505086159550859450611d8d93505050505750806003145b1515611d9857600080fd5b600160a060020a0333166000908152600b60205260409020548214611dbc57600080fd5b6004548490600090600160a060020a03166370a0823133836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515611e1957600080fd5b6102c65a03f11515611e2a57600080fd5b505050604051805190501115611ebf57600454600160a060020a033381169116636352211e8360006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515611e8f57600080fd5b6102c65a03f11515611ea057600080fd5b50505060405180519050600160a060020a0316141515611ebf57600080fd5b6008841115611ecd57600080fd5b611eda8686866001612898565b505050505050565b60005433600160a060020a03908116911614611efd57600080fd5b60068054600160a060020a031916600160a060020a0392909216919091179055565b600d5481565b60005460a060020a900460ff1615611f3c57600080fd5b6003548290600090600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611f8857600080fd5b6102c65a03f11515611f9957600080fd5b505050604051805183109050611fae57600080fd5b600354600160a060020a031663956e958a836000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b151561200157600080fd5b6102c65a03f1151561201257600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051505060ff9096169750508615955085945061206a93505050505750806003145b151561207557600080fd5b600160a060020a0333166000908152600b6020526040902054821461209957600080fd5b6004548390600090600160a060020a03166370a0823133836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156120f657600080fd5b6102c65a03f1151561210757600080fd5b50505060405180519050111561219c57600454600160a060020a033381169116636352211e8360006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561216c57600080fd5b6102c65a03f1151561217d57600080fd5b50505060405180519050600160a060020a031614151561219c57600080fd5b61115e858560006002612898565b60125481565b60145481565b60005433600160a060020a039081169116146121d157600080fd5b600e55565b60115481565b60005433600160a060020a039081169116146121f757600080fd5b601555565b600160a060020a03166000908152600b60209081526040808320546001909252909120549091565b600160a060020a0333166000908152600b60205260408120541580156122bb5750600454600160a060020a03166370a082313360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561229e57600080fd5b6102c65a03f115156122af57600080fd5b50505060405180511590505b156122f25760008052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8805460010190555b600454600160a060020a03166314fbc22b600033816040516020015260405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401602060405180830381600087803b151561235257600080fd5b6102c65a03f1151561236357600080fd5b505050604051805191505090565b60005433600160a060020a0390811691161461238c57600080fd5b60008054600160a060020a0319169055565b60016020526000908152604090205481565b60005433600160a060020a039081169116146123cb57600080fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b60165481565b600f5481565b60005433600160a060020a0390811691161461241457600080fd5b601355565b60005433600160a060020a0390811691161461243457600080fd5b600160a060020a038116151561244957600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146124c257600080fd5b80600160a060020a0316ff5b600e5481565b600160a060020a0382166000908152600160205260409020546124fd908263ffffffff612e3216565b600160a060020a038316600090815260016020526040902055600254612529908263ffffffff612e3216565b6002555050565b6000806000806000806000806000600360009054906101000a9004600160a060020a0316600160a060020a031663956e958a8c6000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b15156125a457600080fd5b6102c65a03f115156125b557600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190509091929394959697509091929394959650909192939495509091929394508463ffffffff16945090919250826fffffffffffffffffffffffffffffffff1692509050809950819a50829b505050506126468a612e48565b909a509550612656868c89612f59565b945084156127b4576126678b612f7f565b600f54909450606490890204925060135489101561269d57601254600f5460648a830281900494509182030389020490506126b7565b600e54600f5460648a830281900494509182030389020490505b8183018101889011156126c957600080fd5b600354600160a060020a0316630b4964a88c838760405160e060020a63ffffffff8616028152600481019390935260248301919091526044820152606401600060405180830381600087803b151561272057600080fd5b6102c65a03f1151561273157600080fd5b50505061273e33836124d4565b6003546127b490600160a060020a0316636352211e8d60006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561279357600080fd5b6102c65a03f115156127a457600080fd5b50505060405180519050846124d4565b600454600160a060020a031663a540db738b60405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b15156127fc57600080fd5b6102c65a03f1151561280d57600080fd5b505050898b33600160a060020a03167f1d62a40f1930b2f52c8eb91d13d8dcd75bf8568c2d41fda621190933b1424007428a8e8d8c8c8b8d60405197885260208801969096526040808801959095526060870193909352901515608086015260a085015260c084015260e0830191909152610100909101905180910390a45050505050505050505050565b6003546000908190819081908190819081908190600160a060020a031663956e958a8d83604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b15156128fb57600080fd5b6102c65a03f1151561290c57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190508863ffffffff16985090919293949596508660ff1696509091929394508463ffffffff16945090919250826fffffffffffffffffffffffffffffffff169250809850819950829a50839b50849c50859d50505050505050600a891015156129ac57600080fd5b60008a11156129c3578860165488020291506129e7565b60115488014210156129dd578860155488020291506129e7565b8860145488020291505b34829010156129f557600080fd5b6129fe8b612e48565b600354919c509150600160a060020a031663a64f829a8d8460405160e060020a63ffffffff851602815260048101929092526024820152604401600060405180830381600087803b1515612a5157600080fd5b6102c65a03f11515612a6257600080fd5b505050612a71338334036124d4565b612a7e8c8c838d8d6130d9565b505050505050505050505050565b600082821115612a9857fe5b50900390565b600080612aa9613561565b6004546000908190819081908190819081908190600160a060020a03166370a082318e836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515612b1257600080fd5b6102c65a03f11515612b2357600080fd5b50505060405180519a5050891515612b3e5760009a50612d23565b89604051805910612b4c5750595b90808252806020026020018201604052509850600097505b89881015612c9a57600454600160a060020a03166328b600318e8a60006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515612bcb57600080fd5b6102c65a03f11515612bdc57600080fd5b5050506040518051600454909850600160a060020a0316905063a8d4a03b8860006040516080015260405160e060020a63ffffffff84160281526004810191909152602401608060405180830381600087803b1515612c3a57600080fd5b6102c65a03f11515612c4b57600080fd5b50505060405180519060200180519060200180519060200180519950612c7993508992508f915061336a9050565b898981518110612c8557fe5b60209081029091010152600190970196612b64565b6005821015612d1f575060005b8851811015612cf15783898281518110612cbd57fe5b906020019060200201511115612ce957888181518110612cd957fe5b9060200190602002015193508092505b600101612ca7565b938301936000898481518110612d0357fe5b6020908102909101015260009350839250600190910190612c9a565b849a505b5050505050505050505092915050565b600454600160a060020a03166370a082313360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515612d8c57600080fd5b6102c65a03f11515612d9d57600080fd5b505050604051805115159050612db757612db5612224565b505b6000828152600c60209081526040808320805460001901905583835280832080546001019055600160a060020a033316808452600b9092529182902083905582918491907f32e43b5becec4a6de1c64c6f5c86d86094f8bf5a8e0c9450f7ed779b3d645d7b9042905190815260200160405180910390a45050565b600082820183811015612e4157fe5b9392505050565b6004548190600090600160a060020a03166370a0823133836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515612ea557600080fd5b6102c65a03f11515612eb657600080fd5b505050604051805115159050612ed157612ece612224565b91505b600454600160a060020a031663a8d4a03b8360006040516080015260405160e060020a63ffffffff84160281526004810191909152602401608060405180830381600087803b1515612f2257600080fd5b6102c65a03f11515612f3357600080fd5b505050604051805190602001805190602001805190602001805195979596505050505050565b6000806000612f68868661336a565b9150612f7384613501565b90911195945050505050565b60035460009081908190819081908190600160a060020a031663956e958a8883604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b1515612fde57600080fd5b6102c65a03f11515612fef57600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051919d50909b5061304197508b965061350195505050505050565b600554909350600160a060020a0316638d8b1b88858760006040516020015260405160e060020a63ffffffff851602815260048101929092526024820152604401602060405180830381600087803b151561309b57600080fd5b6102c65a03f115156130ac57600080fd5b5050506040518051905091506130c182613501565b9050828110156130cf578391505b5095945050505050565b6003546000908190819081908190819081908190600160a060020a031663956e958a8e83604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b151561313c57600080fd5b6102c65a03f1151561314d57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190509091929394959697509091929394959650909192939495509091929394508463ffffffff16945090919250909150905080985081995050506131c98b8e61336a565b95508a9450859350600092505b8883101561328157600654600160a060020a0316630d9f5aed86898d60006040516020015260405160e060020a63ffffffff8616028152600481019390935260248301919091526044820152606401602060405180830381600087803b151561323e57600080fd5b6102c65a03f1151561324f57600080fd5b505050604051805190509150613265828e61336a565b905083811115613276578194508093505b6001909201916131d6565b858411156132ec57600454600160a060020a03166315e839c18d8760405160e060020a63ffffffff851602815260048101929092526024820152604401600060405180830381600087803b15156132d757600080fd5b6102c65a03f115156132e857600080fd5b5050505b8b8d33600160a060020a03167fc65803521ed207655f143edad7860bd56fa74d982a0f4e82fadfb074c301c795428f8d8d8d8c118d604051958652602086019490945260408086019390935260608501919091521515608084015260a083019190915260c0909101905180910390a450505050505050505050505050565b600080600080600080600080600080600360009054906101000a9004600160a060020a0316600160a060020a031663956e958a8c6000604051610120015260405160e060020a63ffffffff8416028152600481019190915260240161012060405180830381600087803b15156133df57600080fd5b6102c65a03f115156133f057600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051505060ff9095169f5060009d50505050505050505b60048710156134655760208c069790970160010196621000008c049b5060019096019561343d565b60208c069450600493505b600c8410156134d65760208c0692506007836020811061348c57fe5b601091828204019190066002029054906101000a900461ffff1661ffff1686019550621000008c8115156134bc57fe5b049b508483146134cb57600094505b600190930192613470565b60108510801592506134ed57506009546000198901025b969094019095019998505050505050505050565b600080805b600c81101561355a576007602085066020811061351f57fe5b601091828204019190066002029054906101000a900461ffff1661ffff1682019150621000008481151561354f57fe5b049350600101613506565b5092915050565b602060405190810160405260008152905600a165627a7a72305820d721d6d6fbeffa8acf2055f2516130153ed75ff8cbdc7c0dd8943a9d0b6575f50029000000000000000000000000dc81a13cfd9aecb8ddc9e4c3c87c3ec9fbc98583000000000000000000000000f93a631cd05a88be1b0077fd2ade62a54382cc6a000000000000000000000000aa57ada57c1e6a391eebdfbc599d7fc0870eae38000000000000000000000000fdf4fdc7a3505aac4b57ad23fa620194d6703444

    Constructor Arguments (ABI-encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000dc81a13cfd9aecb8ddc9e4c3c87c3ec9fbc98583000000000000000000000000f93a631cd05a88be1b0077fd2ade62a54382cc6a000000000000000000000000aa57ada57c1e6a391eebdfbc599d7fc0870eae38000000000000000000000000fdf4fdc7a3505aac4b57ad23fa620194d6703444

-----Decoded View---------------
Found 4 constructor arguments :
Arg [0] : 000000000000000000000000dc81a13cfd9aecb8ddc9e4c3c87c3ec9fbc98583
Arg [1] : 000000000000000000000000f93a631cd05a88be1b0077fd2ade62a54382cc6a
Arg [2] : 000000000000000000000000aa57ada57c1e6a391eebdfbc599d7fc0870eae38
Arg [3] : 000000000000000000000000fdf4fdc7a3505aac4b57ad23fa620194d6703444


   Swarm Source:
bzzr://d721d6d6fbeffa8acf2055f2516130153ed75ff8cbdc7c0dd8943a9d0b6575f5

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.