Contract 0x3742104Df12A40913d50AdA369214EF236Ce87E9

 

Contract Overview

Balance:
0 MATIC

MATIC Value:
$0.00

Token:
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x936b430e499137cb4bebe48d0f70f92c14864a3569ff69992b5c04e145dd1021Update Mining Ad...171094542021-07-21 12:49:37303 days 18 hrs agoLoserChick: Deployer IN  0x3742104df12a40913d50ada369214ef236ce87e90 MATIC0.0000626082
0xc837c89cde13190cc888ebdb6f71f0861cb19f80b8b8c4b849cfd5ceafe36a41Update Mining Ad...171025172021-07-21 8:16:37303 days 22 hrs agoLoserChick: Deployer IN  0x3742104df12a40913d50ada369214ef236ce87e90 MATIC0.0000626082
0xe5f23a34d36b86d80eed79f0add4006a73b1bc9c787ff4e4bc37cacaf3f8b8860x60806040171016202021-07-21 7:41:31303 days 23 hrs agoLoserChick: Deployer IN  Create: MiddleWare0 MATIC0.0049817313.1
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MiddleWare

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at polygonscan.com on 2021-07-21
*/

// File: ..\node_modules\@openzeppelin\contracts\introspection\IERC165.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// File: @openzeppelin\contracts\introspection\ERC165.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;


/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

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

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

// File: ..\node_modules\@openzeppelin\contracts\utils\Context.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

// File: ..\node_modules\@openzeppelin\contracts\token\ERC721\IERC721.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;


/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

// File: ..\node_modules\@openzeppelin\contracts\token\ERC721\IERC721Metadata.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;


/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {

    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

// File: ..\node_modules\@openzeppelin\contracts\token\ERC721\IERC721Enumerable.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;


/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

// File: ..\node_modules\@openzeppelin\contracts\token\ERC721\IERC721Receiver.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}


// File: ..\node_modules\@openzeppelin\contracts\math\SafeMath.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

// File: ..\node_modules\@openzeppelin\contracts\utils\Address.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: ..\node_modules\@openzeppelin\contracts\utils\EnumerableSet.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

// File: ..\node_modules\@openzeppelin\contracts\utils\EnumerableMap.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._indexes[key] != 0;
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

   /**
    * @dev Returns the key-value pair stored at position `index` in the map. O(1).
    *
    * Note that there are no guarantees on the ordering of entries inside the
    * array, and it may change when more entries are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        require(map._entries.length > index, "EnumerableMap: index out of bounds");

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        uint256 keyIndex = map._indexes[key];
        if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
        return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return _remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return _contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return _length(map._inner);
    }

   /**
    * @dev Returns the element stored at position `index` in the set. O(1).
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
    }
}

// File: ..\node_modules\@openzeppelin\contracts\utils\Strings.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = bytes1(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}

// File: @openzeppelin\contracts\token\ERC721\ERC721.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;












/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;

    // 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 holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;

    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

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

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _holderTokens[owner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(base, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view virtual returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _tokenOwners.contains(tokenId);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId); // internal owner

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

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

        _holderTokens[owner].remove(tokenId);

        _tokenOwners.remove(tokenId);

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-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 bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}

// File: @openzeppelin\contracts\utils\Counters.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;


/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}



// File: contracts\OwnableContract.sol

pragma solidity 0.6.6;

contract OwnableContract {
    address public owner;
    address public pendingOwner;
    address public admin;

    event NewAdmin(address oldAdmin, address newAdmin);
    event NewOwner(address oldOwner, address newOwner);
    event NewPendingOwner(address oldPendingOwner, address newPendingOwner);

    constructor() public {
        owner = msg.sender;
        admin = msg.sender;
    }

    modifier onlyOwner {
        require(msg.sender == owner,"onlyOwner");
        _;
    }

    modifier onlyPendingOwner {
        require(msg.sender == pendingOwner,"onlyPendingOwner");
        _;
    }

    modifier onlyAdmin {
        require(msg.sender == admin || msg.sender == owner,"onlyAdmin");
        _;
    } 
    
    function transferOwnership(address _pendingOwner) public onlyOwner {
        emit NewPendingOwner(pendingOwner, _pendingOwner);
        pendingOwner = _pendingOwner;
    }

    function renounceOwnership() public virtual onlyOwner {
        emit NewOwner(owner, address(0));
        emit NewAdmin(admin, address(0));
        emit NewPendingOwner(pendingOwner, address(0));

        owner = address(0);
        pendingOwner = address(0);
        admin = address(0);
    }
    
    function acceptOwner() public onlyPendingOwner {
        emit NewOwner(owner, pendingOwner);
        owner = pendingOwner;

        address newPendingOwner = address(0);
        emit NewPendingOwner(pendingOwner, newPendingOwner);
        pendingOwner = newPendingOwner;
    }    
    
    function setAdmin(address newAdmin) public onlyOwner {
        emit NewAdmin(admin, newAdmin);
        admin = newAdmin;
    }
}

// File: contracts\RandomInterface.sol

pragma solidity 0.6.6;

interface RandomInterface{

    function getRandomNumber() external returns(uint256);
}

// File: contracts\LoserChickNFT.sol

pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;








contract LoserChickNFT is OwnableContract, ERC721("ShriekingChick", "ShriekingChick"){

    using Counters for Counters.Counter;

    struct ChickAttribute{
        uint256 jacket;
        uint256 trousers;
        uint256 suit;
        uint256 expression;
        uint256 hat;
        uint256 leftHandOrnaments;
        uint256 rightHandOrnaments;
        uint256 shoes;
        uint256 bodyOrnaments;
    }

    uint256 public immutable maxSupply;

    uint256 private seed;

    address private randomAddr;

    bool public isLaborChick;

    // Private fields
    Counters.Counter private _tokenIds;

    uint256[7] public jacket = [101, 102, 103, 104, 105, 106, 107];
    uint256[8] public trousers = [201, 202, 203, 204, 205, 206, 207, 208];
    uint256[3] public suit = [301, 302, 303];
    uint256[10] public expression = [401, 402, 403, 404, 405, 406, 407, 408, 409, 410];
    uint256[7] public hat = [501, 502, 503, 504, 505, 506, 507];
    uint256[11] public leftHandOrnaments = [601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611];
    uint256[11] public rightHandOrnaments = [701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711];
    uint256[10] public shoes = [801, 802, 803, 804, 805, 806, 807, 808, 809, 810];
    uint256[11] public bodyOrnaments = [901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911];
    
    mapping(uint256 => ChickAttribute) public tokenIdChickAttribute;

    // Shrieking Chick、 Lucky Chick、Labor Chick、BOSS Chick、Trump Chick
    constructor(uint256 _maxSupply, address _randomAddr, bool _isLaborChick) public{
       maxSupply = _maxSupply;
       randomAddr = _randomAddr;
       isLaborChick = _isLaborChick;
    }

    function getTokenIdChickAttribute(uint256 tokenId) public view returns(ChickAttribute memory){
        return tokenIdChickAttribute[tokenId];
    }

    function tokenOfOwnerPage(address owner, uint256 pageNumber, uint256 pageSize) external view returns (uint256, uint256[] memory){
        uint256 total = balanceOf(owner);
        uint256 start = pageNumber * pageSize;
        require(start < total, 'pageNumber input error!');
        uint256 end;
        if(start + pageSize > total){
            end = total;
        }else{
            end = start + pageSize;
        }
        uint256[] memory tokenIds = new uint256[](end - start);
        uint256 count = 0;
        for(uint256 i=start; i<end; i++){
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            tokenIds[count] = tokenId;
            count++;
        }
        return (total, tokenIds);
    }

    /**
     * @notice
     * @param flag If flag is true, it means shriekingChick, otherwise luckyChick.
     */
    function createNFT(address owner) public onlyAdmin returns(uint256){
        require(totalSupply() < maxSupply, 'The limit has been reached!');

        uint256 tokenId = _mintChick(owner);
            
        ChickAttribute memory chickAttribute;
        RandomInterface randomInterface = RandomInterface(randomAddr);
        uint256 randomNumber = randomInterface.getRandomNumber();
        updateSeed();
        bytes32 random = keccak256(abi.encodePacked(now, randomNumber, seed));
        uint256 expressionIndex = uint256(random) % 10;
        uint256 hatIndex = uint256(random) % 7;
        uint256 leftHandOrnamentsIndex = uint256(random) % 11;
        uint256 rightHandOrnamentsIndex = uint256(random) % 11;
        uint256 shoesIndex = uint256(random) % 10;
        uint256 bodyOrnamentsIndex = uint256(random) % 11;

        chickAttribute.expression = expression[expressionIndex];
        chickAttribute.hat = hat[hatIndex];
        chickAttribute.leftHandOrnaments = leftHandOrnaments[leftHandOrnamentsIndex];
        chickAttribute.rightHandOrnaments = rightHandOrnaments[rightHandOrnamentsIndex];
        chickAttribute.shoes = shoes[shoesIndex];
        chickAttribute.bodyOrnaments = bodyOrnaments[bodyOrnamentsIndex];

        if(isLaborChick){
            uint256 suitIndex = uint256(random) % 3;
            chickAttribute.suit = suit[suitIndex];
        }else{
            uint256 isSuitRandom = uint256(random) % 2;
            if(isSuitRandom == 0){
                uint256 suitIndex = uint256(random) % 3;
                chickAttribute.suit = suit[suitIndex];
            }else if(isSuitRandom == 1){
                uint256 jacketIndex = uint256(random) % 7;
                uint256 trousersIndex = uint256(random) % 8;
                
                chickAttribute.jacket = jacket[jacketIndex];
                chickAttribute.trousers = trousers[trousersIndex];
            }
        }
        tokenIdChickAttribute[tokenId] = chickAttribute;
        return tokenId;
    }

    // Private Methods
    function _mintChick(address owner) private returns(uint256){
        _tokenIds.increment();

        uint256 newItemId = _tokenIds.current();
        _mint(owner, newItemId);
        return newItemId;
    }

    function setBaseURI(string memory newBaseURI) public onlyOwner {
        _setBaseURI(newBaseURI);
    }

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory){
        require(tokenId > 0 && tokenId <= totalSupply(), "URI query for nonexistent token");
        // Fallback to centralised URI
        return string(abi.encodePacked(baseURI(), 'getUrl?name=', name(), '&tokenId=', tokenId.toString()));
    }

    function updateSeed() internal{
        seed = seed + now - 5;
    }

    function updateRandomAddr(address _randomAddr) public onlyOwner{
        randomAddr = _randomAddr;
    }
}

