Contract Overview |  MCH_TokenSale
Balance: 0 Ether
Ether Value: $0
Transactions: 4175 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0xe7af11370c3bab51230d8307454350bdf6d68f4aat txn 0x409857c98951f1803f9d71298759383124548a33ae89676a126a90a45b8bb750
 Latest 25 transactions from a total of 4175 transactions

TxHash Age From To Value [TxFee]
0xb6b2bbeb5675c4a96854528e585fc6f2a73faaf3de900558cc6e49e5337fb95918 days 18 hrs ago0xe9bab38ac0be4984841fab97029f205d5f00751d  IN   MCH_TokenSale0 Ether0.000024765
0x9d6e1bb31a652485c5770b977792604f91e1ff8ce708ecbf1fb303e94e809e8a22 days 14 hrs ago0x395d52e1871d606526d8bfa1e61383fbdb1ccb6e  IN   MCH_TokenSale0 Ether0.000123825
0x5ea9507f1d12b891f4b8bf07bb8d2c1017d09108711e96a86dd7f6756a6b1e6b26 days 31 mins ago0xf498d081c814738216175451ffc2cdc9dde62f5c  IN   MCH_TokenSale0.500744179955747 Ether0.00035406
0x407e0d5915634c374b4b65b10103e0ad48db64832af1c83bde5cae0fc84593a027 days 9 hrs ago0x17cba3340a6794814fdb89aad3b72b05405ac6f4  IN   MCH_TokenSale0 Ether0.00029718
0xbf78e65fdbab090d19c107ebbc5afc8bece3edad465d70e9ee9675a17bcbf25b36 days 18 hrs ago0x10d056883ef7f698e31e8df1e3530152943d9a05  IN   MCH_TokenSale0 Ether0.00004953
0x44d147ab45c2b4bb5572df1fec7d3f87dc3c3706c0ef511b52e37ee4b1ccc53d39 days 7 hrs ago0xe7af11370c3bab51230d8307454350bdf6d68f4a  IN   MCH_TokenSale0 Ether0.00015058
0x5888813cac94531bfcce64c0995093e865b8a820398e55cc69d39187eab2a27f40 days 12 hrs ago0xdcab41244587cf392653006910de7c061df4a37e  IN   MCH_TokenSale0 Ether0.00004953
0xbc0fcfead7b8dd19187d0f4c7c6fa217fc809e43384fd4703930fd0ebb02867141 days 2 hrs ago0x665932313905942958c3f30e539e9a40e63c58f4  IN   MCH_TokenSale0 Ether0.00031254
0x404157caa3c07d0592cf9aac5ecd06fdb9002668e9d48785abb76eebe8c879c041 days 2 hrs ago0x665932313905942958c3f30e539e9a40e63c58f4  IN   MCH_TokenSale0 Ether0.00031254
0x57b516c3cd4218158798fd57260372f6981a5771dbfd7d160e2234b8d07beb4841 days 2 hrs ago0x665932313905942958c3f30e539e9a40e63c58f4  IN   MCH_TokenSale0 Ether0.00031254
0x56e6c4e55bffb445f92008959731dc4558b683a89268fb1de6e2ef6af2ecd90f41 days 2 hrs ago0x665932313905942958c3f30e539e9a40e63c58f4  IN   MCH_TokenSale0 Ether0.00031254
0xb7919411062fa4930a7fca90f0d01bb152e069d3abc9f1f1596f08fbcbe376e743 days 7 hrs ago0xeac18b7a83f55b2b822e141fe219d4f8b1a9aca4  IN   MCH_TokenSale0.101377654167361 Ether0.000707478
0xbb757de45aece84b8d76d1ba5ab22f6bf5df2280d34e7ea7f2a8e447a1863b8943 days 7 hrs ago0xe99840f899d28566487f10e4046685f046958517  IN   MCH_TokenSale6.803598773807101 Ether0.002705556
0x3504ca4cacfe230dc91f95a13bd9121f9a752a9dad3b4a459c8b0c3236ab792543 days 7 hrs ago0x87fc0cdb581f84456c02f20ec1a844d95803c437  IN   MCH_TokenSale0.801694788495522 Ether0.002712576
0x9fda45b3c83d3f45004c5fb88226ad2eda4480436995f35136947a7cd0b42e2343 days 7 hrs ago0xeac18b7a83f55b2b822e141fe219d4f8b1a9aca4  IN   MCH_TokenSale0.103741676790288 Ether0.00117913
0x51db4ce7693508b6eb191445c68d6abfa51d089116c7e55adb8eb386e0fe2e9943 days 7 hrs ago0xcd6fb0f2bf2476e43219e5616709adc58360a8da  IN   MCH_TokenSale0.721796986108358 Ether0.00273378
0xb17a28273a3724af1b6cb7505137f8801fa2d9367b3ce9bd52c699a3d8e61e7c43 days 7 hrs ago0xd868711bd9a2c6f1548f5f4737f71da67d821090  IN   MCH_TokenSale0.101450748689471 Ether0.002892576
0x765fac954aa8fd913d9c2058ae557af42c41accaf150d5deab055f54eccc859043 days 7 hrs ago0xeac18b7a83f55b2b822e141fe219d4f8b1a9aca4  IN   MCH_TokenSale0.099273007302918 Ether0.001003304
0xaf83d0d09d94141b9cc02399182516dabb6aad376c4c6b745c8da123f4bfc22643 days 8 hrs ago0x83c9440dc34da00c47a0d4dc2b598d7bdb1b53f7  IN   MCH_TokenSale0.097286426291448 Ether0.0006622047
0xde1930512530a30c47404f3c3878b1f7d9c3313309cec4c9cc76900d92465a9043 days 9 hrs ago0x65f899e41a38724dc1b857ed114c9820affb462c  IN   MCH_TokenSale0.724165535124621 Ether0.002829912
0x54a1ddc864b2cd70aae2dca399949cb5d2ce9bd3d9083eb0bbced50d7f26c91943 days 9 hrs ago0x8c5fc43ad00cc53e11f61bece329ddc5e3ea0929  IN   MCH_TokenSale0.123897576869158 Ether0.002829912
0x590608b32f08080a7b612bf5bb8c5d69fe1893742229850012add1f16909559743 days 9 hrs ago0x65f899e41a38724dc1b857ed114c9820affb462c  IN   MCH_TokenSale3.420660309781695 Ether0.002829912
0xdd2ff59099b8c7ee8215791e545f3ebf171a3633e4183587a7f2cff8925bf43743 days 9 hrs ago0x65f899e41a38724dc1b857ed114c9820affb462c  IN   MCH_TokenSale0.659515788976524 Ether0.002829912
0xf1c4513a911bfffb3669fe1e8ef69035056ec28bf46b26033fc90c587ac2634343 days 9 hrs ago0x8c5fc43ad00cc53e11f61bece329ddc5e3ea0929  IN   MCH_TokenSale0.099746008524129 Ether0.002829912
0xc43baa0b69281bc5f1c241183167a131d33c80d4d2d98f2278b937dfe3ed706643 days 9 hrs ago0x65f899e41a38724dc1b857ed114c9820affb462c  IN   MCH_TokenSale0.097621525058669 Ether0.002763132
[ 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
0x44d147ab45c2b4bb5572df1fec7d3f87dc3c3706c0ef511b52e37ee4b1ccc53d688341339 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xe7af11370c3bab51230d8307454350bdf6d68f4a202.301770377061322556 Ether
0xb7919411062fa4930a7fca90f0d01bb152e069d3abc9f1f1596f08fbcbe376e7685917243 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xd5e4868b51439ac87279b0d0117b7e2f364750580.020275153231862667 Ether
0xb7919411062fa4930a7fca90f0d01bb152e069d3abc9f1f1596f08fbcbe376e7685917243 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xeac18b7a83f55b2b822e141fe219d4f8b1a9aca40.000001888008048474 Ether
0xbb757de45aece84b8d76d1ba5ab22f6bf5df2280d34e7ea7f2a8e447a1863b89685915943 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xe99840f899d28566487f10e4046685f0469585170.000451270452773746 Ether
0x3504ca4cacfe230dc91f95a13bd9121f9a752a9dad3b4a459c8b0c3236ab7925685915643 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x87fc0cdb581f84456c02f20ec1a844d95803c4370.000042696760135592 Ether
0x9fda45b3c83d3f45004c5fb88226ad2eda4480436995f35136947a7cd0b42e23685913343 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xd5e4868b51439ac87279b0d0117b7e2f364750580.020747398711274585 Ether
0x9fda45b3c83d3f45004c5fb88226ad2eda4480436995f35136947a7cd0b42e23685913343 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xeac18b7a83f55b2b822e141fe219d4f8b1a9aca40.000004683233915783 Ether
0x51db4ce7693508b6eb191445c68d6abfa51d089116c7e55adb8eb386e0fe2e99685912343 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xcd6fb0f2bf2476e43219e5616709adc58360a8da0.000036101729293081 Ether
0xb17a28273a3724af1b6cb7505137f8801fa2d9367b3ce9bd52c699a3d8e61e7c685911643 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xd868711bd9a2c6f1548f5f4737f71da67d8210900.000004697098362369 Ether
0x765fac954aa8fd913d9c2058ae557af42c41accaf150d5deab055f54eccc8590685911043 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xd5e4868b51439ac87279b0d0117b7e2f364750580.019850346122708825 Ether
0x765fac954aa8fd913d9c2058ae557af42c41accaf150d5deab055f54eccc8590685911043 days 7 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xeac18b7a83f55b2b822e141fe219d4f8b1a9aca40.000021276689374739 Ether
0xaf83d0d09d94141b9cc02399182516dabb6aad376c4c6b745c8da123f4bfc226685904743 days 8 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x96080155dd976e98305fa9aea96834a03abda8640.019450735882912268 Ether
0xaf83d0d09d94141b9cc02399182516dabb6aad376c4c6b745c8da123f4bfc226685904743 days 8 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x83c9440dc34da00c47a0d4dc2b598d7bdb1b53f70.000032746876887127 Ether
0xde1930512530a30c47404f3c3878b1f7d9c3313309cec4c9cc76900d92465a90685882543 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xae015ccde814da988dbca7f09c10f7c25d6931c30.144825276649949012 Ether
0xde1930512530a30c47404f3c3878b1f7d9c3313309cec4c9cc76900d92465a90685882543 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x65f899e41a38724dc1b857ed114c9820affb462c0.000039151874876184 Ether
0x54a1ddc864b2cd70aae2dca399949cb5d2ce9bd3d9083eb0bbced50d7f26c919685882143 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x7e1dcf785f0353bf657c38ab7865c1f184efe2080.024778166814723653 Ether
0x54a1ddc864b2cd70aae2dca399949cb5d2ce9bd3d9083eb0bbced50d7f26c919685882143 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x8c5fc43ad00cc53e11f61bece329ddc5e3ea09290.000006742795539743 Ether
0x590608b32f08080a7b612bf5bb8c5d69fe1893742229850012add1f169095597685882043 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xae015ccde814da988dbca7f09c10f7c25d6931c30.684031002099151961 Ether
0x590608b32f08080a7b612bf5bb8c5d69fe1893742229850012add1f169095597685882043 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x65f899e41a38724dc1b857ed114c9820affb462c0.000505299285936092 Ether
0xdd2ff59099b8c7ee8215791e545f3ebf171a3633e4183587a7f2cff8925bf437685881843 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xae015ccde814da988dbca7f09c10f7c25d6931c30.131889615683812686 Ether
0xdd2ff59099b8c7ee8215791e545f3ebf171a3633e4183587a7f2cff8925bf437685881843 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x65f899e41a38724dc1b857ed114c9820affb462c0.00006771055746071 Ether
0xf1c4513a911bfffb3669fe1e8ef69035056ec28bf46b26033fc90c587ac26343685881843 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x7e1dcf785f0353bf657c38ab7865c1f184efe2080.019947215468664634 Ether
0xf1c4513a911bfffb3669fe1e8ef69035056ec28bf46b26033fc90c587ac26343685881843 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x8c5fc43ad00cc53e11f61bece329ddc5e3ea09290.000009931180806097 Ether
0xc43baa0b69281bc5f1c241183167a131d33c80d4d2d98f2278b937dfe3ed7066685880843 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010xae015ccde814da988dbca7f09c10f7c25d6931c30.019520508633413779 Ether
0xc43baa0b69281bc5f1c241183167a131d33c80d4d2d98f2278b937dfe3ed7066685880843 days 9 hrs ago0xa1d2c7e6de2fa512f1fdf486ca17ab79b4dc5d010x65f899e41a38724dc1b857ed114c9820affb462c0.000018981891600637 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: HeroCrowdsale
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity 0.4.24;

// File: contracts/lib/openzeppelin-solidity/contracts/introspection/IERC165.sol

/**
 * @title IERC165
 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
 */
interface IERC165 {

  /**
   * @notice Query if a contract implements an interface
   * @param interfaceId The interface identifier, as specified in ERC-165
   * @dev Interface identification is specified in ERC-165. This function
   * uses less than 30,000 gas.
   */
  function supportsInterface(bytes4 interfaceId)
    external
    view
    returns (bool);
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/IERC721.sol

/**
 * @title ERC721 Non-Fungible Token Standard basic interface
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract IERC721 is IERC165 {

  event Transfer(
    address indexed from,
    address indexed to,
    uint256 indexed tokenId
  );
  event Approval(
    address indexed owner,
    address indexed approved,
    uint256 indexed tokenId
  );
  event ApprovalForAll(
    address indexed owner,
    address indexed operator,
    bool approved
  );

  function balanceOf(address owner) public view returns (uint256 balance);
  function ownerOf(uint256 tokenId) public view returns (address owner);

  function approve(address to, uint256 tokenId) public;
  function getApproved(uint256 tokenId)
    public view returns (address operator);

  function setApprovalForAll(address operator, bool _approved) public;
  function isApprovedForAll(address owner, address operator)
    public view returns (bool);

  function transferFrom(address from, address to, uint256 tokenId) public;
  function safeTransferFrom(address from, address to, uint256 tokenId)
    public;

  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes data
  )
    public;
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
contract IERC721Receiver {
  /**
   * @notice Handle the receipt of an NFT
   * @dev The ERC721 smart contract calls this function on the recipient
   * after a `safeTransfer`. This function MUST return the function selector,
   * otherwise the caller will revert the transaction. The selector to be
   * returned can be obtained as `this.onERC721Received.selector`. This
   * function MAY throw to revert and reject the transfer.
   * Note: the ERC721 contract address is always the message sender.
   * @param operator The address which called `safeTransferFrom` function
   * @param from The address which previously owned the token
   * @param tokenId The NFT identifier which is being transferred
   * @param data Additional data with no specified format
   * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
   */
  function onERC721Received(
    address operator,
    address from,
    uint256 tokenId,
    bytes data
  )
    public
    returns(bytes4);
}

// File: contracts/lib/openzeppelin-solidity/contracts/math/SafeMath.sol

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

  /**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts 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 Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a);
    uint256 c = a - b;

    return c;
  }

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

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/utils/Address.sol

/**
 * Utility library of inline functions on addresses
 */
library Address {

  /**
   * Returns whether the target address is a contract
   * @dev This function will return false if invoked during the constructor of a contract,
   * as the code is not actually created until after the constructor finishes.
   * @param account address of the account to check
   * @return whether the target address is a contract
   */
  function isContract(address account) internal view returns (bool) {
    uint256 size;
    // XXX Currently there is no better way to check if there is a contract in an address
    // than to check the size of the code at that address.
    // See https://ethereum.stackexchange.com/a/14016/36603
    // for more details about how this works.
    // TODO Check this again before the Serenity release, because all addresses will be
    // contracts then.
    // solium-disable-next-line security/no-inline-assembly
    assembly { size := extcodesize(account) }
    return size > 0;
  }

}

// File: contracts/lib/openzeppelin-solidity/contracts/introspection/ERC165.sol

/**
 * @title ERC165
 * @author Matt Condon (@shrugs)
 * @dev Implements ERC165 using a lookup table.
 */
contract ERC165 is IERC165 {

  bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
  /**
   * 0x01ffc9a7 ===
   *   bytes4(keccak256('supportsInterface(bytes4)'))
   */

  /**
   * @dev a mapping of interface id to whether or not it's supported
   */
  mapping(bytes4 => bool) internal _supportedInterfaces;

  /**
   * @dev A contract implementing SupportsInterfaceWithLookup
   * implement ERC165 itself
   */
  constructor()
    public
  {
    _registerInterface(_InterfaceId_ERC165);
  }

  /**
   * @dev implement supportsInterface(bytes4) using a lookup table
   */
  function supportsInterface(bytes4 interfaceId)
    external
    view
    returns (bool)
  {
    return _supportedInterfaces[interfaceId];
  }

  /**
   * @dev private method for registering an interface
   */
  function _registerInterface(bytes4 interfaceId)
    internal
  {
    require(interfaceId != 0xffffffff);
    _supportedInterfaces[interfaceId] = true;
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721 is ERC165, IERC721 {

  using SafeMath for uint256;
  using Address for address;

  // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
  // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
  bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

  // Mapping from token ID to owner
  mapping (uint256 => address) private _tokenOwner;

  // Mapping from token ID to approved address
  mapping (uint256 => address) private _tokenApprovals;

  // Mapping from owner to number of owned token
  mapping (address => uint256) private _ownedTokensCount;

  // Mapping from owner to operator approvals
  mapping (address => mapping (address => bool)) private _operatorApprovals;

  bytes4 private constant _InterfaceId_ERC721 = 0x80ac58cd;
  /*
   * 0x80ac58cd ===
   *   bytes4(keccak256('balanceOf(address)')) ^
   *   bytes4(keccak256('ownerOf(uint256)')) ^
   *   bytes4(keccak256('approve(address,uint256)')) ^
   *   bytes4(keccak256('getApproved(uint256)')) ^
   *   bytes4(keccak256('setApprovalForAll(address,bool)')) ^
   *   bytes4(keccak256('isApprovedForAll(address,address)')) ^
   *   bytes4(keccak256('transferFrom(address,address,uint256)')) ^
   *   bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
   *   bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
   */

  constructor()
    public
  {
    // register the supported interfaces to conform to ERC721 via ERC165
    _registerInterface(_InterfaceId_ERC721);
  }

  /**
   * @dev Gets the balance of the specified address
   * @param owner address to query the balance of
   * @return uint256 representing the amount owned by the passed address
   */
  function balanceOf(address owner) public view returns (uint256) {
    require(owner != address(0));
    return _ownedTokensCount[owner];
  }

  /**
   * @dev Gets the owner of the specified token ID
   * @param tokenId uint256 ID of the token to query the owner of
   * @return owner address currently marked as the owner of the given token ID
   */
  function ownerOf(uint256 tokenId) public view returns (address) {
    address owner = _tokenOwner[tokenId];
    require(owner != address(0));
    return owner;
  }

  /**
   * @dev Approves another address to transfer the given token ID
   * The zero address indicates there is no approved address.
   * There can only be one approved address per token at a given time.
   * Can only be called by the token owner or an approved operator.
   * @param to address to be approved for the given token ID
   * @param tokenId uint256 ID of the token to be approved
   */
  function approve(address to, uint256 tokenId) public {
    address owner = ownerOf(tokenId);
    require(to != owner);
    require(msg.sender == owner || isApprovedForAll(owner, msg.sender));

    _tokenApprovals[tokenId] = to;
    emit Approval(owner, to, tokenId);
  }

  /**
   * @dev Gets the approved address for a token ID, or zero if no address set
   * Reverts if the token ID does not exist.
   * @param tokenId uint256 ID of the token to query the approval of
   * @return address currently approved for the given token ID
   */
  function getApproved(uint256 tokenId) public view returns (address) {
    require(_exists(tokenId));
    return _tokenApprovals[tokenId];
  }

  /**
   * @dev Sets or unsets the approval of a given operator
   * An operator is allowed to transfer all tokens of the sender on their behalf
   * @param to operator address to set the approval
   * @param approved representing the status of the approval to be set
   */
  function setApprovalForAll(address to, bool approved) public {
    require(to != msg.sender);
    _operatorApprovals[msg.sender][to] = approved;
    emit ApprovalForAll(msg.sender, to, approved);
  }

  /**
   * @dev Tells whether an operator is approved by a given owner
   * @param owner owner address which you want to query the approval of
   * @param operator operator address which you want to query the approval of
   * @return bool whether the given operator is approved by the given owner
   */
  function isApprovedForAll(
    address owner,
    address operator
  )
    public
    view
    returns (bool)
  {
    return _operatorApprovals[owner][operator];
  }

  /**
   * @dev Transfers the ownership of a given token ID to another address
   * Usage of this method is discouraged, use `safeTransferFrom` whenever possible
   * Requires the msg sender to be the owner, approved, or operator
   * @param from current owner of the token
   * @param to address to receive the ownership of the given token ID
   * @param tokenId uint256 ID of the token to be transferred
  */
  function transferFrom(
    address from,
    address to,
    uint256 tokenId
  )
    public
  {
    require(_isApprovedOrOwner(msg.sender, tokenId));
    require(to != address(0));

    _clearApproval(from, tokenId);
    _removeTokenFrom(from, tokenId);
    _addTokenTo(to, tokenId);

    emit Transfer(from, to, tokenId);
  }

  /**
   * @dev Safely transfers the ownership of a given token ID to another address
   * If the target address is a contract, it must implement `onERC721Received`,
   * which is called upon a safe transfer, and return the magic value
   * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
   * the transfer is reverted.
   *
   * Requires the msg sender to be the owner, approved, or operator
   * @param from current owner of the token
   * @param to address to receive the ownership of the given token ID
   * @param tokenId uint256 ID of the token to be transferred
  */
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId
  )
    public
  {
    // solium-disable-next-line arg-overflow
    safeTransferFrom(from, to, tokenId, "");
  }

  /**
   * @dev Safely transfers the ownership of a given token ID to another address
   * If the target address is a contract, it must implement `onERC721Received`,
   * which is called upon a safe transfer, and return the magic value
   * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
   * the transfer is reverted.
   * Requires the msg sender to be the owner, approved, or operator
   * @param from current owner of the token
   * @param to address to receive the ownership of the given token ID
   * @param tokenId uint256 ID of the token to be transferred
   * @param _data bytes data to send along with a safe transfer check
   */
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes _data
  )
    public
  {
    transferFrom(from, to, tokenId);
    // solium-disable-next-line arg-overflow
    require(_checkAndCallSafeTransfer(from, to, tokenId, _data));
  }

  /**
   * @dev Returns whether the specified token exists
   * @param tokenId uint256 ID of the token to query the existence of
   * @return whether the token exists
   */
  function _exists(uint256 tokenId) internal view returns (bool) {
    address owner = _tokenOwner[tokenId];
    return owner != address(0);
  }

  /**
   * @dev Returns whether the given spender can transfer a given token ID
   * @param spender address of the spender to query
   * @param tokenId uint256 ID of the token to be transferred
   * @return bool whether the msg.sender is approved for the given token ID,
   *  is an operator of the owner, or is the owner of the token
   */
  function _isApprovedOrOwner(
    address spender,
    uint256 tokenId
  )
    internal
    view
    returns (bool)
  {
    address owner = ownerOf(tokenId);
    // Disable solium check because of
    // https://github.com/duaraghav8/Solium/issues/175
    // solium-disable-next-line operator-whitespace
    return (
      spender == owner ||
      getApproved(tokenId) == spender ||
      isApprovedForAll(owner, spender)
    );
  }

  /**
   * @dev Internal function to mint a new token
   * Reverts if the given token ID already exists
   * @param to The address that will own the minted token
   * @param tokenId uint256 ID of the token to be minted by the msg.sender
   */
  function _mint(address to, uint256 tokenId) internal {
    require(to != address(0));
    _addTokenTo(to, tokenId);
    emit Transfer(address(0), to, tokenId);
  }

  /**
   * @dev Internal function to burn a specific token
   * Reverts if the token does not exist
   * @param tokenId uint256 ID of the token being burned by the msg.sender
   */
  function _burn(address owner, uint256 tokenId) internal {
    _clearApproval(owner, tokenId);
    _removeTokenFrom(owner, tokenId);
    emit Transfer(owner, address(0), tokenId);
  }

  /**
   * @dev Internal function to clear current approval of a given token ID
   * Reverts if the given address is not indeed the owner of the token
   * @param owner owner of the token
   * @param tokenId uint256 ID of the token to be transferred
   */
  function _clearApproval(address owner, uint256 tokenId) internal {
    require(ownerOf(tokenId) == owner);
    if (_tokenApprovals[tokenId] != address(0)) {
      _tokenApprovals[tokenId] = address(0);
    }
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * @param to address representing the new owner of the given token ID
   * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
   */
  function _addTokenTo(address to, uint256 tokenId) internal {
    require(_tokenOwner[tokenId] == address(0));
    _tokenOwner[tokenId] = to;
    _ownedTokensCount[to] = _ownedTokensCount[to].add(1);
  }

  /**
   * @dev Internal function to remove a token ID from the list of a given address
   * @param from address representing the previous owner of the given token ID
   * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
   */
  function _removeTokenFrom(address from, uint256 tokenId) internal {
    require(ownerOf(tokenId) == from);
    _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
    _tokenOwner[tokenId] = address(0);
  }

  /**
   * @dev Internal function to invoke `onERC721Received` on a target address
   * The call is not executed if the target address is not a contract
   * @param from address representing the previous owner of the given token ID
   * @param to target address that will receive the tokens
   * @param tokenId uint256 ID of the token to be transferred
   * @param _data bytes optional data to send along with the call
   * @return whether the call correctly returned the expected magic value
   */
  function _checkAndCallSafeTransfer(
    address from,
    address to,
    uint256 tokenId,
    bytes _data
  )
    internal
    returns (bool)
  {
    if (!to.isContract()) {
      return true;
    }
    bytes4 retval = IERC721Receiver(to).onERC721Received(
      msg.sender, from, tokenId, _data);
    return (retval == _ERC721_RECEIVED);
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/IERC721Enumerable.sol

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract IERC721Enumerable is IERC721 {
  function totalSupply() public view returns (uint256);
  function tokenOfOwnerByIndex(
    address owner,
    uint256 index
  )
    public
    view
    returns (uint256 tokenId);

  function tokenByIndex(uint256 index) public view returns (uint256);
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/ERC721Enumerable.sol

contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
  // Mapping from owner to list of owned token IDs
  mapping(address => uint256[]) private _ownedTokens;

  // Mapping from token ID to index of the owner tokens list
  mapping(uint256 => uint256) private _ownedTokensIndex;

  // Array with all token ids, used for enumeration
  uint256[] private _allTokens;

  // Mapping from token id to position in the allTokens array
  mapping(uint256 => uint256) private _allTokensIndex;

  bytes4 private constant _InterfaceId_ERC721Enumerable = 0x780e9d63;
  /**
   * 0x780e9d63 ===
   *   bytes4(keccak256('totalSupply()')) ^
   *   bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
   *   bytes4(keccak256('tokenByIndex(uint256)'))
   */

  /**
   * @dev Constructor function
   */
  constructor() public {
    // register the supported interface to conform to ERC721 via ERC165
    _registerInterface(_InterfaceId_ERC721Enumerable);
  }

  /**
   * @dev Gets the token ID at a given index of the tokens list of the requested owner
   * @param owner address owning the tokens list to be accessed
   * @param index uint256 representing the index to be accessed of the requested tokens list
   * @return uint256 token ID at the given index of the tokens list owned by the requested address
   */
  function tokenOfOwnerByIndex(
    address owner,
    uint256 index
  )
    public
    view
    returns (uint256)
  {
    require(index < balanceOf(owner));
    return _ownedTokens[owner][index];
  }

  /**
   * @dev Gets the total amount of tokens stored by the contract
   * @return uint256 representing the total amount of tokens
   */
  function totalSupply() public view returns (uint256) {
    return _allTokens.length;
  }

  /**
   * @dev Gets the token ID at a given index of all the tokens in this contract
   * Reverts if the index is greater or equal to the total number of tokens
   * @param index uint256 representing the index to be accessed of the tokens list
   * @return uint256 token ID at the given index of the tokens list
   */
  function tokenByIndex(uint256 index) public view returns (uint256) {
    require(index < totalSupply());
    return _allTokens[index];
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * @param to address representing the new owner of the given token ID
   * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
   */
  function _addTokenTo(address to, uint256 tokenId) internal {
    super._addTokenTo(to, tokenId);
    uint256 length = _ownedTokens[to].length;
    _ownedTokens[to].push(tokenId);
    _ownedTokensIndex[tokenId] = length;
  }

  /**
   * @dev Internal function to remove a token ID from the list of a given address
   * @param from address representing the previous owner of the given token ID
   * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
   */
  function _removeTokenFrom(address from, uint256 tokenId) internal {
    super._removeTokenFrom(from, tokenId);

    // To prevent a gap in the array, we store the last token in the index of the token to delete, and
    // then delete the last slot.
    uint256 tokenIndex = _ownedTokensIndex[tokenId];
    uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
    uint256 lastToken = _ownedTokens[from][lastTokenIndex];

    _ownedTokens[from][tokenIndex] = lastToken;
    // This also deletes the contents at the last position of the array
    _ownedTokens[from].length--;

    // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to
    // be zero. Then we can make sure that we will remove tokenId from the ownedTokens list since we are first swapping
    // the lastToken to the first position, and then dropping the element placed in the last position of the list

    _ownedTokensIndex[tokenId] = 0;
    _ownedTokensIndex[lastToken] = tokenIndex;
  }

  /**
   * @dev Internal function to mint a new token
   * Reverts if the given token ID already exists
   * @param to address the beneficiary that will own the minted token
   * @param tokenId uint256 ID of the token to be minted by the msg.sender
   */
  function _mint(address to, uint256 tokenId) internal {
    super._mint(to, tokenId);

    _allTokensIndex[tokenId] = _allTokens.length;
    _allTokens.push(tokenId);
  }

  /**
   * @dev Internal function to burn a specific token
   * Reverts if the token does not exist
   * @param owner owner of the token to burn
   * @param tokenId uint256 ID of the token being burned by the msg.sender
   */
  function _burn(address owner, uint256 tokenId) internal {
    super._burn(owner, tokenId);

    // Reorg all tokens array
    uint256 tokenIndex = _allTokensIndex[tokenId];
    uint256 lastTokenIndex = _allTokens.length.sub(1);
    uint256 lastToken = _allTokens[lastTokenIndex];

    _allTokens[tokenIndex] = lastToken;
    _allTokens[lastTokenIndex] = 0;

    _allTokens.length--;
    _allTokensIndex[tokenId] = 0;
    _allTokensIndex[lastToken] = tokenIndex;
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/IERC721Metadata.sol

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract IERC721Metadata is IERC721 {
  function name() external view returns (string);
  function symbol() external view returns (string);
  function tokenURI(uint256 tokenId) public view returns (string);
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/ERC721Metadata.sol

contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
  // Token name
  string internal _name;

  // Token symbol
  string internal _symbol;

  // Optional mapping for token URIs
  mapping(uint256 => string) private _tokenURIs;

  bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
  /**
   * 0x5b5e139f ===
   *   bytes4(keccak256('name()')) ^
   *   bytes4(keccak256('symbol()')) ^
   *   bytes4(keccak256('tokenURI(uint256)'))
   */

  /**
   * @dev Constructor function
   */
  constructor(string name, string symbol) public {
    _name = name;
    _symbol = symbol;

    // register the supported interfaces to conform to ERC721 via ERC165
    _registerInterface(InterfaceId_ERC721Metadata);
  }

  /**
   * @dev Gets the token name
   * @return string representing the token name
   */
  function name() external view returns (string) {
    return _name;
  }

  /**
   * @dev Gets the token symbol
   * @return string representing the token symbol
   */
  function symbol() external view returns (string) {
    return _symbol;
  }

  /**
   * @dev Returns an URI for a given token ID
   * Throws if the token ID does not exist. May return an empty string.
   * @param tokenId uint256 ID of the token to query
   */
  function tokenURI(uint256 tokenId) public view returns (string) {
    require(_exists(tokenId));
    return _tokenURIs[tokenId];
  }

  /**
   * @dev Internal function to set the token URI for a given token
   * Reverts if the token ID does not exist
   * @param tokenId uint256 ID of the token to set its URI
   * @param uri string URI to assign
   */
  function _setTokenURI(uint256 tokenId, string uri) internal {
    require(_exists(tokenId));
    _tokenURIs[tokenId] = uri;
  }

  /**
   * @dev Internal function to burn a specific token
   * Reverts if the token does not exist
   * @param owner owner of the token to burn
   * @param tokenId uint256 ID of the token being burned by the msg.sender
   */
  function _burn(address owner, uint256 tokenId) internal {
    super._burn(owner, tokenId);

    // Clear metadata (if any)
    if (bytes(_tokenURIs[tokenId]).length != 0) {
      delete _tokenURIs[tokenId];
    }
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol

/**
 * @title Full ERC721 Token
 * This implementation includes all the required and some optional functionality of the ERC721 standard
 * Moreover, it includes approve all functionality using operator terminology
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
  constructor(string name, string symbol) ERC721Metadata(name, symbol)
    public
  {
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/access/Roles.sol

/**
 * @title Roles
 * @dev Library for managing addresses assigned to a Role.
 */
library Roles {
  struct Role {
    mapping (address => bool) bearer;
  }

  /**
   * @dev give an account access to this role
   */
  function add(Role storage role, address account) internal {
    require(account != address(0));
    role.bearer[account] = true;
  }

  /**
   * @dev remove an account's access to this role
   */
  function remove(Role storage role, address account) internal {
    require(account != address(0));
    role.bearer[account] = false;
  }

  /**
   * @dev check if an account has this role
   * @return bool
   */
  function has(Role storage role, address account)
    internal
    view
    returns (bool)
  {
    require(account != address(0));
    return role.bearer[account];
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/access/roles/MinterRole.sol

contract MinterRole {
  using Roles for Roles.Role;

  event MinterAdded(address indexed account);
  event MinterRemoved(address indexed account);

  Roles.Role private minters;

  constructor() public {
    minters.add(msg.sender);
  }

  modifier onlyMinter() {
    require(isMinter(msg.sender));
    _;
  }

  function isMinter(address account) public view returns (bool) {
    return minters.has(account);
  }

  function addMinter(address account) public onlyMinter {
    minters.add(account);
    emit MinterAdded(account);
  }

  function renounceMinter() public {
    minters.remove(msg.sender);
  }

  function _removeMinter(address account) internal {
    minters.remove(account);
    emit MinterRemoved(account);
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol

/**
 * @title ERC721Mintable
 * @dev ERC721 minting logic
 */
contract ERC721Mintable is ERC721Full, MinterRole {
  event MintingFinished();

  bool private _mintingFinished = false;

  modifier onlyBeforeMintingFinished() {
    require(!_mintingFinished);
    _;
  }

  /**
   * @return true if the minting is finished.
   */
  function mintingFinished() public view returns(bool) {
    return _mintingFinished;
  }

  /**
   * @dev Function to mint tokens
   * @param to The address that will receive the minted tokens.
   * @param tokenId The token id to mint.
   * @return A boolean that indicates if the operation was successful.
   */
  function mint(
    address to,
    uint256 tokenId
  )
    public
    onlyMinter
    onlyBeforeMintingFinished
    returns (bool)
  {
    _mint(to, tokenId);
    return true;
  }

  function mintWithTokenURI(
    address to,
    uint256 tokenId,
    string tokenURI
  )
    public
    onlyMinter
    onlyBeforeMintingFinished
    returns (bool)
  {
    mint(to, tokenId);
    _setTokenURI(tokenId, tokenURI);
    return true;
  }

  /**
   * @dev Function to stop minting new tokens.
   * @return True if the operation was successful.
   */
  function finishMinting()
    public
    onlyMinter
    onlyBeforeMintingFinished
    returns (bool)
  {
    _mintingFinished = true;
    emit MintingFinished();
    return true;
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/access/roles/PauserRole.sol

contract PauserRole {
  using Roles for Roles.Role;

  event PauserAdded(address indexed account);
  event PauserRemoved(address indexed account);

  Roles.Role private pausers;

  constructor() public {
    pausers.add(msg.sender);
  }

  modifier onlyPauser() {
    require(isPauser(msg.sender));
    _;
  }

  function isPauser(address account) public view returns (bool) {
    return pausers.has(account);
  }

  function addPauser(address account) public onlyPauser {
    pausers.add(account);
    emit PauserAdded(account);
  }

  function renouncePauser() public {
    pausers.remove(msg.sender);
  }

  function _removePauser(address account) internal {
    pausers.remove(account);
    emit PauserRemoved(account);
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/lifecycle/Pausable.sol

/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is PauserRole {
  event Paused();
  event Unpaused();

  bool private _paused = false;


  /**
   * @return true if the contract is paused, false otherwise.
   */
  function paused() public view returns(bool) {
    return _paused;
  }

  /**
   * @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() public onlyPauser whenNotPaused {
    _paused = true;
    emit Paused();
  }

  /**
   * @dev called by the owner to unpause, returns to normal state
   */
  function unpause() public onlyPauser whenPaused {
    _paused = false;
    emit Unpaused();
  }
}

// File: contracts/lib/openzeppelin-solidity/contracts/token/ERC721/ERC721Pausable.sol

/**
 * @title ERC721 Non-Fungible Pausable token
 * @dev ERC721 modified with pausable transfers.
 **/
contract ERC721Pausable is ERC721, Pausable {
  function approve(
    address to,
    uint256 tokenId
  )
    public
    whenNotPaused
  {
    super.approve(to, tokenId);
  }

  function setApprovalForAll(
    address to,
    bool approved
  )
    public
    whenNotPaused
  {
    super.setApprovalForAll(to, approved);
  }

  function transferFrom(
    address from,
    address to,
    uint256 tokenId
  )
    public
    whenNotPaused
  {
    super.transferFrom(from, to, tokenId);
  }
}

// File: contracts/HeroAsset.sol

contract HeroAsset is ERC721Mintable, ERC721Pausable {

    uint16 public constant HERO_TYPE_OFFSET = 10000;

    string public tokenURIPrefix = "https://www.mycryptoheroes.net/metadata/hero/";
    mapping(uint16 => uint16) private heroTypeToSupplyLimit;

    constructor() public ERC721Full("MyCryptoHeroes:Hero", "MCHH") {}

    function setSupplyLimit(uint16 _heroType, uint16 _supplyLimit) external onlyMinter {
        require(heroTypeToSupplyLimit[_heroType] == 0 || _supplyLimit < heroTypeToSupplyLimit[_heroType],
            "_supplyLimit is bigger");
        heroTypeToSupplyLimit[_heroType] = _supplyLimit;
    }

    function setTokenURIPrefix(string _tokenURIPrefix) external onlyMinter {
        tokenURIPrefix = _tokenURIPrefix;
    }

    function getSupplyLimit(uint16 _heroType) public view returns (uint16) {
        return heroTypeToSupplyLimit[_heroType];
    }

    function mintHeroAsset(address _owner, uint256 _tokenId) public onlyMinter {
        uint16 _heroType = uint16(_tokenId / HERO_TYPE_OFFSET);
        uint16 _heroTypeIndex = uint16(_tokenId % HERO_TYPE_OFFSET) - 1;
        require(_heroTypeIndex < heroTypeToSupplyLimit[_heroType], "supply over");
        _mint(_owner, _tokenId);
    }

    function tokenURI(uint256 tokenId) public view returns (string) {
        bytes32 tokenIdBytes;
        if (tokenId == 0) {
            tokenIdBytes = "0";
        } else {
            uint256 value = tokenId;
            while (value > 0) {
                tokenIdBytes = bytes32(uint256(tokenIdBytes) / (2 ** 8));
                tokenIdBytes |= bytes32(((value % 10) + 48) * 2 ** (8 * 31));
                value /= 10;
            }
        }

        bytes memory prefixBytes = bytes(tokenURIPrefix);
        bytes memory tokenURIBytes = new bytes(prefixBytes.length + tokenIdBytes.length);

        uint8 i;
        uint8 index = 0;
        
        for (i = 0; i < prefixBytes.length; i++) {
            tokenURIBytes[index] = prefixBytes[i];
            index++;
        }
        
        for (i = 0; i < tokenIdBytes.length; i++) {
            tokenURIBytes[index] = tokenIdBytes[i];
            index++;
        }
        
        return string(tokenURIBytes);
    }

}

// File: contracts/lib/openzeppelin-solidity/contracts/ownership/Ownable.sol

/**
 * @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 private _owner;


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


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

  /**
   * @return the address of the owner.
   */
  function owner() public view returns(address) {
    return _owner;
  }

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

  /**
   * @return true if `msg.sender` is the owner of the contract.
   */
  function isOwner() public view returns(bool) {
    return msg.sender == _owner;
  }

  /**
   * @dev Allows the current owner to relinquish control of the contract.
   * @notice Renouncing to ownership will leave the contract without an owner.
   * It will not be possible to call the functions with the `onlyOwner`
   * modifier anymore.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(_owner);
    _owner = address(0);
  }

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

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address newOwner) internal {
    require(newOwner != address(0));
    emit OwnershipTransferred(_owner, newOwner);
    _owner = newOwner;
  }
}

// File: contracts/access/roles/ReferrerRole.sol

contract ReferrerRole is Ownable {
    using Roles for Roles.Role;

    event ReferrerAdded(address indexed account);
    event ReferrerRemoved(address indexed account);

    Roles.Role private referrers;

    constructor() public {
        referrers.add(msg.sender);
    }

    modifier onlyReferrer() {
        require(isReferrer(msg.sender));
        _;
    }
    
    function isReferrer(address account) public view returns (bool) {
        return referrers.has(account);
    }

    function addReferrer(address account) public onlyOwner() {
        referrers.add(account);
        emit ReferrerAdded(account);
    }

    function removeReferrer(address account) public onlyOwner() {
        referrers.remove(account);
        emit ReferrerRemoved(account);
    }

}

// File: contracts/lib/openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol

/**
 * @title Helps contracts guard against reentrancy attacks.
 * @author Remco Bloemen <[email protected]π.com>, Eenae <[email protected]>
 * @dev If you mark a function `nonReentrant`, you should also
 * mark it `external`.
 */
contract ReentrancyGuard {

  /// @dev counter to allow mutex lock with only one SSTORE operation
  uint256 private _guardCounter = 1;

  /**
   * @dev Prevents a contract from calling itself, directly or indirectly.
   * If you mark a function `nonReentrant`, you should also
   * mark it `external`. Calling one `nonReentrant` function from
   * another is not supported. Instead, you can implement a
   * `private` function doing the actual work, and an `external`
   * wrapper marked as `nonReentrant`.
   */
  modifier nonReentrant() {
    _guardCounter += 1;
    uint256 localCounter = _guardCounter;
    _;
    require(localCounter == _guardCounter);
  }

}

// File: contracts/HeroCrowdsale.sol

contract HeroCrowdsale is ReferrerRole, Pausable, ReentrancyGuard {
    using SafeMath for uint256;

    struct HeroSale {
        uint128 highestPrice;
        uint128 previousPrice;
        uint128 priceIncreaseTo;
        uint64  since;
        uint64  until;
        uint64  previousSaleAt;
        uint16  lowestPriceRate;
        uint16  decreaseRate;
        uint16  supplyLimit;
        uint16  suppliedCounts;
        uint8   currency;
        bool    exists;
    }
    
    mapping(uint16 => HeroSale) public heroTypeToHeroSales;
    mapping(uint16 => uint256[]) public heroTypeIds;
    mapping(uint16 => mapping(address => bool)) public hasAirDropHero;

    HeroAsset public heroAsset;
    uint16 constant internal SUPPLY_LIMIT_MAX = 10000;
    uint256 internal ethBackRate;

    event AddSalesEvent(
        uint16 indexed heroType,
        uint128 startPrice,
        uint256 lowestPrice,
        uint256 becomeLowestAt
    );

    event SoldHeroEvent(
        uint16 indexed heroType,
        uint256 soldPrice,
        uint64  soldAt,
        uint256 priceIncreaseTo,
        uint256 lowestPrice,
        uint256 becomeLowestAt,
        address purchasedBy,
        address indexed referrer,
        uint8   currency
    );

    constructor() public {
        ethBackRate = 20;
    }

    function setHeroAssetAddress(address _heroAssetAddress) external onlyOwner() {
        heroAsset = HeroAsset(_heroAssetAddress);
    }

    function changeEthBackRate(uint256 _newEthBackRate) external onlyOwner() {
        ethBackRate = _newEthBackRate;
    }

    function withdrawEther() external onlyOwner() {
        owner().transfer(address(this).balance);
    }

    function addSales(
        uint16 _heroType,
        uint128 _startPrice,
        uint16 _lowestPriceRate,
        uint16 _decreaseRate,
        uint64 _since,
        uint64 _until,
        uint16 _supplyLimit,
        uint8  _currency
    ) external onlyOwner() {
        require(!heroTypeToHeroSales[_heroType].exists, "this heroType is already added sales");
        require(0 <= _lowestPriceRate && _lowestPriceRate <= 100, "lowestPriceRate should be between 0 and 100");
        require(1 <= _decreaseRate && _decreaseRate <= 100, "decreaseRate should be should be between 1 and 100");
        require(_until > _since, "until should be later than since");

        HeroSale memory _herosale = HeroSale({
            highestPrice: _startPrice,
            previousPrice: _startPrice,
            priceIncreaseTo: _startPrice,
            since:_since,
            until:_until,
            previousSaleAt: _since,
            lowestPriceRate: _lowestPriceRate,
            decreaseRate: _decreaseRate,
            supplyLimit:_supplyLimit,
            suppliedCounts: 0,
            currency: _currency,
            exists: true
        });

        heroTypeToHeroSales[_heroType] = _herosale;
        heroAsset.setSupplyLimit(_heroType, _supplyLimit);

        uint256 _lowestPrice = uint256(_startPrice).mul(_lowestPriceRate).div(100);
        uint256 _becomeLowestAt = uint256(86400).mul(uint256(100).sub(_lowestPriceRate)).div(_decreaseRate).add(_since);

        emit AddSalesEvent(
            _heroType,
            _startPrice,
            _lowestPrice,
            _becomeLowestAt
        );
    }

    function purchase(uint16 _heroType, address _referrer) external whenNotPaused() nonReentrant() payable {
    // solium-disable-next-line security/no-block-members
        return purchaseImpl(_heroType, uint64(block.timestamp), _referrer);
    }

    function airDrop(uint16 _heroType, address _referrer) external whenNotPaused() {
        HeroSale storage heroSales = heroTypeToHeroSales[_heroType];
        require(airDropHero(_heroType), "currency is not 2 (airdrop)");
        require(!hasAirDropHero[_heroType][msg.sender]);
        uint64 _at = uint64(block.timestamp);
        require(isOnSale(_heroType, _at), "out of sales period");

        createHero(_heroType, msg.sender);
        hasAirDropHero[_heroType][msg.sender] = true;
        heroSales.suppliedCounts++;
        heroSales.previousSaleAt = _at;
        address referrer;
        if (_referrer == msg.sender){
            referrer = address(0x0);
        } else {
            referrer = _referrer;
        }

        emit SoldHeroEvent(
            _heroType,
            1,
            _at,
            1,
            1,
            1,
            msg.sender,
            referrer,
            2
        );
    }

    function computeCurrentPrice(uint16 _heroType) external view returns (uint8, uint256){
        // solium-disable-next-line security/no-block-members
        return computeCurrentPriceImpl(_heroType, uint64(block.timestamp));
    }

    function canBePurchasedByETH(uint16 _heroType) internal view returns (bool){
        return (heroTypeToHeroSales[_heroType].currency == 0);
    }

    function airDropHero(uint16 _heroType) internal view returns (bool){
        return (heroTypeToHeroSales[_heroType].currency == 2);
    }

    function isOnSale(uint16 _heroType, uint64 _now) internal view returns (bool){
        HeroSale storage heroSales = heroTypeToHeroSales[_heroType];
        require(heroSales.exists, "not exist sales of this heroType");

        if (heroSales.since <= _now && _now <= heroSales.until) {
            return true;
        } else {
            return false;
        }
    }

    function computeCurrentPriceImpl(uint16 _heroType, uint64 _at) internal view returns (uint8, uint256) {
        HeroSale storage heroSales = heroTypeToHeroSales[_heroType];
        require(heroSales.exists, "not exist sales of this heroType");
        require(heroSales.previousSaleAt <= _at, "current timestamp should not be faster than previousSaleAt");

        uint256 _lowestPrice = uint256(heroSales.highestPrice).mul(heroSales.lowestPriceRate).div(100);
        uint256 _secondsPassed = uint256(_at).sub(heroSales.previousSaleAt);
        uint256 _decreasedPrice = uint256(heroSales.priceIncreaseTo).mul(_secondsPassed).mul(heroSales.decreaseRate).div(100).div(86400);
        uint256 currentPrice;

        if (uint256(heroSales.priceIncreaseTo).sub(_lowestPrice) > _decreasedPrice){
            currentPrice = uint256(heroSales.priceIncreaseTo).sub(_decreasedPrice);
        } else {
            currentPrice = _lowestPrice;
        }

        return (1, currentPrice);
    }

    function purchaseImpl(uint16 _heroType, uint64 _at, address _referrer)
        internal
    {
        HeroSale storage heroSales = heroTypeToHeroSales[_heroType];
        require(canBePurchasedByETH(_heroType), "currency is not 0 (eth)");
        require(isOnSale(_heroType, _at), "out of sales period");
        (, uint256 _price) = computeCurrentPriceImpl(_heroType, _at);
        require(msg.value >= _price, "value is less than the price");

        createHero(_heroType, msg.sender);
        if (msg.value > _price){
            msg.sender.transfer(msg.value.sub(_price));
        }
        address referrer;
        if (_referrer == msg.sender){
            referrer = address(0x0);
        } else {
            referrer = _referrer;
        }
        if ((referrer != address(0x0)) && isReferrer(referrer)) {
            referrer.transfer(_price.mul(ethBackRate).div(100));
        }
        heroSales.previousPrice = uint128(_price);
        heroSales.suppliedCounts++;
        heroSales.previousSaleAt = _at;
        if (heroSales.previousPrice > heroSales.highestPrice){
            heroSales.highestPrice = heroSales.previousPrice;
        }
        uint256 _priceIncreaseTo;
        uint256 _lowestPrice;
        uint256 _becomeLowestAt;
        if (heroSales.supplyLimit > heroSales.suppliedCounts){
            _priceIncreaseTo = SafeMath.add(_price, _price.div((uint256(heroSales.supplyLimit).sub(heroSales.suppliedCounts))));
            heroSales.priceIncreaseTo = uint128(_priceIncreaseTo);
            _lowestPrice = uint256(heroSales.lowestPriceRate).mul(heroSales.highestPrice).div(100);
            _becomeLowestAt = uint256(86400).mul(100).mul((_priceIncreaseTo.sub(_lowestPrice))).div(_priceIncreaseTo).div(heroSales.decreaseRate).add(_at);
        } else {
            _priceIncreaseTo = heroSales.previousPrice;
            heroSales.priceIncreaseTo = uint128(_priceIncreaseTo);
            _lowestPrice = heroSales.previousPrice;
            _becomeLowestAt = _at;
        }
        emit SoldHeroEvent(
            _heroType,
            _price,
            _at,
            _priceIncreaseTo,
            _lowestPrice,
            _becomeLowestAt,
            msg.sender,
            referrer,
            0
        );
    }

    function createHero(uint16 _heroType, address _owner) internal {
        require(heroTypeToHeroSales[_heroType].exists, "not exist sales of this heroType");
        require(heroTypeIds[_heroType].length < heroTypeToHeroSales[_heroType].supplyLimit, "Heroes cant be created more than supplyLimit");

        uint256 _heroId = uint256(_heroType).mul(SUPPLY_LIMIT_MAX).add(heroTypeIds[_heroType].length).add(1);
        heroTypeIds[_heroType].push(_heroId);
        heroAsset.mintHeroAsset(_owner, _heroId);
    }
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"_heroType","type":"uint16"},{"name":"_startPrice","type":"uint128"},{"name":"_lowestPriceRate","type":"uint16"},{"name":"_decreaseRate","type":"uint16"},{"name":"_since","type":"uint64"},{"name":"_until","type":"uint64"},{"name":"_supplyLimit","type":"uint16"},{"name":"_currency","type":"uint8"}],"name":"addSales","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"heroAsset","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint16"}],"name":"heroTypeToHeroSales","outputs":[{"name":"highestPrice","type":"uint128"},{"name":"previousPrice","type":"uint128"},{"name":"priceIncreaseTo","type":"uint128"},{"name":"since","type":"uint64"},{"name":"until","type":"uint64"},{"name":"previousSaleAt","type":"uint64"},{"name":"lowestPriceRate","type":"uint16"},{"name":"decreaseRate","type":"uint16"},{"name":"supplyLimit","type":"uint16"},{"name":"suppliedCounts","type":"uint16"},{"name":"currency","type":"uint8"},{"name":"exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_heroType","type":"uint16"},{"name":"_referrer","type":"address"}],"name":"purchase","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint16"},{"name":"","type":"uint256"}],"name":"heroTypeIds","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawEther","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"removeReferrer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_heroType","type":"uint16"},{"name":"_referrer","type":"address"}],"name":"airDrop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_heroAssetAddress","type":"address"}],"name":"setHeroAssetAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint16"},{"name":"","type":"address"}],"name":"hasAirDropHero","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newEthBackRate","type":"uint256"}],"name":"changeEthBackRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isReferrer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_heroType","type":"uint16"}],"name":"computeCurrentPrice","outputs":[{"name":"","type":"uint8"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addReferrer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"heroType","type":"uint16"},{"indexed":false,"name":"startPrice","type":"uint128"},{"indexed":false,"name":"lowestPrice","type":"uint256"},{"indexed":false,"name":"becomeLowestAt","type":"uint256"}],"name":"AddSalesEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"heroType","type":"uint16"},{"indexed":false,"name":"soldPrice","type":"uint256"},{"indexed":false,"name":"soldAt","type":"uint64"},{"indexed":false,"name":"priceIncreaseTo","type":"uint256"},{"indexed":false,"name":"lowestPrice","type":"uint256"},{"indexed":false,"name":"becomeLowestAt","type":"uint256"},{"indexed":false,"name":"purchasedBy","type":"address"},{"indexed":true,"name":"referrer","type":"address"},{"indexed":false,"name":"currency","type":"uint8"}],"name":"SoldHeroEvent","type":"event"},{"anonymous":false,"inputs":[],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"ReferrerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"ReferrerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","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
60806040526000600360006101000a81548160ff02191690831515021790555060016004553480156200003157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000096336001620000c864010000000002620024a5179091906401000000009004565b620000ba336002620000c864010000000002620024a5179091906401000000009004565b601460098190555062000163565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156200010557600080fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b612f5580620001736000396000f30060806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806304803c2a1461014357806316f38b63146101ef57806328aa48b414610246578063396c8228146103aa5780633f4ba83a146103ee57806346fbf68e146104055780635c975abb146104605780636980f4fb1461048f5780636ef8d66d146104de578063715018a6146104f55780637362377b1461050c5780637a00e2e31461052357806382dc1ec4146105665780638456cb59146105a95780638da5cb5b146105c05780638e2ed557146106175780638f32d59b14610668578063985df3a714610697578063b673ddb7146106da578063cdd9e4c614610743578063d64d696814610770578063e6d944a7146107cb578063f2fde38b1461081d578063fefa9bb114610860575b600080fd5b34801561014f57600080fd5b506101ed600480360381019080803561ffff16906020019092919080356fffffffffffffffffffffffffffffffff169060200190929190803561ffff169060200190929190803561ffff169060200190929190803567ffffffffffffffff169060200190929190803567ffffffffffffffff169060200190929190803561ffff169060200190929190803560ff1690602001909291905050506108a3565b005b3480156101fb57600080fd5b50610204611052565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025257600080fd5b50610275600480360381019080803561ffff169060200190929190505050611078565b604051808d6fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020018c6fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020018b6fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020018a67ffffffffffffffff1667ffffffffffffffff1681526020018967ffffffffffffffff1667ffffffffffffffff1681526020018867ffffffffffffffff1667ffffffffffffffff1681526020018761ffff1661ffff1681526020018661ffff1661ffff1681526020018561ffff1661ffff1681526020018461ffff1661ffff1681526020018360ff1660ff168152602001821515151581526020019c5050505050505050505050505060405180910390f35b6103ec600480360381019080803561ffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111ba565b005b3480156103fa57600080fd5b5061040361120e565b005b34801561041157600080fd5b50610446600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611286565b604051808215151515815260200191505060405180910390f35b34801561046c57600080fd5b506104756112a3565b604051808215151515815260200191505060405180910390f35b34801561049b57600080fd5b506104c8600480360381019080803561ffff169060200190929190803590602001909291905050506112ba565b6040518082815260200191505060405180910390f35b3480156104ea57600080fd5b506104f36112ea565b005b34801561050157600080fd5b5061050a611300565b005b34801561051857600080fd5b506105216113ba565b005b34801561052f57600080fd5b50610564600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611434565b005b34801561057257600080fd5b506105a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114a1565b005b3480156105b557600080fd5b506105be61150f565b005b3480156105cc57600080fd5b506105d5611588565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561062357600080fd5b50610666600480360381019080803561ffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b1565b005b34801561067457600080fd5b5061067d61194e565b604051808215151515815260200191505060405180910390f35b3480156106a357600080fd5b506106d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119a5565b005b3480156106e657600080fd5b50610729600480360381019080803561ffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119fc565b604051808215151515815260200191505060405180910390f35b34801561074f57600080fd5b5061076e60048036038101908080359060200190929190505050611a2b565b005b34801561077c57600080fd5b506107b1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a48565b604051808215151515815260200191505060405180910390f35b3480156107d757600080fd5b506107fa600480360381019080803561ffff169060200190929190505050611a65565b604051808360ff1660ff1681526020018281526020019250505060405180910390f35b34801561082957600080fd5b5061085e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a7b565b005b34801561086c57600080fd5b506108a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a9a565b005b6108ab612e5e565b6000806108b661194e565b15156108c157600080fd5b600560008c61ffff1661ffff16815260200190815260200160002060020160119054906101000a900460ff16151515610988576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f74686973206865726f5479706520697320616c7265616479206164646564207381526020017f616c65730000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8861ffff166000111580156109a2575060648961ffff1611155b1515610a3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b8152602001807f6c6f776573745072696365526174652073686f756c642062652062657477656581526020017f6e203020616e642031303000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8761ffff16600111158015610a56575060648861ffff1611155b1515610af0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f6465637265617365526174652073686f756c642062652073686f756c6420626581526020017f206265747765656e203120616e6420313030000000000000000000000000000081525060400191505060405180910390fd5b8667ffffffffffffffff168667ffffffffffffffff16111515610b7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f756e74696c2073686f756c64206265206c61746572207468616e2073696e636581525060200191505060405180910390fd5b610180604051908101604052808b6fffffffffffffffffffffffffffffffff1681526020018b6fffffffffffffffffffffffffffffffff1681526020018b6fffffffffffffffffffffffffffffffff1681526020018867ffffffffffffffff1681526020018767ffffffffffffffff1681526020018867ffffffffffffffff1681526020018a61ffff1681526020018961ffff1681526020018661ffff168152602001600061ffff1681526020018560ff16815260200160011515815250925082600560008d61ffff1661ffff16815260200190815260200160002060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060408201518160010160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060608201518160010160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060808201518160010160186101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060a08201518160020160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060c08201518160020160086101000a81548161ffff021916908361ffff16021790555060e082015181600201600a6101000a81548161ffff021916908361ffff16021790555061010082015181600201600c6101000a81548161ffff021916908361ffff16021790555061012082015181600201600e6101000a81548161ffff021916908361ffff1602179055506101408201518160020160106101000a81548160ff021916908360ff1602179055506101608201518160020160116101000a81548160ff021916908315150217905550905050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fa23f738c876040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff1681526020018261ffff1661ffff16815260200192505050600060405180830381600087803b158015610f1e57600080fd5b505af1158015610f32573d6000803e3d6000fd5b50505050610f726064610f648b61ffff168d6fffffffffffffffffffffffffffffffff16611b0790919063ffffffff16565b611b4590919063ffffffff16565b9150610fd38767ffffffffffffffff16610fc58a61ffff16610fb7610fa58e61ffff166064611b6f90919063ffffffff16565b62015180611b0790919063ffffffff16565b611b4590919063ffffffff16565b611b9090919063ffffffff16565b90508a61ffff167fbb9aad0aec529392a851fee029d68b1fe345568b44c44e3e4ea716375f4949528b848460405180846fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a25050505050505050505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60056020528060005260406000206000915090508060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16908060010160009054906101000a90046fffffffffffffffffffffffffffffffff16908060010160109054906101000a900467ffffffffffffffff16908060010160189054906101000a900467ffffffffffffffff16908060020160009054906101000a900467ffffffffffffffff16908060020160089054906101000a900461ffff169080600201600a9054906101000a900461ffff169080600201600c9054906101000a900461ffff169080600201600e9054906101000a900461ffff16908060020160109054906101000a900460ff16908060020160119054906101000a900460ff1690508c565b600360009054906101000a900460ff161515156111d657600080fd5b6000600160046000828254019250508190555060045490506111f9834284611bb1565b6004548114151561120957600080fd5b505050565b61121733611286565b151561122257600080fd5b600360009054906101000a900460ff16151561123d57600080fd5b6000600360006101000a81548160ff0219169083151502179055507fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693360405160405180910390a1565b600061129c82600261237790919063ffffffff16565b9050919050565b6000600360009054906101000a900460ff16905090565b6006602052816000526040600020818154811015156112d557fe5b90600052602060002001600091509150505481565b6112fe33600261240b90919063ffffffff16565b565b61130861194e565b151561131357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6113c261194e565b15156113cd57600080fd5b6113d5611588565b73ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611431573d6000803e3d6000fd5b50565b61143c61194e565b151561144757600080fd5b61145b81600161240b90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f68e673b5cfb652e620fba208d02d6b172a0dc242d4497d94a1f92bb5fa92bc3160405160405180910390a250565b6114aa33611286565b15156114b557600080fd5b6114c98160026124a590919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b61151833611286565b151561152357600080fd5b600360009054906101000a900460ff1615151561153f57600080fd5b6001600360006101000a81548160ff0219169083151502179055507f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75260405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806000600360009054906101000a900460ff161515156115d257600080fd5b600560008661ffff1661ffff16815260200190815260200160002092506115f88561253f565b151561166c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f63757272656e6379206973206e6f742032202861697264726f7029000000000081525060200191505060405180910390fd5b600760008661ffff1661ffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156116de57600080fd5b4291506116eb858361257a565b151561175f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f7574206f662073616c657320706572696f640000000000000000000000000081525060200191505060405180910390fd5b61176985336126a2565b6001600760008761ffff1661ffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555082600201600e81819054906101000a900461ffff168092919060010191906101000a81548161ffff021916908361ffff16021790555050818360020160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611879576000905061187d565b8390505b8073ffffffffffffffffffffffffffffffffffffffff168561ffff167f3db18ae119a752978a5fdd210c2d8457748cafadf61769dde052bb15edb62e7f6001856001806001336002604051808881526020018767ffffffffffffffff1667ffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200197505050505050505060405180910390a35050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6119ad61194e565b15156119b857600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b611a3361194e565b1515611a3e57600080fd5b8060098190555050565b6000611a5e82600161237790919063ffffffff16565b9050919050565b600080611a7283426129b8565b91509150915091565b611a8361194e565b1515611a8e57600080fd5b611a9781612d2a565b50565b611aa261194e565b1515611aad57600080fd5b611ac18160016124a590919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f51e6bb66cce1aac9478cbafcad3421bf2a600ce8ec3874296c671ab32c68ce9260405160405180910390a250565b6000806000841415611b1c5760009150611b3e565b8284029050828482811515611b2d57fe5b04141515611b3a57600080fd5b8091505b5092915050565b600080600083111515611b5757600080fd5b8284811515611b6257fe5b0490508091505092915050565b600080838311151515611b8157600080fd5b82840390508091505092915050565b6000808284019050838110151515611ba757600080fd5b8091505092915050565b600080600080600080600560008a61ffff1661ffff1681526020019081526020016000209550611be089612e24565b1515611c54576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f63757272656e6379206973206e6f74203020286574682900000000000000000081525060200191505060405180910390fd5b611c5e898961257a565b1515611cd2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f7574206f662073616c657320706572696f640000000000000000000000000081525060200191505060405180910390fd5b611cdc89896129b8565b955050843410151515611d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f76616c7565206973206c657373207468616e207468652070726963650000000081525060200191505060405180910390fd5b611d6189336126a2565b84341115611dc3573373ffffffffffffffffffffffffffffffffffffffff166108fc611d968734611b6f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611dc1573d6000803e3d6000fd5b505b3373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415611e005760009350611e04565b8693505b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611e465750611e4584611a48565b5b15611eba578373ffffffffffffffffffffffffffffffffffffffff166108fc611e8d6064611e7f6009548a611b0790919063ffffffff16565b611b4590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611eb8573d6000803e3d6000fd5b505b848660000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555085600201600e81819054906101000a900461ffff168092919060010191906101000a81548161ffff021916908361ffff16021790555050878660020160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055508560000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168660000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16111561201f578560000160109054906101000a90046fffffffffffffffffffffffffffffffff168660000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505b85600201600e9054906101000a900461ffff1661ffff1686600201600c9054906101000a900461ffff1661ffff1611156121f2576120ad856120a861209989600201600e9054906101000a900461ffff1661ffff168a600201600c9054906101000a900461ffff1661ffff16611b6f90919063ffffffff16565b88611b4590919063ffffffff16565b611b90565b9250828660010160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550612158606461214a8860000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168960020160089054906101000a900461ffff1661ffff16611b0790919063ffffffff16565b611b4590919063ffffffff16565b91506121eb8867ffffffffffffffff166121dd88600201600a9054906101000a900461ffff1661ffff166121cf876121c161219c898b611b6f90919063ffffffff16565b6121b3606462015180611b0790919063ffffffff16565b611b0790919063ffffffff16565b611b4590919063ffffffff16565b611b4590919063ffffffff16565b611b9090919063ffffffff16565b90506122a5565b8560000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169250828660010160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508560000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1691508767ffffffffffffffff1690505b8373ffffffffffffffffffffffffffffffffffffffff168961ffff167f3db18ae119a752978a5fdd210c2d8457748cafadf61769dde052bb15edb62e7f878b878787336000604051808881526020018767ffffffffffffffff1667ffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200197505050505050505060405180910390a3505050505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156123b457600080fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561244757600080fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156124e157600080fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60006002600560008461ffff1661ffff16815260200190815260200160002060020160109054906101000a900460ff1660ff16149050919050565b600080600560008561ffff1661ffff16815260200190815260200160002090508060020160119054906101000a900460ff161515612620576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6e6f742065786973742073616c6573206f662074686973206865726f5479706581525060200191505060405180910390fd5b8267ffffffffffffffff168160010160109054906101000a900467ffffffffffffffff1667ffffffffffffffff161115801561268857508060010160189054906101000a900467ffffffffffffffff1667ffffffffffffffff168367ffffffffffffffff1611155b15612696576001915061269b565b600091505b5092915050565b6000600560008461ffff1661ffff16815260200190815260200160002060020160119054906101000a900460ff161515612744576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6e6f742065786973742073616c6573206f662074686973206865726f5479706581525060200191505060405180910390fd5b600560008461ffff1661ffff168152602001908152602001600020600201600c9054906101000a900461ffff1661ffff16600660008561ffff1661ffff1681526020019081526020016000208054905010151561282f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001807f4865726f65732063616e742062652063726561746564206d6f7265207468616e81526020017f20737570706c794c696d6974000000000000000000000000000000000000000081525060400191505060405180910390fd5b61288f6001612881600660008761ffff1661ffff1681526020019081526020016000208054905061287361271061ffff168861ffff16611b0790919063ffffffff16565b611b9090919063ffffffff16565b611b9090919063ffffffff16565b9050600660008461ffff1661ffff168152602001908152602001600020819080600181540180825580915050906001820390600052602060002001600090919290919091505550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634d5b335d83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561299b57600080fd5b505af11580156129af573d6000803e3d6000fd5b50505050505050565b6000806000806000806000600560008a61ffff1661ffff16815260200190815260200160002094508460020160119054906101000a900460ff161515612a66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6e6f742065786973742073616c6573206f662074686973206865726f5479706581525060200191505060405180910390fd5b8767ffffffffffffffff168560020160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1611151515612b30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001807f63757272656e742074696d657374616d702073686f756c64206e6f742062652081526020017f666173746572207468616e2070726576696f757353616c65417400000000000081525060400191505060405180910390fd5b612b9e6064612b908760020160089054906101000a900461ffff1661ffff168860000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16611b0790919063ffffffff16565b611b4590919063ffffffff16565b9350612bdf8560020160009054906101000a900467ffffffffffffffff1667ffffffffffffffff168967ffffffffffffffff16611b6f90919063ffffffff16565b9250612c7662015180612c686064612c5a89600201600a9054906101000a900461ffff1661ffff16612c4c898c60010160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16611b0790919063ffffffff16565b611b0790919063ffffffff16565b611b4590919063ffffffff16565b611b4590919063ffffffff16565b915081612cbe858760010160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16611b6f90919063ffffffff16565b1115612d1057612d09828660010160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16611b6f90919063ffffffff16565b9050612d14565b8390505b6001818191509650965050505050509250929050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612d6657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600560008461ffff1661ffff16815260200190815260200160002060020160109054906101000a900460ff1660ff16149050919050565b6101806040519081016040528060006fffffffffffffffffffffffffffffffff16815260200160006fffffffffffffffffffffffffffffffff16815260200160006fffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600060ff16815260200160001515815250905600a165627a7a723058205b26bad645de44afffd20bdda8f495b1a0704e85a28212acd8704342297bee0e0029

   Swarm Source:
bzzr://5b26bad645de44afffd20bdda8f495b1a0704e85a28212acd8704342297bee0e

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.