ETH Price: $3,245.53 (+1.97%)
Gas: 1 Gwei

Token

BoxKey (BX)
 

Overview

Max Total Supply

22 BX

Holders

11

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
m1k3.eth
Balance
1 BX
0xa6518bee322af13ba71c471b3527416ed08ad2a4
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

NFT relayer and wallet made for ERC-20 and ERC-721 assets in gaming communities.

# Exchange Pair Price  24H Volume % Volume

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x1DE72298...31CB696a7
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ERC721ProductKey

Compiler Version
v0.5.7+commit.6da8b019

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2019-03-27
*/

pragma solidity ^0.5.7;

/**
 * @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);
}

/**
 * @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 memory data) public;
}

/**
 * @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 memory data) public returns (bytes4);
}

library Strings {
    function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
        if (_i == 0) {
            return "0";
        }
        uint j = _i;
        uint len;
        while (j != 0) {
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint k = len - 1;
        while (_i != 0) {
            bstr[k--] = byte(uint8(48 + _i % 10));
            _i /= 10;
        }
        return string(bstr);
    }
    
    function strConcat(string memory _a, string memory _b) internal pure returns (string memory _concatenatedString) {
        return strConcat(_a, _b, "", "", "");
    }
    
    function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory _concatenatedString) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        uint i = 0;
        for (i = 0; i < _ba.length; i++) {
            babcde[k++] = _ba[i];
        }
        for (i = 0; i < _bb.length; i++) {
            babcde[k++] = _bb[i];
        }
        for (i = 0; i < _bc.length; i++) {
            babcde[k++] = _bc[i];
        }
        for (i = 0; i < _bd.length; i++) {
            babcde[k++] = _bd[i];
        }
        for (i = 0; i < _be.length; i++) {
            babcde[k++] = _be[i];
        }
        return string(babcde);
    }
}
/**
 * @title SafeMath
 * @dev Unsigned math operations with safety checks that revert on error
 */
library SafeMath {
    /**
    * @dev Multiplies two unsigned integers, 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 unsigned integers truncating the quotient, reverts on division by zero.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 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 unsigned integers, 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 unsigned integers, 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 unsigned integers 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;
    }
}

/**
 * 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.
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }
}

/**
 * @title ERC165
 * @author Matt Condon (@shrugs)
 * @dev Implements ERC165 using a lookup table.
 */
contract ERC165 is IERC165 {
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
    /**
     * 0x01ffc9a7 ===
     *     bytes4(keccak256('supportsInterface(bytes4)'))
     */

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

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

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

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

/**
 * @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 _INTERFACE_ID_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(_INTERFACE_ID_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));

        _transferFrom(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 {
        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 memory _data) public {
        transferFrom(from, to, tokenId);
        require(_checkOnERC721Received(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);
        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
     */
    function _mint(address to, uint256 tokenId) internal {
        require(to != address(0));
        require(!_exists(tokenId));

        _tokenOwner[tokenId] = to;
        _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Internal function to burn a specific token
     * Reverts if the token does not exist
     * Deprecated, use _burn(uint256) instead.
     * @param owner owner of the token to burn
     * @param tokenId uint256 ID of the token being burned
     */
    function _burn(address owner, uint256 tokenId) internal {
        require(ownerOf(tokenId) == owner);

        _clearApproval(tokenId);

        _ownedTokensCount[owner] = _ownedTokensCount[owner].sub(1);
        _tokenOwner[tokenId] = address(0);

        emit Transfer(owner, address(0), 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
     */
    function _burn(uint256 tokenId) internal {
        _burn(ownerOf(tokenId), tokenId);
    }

    /**
     * @dev Internal function to transfer ownership of a given token ID to another address.
     * As opposed to transferFrom, this imposes no restrictions on msg.sender.
     * @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) internal {
        require(ownerOf(tokenId) == from);
        require(to != address(0));

        _clearApproval(tokenId);

        _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
        _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

        _tokenOwner[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @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 _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        internal returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }

        bytes4 retval = IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data);
        return (retval == _ERC721_RECEIVED);
    }

    /**
     * @dev Private function to clear current approval of a given token ID
     * @param tokenId uint256 ID of the token to be transferred
     */
    function _clearApproval(uint256 tokenId) private {
        if (_tokenApprovals[tokenId] != address(0)) {
            _tokenApprovals[tokenId] = address(0);
        }
    }
}

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
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);
}
/**
 * @title ERC-721 Non-Fungible Token with optional enumeration extension logic
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
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 _INTERFACE_ID_ERC721_ENUMERABLE = 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 ERC721Enumerable via ERC165
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @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 transfer ownership of a given token ID to another address.
     * As opposed to transferFrom, this imposes no restrictions on msg.sender.
     * @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) internal {
        super._transferFrom(from, to, tokenId);

        _removeTokenFromOwnerEnumeration(from, tokenId);

        _addTokenToOwnerEnumeration(to, tokenId);
    }

    /**
     * @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
     */
    function _mint(address to, uint256 tokenId) internal {
        super._mint(to, tokenId);

        _addTokenToOwnerEnumeration(to, tokenId);

        _addTokenToAllTokensEnumeration(tokenId);
    }

    /**
     * @dev Gets the list of token IDs of the requested owner
     * @param owner address owning the tokens
     * @return uint256[] List of token IDs owned by the requested address
     */
    function _tokensOfOwner(address owner) internal view returns (uint256[] storage) {
        return _ownedTokens[owner];
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @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 _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        _ownedTokensIndex[tokenId] = _ownedTokens[to].length;
        _ownedTokens[to].push(tokenId);
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the _ownedTokensIndex mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @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 _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

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

        // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by
        // lastTokenId, or just over the end of the array if the token was the last one).
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length.sub(1);
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        _allTokens.length--;
        _allTokensIndex[tokenId] = 0;
    }
}

/**
 * @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));
        require(!has(role, account));

        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));
        require(has(role, account));

        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];
    }
}

contract MinterRole {
    using Roles for Roles.Role;

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

    Roles.Role private _minters;

    constructor () internal {
        _addMinter(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 {
        _addMinter(account);
    }

    function renounceMinter() public {
        _removeMinter(msg.sender);
    }

    function _addMinter(address account) internal {
        _minters.add(account);
        emit MinterAdded(account);
    }

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

}

/**
 * @title Helps contracts guard against reentrancy attacks.
 * @author Remco Bloemen <remco@2π.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;

    constructor () internal {
        // The counter starts at one to prevent changing it from zero to a non-zero
        // value, which is a more expensive operation.
        _guardCounter = 1;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _guardCounter += 1;
        uint256 localCounter = _guardCounter;
        _;
        require(localCounter == _guardCounter);
    }
}

contract IERC721Metadata is IERC721 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

contract ProductInventory is MinterRole {
    using SafeMath for uint256;
    using Address for address;
    
    event ProductCreated(
        uint256 id,
        uint256 price,
        uint256 activationPrice,
        uint256 available,
        uint256 supply,
        uint256 interval,
        bool minterOnly
    );
    event ProductAvailabilityChanged(uint256 productId, uint256 available);
    event ProductPriceChanged(uint256 productId, uint256 price);

    // All product ids in existence
    uint256[] public allProductIds;

    // Map from product id to Product
    mapping (uint256 => Product) public products;

    struct Product {
        uint256 id;
        uint256 price;
        uint256 activationPrice;
        uint256 available;
        uint256 supply;
        uint256 sold;
        uint256 interval;
        bool minterOnly;
    }

    function _productExists(uint256 _productId) internal view returns (bool) {
        return products[_productId].id != 0;
    }

    function _createProduct(
        uint256 _productId,
        uint256 _price,
        uint256 _activationPrice,
        uint256 _initialAvailable,
        uint256 _supply,
        uint256 _interval,
        bool _minterOnly
    )
    internal
    {
        require(_productId != 0);
        require(!_productExists(_productId));
        require(_initialAvailable <= _supply);

        Product memory _product = Product({
            id: _productId,
            price: _price,
            activationPrice: _activationPrice,
            available: _initialAvailable,
            supply: _supply,
            sold: 0,
            interval: _interval,
            minterOnly: _minterOnly
        });

        products[_productId] = _product;
        allProductIds.push(_productId);

        emit ProductCreated(
            _product.id,
            _product.price,
            _product.activationPrice,
            _product.available,
            _product.supply,
            _product.interval,
            _product.minterOnly
        );
    }

    function _incrementAvailability(
        uint256 _productId,
        uint256 _increment)
        internal
    {
        require(_productExists(_productId));
        uint256 newAvailabilityLevel = products[_productId].available.add(_increment);
        //if supply isn't 0 (unlimited), we check if incrementing puts above supply
        if(products[_productId].supply != 0) {
            require(products[_productId].sold.add(newAvailabilityLevel) <= products[_productId].supply);
        }
        products[_productId].available = newAvailabilityLevel;
    }

    function _setPrice(uint256 _productId, uint256 _price) internal
    {
        require(_productExists(_productId));
        products[_productId].price = _price;
    }

    function _setMinterOnly(uint256 _productId, bool _isMinterOnly) internal
    {
        require(_productExists(_productId));
        products[_productId].minterOnly = _isMinterOnly;
    }

    function _purchaseProduct(uint256 _productId) internal {
        require(_productExists(_productId));
        require(products[_productId].available > 0);
        require(products[_productId].available.sub(1) >= 0);
        products[_productId].available = products[_productId].available.sub(1);
        products[_productId].sold = products[_productId].sold.add(1);
    }

    /*** public onlyMinter ***/

    /**
    * @notice Creates a Product
    * @param _productId - product id to use (immutable)
    * @param _price - price of product
    * @param _activationPrice - price of activation
    * @param _initialAvailable - the initial amount available for sale
    * @param _supply - total supply - `0` means unlimited (immutable)
    * @param _interval - interval - period of time, in seconds, users can subscribe 
    * for. If set to 0, it's not a subscription product (immutable)
    * @param _minterOnly - if true, purchase is only available to minter
    */
    function createProduct(
        uint256 _productId,
        uint256 _price,
        uint256 _activationPrice,
        uint256 _initialAvailable,
        uint256 _supply,
        uint256 _interval,
        bool _minterOnly
    )
    external
    onlyMinter
    {
        _createProduct(
            _productId,
            _price,
            _activationPrice,
            _initialAvailable,
            _supply,
            _interval,
            _minterOnly);
    }

    /**
    * @notice incrementAvailability - increments the 
    * @param _productId - product id
    * @param _increment - amount to increment
    */
    function incrementAvailability(
        uint256 _productId,
        uint256 _increment)
    external
    onlyMinter
    {
        _incrementAvailability(_productId, _increment);
        emit ProductAvailabilityChanged(_productId, products[_productId].available);
    }

    /**
    * @notice Sets the price of a product
    * @param _productId - the product id
    * @param _price - the product price
    */
    function setPrice(uint256 _productId, uint256 _price)
    external
    onlyMinter
    {
        _setPrice(_productId, _price);
        emit ProductPriceChanged(_productId, _price);
    }

    /**
    * @notice Sets the price of a product
    * @param _productId - the product id
    * @param _isMinterOnly - the product price
    */
    function setMinterOnly(uint256 _productId, bool _isMinterOnly)
    external
    onlyMinter
    {
        _setMinterOnly(_productId, _isMinterOnly);
    }

    /*** public onlyMinter ***/

    /**
    * @notice Total amount sold of a product
    * @param _productId - the product id
    */
    function totalSold(uint256 _productId) public view returns (uint256) {
        return products[_productId].sold;
    }

    /**
    * @notice Mintable permission of a product
    * @param _productId - the product id
    */
    function isMinterOnly(uint256 _productId) public view returns (bool) {
        return products[_productId].minterOnly;
    }

    /**
    * @notice Price of a product
    * @param _productId - the product id
    */
    function priceOf(uint256 _productId) public view returns (uint256) {
        return products[_productId].price;
    }

    /**
    * @notice Price of activation of a product
    * @param _productId - the product id
    */
    function priceOfActivation(uint256 _productId) public view returns (uint256) {
        return products[_productId].activationPrice;
    }

    /**
    * @notice Product info for a product
    * @param _productId - the product id
    */
    function productInfo(uint256 _productId)
    public
    view
    returns (uint256, uint256, uint256, uint256, uint256, bool)
    {
        return (
            products[_productId].price,
            products[_productId].activationPrice,
            products[_productId].available,
            products[_productId].supply,
            products[_productId].interval,
            products[_productId].minterOnly
        );
    }

  /**
  * @notice Get product ids
  */
    function getAllProductIds() public view returns (uint256[] memory) {
        return allProductIds;
    }
}