// File: @openzeppelin\contracts\GSN\Context.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

// File: @openzeppelin\contracts\token\ERC20\IERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

// File: @openzeppelin\contracts\utils\ReentrancyGuard.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}


// File: @openzeppelin\contracts\token\ERC20\SafeERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;




/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// File: @openzeppelin\contracts\access\Ownable.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}


// File: contracts\ChickMining.sol

pragma solidity 0.6.6;











contract ChickMining is OwnableContract, ReentrancyGuard, IERC721Receiver{
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.UintSet;

    // Info of each user.
    struct UserInfo {
        uint256 amount;     // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
        uint256 rewardToClaim; // when deposit or withdraw, update pending reward  to rewardToClaim.
        EnumerableSet.UintSet holderTokens;
    }

    struct PoolInfo {
        address lpToken;            // Address of   LP token.
        uint256 allocPoint;         // How many allocation points assigned to this pool. mining token  distribute per block.
        uint256 lastRewardBlock;    // Last block number that mining token distribution occurs.
        uint256 accPerShare;        // Accumulated mining token per share, times 1e18. See below.
        uint256 maxAmountPerUser;   // The maximum amount of deposits per user, 0 means unlimited.
        uint256 lpTokenAmount;      // lpToken deposit amount in this pool, for calculating APY
        bool    isNFT;              // true : NFT; false: ERC20
    }

    IERC20 public miningToken; // The mining token TOKEN


    PoolInfo[] public poolInfo; // Info of each pool.
    mapping(uint256 => mapping(address => UserInfo)) private userInfo; // Info of each user that stakes LP tokens.
    uint256 public totalAllocPoint = 0;  // Total allocation points. Must be the sum of all allocation points in all pools.

    bool public whitelistSwitch = true;

    uint256 public whitelistCount;

    mapping(address => bool) public minerAddress;

    uint256 public minerCount;

    uint256[] public phaseEndBlockNumberArray;

    uint256[] public phasePerBlockRewardArray;

    uint256 public phase1StartBlockNumber;

    uint256 public constant blockCountPerDay = 43200; // day blockNumber total, 2s one block

    event Claim(address indexed user, uint256 pid, uint256 amount);
    event Deposit(address indexed user, uint256 pid, uint256 amount);
    event Withdraw(address indexed user, uint256 pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 pid, uint256 amount);

    mapping(address => bool) private whitelist;

    modifier onlyWhitelisted() {
        require(isWhitelisted(msg.sender), "The address is not on the whitelist");
        _;
    }

    constructor(address _mining_token, uint256 _mining_start_block) public {
        miningToken = IERC20(_mining_token);



        phase1StartBlockNumber = _mining_start_block;

        phaseEndBlockNumberArray = new uint256[](7);
        phaseEndBlockNumberArray[0] = phase1StartBlockNumber.add(blockCountPerDay.mul(14));
        phaseEndBlockNumberArray[1] = phaseEndBlockNumberArray[0].add(blockCountPerDay.mul(14));
        phaseEndBlockNumberArray[2] = phaseEndBlockNumberArray[1].add(blockCountPerDay.mul(14));
        phaseEndBlockNumberArray[3] = phaseEndBlockNumberArray[2].add(blockCountPerDay.mul(90));
        phaseEndBlockNumberArray[4] = phaseEndBlockNumberArray[3].add(blockCountPerDay.mul(90));
        phaseEndBlockNumberArray[5] = phaseEndBlockNumberArray[4].add(blockCountPerDay.mul(90));
        phaseEndBlockNumberArray[6] = phaseEndBlockNumberArray[5].add(blockCountPerDay.mul(90));

        phasePerBlockRewardArray = new uint256[](7);
        phasePerBlockRewardArray[0] = 384 * 1e16;
        phasePerBlockRewardArray[1] = 192 * 1e16;
        phasePerBlockRewardArray[2] = 96 * 1e16;
        phasePerBlockRewardArray[3] = 48 * 1e16;
        phasePerBlockRewardArray[4] = 24 * 1e16;
        phasePerBlockRewardArray[5] = 12 * 1e16;
        phasePerBlockRewardArray[6] = 6 * 1e16;
    }

    function updateBlockReward(uint256 _phaseIndex, uint256 _reward) public onlyOwner {
        require(_phaseIndex < phasePerBlockRewardArray.length, "invalid _phaseIndex");
        phasePerBlockRewardArray[_phaseIndex] = _reward;
    }

    function updatePhaseEndBlockNumber(uint256 _phaseIndex, uint256 _endBlockNumber) public onlyOwner {
        require(_phaseIndex < phaseEndBlockNumberArray.length, "invalid _phaseIndex");
        phaseEndBlockNumberArray[_phaseIndex] = _endBlockNumber;
    }

    function addMiningPhase(uint256 _phaseEndBlockNumber, uint256 _phasePerBlockReward) public onlyOwner {
        require(_phaseEndBlockNumber > phaseEndBlockNumberArray[phaseEndBlockNumberArray.length - 1], "invalid _phaseEndBlockNumber");
        phaseEndBlockNumberArray.push(_phaseEndBlockNumber);
        phasePerBlockRewardArray.push(_phasePerBlockReward);
    }

    function getUserInfo(uint256 _pid, address _user) public view returns (
        uint256 _amount, uint256 _rewardDebt, uint256 _rewardToClaim) {
        require(_pid < poolInfo.length, "invalid _pid");
        UserInfo memory info = userInfo[_pid][_user];
        _amount = info.amount;
        _rewardDebt = info.rewardDebt;
        _rewardToClaim = info.rewardToClaim;
    }

    function getUserStakingNftTokenIdArray(uint256 _pid, address _user, uint256 _pageNumber, uint256 _pageSize) public view returns (uint256[] memory) {
        require(_pageSize <= 50, 'The maximum PageSize is 50!');
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        require(pool.isNFT, 'invalid _pid');
        UserInfo storage user = userInfo[_pid][_user];
        uint256 start;
        start = _pageNumber * _pageSize;
        require(start < user.holderTokens.length(), '_pageNumber input error!');
        uint256 end;
        if(start + _pageSize > user.holderTokens.length()){
            end = user.holderTokens.length();
        }else{
            end = start + _pageSize;
        }
        uint256[] memory tokenIds = new uint256[](end - start);
        uint256 count = 0;
        for(uint256 i=start; i<end; i++){
            uint256 tokenId = user.holderTokens.at(i);
            tokenIds[count] = tokenId;
            count++;
        }
        return tokenIds;
    }
    
    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    // Add a new lp to the pool. Can only be called by the owner.
    function add(uint256 _allocPoint, address _lpToken, uint256 _maxAmountPerUser, bool _withUpdate, bool _isNFT) public onlyAdmin {
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > phase1StartBlockNumber ? block.number : phase1StartBlockNumber;
        totalAllocPoint = totalAllocPoint.add(_allocPoint);

        PoolInfo memory _poolInfo;
        _poolInfo.isNFT = _isNFT;
        _poolInfo.lpToken = _lpToken;
        _poolInfo.allocPoint = _allocPoint;
        _poolInfo.lastRewardBlock = lastRewardBlock;
        _poolInfo.accPerShare = 0;
        _poolInfo.maxAmountPerUser = _maxAmountPerUser;
        _poolInfo.lpTokenAmount = 0;

        poolInfo.push(_poolInfo);
    }

    function set(uint256 _pid, uint256 _allocPoint, uint256 _maxAmountPerUser, bool _withUpdate) public onlyAdmin {
        require(_pid < poolInfo.length, "invalid _pid");
        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
        poolInfo[_pid].allocPoint = _allocPoint;
        poolInfo[_pid].maxAmountPerUser = _maxAmountPerUser;
    }

    function getCurrentRewardsPerBlock() public view returns (uint256) {
        return getMultiplier(block.number - 1, block.number);
    }

    // Return reward  over the given _from to _to block. Suppose it doesn't span greater than  two phases
    function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
        require(_to > _from, "_to should greater than _from");
        if(_to <= phase1StartBlockNumber || _from > phaseEndBlockNumberArray[phaseEndBlockNumberArray.length - 1]){
            return 0;
        }
        if(_from < phase1StartBlockNumber){
            _from = phase1StartBlockNumber;
        }

        if(_to > phaseEndBlockNumberArray[phaseEndBlockNumberArray.length - 1]){
            _to = phaseEndBlockNumberArray[phaseEndBlockNumberArray.length - 1];
        }

        // _from  and _to between first phase :
        if( phase1StartBlockNumber <= _from && _to <= phaseEndBlockNumberArray[0]){
            return  _to.sub(_from).mul(phasePerBlockRewardArray[0]);
        }

        
        for(uint256 i=1; i< phaseEndBlockNumberArray.length; i++){

            // _from  and _to between one  phase:
            if( phaseEndBlockNumberArray[i-1] <= _from && _to <= phaseEndBlockNumberArray[i]){
                return _to.sub(_from).mul(phasePerBlockRewardArray[i]);                
            }

            // _from and _to span two  phase: 
            if(_from < phaseEndBlockNumberArray[i - 1] &&  phaseEndBlockNumberArray[i - 1] <  _to  && _to <= phaseEndBlockNumberArray[i]){
                uint256 reword1 = phaseEndBlockNumberArray[i - 1].sub(_from).mul(phasePerBlockRewardArray[i - 1]);
                uint256 reword2 = _to.sub(phaseEndBlockNumberArray[i - 1]).mul(phasePerBlockRewardArray[i]);
                return  reword1.add(reword2);
            }
        } 


        return 0;
    }

    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            updatePool(pid);
        }
    }

    function updatePool(uint256 _pid) public {
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }
        uint256 lpSupply = pool.lpTokenAmount;
        if (lpSupply == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 reward = multiplier.mul(pool.allocPoint).div(totalAllocPoint);
        pool.accPerShare = pool.accPerShare.add(reward.mul(1e18).div(lpSupply));
        pool.lastRewardBlock = block.number;
    }

    function getPendingAmount(uint256 _pid, address _user) public view returns (uint256) {
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accPerShare = pool.accPerShare;
        uint256 lpSupply = pool.lpTokenAmount;
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
            uint256 reward = multiplier.mul(pool.allocPoint).div(totalAllocPoint);
            accPerShare = accPerShare.add(reward.mul(1e18).div(lpSupply));
        }
        uint256 pending = user.amount.mul(accPerShare).div(1e18).sub(user.rewardDebt);
        uint256 totalPendingAmount = user.rewardToClaim.add(pending);
        return totalPendingAmount;
    }

    function getAllPendingAmount(address _user) external view returns (uint256) {
        uint256 length = poolInfo.length;
        uint256 allAmount = 0;
        for (uint256 pid = 0; pid < length; ++pid) {
            allAmount = allAmount.add(getPendingAmount(pid, _user));
        }
        return allAmount;
    }

    function claimAll() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            if (getPendingAmount(pid, msg.sender) > 0) {
                claim(pid);
            }
        }
    }

    function claim(uint256 _pid) public {
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accPerShare).div(1e18).sub(user.rewardDebt);
            user.rewardToClaim = user.rewardToClaim.add(pending);
        }
        user.rewardDebt = user.amount.mul(pool.accPerShare).div(1e18);
        safeMiningTokenTransfer(msg.sender, user.rewardToClaim);
        emit Claim(msg.sender, _pid, user.rewardToClaim);
        user.rewardToClaim = 0;
    }

    // Deposit LP tokens to Mining for token allocation.
    function depositERC20(uint256 _pid, uint256 _amount) public nonReentrant onlyWhitelisted {
        require(_amount > 0, '_amount should be greater than 0');
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        require(!pool.isNFT, 'invalid _pid');
        UserInfo storage user = userInfo[_pid][msg.sender];
        if(pool.maxAmountPerUser != 0){
            uint256 allowance = pool.maxAmountPerUser.sub(user.amount);
            require(_amount <= allowance, "deposit amount exceeds allowance");
        }
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accPerShare).div(1e18).sub(user.rewardDebt);
            user.rewardToClaim = user.rewardToClaim.add(pending);
        }
        IERC20 erc20 = IERC20(pool.lpToken);
        erc20.safeTransferFrom(address(msg.sender), address(this), _amount);
        user.amount = user.amount.add(_amount);
        emit Deposit(msg.sender, _pid, _amount);

        pool.lpTokenAmount = pool.lpTokenAmount.add(_amount);
        user.rewardDebt = user.amount.mul(pool.accPerShare).div(1e18);

        if(!minerAddress[msg.sender]){
            minerAddress[msg.sender] = true;
            minerCount++;
        }
    }

    // Withdraw LP tokens from Mining.
    function withdrawERC20(uint256 _pid, uint256 _amount) public nonReentrant {
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        require(!pool.isNFT, 'PID error, please send the PID of erc20');
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: user.amount is not enough");
        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accPerShare).div(1e18).sub(user.rewardDebt);
        user.rewardToClaim = user.rewardToClaim.add(pending);
        user.amount = user.amount.sub(_amount);
        user.rewardDebt = user.amount.mul(pool.accPerShare).div(1e18);
        IERC20 erc20 = IERC20(pool.lpToken);
        erc20.safeTransfer(address(msg.sender), _amount);
        pool.lpTokenAmount = pool.lpTokenAmount.sub(_amount);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdrawERC20(uint256 _pid) public nonReentrant {
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        require(!pool.isNFT, 'PID error, please send the PID of erc20');
        UserInfo storage user = userInfo[_pid][msg.sender];
        IERC20 erc20 = IERC20(pool.lpToken);
        erc20.safeTransfer(address(msg.sender), user.amount);
        pool.lpTokenAmount = pool.lpTokenAmount.sub(user.amount);
        emit EmergencyWithdraw(msg.sender, _pid, user.amount);
        user.amount = 0;
        user.rewardDebt = 0;
        user.rewardToClaim = 0;
    }

    function depositNFT(uint256 _pid, uint256 _amount) public nonReentrant {
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        require(pool.isNFT, 'invalid _pid');
        ERC721 erc721 = ERC721(pool.lpToken);
        uint256 tokenIdLength = erc721.balanceOf(msg.sender);
        require(tokenIdLength > 0, "there is no chick in your account!");
        require(_amount <= tokenIdLength, "invalid _amount ");
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accPerShare).div(1e18).sub(user.rewardDebt);
            user.rewardToClaim = user.rewardToClaim.add(pending);
        }

        
        for(uint256 i=0; i<_amount; i++){
            // after call erc721.safeTransferFrom(address(msg.sender), address(this), tokenId),  the tokenId of index 0 will change
            uint256 tokenId = erc721.tokenOfOwnerByIndex(msg.sender, 0); // index = 0 
            user.holderTokens.add(tokenId);
            erc721.safeTransferFrom(address(msg.sender), address(this), tokenId);
        }
        user.amount = user.amount.add(_amount);
        pool.lpTokenAmount = pool.lpTokenAmount.add(_amount);
        user.rewardDebt = user.amount.mul(pool.accPerShare).div(1e18);

        emit Deposit(msg.sender, _pid, _amount);

        if(!minerAddress[msg.sender]){
            minerAddress[msg.sender] = true;
            minerCount++;
        }

        require(user.amount == user.holderTokens.length(), "user.amount != user.holderTokens.length()");
    }

    function withdrawNFT(uint256 _pid, uint256 _amount) public nonReentrant{
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        require(pool.isNFT, 'invalid _pid');
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(_amount <= user.holderTokens.length(), "invalid _amount");
        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accPerShare).div(1e18).sub(user.rewardDebt);
        user.rewardToClaim = user.rewardToClaim.add(pending);
        user.amount = user.holderTokens.length().sub(_amount);
        user.rewardDebt = user.amount.mul(pool.accPerShare).div(1e18);

        ERC721 erc721 = ERC721(pool.lpToken);

        for(uint256 i=0; i < _amount; i++){
            uint256 tokenId = user.holderTokens.at(0); 
            erc721.safeTransferFrom(address(this), address(msg.sender), tokenId);
            user.holderTokens.remove(tokenId);
        }
        pool.lpTokenAmount = pool.lpTokenAmount.sub(_amount);
        emit Withdraw(msg.sender, _pid, _amount);
        require(user.amount == user.holderTokens.length(), "user.amount != user.holderTokens.length()");
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdrawNFT(uint256 _pid, uint256 _amount) public nonReentrant {
        require(_pid < poolInfo.length, "invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];
        require(pool.isNFT, 'invalid _pid');
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(_amount <= user.holderTokens.length(), "invalid _amount");

        ERC721 erc721 = ERC721(pool.lpToken);
        
        for(uint256 i=0; i < _amount; i++){
            uint256 tokenId = user.holderTokens.at(0); 
            erc721.safeTransferFrom(address(this), address(msg.sender), tokenId);
            user.holderTokens.remove(tokenId);
        }

        pool.lpTokenAmount = pool.lpTokenAmount.sub(_amount);
        
        emit EmergencyWithdraw(msg.sender, _pid, _amount);
        user.amount = 0; // set amount to 0, there will be no rewards.
        user.rewardDebt = 0;
        user.rewardToClaim = 0;        
    }

    // Safe token transfer function, just in case if rounding error causes pool to not have enough mining token.
    function safeMiningTokenTransfer(address _to, uint256 _amount) internal {
        uint256 bal = miningToken.balanceOf(address(this));
        require(bal >= _amount, "balance is not enough.");
        miningToken.safeTransfer(_to, _amount);
    }

    function addAddressToWhitelist(address[] memory _addresses) public onlyAdmin {
        require(_addresses.length > 0, "_addresses is empty");
        for (uint256 i = 0; i < _addresses.length; i++) {
            address addr = _addresses[i];
            if(!whitelist[addr]){
                whitelistCount++;
                whitelist[addr] = true;
            }
        }
    }

    function removeAddressFromWhitelist(address[] memory _addresses) public onlyAdmin {
        require(_addresses.length > 0, "_addresses is empty");
        for (uint256 i = 0; i < _addresses.length; i++) {
            address addr = _addresses[i];
            if(whitelist[addr]){
                whitelistCount--;
                whitelist[addr] = false;
            }
        }
    }

    // Whether the address is on the whitelist
    function isWhitelisted(address _address) public view returns (bool) {
        return (whitelistSwitch == false) || whitelist[_address];
    }

    function updateWhitelistSwitch(bool _whitelistSwitch) public onlyAdmin {
        whitelistSwitch = _whitelistSwitch;
    }

    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external override returns (bytes4){
        bytes4 received = 0x150b7a02;
        return received;
    }

    function totalMiningRewardsUpToNow() public view returns(uint256){
        uint256 _block = block.number;
        if(_block <= phase1StartBlockNumber){
            return 0;
        }
        uint256 currentPhaseIndex = 0;
        if(_block > phaseEndBlockNumberArray[phaseEndBlockNumberArray.length.sub(1)]){
            currentPhaseIndex = phaseEndBlockNumberArray.length.sub(1);
            _block = phaseEndBlockNumberArray[currentPhaseIndex];
        }else{
            for(uint256 i=0; i<phaseEndBlockNumberArray.length; i++){
                if(_block <= phaseEndBlockNumberArray[i]){
                    currentPhaseIndex = i;
                    break;
                }
            }
        }

        uint256 rewards = 0;
        if(currentPhaseIndex == 0){
            rewards = _block.sub(phase1StartBlockNumber).mul(phasePerBlockRewardArray[0]);
        }else{
            rewards = _block.sub(phaseEndBlockNumberArray[currentPhaseIndex.sub(1)]).mul(phasePerBlockRewardArray[currentPhaseIndex]);
        }

        for(uint256 i = 0; i < currentPhaseIndex; i++){
            if(i == 0){
                rewards = rewards.add(phaseEndBlockNumberArray[0].sub(phase1StartBlockNumber).mul(phasePerBlockRewardArray[0]));
            }else{
                rewards = rewards.add((phaseEndBlockNumberArray[i].sub(phaseEndBlockNumberArray[i.sub(1)])).mul(phasePerBlockRewardArray[i]));
            }
        }

        return rewards;
    }
}

// File: contracts\MiddleWare.sol

pragma solidity 0.6.6;




contract MiddleWare is OwnableContract{

    address[] public addressArray;

    uint256[] public poolIdArray;

    constructor(address _shriekingChickAddr, address _luckyChickAddr, address _laborChickAddr, address _bossChickAddr, address _trumpChickAddr, address _miningAddr) public{
        addressArray = new address[](6);
        addressArray[0] = _shriekingChickAddr;
        addressArray[1] = _luckyChickAddr;
        addressArray[2] = _laborChickAddr;
        addressArray[3] = _bossChickAddr;
        addressArray[4] = _trumpChickAddr;
        addressArray[5] = _miningAddr;

        poolIdArray = new uint256[](5);
        poolIdArray[0] = 1;
        poolIdArray[1] = 2;
        poolIdArray[2] = 3;
        poolIdArray[3] = 4;
        poolIdArray[4] = 5;
    }

    function getWalletAndMining(address userAddress) public view returns(address[] memory, uint256[] memory, uint256[] memory){
        address[] memory addrArray = new address[](5);
        uint256[] memory walletArray = new uint256[](5);
        uint256[] memory miningArray = new uint256[](5);
        address _userAddress = userAddress;
        
        ChickMining chickMining = ChickMining(addressArray[5]);
        for(uint256 i=0; i<5; i++){
            LoserChickNFT loserChickNFT = LoserChickNFT(addressArray[i]);
            uint256 balanceof = loserChickNFT.balanceOf(userAddress);

            (uint256 amount, uint256 rewardDebt, uint256 rewardToClaim) = chickMining.getUserInfo(poolIdArray[i], _userAddress);

            addrArray[i] = addressArray[i];
            walletArray[i] = balanceof;
            miningArray[i] = amount;
        }
        return (addrArray, walletArray, miningArray);
    }

    function updateNFTAddress(uint256 index, uint256 poolId, address nftAddress) public onlyOwner{
        require(index < 5, 'Index is wrong!');
        addressArray[index] = nftAddress;
        poolIdArray[index] = poolId;
    }

    function updateMiningAddress(address miningAddress) public onlyOwner{
        addressArray[5] = miningAddress;
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_shriekingChickAddr","type":"address"},{"internalType":"address","name":"_luckyChickAddr","type":"address"},{"internalType":"address","name":"_laborChickAddr","type":"address"},{"internalType":"address","name":"_bossChickAddr","type":"address"},{"internalType":"address","name":"_trumpChickAddr","type":"address"},{"internalType":"address","name":"_miningAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingOwner","type":"address"}],"name":"NewPendingOwner","type":"event"},{"inputs":[],"name":"acceptOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"addressArray","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getWalletAndMining","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdArray","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pendingOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"miningAddress","type":"address"}],"name":"updateMiningAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"address","name":"nftAddress","type":"address"}],"name":"updateNFTAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162001c1638038062001c16833981810160405281019062000037919062000596565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600667ffffffffffffffff81118015620000d157600080fd5b50604051908082528060200260200182016040528015620001015781602001602082028036833780820191505090505b50600390805190602001906200011992919062000430565b508560036000815481106200012a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460036001815481106200018257fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550836003600281548110620001da57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600380815481106200023157fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508160036004815481106200028957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806003600581548110620002e157fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600567ffffffffffffffff811180156200034257600080fd5b50604051908082528060200260200182016040528015620003725781602001602082028036833780820191505090505b50600490805190602001906200038a929190620004bf565b50600160046000815481106200039c57fe5b906000526020600020018190555060026004600181548110620003bb57fe5b906000526020600020018190555060036004600281548110620003da57fe5b9060005260206000200181905550600480600381548110620003f857fe5b90600052602060002001819055506005600480815481106200041657fe5b90600052602060002001819055505050505050506200067a565b828054828255906000526020600020908101928215620004ac579160200282015b82811115620004ab5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000451565b5b509050620004bb919062000511565b5090565b828054828255906000526020600020908101928215620004fe579160200282015b82811115620004fd578251825591602001919060010190620004e0565b5b5090506200050d919062000557565b5090565b6200055491905b808211156200055057600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010162000518565b5090565b90565b6200057c91905b80821115620005785760008160009055506001016200055e565b5090565b90565b600081519050620005908162000660565b92915050565b60008060008060008060c08789031215620005b057600080fd5b6000620005c089828a016200057f565b9650506020620005d389828a016200057f565b9550506040620005e689828a016200057f565b9450506060620005f989828a016200057f565b93505060806200060c89828a016200057f565b92505060a06200061f89828a016200057f565b9150509295509295509295565b6000620006398262000640565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6200066b816200062c565b81146200067757600080fd5b50565b61158c806200068a6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a23610e311610071578063a23610e314610179578063e30c397814610195578063e5ce4581146101b3578063ebbc4965146101e5578063f2fde38b146101ef578063f851a4401461020b576100b4565b80630f96cf34146100b9578063704b6c02146100e9578063715018a6146101055780637b6e9d871461010f5780638465bef51461012b5780638da5cb5b1461015b575b600080fd5b6100d360048036038101906100ce9190610fef565b610229565b6040516100e091906112d6565b60405180910390f35b61010360048036038101906100fe9190610fc6565b610265565b005b61010d610393565b005b61012960048036038101906101249190611041565b6105fc565b005b61014560048036038101906101409190610fef565b610745565b60405161015291906113ef565b60405180910390f35b610163610766565b60405161017091906112d6565b60405180910390f35b610193600480360381019061018e9190610fc6565b61078b565b005b61019d610874565b6040516101aa91906112d6565b60405180910390f35b6101cd60048036038101906101c89190610fc6565b61089a565b6040516101dc93929190611343565b60405180910390f35b6101ed610c21565b005b61020960048036038101906102049190610fc6565b610e33565b005b610213610f61565b60405161022091906112d6565b60405180910390f35b6003818154811061023657fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102eb906113cf565b60405180910390fd5b7ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826040516103479291906112f1565b60405180910390a180600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610422576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610419906113cf565b60405180910390fd5b7f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b23646000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600060405161047592919061131a565b60405180910390a17ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040516104d192919061131a565b60405180910390a17fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600060405161052d92919061131a565b60405180910390a160008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461068b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610682906113cf565b60405180910390fd5b600583106106ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c59061138f565b60405180910390fd5b80600384815481106106dc57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816004848154811061073257fe5b9060005260206000200181905550505050565b6004818154811061075257fe5b906000526020600020016000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610811906113cf565b60405180910390fd5b80600360058154811061082957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606080606080600567ffffffffffffffff811180156108b857600080fd5b506040519080825280602002602001820160405280156108e75781602001602082028036833780820191505090505b5090506060600567ffffffffffffffff8111801561090457600080fd5b506040519080825280602002602001820160405280156109335781602001602082028036833780820191505090505b5090506060600567ffffffffffffffff8111801561095057600080fd5b5060405190808252806020026020018201604052801561097f5781602001602082028036833780820191505090505b50905060008790506000600360058154811061099757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008090505b6005811015610c0b576000600382815481106109e257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff166370a082318d6040518263ffffffff1660e01b8152600401610a4a91906112d6565b60206040518083038186803b158015610a6257600080fd5b505afa158015610a76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9a9190611018565b905060008060008673ffffffffffffffffffffffffffffffffffffffff16631069f3b560048881548110610aca57fe5b90600052602060002001548a6040518363ffffffff1660e01b8152600401610af392919061140a565b60606040518083038186803b158015610b0b57600080fd5b505afa158015610b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b439190611090565b92509250925060038681548110610b5657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168b8781518110610b8d57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838a8781518110610bd457fe5b60200260200101818152505082898781518110610bed57fe5b602002602001018181525050505050505080806001019150506109ca565b5084848497509750975050505050509193909250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca8906113af565b60405180910390fd5b7f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b23646000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610d259291906112f1565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090507fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051610de79291906112f1565b60405180910390a180600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ec2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb9906113cf565b60405180910390fd5b7fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051610f159291906112f1565b60405180910390a180600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610f9681611528565b92915050565b600081359050610fab8161153f565b92915050565b600081519050610fc08161153f565b92915050565b600060208284031215610fd857600080fd5b6000610fe684828501610f87565b91505092915050565b60006020828403121561100157600080fd5b600061100f84828501610f9c565b91505092915050565b60006020828403121561102a57600080fd5b600061103884828501610fb1565b91505092915050565b60008060006060848603121561105657600080fd5b600061106486828701610f9c565b935050602061107586828701610f9c565b925050604061108686828701610f87565b9150509250925092565b6000806000606084860312156110a557600080fd5b60006110b386828701610fb1565b93505060206110c486828701610fb1565b92505060406110d586828701610fb1565b9150509250925092565b60006110eb838361111e565b60208301905092915050565b600061110383836112b8565b60208301905092915050565b611118816114f2565b82525050565b611127816114b6565b82525050565b611136816114b6565b82525050565b600061114782611453565b6111518185611483565b935061115c83611433565b8060005b8381101561118d57815161117488826110df565b975061117f83611469565b925050600181019050611160565b5085935050505092915050565b60006111a58261145e565b6111af8185611494565b93506111ba83611443565b8060005b838110156111eb5781516111d288826110f7565b97506111dd83611476565b9250506001810190506111be565b5085935050505092915050565b6000611205600f836114a5565b91507f496e6465782069732077726f6e672100000000000000000000000000000000006000830152602082019050919050565b60006112456010836114a5565b91507f6f6e6c7950656e64696e674f776e6572000000000000000000000000000000006000830152602082019050919050565b60006112856009836114a5565b91507f6f6e6c794f776e657200000000000000000000000000000000000000000000006000830152602082019050919050565b6112c1816114e8565b82525050565b6112d0816114e8565b82525050565b60006020820190506112eb600083018461112d565b92915050565b6000604082019050611306600083018561112d565b611313602083018461112d565b9392505050565b600060408201905061132f600083018561112d565b61133c602083018461110f565b9392505050565b6000606082019050818103600083015261135d818661113c565b90508181036020830152611371818561119a565b90508181036040830152611385818461119a565b9050949350505050565b600060208201905081810360008301526113a8816111f8565b9050919050565b600060208201905081810360008301526113c881611238565b9050919050565b600060208201905081810360008301526113e881611278565b9050919050565b600060208201905061140460008301846112c7565b92915050565b600060408201905061141f60008301856112c7565b61142c602083018461112d565b9392505050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006114c1826114c8565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006114fd82611504565b9050919050565b600061150f82611516565b9050919050565b6000611521826114c8565b9050919050565b611531816114b6565b811461153c57600080fd5b50565b611548816114e8565b811461155357600080fd5b5056fea26469706673582212200dd32ab777b687344e73d071bac772eaace176a77784de8f8566e5ad844f3e6c64736f6c63430006060033000000000000000000000000e50b1f6e58a0a77b0a41aedc085190808d25d7060000000000000000000000008580a90f6e378db283ddb8af06356a962551e89a000000000000000000000000388eb34b54fe92e944b81a23f8e60146ca8381800000000000000000000000004f1e6318acc9ee33c88f0e3e3578d5ad62e192850000000000000000000000004f17c6514b9ca3abccfdefd12df2dfa195a76dc400000000000000000000000021b8339760ebd0dd7644aad8d0b54f6ced2ab633

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