contract IERC721ProductKey is IERC721Enumerable, IERC721Metadata {
    function activate(uint256 _tokenId) public payable;
    function purchase(uint256 _productId, address _beneficiary) public payable returns (uint256);
    function setKeyAttributes(uint256 _keyId, uint256 _attributes) public;
    function keyInfo(uint256 _keyId) external view returns (uint256, uint256, uint256, uint256);
    function isKeyActive(uint256 _keyId) public view returns (bool);
    event KeyIssued(
        address indexed owner,
        address indexed purchaser,
        uint256 keyId,
        uint256 productId,
        uint256 attributes,
        uint256 issuedTime,
        uint256 expirationTime
    );
    event KeyActivated(
        address indexed owner,
        address indexed activator,
        uint256 keyId,
        uint256 productId,
        uint256 attributes,
        uint256 issuedTime,
        uint256 expirationTime
    );
}

contract ERC721ProductKey is IERC721ProductKey, ERC721Enumerable, ReentrancyGuard, ProductInventory {
    using SafeMath for uint256;
    using Address for address;

    // Token name
    string private _name;
    // Token symbol
    string private _symbol;
    // Base metadata URI symbol
    string private _baseMetadataURI;
    // Withdrawal wallet
    address payable private _withdrawalWallet;

    event KeyIssued(
        address indexed owner,
        address indexed purchaser,
        uint256 keyId,
        uint256 productId,
        uint256 attributes,
        uint256 issuedTime,
        uint256 expirationTime
    );

    event KeyActivated(
        address indexed owner,
        address indexed activator,
        uint256 keyId,
        uint256 productId,
        uint256 attributes,
        uint256 issuedTime,
        uint256 expirationTime
    );

    struct ProductKey {
        uint256 productId;
        uint256 attributes;
        uint256 issuedTime;
        uint256 expirationTime;
    }
    
    // Map from keyid to ProductKey
    mapping (uint256 => ProductKey) public productKeys;

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

    /**
     * @dev Constructor function
     */
    constructor (string memory name, string memory symbol, string memory baseURI, address payable withdrawalWallet) public {
        _name = name;
        _symbol = symbol;
        _baseMetadataURI = baseURI;
        _withdrawalWallet = withdrawalWallet;
        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
    }

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

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

    /**
     * @return the address where funds are collected.
     */
    function withdrawalWallet() public view returns (address payable) {
        return _withdrawalWallet;
    }

    /**
     * @notice Sets a Base URI to be used for token URI
     * @param baseURI string of the base uri to set
     */
    function setTokenMetadataBaseURI(string calldata baseURI) external onlyMinter {
        _baseMetadataURI = baseURI;
    }

    /**
     * @notice Returns a URI for a given 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) external view returns (string memory) {
        require(_exists(tokenId));
        return Strings.strConcat(
            _baseMetadataURI,
            Strings.uint2str(tokenId));
    }
    
    /**
     * @notice activates access key
     * Throws if not approved or owner or key already active
     * @param _keyId uint256 ID of the key to activate
     */
    function _activate(uint256 _keyId) internal {
        require(_isApprovedOrOwner(msg.sender, _keyId));
        require(!isKeyActive(_keyId));
        require(productKeys[_keyId].expirationTime == 0);
        uint256 productId = productKeys[_keyId].productId;
        //set expiration time which activates the productkey
        productKeys[_keyId].expirationTime = now.add(products[productId].interval);
        //emit key activated event
        emit KeyActivated(
            ownerOf(_keyId),
            msg.sender,
            _keyId,
            productId,
            productKeys[_keyId].attributes,
            productKeys[_keyId].issuedTime,
            productKeys[_keyId].expirationTime
        );
    }

    function _createKey(
        uint256 _productId,
        address _beneficiary
    )
    internal
    returns (uint)
    {
        ProductKey memory _productKey = ProductKey({
            productId: _productId,
            attributes: 0,
            issuedTime: now, 
            expirationTime: 0
        });

        uint256 newKeyId = totalSupply();
            
        productKeys[newKeyId] = _productKey;
        emit KeyIssued(
            _beneficiary,
            msg.sender,
            newKeyId,
            _productKey.productId,
            _productKey.attributes,
            _productKey.issuedTime,
            _productKey.expirationTime);
        _mint(_beneficiary, newKeyId);
        return newKeyId;
    }

    function _setKeyAttributes(uint256 _keyId, uint256 _attributes) internal
    {
        productKeys[_keyId].attributes = _attributes;
    }

    function _purchase(
        uint256 _productId,
        address _beneficiary)
    internal returns (uint)
    {
        _purchaseProduct(_productId);
        return _createKey(
            _productId,
            _beneficiary
        );
    }

    /** only minter **/

    function withdrawBalance() external onlyMinter {
        _withdrawalWallet.transfer(address(this).balance);
    }

    function minterOnlyPurchase(
        uint256 _productId,
        address _beneficiary
    )
    external
    onlyMinter
    returns (uint256)
    {
        return _purchase(
            _productId,
            _beneficiary
        );
    }

    function setKeyAttributes(
        uint256 _keyId,
        uint256 _attributes
    )
    public
    onlyMinter
    {
        return _setKeyAttributes(
            _keyId,
            _attributes
        );
    }

    /** anyone **/

    /**
    * @notice Get if productkey is active
    * @param _keyId the id of key
    */
    function isKeyActive(uint256 _keyId) public view returns (bool) {
        return productKeys[_keyId].expirationTime > now || products[productKeys[_keyId].productId].interval == 0;
    }

    /**
    * @notice Get a ProductKey's info
    * @param _keyId key id
    */
    function keyInfo(uint256 _keyId)
    external view returns (uint256, uint256, uint256, uint256)
    {
        return (productKeys[_keyId].productId,
            productKeys[_keyId].attributes,
            productKeys[_keyId].issuedTime,
            productKeys[_keyId].expirationTime
        );
    }

    /**
    * @notice purchase a product
    * @param _productId - product id to purchase
    * @param _beneficiary - the token receiving address
    */
    function purchase(
        uint256 _productId,
        address _beneficiary
    )
    public
    payable
    returns (uint256)
    {
        require(_productId != 0);
        require(_beneficiary != address(0));
        // No excess
        require(msg.value == priceOf(_productId));
        require(!isMinterOnly(_productId));
        return _purchase(
            _productId,
            _beneficiary
        );
    }

    /**
    * @notice activates token
    */
    function activate(
        uint256 _tokenId
    )
    public
    payable
    {
        require(ownerOf(_tokenId) != address(0));
        // no excess
        require(msg.value == priceOfActivation(_tokenId));
        _activate(_tokenId);
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"baseURI","type":"string"}],"name":"setTokenMetadataBaseURI","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_productId","type":"uint256"}],"name":"priceOfActivation","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"withdrawalWallet","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_productId","type":"uint256"}],"name":"isMinterOnly","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_keyId","type":"uint256"},{"name":"_attributes","type":"uint256"}],"name":"setKeyAttributes","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAllProductIds","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"productKeys","outputs":[{"name":"productId","type":"uint256"},{"name":"attributes","type":"uint256"},{"name":"issuedTime","type":"uint256"},{"name":"expirationTime","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"products","outputs":[{"name":"id","type":"uint256"},{"name":"price","type":"uint256"},{"name":"activationPrice","type":"uint256"},{"name":"available","type":"uint256"},{"name":"supply","type":"uint256"},{"name":"sold","type":"uint256"},{"name":"interval","type":"uint256"},{"name":"minterOnly","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_productId","type":"uint256"}],"name":"totalSold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_productId","type":"uint256"},{"name":"_isMinterOnly","type":"bool"}],"name":"setMinterOnly","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_productId","type":"uint256"},{"name":"_price","type":"uint256"},{"name":"_activationPrice","type":"uint256"},{"name":"_initialAvailable","type":"uint256"},{"name":"_supply","type":"uint256"},{"name":"_interval","type":"uint256"},{"name":"_minterOnly","type":"bool"}],"name":"createProduct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_productId","type":"uint256"},{"name":"_beneficiary","type":"address"}],"name":"minterOnlyPurchase","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isMinter","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_productId","type":"uint256"},{"name":"_beneficiary","type":"address"}],"name":"purchase","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"activate","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_productId","type":"uint256"}],"name":"priceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_productId","type":"uint256"}],"name":"productInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_keyId","type":"uint256"}],"name":"keyInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_productId","type":"uint256"},{"name":"_increment","type":"uint256"}],"name":"incrementAvailability","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"allProductIds","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_keyId","type":"uint256"}],"name":"isKeyActive","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_productId","type":"uint256"},{"name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"name","type":"string"},{"name":"symbol","type":"string"},{"name":"baseURI","type":"string"},{"name":"withdrawalWallet","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"purchaser","type":"address"},{"indexed":false,"name":"keyId","type":"uint256"},{"indexed":false,"name":"productId","type":"uint256"},{"indexed":false,"name":"attributes","type":"uint256"},{"indexed":false,"name":"issuedTime","type":"uint256"},{"indexed":false,"name":"expirationTime","type":"uint256"}],"name":"KeyIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"activator","type":"address"},{"indexed":false,"name":"keyId","type":"uint256"},{"indexed":false,"name":"productId","type":"uint256"},{"indexed":false,"name":"attributes","type":"uint256"},{"indexed":false,"name":"issuedTime","type":"uint256"},{"indexed":false,"name":"expirationTime","type":"uint256"}],"name":"KeyActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint256"},{"indexed":false,"name":"price","type":"uint256"},{"indexed":false,"name":"activationPrice","type":"uint256"},{"indexed":false,"name":"available","type":"uint256"},{"indexed":false,"name":"supply","type":"uint256"},{"indexed":false,"name":"interval","type":"uint256"},{"indexed":false,"name":"minterOnly","type":"bool"}],"name":"ProductCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"productId","type":"uint256"},{"indexed":false,"name":"available","type":"uint256"}],"name":"ProductAvailabilityChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"productId","type":"uint256"},{"indexed":false,"name":"price","type":"uint256"}],"name":"ProductPriceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":true,"name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"approved","type":"address"},{"indexed":true,"name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"operator","type":"address"},{"indexed":false,"name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}]

60806040523480156200001157600080fd5b5060405162002a0238038062002a02833981018060405260808110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b820160208101848111156200006457600080fd5b81516401000000008111828201871017156200007f57600080fd5b505092919060200180516401000000008111156200009c57600080fd5b82016020810184811115620000b057600080fd5b8151640100000000811182820187101715620000cb57600080fd5b50509291906020018051640100000000811115620000e857600080fd5b82016020810184811115620000fc57600080fd5b81516401000000008111828201871017156200011757600080fd5b5050602091820151909350915062000155907f01ffc9a7000000000000000000000000000000000000000000000000000000009062000235811b901c565b6200016d6380ac58cd60e01b6200023560201b60201c565b6200018563780e9d6360e01b6200023560201b60201c565b60016009556200019c33620002a2602090811b901c565b8351620001b190600d90602087019062000380565b508251620001c790600e90602086019062000380565b508151620001dd90600f90602085019062000380565b50601080546001600160a01b0319166001600160a01b0383161790556200022b7f5b5e139f0000000000000000000000000000000000000000000000000000000062000235602090811b901c565b5050505062000425565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156200026557600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b620002bd81600a620002f460201b62001eaa1790919060201c565b6040516001600160a01b038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b6001600160a01b0381166200030857600080fd5b6200031a82826200034a60201b60201c565b156200032557600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b60006001600160a01b0382166200036057600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003c357805160ff1916838001178555620003f3565b82800160010185558215620003f3579182015b82811115620003f3578251825591602001919060010190620003d6565b506200040192915062000405565b5090565b6200042291905b808211156200040157600081556001016200040c565b90565b6125cd80620004356000396000f3fe6080604052600436106102465760003560e01c806393b2467e11610139578063b260c42a116100b6578063c72c0c481161007a578063c72c0c4814610ad7578063c87b56dd14610b07578063dde1bbcf14610b31578063e4375d2214610b5b578063e985e9c514610b85578063f7d9757714610bc057610246565b8063b260c42a14610934578063b88d4fde14610951578063b9186d7d14610a24578063bb119f6e14610a4e578063c62f9c7f14610aad57610246565b8063a09ab765116100fd578063a09ab76514610811578063a22cb46514610861578063a510f70a1461089c578063aa271e1a146108d5578063ae77c2371461090857610246565b806393b2467e1461075857806395d89b4114610782578063983b2d561461079757806398650275146107ca5780639f36bea2146107df57610246565b80634a7d80b3116101c75780636352211e1161018b5780636352211e146105d9578063663c01af146106035780636b1023dd1461066857806370a08231146106b85780637acc0b20146106eb57610246565b80634a7d80b31461052b5780634f6ccce71461054057806356ffc7f11461056a5780635e8ef7fc146105945780635fd8c710146105c457610246565b80631e20363a1161020e5780631e20363a146103c5578063203dc56e1461044257806323b872dd1461046c5780632f745c59146104af57806342842e0e146104e857610246565b806301ffc9a71461024b57806306fdde0314610293578063081812fc1461031d578063095ea7b31461036357806318160ddd1461039e575b600080fd5b34801561025757600080fd5b5061027f6004803603602081101561026e57600080fd5b50356001600160e01b031916610bf0565b604080519115158252519081900360200190f35b34801561029f57600080fd5b506102a8610c13565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e25781810151838201526020016102ca565b50505050905090810190601f16801561030f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561032957600080fd5b506103476004803603602081101561034057600080fd5b5035610caa565b604080516001600160a01b039092168252519081900360200190f35b34801561036f57600080fd5b5061039c6004803603604081101561038657600080fd5b506001600160a01b038135169060200135610cda565b005b3480156103aa57600080fd5b506103b3610d87565b60408051918252519081900360200190f35b3480156103d157600080fd5b5061039c600480360360208110156103e857600080fd5b81019060208101813564010000000081111561040357600080fd5b82018360208201111561041557600080fd5b8035906020019184600183028401116401000000008311171561043757600080fd5b509092509050610d8d565b34801561044e57600080fd5b506103b36004803603602081101561046557600080fd5b5035610db0565b34801561047857600080fd5b5061039c6004803603606081101561048f57600080fd5b506001600160a01b03813581169160208101359091169060400135610dc5565b3480156104bb57600080fd5b506103b3600480360360408110156104d257600080fd5b506001600160a01b038135169060200135610de3565b3480156104f457600080fd5b5061039c6004803603606081101561050b57600080fd5b506001600160a01b03813581169160208101359091169060400135610e30565b34801561053757600080fd5b50610347610e4b565b34801561054c57600080fd5b506103b36004803603602081101561056357600080fd5b5035610e5a565b34801561057657600080fd5b5061027f6004803603602081101561058d57600080fd5b5035610e8e565b3480156105a057600080fd5b5061039c600480360360408110156105b757600080fd5b5080359060200135610ea6565b3480156105d057600080fd5b5061039c610ec6565b3480156105e557600080fd5b50610347600480360360208110156105fc57600080fd5b5035610f15565b34801561060f57600080fd5b50610618610f3d565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561065457818101518382015260200161063c565b505050509050019250505060405180910390f35b34801561067457600080fd5b506106926004803603602081101561068b57600080fd5b5035610f94565b604080519485526020850193909352838301919091526060830152519081900360800190f35b3480156106c457600080fd5b506103b3600480360360208110156106db57600080fd5b50356001600160a01b0316610fbb565b3480156106f757600080fd5b506107156004803603602081101561070e57600080fd5b5035610fec565b604080519889526020890197909752878701959095526060870193909352608086019190915260a085015260c0840152151560e083015251908190036101000190f35b34801561076457600080fd5b506103b36004803603602081101561077b57600080fd5b5035611032565b34801561078e57600080fd5b506102a8611047565b3480156107a357600080fd5b5061039c600480360360208110156107ba57600080fd5b50356001600160a01b03166110a8565b3480156107d657600080fd5b5061039c6110c3565b3480156107eb57600080fd5b5061039c6004803603604081101561080257600080fd5b508035906020013515156110ce565b34801561081d57600080fd5b5061039c600480360360e081101561083457600080fd5b5080359060208101359060408101359060608101359060808101359060a08101359060c0013515156110ea565b34801561086d57600080fd5b5061039c6004803603604081101561088457600080fd5b506001600160a01b0381351690602001351515611114565b3480156108a857600080fd5b506103b3600480360360408110156108bf57600080fd5b50803590602001356001600160a01b0316611198565b3480156108e157600080fd5b5061027f600480360360208110156108f857600080fd5b50356001600160a01b03166111bd565b6103b36004803603604081101561091e57600080fd5b50803590602001356001600160a01b03166111d0565b61039c6004803603602081101561094a57600080fd5b5035611216565b34801561095d57600080fd5b5061039c6004803603608081101561097457600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156109af57600080fd5b8201836020820111156109c157600080fd5b803590602001918460018302840111640100000000831117156109e357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b348015610a3057600080fd5b506103b360048036036020811015610a4757600080fd5b5035611278565b348015610a5a57600080fd5b50610a7860048036036020811015610a7157600080fd5b503561128d565b6040805196875260208701959095528585019390935260608501919091526080840152151560a0830152519081900360c00190f35b348015610ab957600080fd5b5061069260048036036020811015610ad057600080fd5b50356112ca565b348015610ae357600080fd5b5061039c60048036036040811015610afa57600080fd5b50803590602001356112f2565b348015610b1357600080fd5b506102a860048036036020811015610b2a57600080fd5b503561135e565b348015610b3d57600080fd5b506103b360048036036020811015610b5457600080fd5b5035611412565b348015610b6757600080fd5b5061027f60048036036020811015610b7e57600080fd5b5035611430565b348015610b9157600080fd5b5061027f60048036036040811015610ba857600080fd5b506001600160a01b038135811691602001351661146e565b348015610bcc57600080fd5b5061039c60048036036040811015610be357600080fd5b508035906020013561149c565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b600d8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9f5780601f10610c7457610100808354040283529160200191610c9f565b820191906000526020600020905b815481529060010190602001808311610c8257829003601f168201915b505050505090505b90565b6000610cb5826114f7565b610cbe57600080fd5b506000908152600260205260409020546001600160a01b031690565b6000610ce582610f15565b9050806001600160a01b0316836001600160a01b03161415610d0657600080fd5b336001600160a01b0382161480610d225750610d22813361146e565b610d2b57600080fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60075490565b610d96336111bd565b610d9f57600080fd5b610dab600f8383612476565b505050565b6000908152600c602052604090206002015490565b610dcf3382611514565b610dd857600080fd5b610dab838383611573565b6000610dee83610fbb565b8210610df957600080fd5b6001600160a01b0383166000908152600560205260409020805483908110610e1d57fe5b9060005260206000200154905092915050565b610dab83838360405180602001604052806000815250611252565b6010546001600160a01b031690565b6000610e64610d87565b8210610e6f57600080fd5b60078281548110610e7c57fe5b90600052602060002001549050919050565b6000908152600c602052604090206007015460ff1690565b610eaf336111bd565b610eb857600080fd5b610ec28282611592565b5050565b610ecf336111bd565b610ed857600080fd5b6010546040516001600160a01b0390911690303180156108fc02916000818181858888f19350505050158015610f12573d6000803e3d6000fd5b50565b6000818152600160205260408120546001600160a01b031680610f3757600080fd5b92915050565b6060600b805480602002602001604051908101604052809291908181526020018280548015610c9f57602002820191906000526020600020905b815481526020019060010190808311610f77575050505050905090565b60116020526000908152604090208054600182015460028301546003909301549192909184565b60006001600160a01b038216610fd057600080fd5b506001600160a01b031660009081526003602052604090205490565b600c602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015495969495939492939192909160ff1688565b6000908152600c602052604090206005015490565b600e8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9f5780601f10610c7457610100808354040283529160200191610c9f565b6110b1336111bd565b6110ba57600080fd5b610f12816115a7565b6110cc336115ef565b565b6110d7336111bd565b6110e057600080fd5b610ec28282611637565b6110f3336111bd565b6110fc57600080fd5b61110b8787878787878761166c565b50505050505050565b6001600160a01b03821633141561112a57600080fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b60006111a3336111bd565b6111ac57600080fd5b6111b68383611817565b9392505050565b6000610f37600a8363ffffffff61182c16565b6000826111dc57600080fd5b6001600160a01b0382166111ef57600080fd5b6111f883611278565b341461120357600080fd5b61120c83610e8e565b156111ac57600080fd5b600061122182610f15565b6001600160a01b0316141561123557600080fd5b61123e81610db0565b341461124957600080fd5b610f1281611861565b61125d848484610dc5565b6112698484848461196f565b61127257600080fd5b50505050565b6000908152600c602052604090206001015490565b6000908152600c6020526040902060018101546002820154600383015460048401546006850154600790950154939592949193909260ff90911690565b6000908152601160205260409020805460018201546002830154600390930154919390929190565b6112fb336111bd565b61130457600080fd5b61130e8282611aa8565b6000828152600c60209081526040918290206003015482518581529182015281517f0efef8c0c9349a65e00e160f2f84c8eb54571014c399fb86e9d09ce10b7f7047929181900390910190a15050565b6060611369826114f7565b61137257600080fd5b600f8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152610f3793909290918301828280156113ff5780601f106113d4576101008083540402835291602001916113ff565b820191906000526020600020905b8154815290600101906020018083116113e257829003601f168201915b505050505061140d84611b43565b611c07565b600b818154811061141f57fe5b600091825260209091200154905081565b600081815260116020526040812060030154421080610f375750506000908152601160209081526040808320548352600c9091529020600601541590565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6114a5336111bd565b6114ae57600080fd5b6114b88282611c43565b604080518381526020810183905281517fd63cc1ed2f6abbff2bdc8aeb9f139df953e98c6aa57ca5bfe8e1876be9e890ec929181900390910190a15050565b6000908152600160205260409020546001600160a01b0316151590565b60008061152083610f15565b9050806001600160a01b0316846001600160a01b0316148061155b5750836001600160a01b031661155084610caa565b6001600160a01b0316145b8061156b575061156b818561146e565b949350505050565b61157e838383611c6a565b6115888382611d77565b610dab8282611e6c565b60009182526011602052604090912060010155565b6115b8600a8263ffffffff611eaa16565b6040516001600160a01b038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b611600600a8263ffffffff611ef616565b6040516001600160a01b038216907fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669290600090a250565b61164082611f3e565b61164957600080fd5b6000918252600c6020526040909120600701805460ff1916911515919091179055565b8661167657600080fd5b61167f87611f3e565b1561168957600080fd5b8284111561169657600080fd5b61169e6124f4565b60405180610100016040528089815260200188815260200187815260200186815260200185815260200160008152602001848152602001831515815250905080600c60008a8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070160006101000a81548160ff021916908315150217905550905050600b8890806001815401808255809150509060018203906000526020600020016000909192909190915055507f59602036a4d5ddc6d26a204732c88deed66e3cbd4e5bd29fb7d85ca6eca3b212816000015182602001518360400151846060015185608001518660c001518760e00151604051808881526020018781526020018681526020018581526020018481526020018381526020018215151515815260200197505050505050505060405180910390a15050505050505050565b600061182283611f52565b6111b68383612010565b60006001600160a01b03821661184157600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b61186b3382611514565b61187457600080fd5b61187d81611430565b1561188757600080fd5b600081815260116020526040902060030154156118a357600080fd5b600081815260116020908152604080832054808452600c909252909120600601546118d590429063ffffffff6120e716565b600083815260116020526040902060030155336118f183610f15565b600084815260116020908152604091829020600181015460028201546003909201548451898152938401889052838501919091526060830191909152608082015290516001600160a01b0392909216917f15f1eaefde46e210eb8664f2c58596610055fcadc08f4430b1ea447229fe688a9181900360a00190a35050565b6000611983846001600160a01b03166120f9565b61198f5750600161156b565b604051600160e11b630a85bd0102815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b83811015611a0c5781810151838201526020016119f4565b50505050905090810190601f168015611a395780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015611a5b57600080fd5b505af1158015611a6f573d6000803e3d6000fd5b505050506040513d6020811015611a8557600080fd5b50516001600160e01b031916600160e11b630a85bd010214915050949350505050565b611ab182611f3e565b611aba57600080fd5b6000828152600c6020526040812060030154611adc908363ffffffff6120e716565b6000848152600c602052604090206004015490915015611b2a576000838152600c602052604090206004810154600590910154611b1f908363ffffffff6120e716565b1115611b2a57600080fd5b6000928352600c60205260409092206003019190915550565b606081611b6b57506040805180820190915260018152600160fc1b6003026020820152610c0e565b8160005b8115611b8357600101600a82049150611b6f565b6060816040519080825280601f01601f191660200182016040528015611bb0576020820181803883390190505b50905060001982015b8515611bfe57600a860660300160f81b82828060019003935081518110611bdc57fe5b60200101906001600160f81b031916908160001a905350600a86049550611bb9565b50949350505050565b60606111b683836040518060200160405280600081525060405180602001604052806000815250604051806020016040528060008152506120ff565b611c4c82611f3e565b611c5557600080fd5b6000918252600c602052604090912060010155565b826001600160a01b0316611c7d82610f15565b6001600160a01b031614611c9057600080fd5b6001600160a01b038216611ca357600080fd5b611cac81612313565b6001600160a01b038316600090815260036020526040902054611cd690600163ffffffff61234e16565b6001600160a01b038085166000908152600360205260408082209390935590841681522054611d0c90600163ffffffff6120e716565b6001600160a01b038084166000818152600360209081526040808320959095558582526001905283812080546001600160a01b031916831790559251849391928716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216600090815260056020526040812054611da190600163ffffffff61234e16565b600083815260066020526040902054909150808214611e3c576001600160a01b0384166000908152600560205260408120805484908110611dde57fe5b906000526020600020015490508060056000876001600160a01b03166001600160a01b031681526020019081526020016000208381548110611e1c57fe5b600091825260208083209091019290925591825260069052604090208190555b6001600160a01b0384166000908152600560205260409020805490611e6590600019830161253b565b5050505050565b6001600160a01b0390911660009081526005602081815260408084208054868652600684529185208290559282526001810183559183529091200155565b6001600160a01b038116611ebd57600080fd5b611ec7828261182c565b15611ed157600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6001600160a01b038116611f0957600080fd5b611f13828261182c565b611f1c57600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b6000908152600c6020526040902054151590565b611f5b81611f3e565b611f6457600080fd5b6000818152600c6020526040902060030154611f7f57600080fd5b6000818152600c6020526040812060030154611fa290600163ffffffff61234e16565b1015611fad57600080fd5b6000818152600c6020526040902060030154611fd090600163ffffffff61234e16565b6000828152600c60205260409020600381019190915560050154611ffb90600163ffffffff6120e716565b6000918252600c602052604090912060050155565b600061201a61255f565b604051806080016040528085815260200160008152602001428152602001600081525090506000612049610d87565b6000818152601160209081526040918290208551808255828701516001830181905584880151600284018190556060808a0151600390950185905586518881529586019390935284860191909152908301526080820152905191925033916001600160a01b038716917f33d8a0d4d86189158700a65b6c1f751f659b0b71c3ffad3836b9918a60bc2e54919081900360a00190a361156b8482612363565b6000828201838110156111b657600080fd5b3b151590565b6060808690506060869050606086905060608690506060869050606081518351855187518951010101016040519080825280601f01601f191660200182016040528015612153576020820181803883390190505b509050806000805b88518110156121ac5788818151811061217057fe5b602001015160f81c60f81b83838060010194508151811061218d57fe5b60200101906001600160f81b031916908160001a90535060010161215b565b5060005b8751811015612201578781815181106121c557fe5b602001015160f81c60f81b8383806001019450815181106121e257fe5b60200101906001600160f81b031916908160001a9053506001016121b0565b5060005b86518110156122565786818151811061221a57fe5b602001015160f81c60f81b83838060010194508151811061223757fe5b60200101906001600160f81b031916908160001a905350600101612205565b5060005b85518110156122ab5785818151811061226f57fe5b602001015160f81c60f81b83838060010194508151811061228c57fe5b60200101906001600160f81b031916908160001a90535060010161225a565b5060005b8451811015612300578481815181106122c457fe5b602001015160f81c60f81b8383806001019450815181106122e157fe5b60200101906001600160f81b031916908160001a9053506001016122af565b50909d9c50505050505050505050505050565b6000818152600260205260409020546001600160a01b031615610f1257600090815260026020526040902080546001600160a01b0319169055565b60008282111561235d57600080fd5b50900390565b61236d8282612380565b6123778282611e6c565b610ec281612432565b6001600160a01b03821661239357600080fd5b61239c816114f7565b156123a657600080fd5b600081815260016020818152604080842080546001600160a01b0319166001600160a01b03881690811790915584526003909152909120546123e7916120e7565b6001600160a01b0383166000818152600360205260408082209390935591518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600780546000838152600860205260408120829055600182018355919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880155565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106124b75782800160ff198235161785556124e4565b828001600101855582156124e4579182015b828111156124e45782358255916020019190600101906124c9565b506124f0929150612587565b5090565b604051806101000160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b815481835581811115610dab57600083815260209020610dab918101908301612587565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b610ca791905b808211156124f0576000815560010161258d56fea165627a7a72305820c5cdf40d6776ef578c59e67455e3dcbd559da6351af51d6e410d8e0eb23691a60029000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000c447f59800280e8bdb51350aab33af849d14ccf90000000000000000000000000000000000000000000000000000000000000006426f784b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000342584b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a626f78737761702e696f00000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106102465760003560e01c806393b2467e11610139578063b260c42a116100b6578063c72c0c481161007a578063c72c0c4814610ad7578063c87b56dd14610b07578063dde1bbcf14610b31578063e4375d2214610b5b578063e985e9c514610b85578063f7d9757714610bc057610246565b8063b260c42a14610934578063b88d4fde14610951578063b9186d7d14610a24578063bb119f6e14610a4e578063c62f9c7f14610aad57610246565b8063a09ab765116100fd578063a09ab76514610811578063a22cb46514610861578063a510f70a1461089c578063aa271e1a146108d5578063ae77c2371461090857610246565b806393b2467e1461075857806395d89b4114610782578063983b2d561461079757806398650275146107ca5780639f36bea2146107df57610246565b80634a7d80b3116101c75780636352211e1161018b5780636352211e146105d9578063663c01af146106035780636b1023dd1461066857806370a08231146106b85780637acc0b20146106eb57610246565b80634a7d80b31461052b5780634f6ccce71461054057806356ffc7f11461056a5780635e8ef7fc146105945780635fd8c710146105c457610246565b80631e20363a1161020e5780631e20363a146103c5578063203dc56e1461044257806323b872dd1461046c5780632f745c59146104af57806342842e0e146104e857610246565b806301ffc9a71461024b57806306fdde0314610293578063081812fc1461031d578063095ea7b31461036357806318160ddd1461039e575b600080fd5b34801561025757600080fd5b5061027f6004803603602081101561026e57600080fd5b50356001600160e01b031916610bf0565b604080519115158252519081900360200190f35b34801561029f57600080fd5b506102a8610c13565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e25781810151838201526020016102ca565b50505050905090810190601f16801561030f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561032957600080fd5b506103476004803603602081101561034057600080fd5b5035610caa565b604080516001600160a01b039092168252519081900360200190f35b34801561036f57600080fd5b5061039c6004803603604081101561038657600080fd5b506001600160a01b038135169060200135610cda565b005b3480156103aa57600080fd5b506103b3610d87565b60408051918252519081900360200190f35b3480156103d157600080fd5b5061039c600480360360208110156103e857600080fd5b81019060208101813564010000000081111561040357600080fd5b82018360208201111561041557600080fd5b8035906020019184600183028401116401000000008311171561043757600080fd5b509092509050610d8d565b34801561044e57600080fd5b506103b36004803603602081101561046557600080fd5b5035610db0565b34801561047857600080fd5b5061039c6004803603606081101561048f57600080fd5b506001600160a01b03813581169160208101359091169060400135610dc5565b3480156104bb57600080fd5b506103b3600480360360408110156104d257600080fd5b506001600160a01b038135169060200135610de3565b3480156104f457600080fd5b5061039c6004803603606081101561050b57600080fd5b506001600160a01b03813581169160208101359091169060400135610e30565b34801561053757600080fd5b50610347610e4b565b34801561054c57600080fd5b506103b36004803603602081101561056357600080fd5b5035610e5a565b34801561057657600080fd5b5061027f6004803603602081101561058d57600080fd5b5035610e8e565b3480156105a057600080fd5b5061039c600480360360408110156105b757600080fd5b5080359060200135610ea6565b3480156105d057600080fd5b5061039c610ec6565b3480156105e557600080fd5b50610347600480360360208110156105fc57600080fd5b5035610f15565b34801561060f57600080fd5b50610618610f3d565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561065457818101518382015260200161063c565b505050509050019250505060405180910390f35b34801561067457600080fd5b506106926004803603602081101561068b57600080fd5b5035610f94565b604080519485526020850193909352838301919091526060830152519081900360800190f35b3480156106c457600080fd5b506103b3600480360360208110156106db57600080fd5b50356001600160a01b0316610fbb565b3480156106f757600080fd5b506107156004803603602081101561070e57600080fd5b5035610fec565b604080519889526020890197909752878701959095526060870193909352608086019190915260a085015260c0840152151560e083015251908190036101000190f35b34801561076457600080fd5b506103b36004803603602081101561077b57600080fd5b5035611032565b34801561078e57600080fd5b506102a8611047565b3480156107a357600080fd5b5061039c600480360360208110156107ba57600080fd5b50356001600160a01b03166110a8565b3480156107d657600080fd5b5061039c6110c3565b3480156107eb57600080fd5b5061039c6004803603604081101561080257600080fd5b508035906020013515156110ce565b34801561081d57600080fd5b5061039c600480360360e081101561083457600080fd5b5080359060208101359060408101359060608101359060808101359060a08101359060c0013515156110ea565b34801561086d57600080fd5b5061039c6004803603604081101561088457600080fd5b506001600160a01b0381351690602001351515611114565b3480156108a857600080fd5b506103b3600480360360408110156108bf57600080fd5b50803590602001356001600160a01b0316611198565b3480156108e157600080fd5b5061027f600480360360208110156108f857600080fd5b50356001600160a01b03166111bd565b6103b36004803603604081101561091e57600080fd5b50803590602001356001600160a01b03166111d0565b61039c6004803603602081101561094a57600080fd5b5035611216565b34801561095d57600080fd5b5061039c6004803603608081101561097457600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156109af57600080fd5b8201836020820111156109c157600080fd5b803590602001918460018302840111640100000000831117156109e357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b348015610a3057600080fd5b506103b360048036036020811015610a4757600080fd5b5035611278565b348015610a5a57600080fd5b50610a7860048036036020811015610a7157600080fd5b503561128d565b6040805196875260208701959095528585019390935260608501919091526080840152151560a0830152519081900360c00190f35b348015610ab957600080fd5b5061069260048036036020811015610ad057600080fd5b50356112ca565b348015610ae357600080fd5b5061039c60048036036040811015610afa57600080fd5b50803590602001356112f2565b348015610b1357600080fd5b506102a860048036036020811015610b2a57600080fd5b503561135e565b348015610b3d57600080fd5b506103b360048036036020811015610b5457600080fd5b5035611412565b348015610b6757600080fd5b5061027f60048036036020811015610b7e57600080fd5b5035611430565b348015610b9157600080fd5b5061027f60048036036040811015610ba857600080fd5b506001600160a01b038135811691602001351661146e565b348015610bcc57600080fd5b5061039c60048036036040811015610be357600080fd5b508035906020013561149c565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b600d8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9f5780601f10610c7457610100808354040283529160200191610c9f565b820191906000526020600020905b815481529060010190602001808311610c8257829003601f168201915b505050505090505b90565b6000610cb5826114f7565b610cbe57600080fd5b506000908152600260205260409020546001600160a01b031690565b6000610ce582610f15565b9050806001600160a01b0316836001600160a01b03161415610d0657600080fd5b336001600160a01b0382161480610d225750610d22813361146e565b610d2b57600080fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60075490565b610d96336111bd565b610d9f57600080fd5b610dab600f8383612476565b505050565b6000908152600c602052604090206002015490565b610dcf3382611514565b610dd857600080fd5b610dab838383611573565b6000610dee83610fbb565b8210610df957600080fd5b6001600160a01b0383166000908152600560205260409020805483908110610e1d57fe5b9060005260206000200154905092915050565b610dab83838360405180602001604052806000815250611252565b6010546001600160a01b031690565b6000610e64610d87565b8210610e6f57600080fd5b60078281548110610e7c57fe5b90600052602060002001549050919050565b6000908152600c602052604090206007015460ff1690565b610eaf336111bd565b610eb857600080fd5b610ec28282611592565b5050565b610ecf336111bd565b610ed857600080fd5b6010546040516001600160a01b0390911690303180156108fc02916000818181858888f19350505050158015610f12573d6000803e3d6000fd5b50565b6000818152600160205260408120546001600160a01b031680610f3757600080fd5b92915050565b6060600b805480602002602001604051908101604052809291908181526020018280548015610c9f57602002820191906000526020600020905b815481526020019060010190808311610f77575050505050905090565b60116020526000908152604090208054600182015460028301546003909301549192909184565b60006001600160a01b038216610fd057600080fd5b506001600160a01b031660009081526003602052604090205490565b600c602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015495969495939492939192909160ff1688565b6000908152600c602052604090206005015490565b600e8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9f5780601f10610c7457610100808354040283529160200191610c9f565b6110b1336111bd565b6110ba57600080fd5b610f12816115a7565b6110cc336115ef565b565b6110d7336111bd565b6110e057600080fd5b610ec28282611637565b6110f3336111bd565b6110fc57600080fd5b61110b8787878787878761166c565b50505050505050565b6001600160a01b03821633141561112a57600080fd5b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b60006111a3336111bd565b6111ac57600080fd5b6111b68383611817565b9392505050565b6000610f37600a8363ffffffff61182c16565b6000826111dc57600080fd5b6001600160a01b0382166111ef57600080fd5b6111f883611278565b341461120357600080fd5b61120c83610e8e565b156111ac57600080fd5b600061122182610f15565b6001600160a01b0316141561123557600080fd5b61123e81610db0565b341461124957600080fd5b610f1281611861565b61125d848484610dc5565b6112698484848461196f565b61127257600080fd5b50505050565b6000908152600c602052604090206001015490565b6000908152600c6020526040902060018101546002820154600383015460048401546006850154600790950154939592949193909260ff90911690565b6000908152601160205260409020805460018201546002830154600390930154919390929190565b6112fb336111bd565b61130457600080fd5b61130e8282611aa8565b6000828152600c60209081526040918290206003015482518581529182015281517f0efef8c0c9349a65e00e160f2f84c8eb54571014c399fb86e9d09ce10b7f7047929181900390910190a15050565b6060611369826114f7565b61137257600080fd5b600f8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152610f3793909290918301828280156113ff5780601f106113d4576101008083540402835291602001916113ff565b820191906000526020600020905b8154815290600101906020018083116113e257829003601f168201915b505050505061140d84611b43565b611c07565b600b818154811061141f57fe5b600091825260209091200154905081565b600081815260116020526040812060030154421080610f375750506000908152601160209081526040808320548352600c9091529020600601541590565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6114a5336111bd565b6114ae57600080fd5b6114b88282611c43565b604080518381526020810183905281517fd63cc1ed2f6abbff2bdc8aeb9f139df953e98c6aa57ca5bfe8e1876be9e890ec929181900390910190a15050565b6000908152600160205260409020546001600160a01b0316151590565b60008061152083610f15565b9050806001600160a01b0316846001600160a01b0316148061155b5750836001600160a01b031661155084610caa565b6001600160a01b0316145b8061156b575061156b818561146e565b949350505050565b61157e838383611c6a565b6115888382611d77565b610dab8282611e6c565b60009182526011602052604090912060010155565b6115b8600a8263ffffffff611eaa16565b6040516001600160a01b038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b611600600a8263ffffffff611ef616565b6040516001600160a01b038216907fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669290600090a250565b61164082611f3e565b61164957600080fd5b6000918252600c6020526040909120600701805460ff1916911515919091179055565b8661167657600080fd5b61167f87611f3e565b1561168957600080fd5b8284111561169657600080fd5b61169e6124f4565b60405180610100016040528089815260200188815260200187815260200186815260200185815260200160008152602001848152602001831515815250905080600c60008a8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070160006101000a81548160ff021916908315150217905550905050600b8890806001815401808255809150509060018203906000526020600020016000909192909190915055507f59602036a4d5ddc6d26a204732c88deed66e3cbd4e5bd29fb7d85ca6eca3b212816000015182602001518360400151846060015185608001518660c001518760e00151604051808881526020018781526020018681526020018581526020018481526020018381526020018215151515815260200197505050505050505060405180910390a15050505050505050565b600061182283611f52565b6111b68383612010565b60006001600160a01b03821661184157600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b61186b3382611514565b61187457600080fd5b61187d81611430565b1561188757600080fd5b600081815260116020526040902060030154156118a357600080fd5b600081815260116020908152604080832054808452600c909252909120600601546118d590429063ffffffff6120e716565b600083815260116020526040902060030155336118f183610f15565b600084815260116020908152604091829020600181015460028201546003909201548451898152938401889052838501919091526060830191909152608082015290516001600160a01b0392909216917f15f1eaefde46e210eb8664f2c58596610055fcadc08f4430b1ea447229fe688a9181900360a00190a35050565b6000611983846001600160a01b03166120f9565b61198f5750600161156b565b604051600160e11b630a85bd0102815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b83811015611a0c5781810151838201526020016119f4565b50505050905090810190601f168015611a395780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015611a5b57600080fd5b505af1158015611a6f573d6000803e3d6000fd5b505050506040513d6020811015611a8557600080fd5b50516001600160e01b031916600160e11b630a85bd010214915050949350505050565b611ab182611f3e565b611aba57600080fd5b6000828152600c6020526040812060030154611adc908363ffffffff6120e716565b6000848152600c602052604090206004015490915015611b2a576000838152600c602052604090206004810154600590910154611b1f908363ffffffff6120e716565b1115611b2a57600080fd5b6000928352600c60205260409092206003019190915550565b606081611b6b57506040805180820190915260018152600160fc1b6003026020820152610c0e565b8160005b8115611b8357600101600a82049150611b6f565b6060816040519080825280601f01601f191660200182016040528015611bb0576020820181803883390190505b50905060001982015b8515611bfe57600a860660300160f81b82828060019003935081518110611bdc57fe5b60200101906001600160f81b031916908160001a905350600a86049550611bb9565b50949350505050565b60606111b683836040518060200160405280600081525060405180602001604052806000815250604051806020016040528060008152506120ff565b611c4c82611f3e565b611c5557600080fd5b6000918252600c602052604090912060010155565b826001600160a01b0316611c7d82610f15565b6001600160a01b031614611c9057600080fd5b6001600160a01b038216611ca357600080fd5b611cac81612313565b6001600160a01b038316600090815260036020526040902054611cd690600163ffffffff61234e16565b6001600160a01b038085166000908152600360205260408082209390935590841681522054611d0c90600163ffffffff6120e716565b6001600160a01b038084166000818152600360209081526040808320959095558582526001905283812080546001600160a01b031916831790559251849391928716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216600090815260056020526040812054611da190600163ffffffff61234e16565b600083815260066020526040902054909150808214611e3c576001600160a01b0384166000908152600560205260408120805484908110611dde57fe5b906000526020600020015490508060056000876001600160a01b03166001600160a01b031681526020019081526020016000208381548110611e1c57fe5b600091825260208083209091019290925591825260069052604090208190555b6001600160a01b0384166000908152600560205260409020805490611e6590600019830161253b565b5050505050565b6001600160a01b0390911660009081526005602081815260408084208054868652600684529185208290559282526001810183559183529091200155565b6001600160a01b038116611ebd57600080fd5b611ec7828261182c565b15611ed157600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6001600160a01b038116611f0957600080fd5b611f13828261182c565b611f1c57600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b6000908152600c6020526040902054151590565b611f5b81611f3e565b611f6457600080fd5b6000818152600c6020526040902060030154611f7f57600080fd5b6000818152600c6020526040812060030154611fa290600163ffffffff61234e16565b1015611fad57600080fd5b6000818152600c6020526040902060030154611fd090600163ffffffff61234e16565b6000828152600c60205260409020600381019190915560050154611ffb90600163ffffffff6120e716565b6000918252600c602052604090912060050155565b600061201a61255f565b604051806080016040528085815260200160008152602001428152602001600081525090506000612049610d87565b6000818152601160209081526040918290208551808255828701516001830181905584880151600284018190556060808a0151600390950185905586518881529586019390935284860191909152908301526080820152905191925033916001600160a01b038716917f33d8a0d4d86189158700a65b6c1f751f659b0b71c3ffad3836b9918a60bc2e54919081900360a00190a361156b8482612363565b6000828201838110156111b657600080fd5b3b151590565b6060808690506060869050606086905060608690506060869050606081518351855187518951010101016040519080825280601f01601f191660200182016040528015612153576020820181803883390190505b509050806000805b88518110156121ac5788818151811061217057fe5b602001015160f81c60f81b83838060010194508151811061218d57fe5b60200101906001600160f81b031916908160001a90535060010161215b565b5060005b8751811015612201578781815181106121c557fe5b602001015160f81c60f81b8383806001019450815181106121e257fe5b60200101906001600160f81b031916908160001a9053506001016121b0565b5060005b86518110156122565786818151811061221a57fe5b602001015160f81c60f81b83838060010194508151811061223757fe5b60200101906001600160f81b031916908160001a905350600101612205565b5060005b85518110156122ab5785818151811061226f57fe5b602001015160f81c60f81b83838060010194508151811061228c57fe5b60200101906001600160f81b031916908160001a90535060010161225a565b5060005b8451811015612300578481815181106122c457fe5b602001015160f81c60f81b8383806001019450815181106122e157fe5b60200101906001600160f81b031916908160001a9053506001016122af565b50909d9c50505050505050505050505050565b6000818152600260205260409020546001600160a01b031615610f1257600090815260026020526040902080546001600160a01b0319169055565b60008282111561235d57600080fd5b50900390565b61236d8282612380565b6123778282611e6c565b610ec281612432565b6001600160a01b03821661239357600080fd5b61239c816114f7565b156123a657600080fd5b600081815260016020818152604080842080546001600160a01b0319166001600160a01b03881690811790915584526003909152909120546123e7916120e7565b6001600160a01b0383166000818152600360205260408082209390935591518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600780546000838152600860205260408120829055600182018355919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880155565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106124b75782800160ff198235161785556124e4565b828001600101855582156124e4579182015b828111156124e45782358255916020019190600101906124c9565b506124f0929150612587565b5090565b604051806101000160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b815481835581811115610dab57600083815260209020610dab918101908301612587565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b610ca791905b808211156124f0576000815560010161258d56fea165627a7a72305820c5cdf40d6776ef578c59e67455e3dcbd559da6351af51d6e410d8e0eb23691a60029

Swarm Source

bzzr://c5cdf40d6776ef578c59e67455e3dcbd559da6351af51d6e410d8e0eb23691a6
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.