000000000000000000000000e50b1f6e58a0a77b0a41aedc085190808d25d7060000000000000000000000008580a90f6e378db283ddb8af06356a962551e89a000000000000000000000000388eb34b54fe92e944b81a23f8e60146ca8381800000000000000000000000004f1e6318acc9ee33c88f0e3e3578d5ad62e192850000000000000000000000004f17c6514b9ca3abccfdefd12df2dfa195a76dc400000000000000000000000021b8339760ebd0dd7644aad8d0b54f6ced2ab633

-----Decoded View---------------
Arg [0] : _shriekingChickAddr (address): 0xe50b1f6e58a0a77b0a41aedc085190808d25d706
Arg [1] : _luckyChickAddr (address): 0x8580a90f6e378db283ddb8af06356a962551e89a
Arg [2] : _laborChickAddr (address): 0x388eb34b54fe92e944b81a23f8e60146ca838180
Arg [3] : _bossChickAddr (address): 0x4f1e6318acc9ee33c88f0e3e3578d5ad62e19285
Arg [4] : _trumpChickAddr (address): 0x4f17c6514b9ca3abccfdefd12df2dfa195a76dc4
Arg [5] : _miningAddr (address): 0x21b8339760ebd0dd7644aad8d0b54f6ced2ab633

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000e50b1f6e58a0a77b0a41aedc085190808d25d706
Arg [1] : 0000000000000000000000008580a90f6e378db283ddb8af06356a962551e89a
Arg [2] : 000000000000000000000000388eb34b54fe92e944b81a23f8e60146ca838180
Arg [3] : 0000000000000000000000004f1e6318acc9ee33c88f0e3e3578d5ad62e19285
Arg [4] : 0000000000000000000000004f17c6514b9ca3abccfdefd12df2dfa195a76dc4
Arg [5] : 00000000000000000000000021b8339760ebd0dd7644aad8d0b54f6ced2ab633


Deployed ByteCode Sourcemap

109020:2094:0:-:0;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;109020:2094:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;9;2:12;109067:29:0;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;68240:129;;;;;;;;;;;;;;;;:::i;:::-;;67628:301;;;:::i;:::-;;110755:230;;;;;;;;;;;;;;;;:::i;:::-;;109105:28;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;66724:20;;;:::i;:::-;;;;;;;;;;;;;;;;110993:118;;;;;;;;;;;;;;;;:::i;:::-;;66751:27;;;:::i;:::-;;;;;;;;;;;;;;;;109818:929;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;67941:283;;;:::i;:::-;;67446:174;;;;;;;;;;;;;;;;:::i;:::-;;66785:20;;;:::i;:::-;;;;;;;;;;;;;;;;109067:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;68240:129::-;67155:5;;;;;;;;;;;67141:19;;:10;:19;;;67133:40;;;;;;;;;;;;;;;;;;;;;;68309:25:::1;68318:5;;;;;;;;;;;68325:8;68309:25;;;;;;;;;;;;;;;;68353:8;68345:5;;:16;;;;;;;;;;;;;;;;;;68240:129:::0;:::o;67628:301::-;67155:5;;;;;;;;;;;67141:19;;:10;:19;;;67133:40;;;;;;;;;;;;;;;;;;;;;;67698:27:::1;67707:5;::::0;::::1;;;;;;;;;67722:1;67698:27;;;;;;;;;;;;;;;;67741;67750:5;;;;;;;;;;;67765:1;67741:27;;;;;;;;;;;;;;;;67784:41;67800:12;;;;;;;;;;;67822:1;67784:41;;;;;;;;;;;;;;;;67854:1;67838:5:::0;::::1;:18;;;;;;;;;;;;;;;;;;67890:1;67867:12;;:25;;;;;;;;;;;;;;;;;;67919:1;67903:5;;:18;;;;;;;;;;;;;;;;;;67628:301::o:0;110755:230::-;67155:5;;;;;;;;;;;67141:19;;:10;:19;;;67133:40;;;;;;;;;;;;;;;;;;;;;;110875:1:::1;110867:5;:9;110859:37;;;;;;;;;;;;;;;;;;;;;;110929:10;110907:12;110920:5;110907:19;;;;;;;;;;;;;;;;:32;;;;;;;;;;;;;;;;;;110971:6;110950:11;110962:5;110950:18;;;;;;;;;;;;;;;:27;;;;110755:230:::0;;;:::o;109105:28::-;;;;;;;;;;;;;;;;;;;;;;;;;:::o;66724:20::-;;;;;;;;;;;;;:::o;110993:118::-;67155:5;;;;;;;;;;;67141:19;;:10;:19;;;67133:40;;;;;;;;;;;;;;;;;;;;;;111090:13:::1;111072:12;111085:1;111072:15;;;;;;;;;;;;;;;;:31;;;;;;;;;;;;;;;;;;110993:118:::0;:::o;66751:27::-;;;;;;;;;;;;;:::o;109818:929::-;109887:16;109905;109923;109951:26;109994:1;109980:16;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;109980:16:0;;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;125:4;109:14;101:6;88:42;156:4;148:6;144:17;134:27;;0:165;109980:16:0;;;;109951:45;;110007:28;110052:1;110038:16;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;110038:16:0;;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;125:4;109:14;101:6;88:42;156:4;148:6;144:17;134:27;;0:165;110038:16:0;;;;110007:47;;110065:28;110110:1;110096:16;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;110096:16:0;;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;125:4;109:14;101:6;88:42;156:4;148:6;144:17;134:27;;0:165;110096:16:0;;;;110065:47;;110123:20;110146:11;110123:34;;110178:23;110216:12;110229:1;110216:15;;;;;;;;;;;;;;;;;;;;;;;;;110178:54;;110247:9;110257:1;110247:11;;110243:442;110262:1;110260;:3;110243:442;;;110284:27;110328:12;110341:1;110328:15;;;;;;;;;;;;;;;;;;;;;;;;;110284:60;;110359:17;110379:13;:23;;;110403:11;110379:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;110379:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;110379:36:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;110379:36:0;;;;;;;;;110359:56;;110433:14;110449:18;110469:21;110494:11;:23;;;110518:11;110530:1;110518:14;;;;;;;;;;;;;;;;110534:12;110494:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;110494:53:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;110494:53:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;110494:53:0;;;;;;;;;110432:115;;;;;;110579:12;110592:1;110579:15;;;;;;;;;;;;;;;;;;;;;;;;;110564:9;110574:1;110564:12;;;;;;;;;;;;;:30;;;;;;;;;;;110626:9;110609:11;110621:1;110609:14;;;;;;;;;;;;;:26;;;;;110667:6;110650:11;110662:1;110650:14;;;;;;;;;;;;;:23;;;;;110243:442;;;;;110265:3;;;;;;;110243:442;;;;110703:9;110714:11;110727;110695:44;;;;;;;;;;;109818:929;;;;;:::o;67941:283::-;67260:12;;;;;;;;;;;67246:26;;:10;:26;;;67238:54;;;;;;;;;;;;;;;;;;;;;;68004:29:::1;68013:5;::::0;::::1;;;;;;;;;68020:12;;;;;;;;;;;68004:29;;;;;;;;;;;;;;;;68052:12;;;;;;;;;;;68044:5;::::0;:20:::1;;;;;;;;;;;;;;;;;;68077:23;68111:1:::0;68077:36:::1;;68129:46;68145:12;;;;;;;;;;;68159:15;68129:46;;;;;;;;;;;;;;;;68201:15;68186:12;;:30;;;;;;;;;;;;;;;;;;67303:1;67941:283::o:0;67446:174::-;67155:5;;;;;;;;;;;67141:19;;:10;:19;;;67133:40;;;;;;;;;;;;;;;;;;;;;;67529:44:::1;67545:12;;;;;;;;;;;67559:13;67529:44;;;;;;;;;;;;;;;;67599:13;67584:12;;:28;;;;;;;;;;;;;;;;;;67446:174:::0;:::o;66785:20::-;;;;;;;;;;;;;:::o;5:130:-1:-;;85:6;72:20;63:29;;97:33;124:5;97:33;;;57:78;;;;;142:130;;222:6;209:20;200:29;;234:33;261:5;234:33;;;194:78;;;;;279:134;;363:6;357:13;348:22;;375:33;402:5;375:33;;;342:71;;;;;420:241;;524:2;512:9;503:7;499:23;495:32;492:2;;;540:1;537;530:12;492:2;575:1;592:53;637:7;628:6;617:9;613:22;592:53;;;582:63;;554:97;486:175;;;;;668:241;;772:2;760:9;751:7;747:23;743:32;740:2;;;788:1;785;778:12;740:2;823:1;840:53;885:7;876:6;865:9;861:22;840:53;;;830:63;;802:97;734:175;;;;;916:263;;1031:2;1019:9;1010:7;1006:23;1002:32;999:2;;;1047:1;1044;1037:12;999:2;1082:1;1099:64;1155:7;1146:6;1135:9;1131:22;1099:64;;;1089:74;;1061:108;993:186;;;;;1186:491;;;;1324:2;1312:9;1303:7;1299:23;1295:32;1292:2;;;1340:1;1337;1330:12;1292:2;1375:1;1392:53;1437:7;1428:6;1417:9;1413:22;1392:53;;;1382:63;;1354:97;1482:2;1500:53;1545:7;1536:6;1525:9;1521:22;1500:53;;;1490:63;;1461:98;1590:2;1608:53;1653:7;1644:6;1633:9;1629:22;1608:53;;;1598:63;;1569:98;1286:391;;;;;;1684:535;;;;1833:2;1821:9;1812:7;1808:23;1804:32;1801:2;;;1849:1;1846;1839:12;1801:2;1884:1;1901:64;1957:7;1948:6;1937:9;1933:22;1901:64;;;1891:74;;1863:108;2002:2;2020:64;2076:7;2067:6;2056:9;2052:22;2020:64;;;2010:74;;1981:109;2121:2;2139:64;2195:7;2186:6;2175:9;2171:22;2139:64;;;2129:74;;2100:109;1795:424;;;;;;2227:173;;2314:46;2356:3;2348:6;2314:46;;;2389:4;2384:3;2380:14;2366:28;;2307:93;;;;;2409:173;;2496:46;2538:3;2530:6;2496:46;;;2571:4;2566:3;2562:14;2548:28;;2489:93;;;;;2590:142;2681:45;2720:5;2681:45;;;2676:3;2669:58;2663:69;;;2739:103;2812:24;2830:5;2812:24;;;2807:3;2800:37;2794:48;;;2849:113;2932:24;2950:5;2932:24;;;2927:3;2920:37;2914:48;;;3000:690;;3145:54;3193:5;3145:54;;;3212:86;3291:6;3286:3;3212:86;;;3205:93;;3319:56;3369:5;3319:56;;;3395:7;3423:1;3408:260;3433:6;3430:1;3427:13;3408:260;;;3500:6;3494:13;3521:63;3580:3;3565:13;3521:63;;;3514:70;;3601:60;3654:6;3601:60;;;3591:70;;3465:203;3455:1;3452;3448:9;3443:14;;3408:260;;;3412:14;3681:3;3674:10;;3124:566;;;;;;;;3729:690;;3874:54;3922:5;3874:54;;;3941:86;4020:6;4015:3;3941:86;;;3934:93;;4048:56;4098:5;4048:56;;;4124:7;4152:1;4137:260;4162:6;4159:1;4156:13;4137:260;;;4229:6;4223:13;4250:63;4309:3;4294:13;4250:63;;;4243:70;;4330:60;4383:6;4330:60;;;4320:70;;4194:203;4184:1;4181;4177:9;4172:14;;4137:260;;;4141:14;4410:3;4403:10;;3853:566;;;;;;;;4428:315;;4588:67;4652:2;4647:3;4588:67;;;4581:74;;4688:17;4684:1;4679:3;4675:11;4668:38;4734:2;4729:3;4725:12;4718:19;;4574:169;;;;4752:316;;4912:67;4976:2;4971:3;4912:67;;;4905:74;;5012:18;5008:1;5003:3;4999:11;4992:39;5059:2;5054:3;5050:12;5043:19;;4898:170;;;;5077:308;;5237:66;5301:1;5296:3;5237:66;;;5230:73;;5336:11;5332:1;5327:3;5323:11;5316:32;5376:2;5371:3;5367:12;5360:19;;5223:162;;;;5393:103;5466:24;5484:5;5466:24;;;5461:3;5454:37;5448:48;;;5503:113;5586:24;5604:5;5586:24;;;5581:3;5574:37;5568:48;;;5623:213;;5741:2;5730:9;5726:18;5718:26;;5755:71;5823:1;5812:9;5808:17;5799:6;5755:71;;;5712:124;;;;;5843:324;;5989:2;5978:9;5974:18;5966:26;;6003:71;6071:1;6060:9;6056:17;6047:6;6003:71;;;6085:72;6153:2;6142:9;6138:18;6129:6;6085:72;;;5960:207;;;;;;6174:340;;6328:2;6317:9;6313:18;6305:26;;6342:71;6410:1;6399:9;6395:17;6386:6;6342:71;;;6424:80;6500:2;6489:9;6485:18;6476:6;6424:80;;;6299:215;;;;;;6521:879;;6845:2;6834:9;6830:18;6822:26;;6895:9;6889:4;6885:20;6881:1;6870:9;6866:17;6859:47;6920:108;7023:4;7014:6;6920:108;;;6912:116;;7076:9;7070:4;7066:20;7061:2;7050:9;7046:18;7039:48;7101:108;7204:4;7195:6;7101:108;;;7093:116;;7257:9;7251:4;7247:20;7242:2;7231:9;7227:18;7220:48;7282:108;7385:4;7376:6;7282:108;;;7274:116;;6816:584;;;;;;;7407:407;;7598:2;7587:9;7583:18;7575:26;;7648:9;7642:4;7638:20;7634:1;7623:9;7619:17;7612:47;7673:131;7799:4;7673:131;;;7665:139;;7569:245;;;;7821:407;;8012:2;8001:9;7997:18;7989:26;;8062:9;8056:4;8052:20;8048:1;8037:9;8033:17;8026:47;8087:131;8213:4;8087:131;;;8079:139;;7983:245;;;;8235:407;;8426:2;8415:9;8411:18;8403:26;;8476:9;8470:4;8466:20;8462:1;8451:9;8447:17;8440:47;8501:131;8627:4;8501:131;;;8493:139;;8397:245;;;;8649:213;;8767:2;8756:9;8752:18;8744:26;;8781:71;8849:1;8838:9;8834:17;8825:6;8781:71;;;8738:124;;;;;8869:324;;9015:2;9004:9;9000:18;8992:26;;9029:71;9097:1;9086:9;9082:17;9073:6;9029:71;;;9111:72;9179:2;9168:9;9164:18;9155:6;9111:72;;;8986:207;;;;;;9200:151;;9286:3;9278:11;;9324:4;9319:3;9315:14;9307:22;;9272:79;;;;9358:151;;9444:3;9436:11;;9482:4;9477:3;9473:14;9465:22;;9430:79;;;;9516:137;;9625:5;9619:12;9609:22;;9590:63;;;;9660:137;;9769:5;9763:12;9753:22;;9734:63;;;;9804:108;;9902:4;9897:3;9893:14;9885:22;;9879:33;;;;9919:108;;10017:4;10012:3;10008:14;10000:22;;9994:33;;;;10035:178;;10165:6;10160:3;10153:19;10202:4;10197:3;10193:14;10178:29;;10146:67;;;;;10222:178;;10352:6;10347:3;10340:19;10389:4;10384:3;10380:14;10365:29;;10333:67;;;;;10409:163;;10524:6;10519:3;10512:19;10561:4;10556:3;10552:14;10537:29;;10505:67;;;;;10580:91;;10642:24;10660:5;10642:24;;;10631:35;;10625:46;;;;10678:121;;10751:42;10744:5;10740:54;10729:65;;10723:76;;;;10806:72;;10868:5;10857:16;;10851:27;;;;10885:129;;10972:37;11003:5;10972:37;;;10959:50;;10953:61;;;;11021:121;;11100:37;11131:5;11100:37;;;11087:50;;11081:61;;;;11149:108;;11228:24;11246:5;11228:24;;;11215:37;;11209:48;;;;11264:117;11333:24;11351:5;11333:24;;;11326:5;11323:35;11313:2;;11372:1;11369;11362:12;11313:2;11307:74;;11388:117;11457:24;11475:5;11457:24;;;11450:5;11447:35;11437:2;;11496:1;11493;11486:12;11437:2;11431:74;

Swarm Source

ipfs://0dd32ab777b687344e73d071bac772eaace176a77784de8f8566e5ad844f3e6c
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.