ETH Price: $3,941.62 (+7.41%)

Contract

0xBA955E54127a3A98220e19020155488d1840BcE7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Payout Reward T1128558802021-07-19 8:07:011241 days ago1626682021IN
NFTeGG: Farm
0 ETH0.0034762548
Payout Reward T1128558802021-07-19 8:07:011241 days ago1626682021IN
NFTeGG: Farm
0 ETH0.01105498163
Payout Reward T1128558802021-07-19 8:07:011241 days ago1626682021IN
NFTeGG: Farm
0 ETH0.00396180.00000145
Payout Reward T1125484912021-06-01 12:14:011289 days ago1622549641IN
NFTeGG: Farm
0 ETH0.0013428315
Payout Reward T1125449592021-05-31 22:58:461290 days ago1622501926IN
NFTeGG: Farm
0 ETH0.0020078727.83
Payout Reward T1125449562021-05-31 22:58:061290 days ago1622501886IN
NFTeGG: Farm
0 ETH0.0020078727.83
Payout Reward T1125449562021-05-31 22:58:061290 days ago1622501886IN
NFTeGG: Farm
0 ETH0.0020078727.83
Payout Reward T1125449332021-05-31 22:52:191290 days ago1622501539IN
NFTeGG: Farm
0 ETH0.0026774430
Payout Reward T1125428762021-05-31 15:21:051290 days ago1622474465IN
NFTeGG: Farm
0 ETH0.0039107854
Payout Reward T1125428682021-05-31 15:18:391290 days ago1622474319IN
NFTeGG: Farm
0 ETH0.0031865644
Payout Reward T1125428572021-05-31 15:15:481290 days ago1622474148IN
NFTeGG: Farm
0 ETH0.0032589945
Payout Reward T1125428542021-05-31 15:15:281290 days ago1622474128IN
NFTeGG: Farm
0 ETH0.0032589945
Payout Reward T1125428382021-05-31 15:11:111290 days ago1622473871IN
NFTeGG: Farm
0 ETH0.0035486749
Payout Reward T1125428322021-05-31 15:10:191290 days ago1622473819IN
NFTeGG: Farm
0 ETH0.0035486749
Payout Reward T1125428282021-05-31 15:10:051290 days ago1622473805IN
NFTeGG: Farm
0 ETH0.0035486749
Payout Reward T1125427832021-05-31 14:59:351290 days ago1622473175IN
NFTeGG: Farm
0 ETH0.0024623434
Payout Reward T1125427742021-05-31 14:57:581290 days ago1622473078IN
NFTeGG: Farm
0 ETH0.0026289136.3
Payout Reward T1125426832021-05-31 14:34:301290 days ago1622471670IN
NFTeGG: Farm
0 ETH0.0021002329
Payout Reward T1125426832021-05-31 14:34:301290 days ago1622471670IN
NFTeGG: Farm
0 ETH0.0021002329
Payout Reward T1125426832021-05-31 14:34:301290 days ago1622471670IN
NFTeGG: Farm
0 ETH0.0021002329
Payout Reward T1125426832021-05-31 14:34:301290 days ago1622471670IN
NFTeGG: Farm
0 ETH0.0021002329
Payout Reward T1125426832021-05-31 14:34:301290 days ago1622471670IN
NFTeGG: Farm
0 ETH0.0021002329
Payout Reward T1125426692021-05-31 14:31:421290 days ago1622471502IN
NFTeGG: Farm
0 ETH0.0021002329
Payout Reward T1125424272021-05-31 13:36:541290 days ago1622468214IN
NFTeGG: Farm
0 ETH0.0021002329
Payout Reward T1125424272021-05-31 13:36:541290 days ago1622468214IN
NFTeGG: Farm
0 ETH0.0021002329
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NFTeGG_Farm_3_Final

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-12-03
*/

/**
 *Submitted for verification at Etherscan.io on 2020-11-25
*/

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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--] = byte(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}

/**
 * @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 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) {
        return _get(map, key, "EnumerableMap: nonexistent key");
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     */
    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(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(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(uint256(_get(map._inner, bytes32(key))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint256(_get(map._inner, bytes32(key), errorMessage)));
    }
}

/**
 * @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.0.0, only sets of type `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];
    }

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

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

/**
 * @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, 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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * 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);
        uint256 c = a - b;

        return c;
    }

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

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

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

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

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

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

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

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

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

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

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
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 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;
    }
}

/**
 * @dev Contract module that can be used to recover ERC20 compatible tokens stuck in the contract.
 */
contract ERC20Recoverable is Ownable {
    /**
     * @dev Used to transfer tokens stuck on this contract to another address.
     */
    function recoverERC20(address token, address recipient, uint256 amount) external onlyOwner returns (bool) {
        return IERC20(token).transfer(recipient, amount);
    }

    /**
     * @dev Used to approve recovery of stuck tokens. May also be used to approve token transfers in advance.
     */
     function recoverERC20Approve(address token, address spender, uint256 amount) external onlyOwner returns (bool) {
        return IERC20(token).approve(spender, amount);
    }
}

/**
 * @dev Contract module that can be used to recover ERC20 compatible tokens stuck in the contract.
 */
contract ERC721Recoverable is Ownable {
    /**
     * @dev Used to recover a stuck token.
     */
    function recoverERC721(address token, address recipient, uint256 tokenId) external onlyOwner {
        return IERC721(token).transferFrom(address(this), recipient, tokenId);
    }

    /**
     * @dev Used to recover a stuck token using the safe transfer function of ERC721.
     */
    function recoverERC721Safe(address token, address recipient, uint256 tokenId) external onlyOwner {
        return IERC721(token).safeTransferFrom(address(this), recipient, tokenId);
    }

    /**
     * @dev Used to approve the recovery of a stuck token.
     */
    function recoverERC721Approve(address token, address recipient, uint256 tokenId) external onlyOwner {
        return IERC721(token).approve(recipient, tokenId);
    }

    /**
     * @dev Used to approve the recovery of stuck token, also in future.
     */
    function recoverERC721ApproveAll(address token, address recipient, bool approved) external onlyOwner {
        return IERC721(token).setApprovalForAll(recipient, approved);
    }
}

/**
 * @dev Most credited to OpenZeppelin ERC721.sol, but with some adjustments.
 */
contract T2 is Context, Ownable, ERC165, IERC721, IERC721Metadata, IERC721Enumerable, ERC20Recoverable, ERC721Recoverable {
    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;

    // Base URI
    string private _baseURI;

    // Specified if tokens are transferable. Can be flipped by the owner.
    bool private _transferable;

    // Price per token. Is chosen and can be changed by contract owner.
    uint256 private _tokenPrice;

    // Counter for token id
    uint256 private _nextId = 1;

    /*
     *     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, string memory baseURI, bool transferable, uint256 tokenPrice) public {
        _name = name;
        _symbol = symbol;
        _baseURI = baseURI;
        _transferable = transferable;
        _tokenPrice = tokenPrice;

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

// public functions:
    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) external view 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 override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

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

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

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

        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(_baseURI, 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() external view returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev Returns if tokens are globally transferable currently. That may be decided by the contract owner.
     */
    function transferable() external view returns (bool) {
        return _transferable;
    }

    /**
     * @dev Price per token for public purchase.
     */
    function tokenPrice() external view returns (uint256) {
        return _tokenPrice;
    }

    /**
     * @dev Next token id.
     */
    function nextTokenId() public view returns (uint256) {
        return _nextId;
    }

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

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() external view 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) external view override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

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

        require(_msgSender() == owner || 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 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) external 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 override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) external 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) external 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);
    }

    function buyToken() external payable returns (bool)
    {
        uint256 paidAmount = msg.value;
        require(paidAmount == _tokenPrice, "Invalid amount for token purchase");
        _mint(msg.sender, nextTokenId());
        _incrementTokenId();
        payable(owner()).transfer(paidAmount);
        return true;
    }

    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public returns (bool) {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
        return true;
    }

    function burnAnyFrom(address burner) public returns (bool) {
        require(_holderTokens[burner].length() > 0, "Address does not have any tokens to burn");
        return burn(_holderTokens[burner].at(0));
    }

    function burnAny() external returns (bool) {
        return burnAnyFrom(msg.sender);
    }

// owner functions:
    /**
     * @dev Function to set the base URI for all token IDs. It is automatically added as a prefix to the token id in {tokenURI} to retrieve the token URI.
     */
    function setBaseURI(string calldata baseURI_) external onlyOwner {
        _baseURI = baseURI_;
    }

    /**
     * @dev Function for the contract owner to allow or disallow token transfers.
     */
    function setTransferable(bool allowed) external onlyOwner {
        _transferable = allowed;
    }

    /**
     * @dev Sets a new token price.
     */
    function setTokenPrice(uint256 newPrice) external onlyOwner {
        _tokenPrice = newPrice;
    }

// internal functions:
    /**
     * @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) private {
        _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) private view 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) private view returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || 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) private {
        _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) private {
        _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) private {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _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 = ownerOf(tokenId);

        // Clear approvals
        _approve(address(0), 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`.
     * - contract owner must have transfer globally allowed.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) private {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");
        require(_transferable == true, "ERC721 transfer not permitted by contract owner");

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

    function _approve(address to, uint256 tokenId) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }

    function _incrementTokenId() private {
        _nextId = _nextId.add(1);
    }
}


/**
 * @dev Most credited to OpenZeppelin ERC721.sol, but with some adjustments.
 */
contract T1 is Context, Ownable, ERC165, IERC721, IERC721Metadata, IERC721Enumerable, ERC20Recoverable, ERC721Recoverable {
    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;

    // ERC721 token contract address serving as "ticket" to flip the bool in additional data
    address private _ticketContract;

    // Base URI
    string private _baseURI;

    // Price per token. Is chosen and can be changed by contract owner.
    uint256 private _tokenPrice;

    struct AdditionalData {
        bool isA; // A (true) or B (false)
        bool someBool; // may be flipped by token owner if he owns T2; default value in _mint
        uint8 power;
    }

    // Mapping from token ID to its additional data
    mapping (uint256 => AdditionalData) private _additionalData;

    // Counter for token id, and types
    uint256 private _nextId = 1;
    uint32 private _countA = 0; // count of B is implicit and not needed

    mapping (address => bool) public freeBoolSetters; // addresses which do not need to pay to set the bool variable

    // limits
    uint256 public constant MAX_SUPPLY = 7000;
    uint32 public constant MAX_A = 1000;
    uint32 public constant MAX_B = 6000;

    /*
     *     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, string memory baseURI, uint256 tokenPrice, address ticketContract) public {
        _name = name;
        _symbol = symbol;
        _baseURI = baseURI;
        _tokenPrice = tokenPrice;
        _ticketContract = ticketContract;

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

// public functions:
    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view 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 override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

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

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

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

        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(_baseURI, 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() external view returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev Retrieves address of the ticket token contract.
     */
    function ticketContract() external view returns (address) {
        return _ticketContract;
    }

    /**
     * @dev Price per token for public purchase.
     */
    function tokenPrice() external view returns (uint256) {
        return _tokenPrice;
    }

    /**
     * @dev Next token id.
     */
    function nextTokenId() public view returns (uint256) {
        return _nextId;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view override returns (uint256) {
        require(index < balanceOf(owner), "Invalid token index for holder");
        return _holderTokens[owner].at(index);
    }

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

    /**
     * @dev Supply of A tokens.
     */
    function supplyOfA() external view returns (uint256) {
        return _countA;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) external view override returns (uint256) {
        require(index < _tokenOwners.length(), "Invalid token index");
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

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

        require(_msgSender() == owner || 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 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) external 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 override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) external 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) external 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 Buys a token. Needs to be supplied the correct amount of ether.
     */
    function buyToken() external payable returns (bool)
    {
        uint256 paidAmount = msg.value;
        require(paidAmount == _tokenPrice, "Invalid amount for token purchase");
        address to = msg.sender;
        uint256 nextToken = nextTokenId();
        uint256 remainingTokens = 1 + MAX_SUPPLY - nextToken;
        require(remainingTokens > 0, "Maximum supply already reached");

        _holderTokens[to].add(nextToken);
        _tokenOwners.set(nextToken, to);

        uint256 remainingA = MAX_A - _countA;
        bool a = (uint256(keccak256(abi.encodePacked(blockhash(block.number - 1), now, nextToken))) % remainingTokens) < remainingA;
        uint8 pow = uint8(uint256(keccak256(abi.encodePacked(blockhash(block.number - 1), now + 1, nextToken))) % (a ? 21 : 79) + (a ? 80 : 1));
        _additionalData[nextToken] = AdditionalData(a, false, pow);

        if (a) {
            _countA = _countA + 1;
        }

        emit Transfer(address(0), to, nextToken);
        _nextId = nextToken.add(1);

        payable(owner()).transfer(paidAmount);
        return true;
    }

    function buy6Tokens() external payable returns (bool)
    {
        uint256 paidAmount = msg.value;
        require(paidAmount == (_tokenPrice * 5 + _tokenPrice / 2), "Invalid amount for token purchase"); // price for 6 tokens is 5.5 times the price for one token
        address to = msg.sender;
        uint256 nextToken = nextTokenId();
        uint256 remainingTokens = 1 + MAX_SUPPLY - nextToken;
        require(remainingTokens > 5, "Maximum supply already reached");
        uint256 endLoop = nextToken.add(6);

        while (nextToken < endLoop) {
            _holderTokens[to].add(nextToken);
            _tokenOwners.set(nextToken, to);

            uint256 remainingA = MAX_A - _countA;
            bool a = (uint256(keccak256(abi.encodePacked(blockhash(block.number - 1), now, nextToken))) % remainingTokens) < remainingA;
            uint8 pow = uint8(uint256(keccak256(abi.encodePacked(blockhash(block.number - 1), now + 1, nextToken))) % (a ? 21 : 79) + (a ? 80 : 1));
            _additionalData[nextToken] = AdditionalData(a, false, pow);

            if (a) {
                _countA = _countA + 1;
            }

            emit Transfer(address(0), to, nextToken);
            nextToken = nextToken.add(1);
            remainingTokens = remainingTokens.sub(1);
        }

        _nextId = _nextId.add(6);

        payable(owner()).transfer(paidAmount);
        return true;
    }

    /**
     * @dev Retrieves if the specified token is of A type.
     */
    function isA(uint256 tokenId) external view returns (bool) {
        require(_exists(tokenId), "Token ID does not exist");
        return _additionalData[tokenId].isA;
    }

    /**
     * @dev Retrieves if the specified token has its someBool attribute set.
     */
    function someBool(uint256 tokenId) external view returns (bool) {
        require(_exists(tokenId), "Token ID does not exist");
        return _additionalData[tokenId].someBool;
    }

    /**
     * @dev Sets someBool for the specified token. Can only be used by the owner of the token (not an approved account).
     * Owner needs to also own a ticket token to set the someBool attribute.
     */
    function setSomeBool(uint256 tokenId, bool newValue) external {
        require(_exists(tokenId), "Token ID does not exist");
        require(ownerOf(tokenId) == msg.sender, "Only token owner can set attribute");

        if (freeBoolSetters[msg.sender] == false && _additionalData[tokenId].someBool != newValue) {
            require(T2(_ticketContract).burnAnyFrom(msg.sender), "Token owner ticket could not be burned");
        }

        _additionalData[tokenId].someBool = newValue;
    }

    /**
     * @dev Retrieves the power value for a specified token.
     */
    function power(uint256 tokenId) external view returns (uint8) {
        require(_exists(tokenId), "Token ID does not exist");
        return _additionalData[tokenId].power;
    }

// owner functions:
    /**
     * @dev Function to set the base URI for all token IDs. It is automatically added as a prefix to the token id in {tokenURI} to retrieve the token URI.
     */
    function setBaseURI(string calldata baseURI_) external onlyOwner {
        _baseURI = baseURI_;
    }

    /**
     * @dev Sets a new token price.
     */
    function setTokenPrice(uint256 newPrice) external onlyOwner {
        _tokenPrice = newPrice;
    }

    function setFreeBoolSetter(address holder, bool setForFree) external onlyOwner {
        freeBoolSetters[holder] = setForFree;
    }

// internal functions:
    /**
     * @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) private {
        _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`).
     */
    function _exists(uint256 tokenId) private view returns (bool) {
        return tokenId < _nextId && _tokenOwners.contains(tokenId);
    }

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

    /**
     * @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`.
     * - contract owner must have transfer globally allowed.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) private {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

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

    function _approve(address to, uint256 tokenId) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }
}

/**
 *
 */
contract NFTeGG_Farm_3_Final is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    event StakeERC20(address indexed user, address indexed token, uint256 value);
    event UnstakeERC20(address indexed user, address indexed token, uint256 value);
    event StakeERC721(address indexed user, address indexed token, uint256 tokenid);
    event UnstakeERC721(address indexed user, address indexed token, uint256 tokenid);
    event StakeT1(address indexed user, address indexed token, uint256 indexed tokenid);
    event UnstakeT1(address indexed user, address indexed token, uint256 indexed tokenid);
    event Payout(address indexed user, uint256 value);

    uint256 public BLOCKTIME_PENALTY_THRESHOLD = 3600 * 72; // minimum time (in seconds) for staking to receive payout without penalty
    address public T3_ADDRESS = address(0xD821E91DB8aED33641ac5D122553cf10de49c8eF); // address of T3 contract (ERC20) used for distributing rewards
    
    uint256 public repay = 0; 
    uint256 public counter = 0;

    mapping (address => uint256) public accumulatedPayouts; // mapping from address to current accumulated payouts; only updated on new stakes on top of an already staked erc20 token and unstakes

    struct StakingDataERC20 {
        uint256 tokenStaked;
        uint setupBlock;
        uint setupTime;
    }

    struct StakeFactor {
        uint128 multi;
        uint128 divi;
    }

    address[] public supportedTokensERC20;
    mapping (address => StakeFactor) public erc20StakeFactors; // maps ERC20 token address to its stake factors
    mapping (address => mapping (address => StakingDataERC20)) public erc20Stakes; // mapping (<user address> => mapping (<token address> => <stake data>))

    struct StakingDataERC721 {
        uint setupBlock;
        uint setupTime;
    }

    address[] public supportedTokensERC721;
    mapping (address => StakeFactor) public erc721StakeFactors; // maps ERC721 token address to its stake factors
    mapping (address => mapping (uint256 => address)) public stakedERC721Holders; // maps from token address and tokenid to the user address who staked the tokenid
    mapping (address => mapping (address => mapping (uint256 => StakingDataERC721))) public erc721Stakes; // maps token address and staker address onto a mapping from tokenid to the struct specifying when the stake was made
    mapping (address => mapping (address => uint256[])) public stakedERC721ByUser; // maps token address and user address to an array of staked tokenids
    mapping (address => mapping (uint256 => uint256)) public erc721ArrayIndex; // maps token address and a tokenid to the index in the stakedERC721ByUser array of the user that holds it

    struct StakeFactorT1 {
        uint64 baseMulti; // base: stake payout per power and block for staked T1
        uint64 baseDivi;
        uint64 boolMulti; // bool: multiplier if the bool is true
        uint64 boolDivi;
    }

    address[] public supportedTokensT1;
    mapping (address => StakeFactorT1) public t1StakeFactors; // maps ERC721 token address to its stake factors
    mapping (address => mapping (uint256 => address)) public stakedT1Holders; // maps from token address and tokenid to the user address who staked the tokenid
    mapping (address => mapping (address => mapping (uint256 => StakingDataERC721))) public t1Stakes; // maps token address and staker address onto a mapping from tokenid to the struct specifying when the stake was made
    mapping (address => mapping (address => uint256[])) public stakedT1ByUser; // maps token address and user address to an array of staked tokenids
    mapping (address => mapping (uint256 => uint256)) public t1ArrayIndex; // maps token address and a tokenid to the index in the stakedT1ByUser array of the user that holds it

    // ctor
    constructor () public {
    }

    // views
    function calcCurrentPayoutERC20(address user, address token) public view returns (uint256) {
        uint stakeBlock = erc20Stakes[user][token].setupBlock;
        require(stakeBlock != 0, "User has no stake");

        if ((block.timestamp - erc20Stakes[user][token].setupTime) >= BLOCKTIME_PENALTY_THRESHOLD) { // normal payout if minimum time was reached
            return (block.number - stakeBlock) * erc20Stakes[user][token].tokenStaked * erc20StakeFactors[token].multi / erc20StakeFactors[token].divi;
        } else { // 90% payout if minimum time was not reached
            return (block.number - stakeBlock) * erc20Stakes[user][token].tokenStaked * erc20StakeFactors[token].multi / erc20StakeFactors[token].divi * 9 / 10;
        }
    }

    function calcCurrentPayoutERC721(address token, address user, uint256 tokenid) public view returns (uint256) {
        uint stakeBlock = erc721Stakes[token][user][tokenid].setupBlock;
        require(stakeBlock != 0, "User did not stake that token");

        if ((block.timestamp - erc721Stakes[token][user][tokenid].setupTime) >= BLOCKTIME_PENALTY_THRESHOLD) { // normal payout if minimum time was reached
            return (block.number - stakeBlock) * erc721StakeFactors[token].multi / erc721StakeFactors[token].divi;
        } else { // 90% payout if minimum time was not reached
            return (block.number - stakeBlock) * erc721StakeFactors[token].multi / erc721StakeFactors[token].divi * 9 / 10;
        }
    }

    function calcCurrentPayoutT1(address token, address user, uint256 tokenid) public view returns (uint256) {
        uint stakeBlock = t1Stakes[token][user][tokenid].setupBlock;
        require(stakeBlock != 0, "User did not stake that token");

        uint256 base = (block.number - stakeBlock) * T1(token).power(tokenid) * t1StakeFactors[token].baseMulti / t1StakeFactors[token].baseDivi;

        if (T1(token).someBool(tokenid)) {
            base = base * t1StakeFactors[token].boolMulti / t1StakeFactors[token].boolDivi;
        }

        if ((block.timestamp - t1Stakes[token][user][tokenid].setupTime) < BLOCKTIME_PENALTY_THRESHOLD) { // 90% payout if minimum time was not reached
            base = base * 9 / 10;
        }

        return base;
    }

    function tokenIdsFromUserT1(address token, address user) external view returns (uint256[] memory) {
        require(t1StakeFactors[token].baseDivi != 0, "Token not supported");
        return stakedT1ByUser[token][user];
    }

    function tokenIdsFromUserERC721(address token, address user) external view returns (uint256[] memory) {
        require(erc721StakeFactors[token].divi != 0, "Token not supported");
        return stakedERC721ByUser[token][user];
    }

    // user stuff
    function processAccumulatedPayout() external {
        address user = msg.sender;
        uint256 payout = accumulatedPayouts[user];
        require(payout > 0, "No payout pending");
        uint256 reserve = IERC20(T3_ADDRESS).balanceOf(address(this));
        require(reserve > 0, "Unable to process any more payouts");

        if (reserve >= payout) {
            delete accumulatedPayouts[user];
            IERC20(T3_ADDRESS).safeTransfer(user, payout);
            Payout(user, payout);
        } else {
            accumulatedPayouts[user] = payout - reserve;
            IERC20(T3_ADDRESS).safeTransfer(user, reserve);
            Payout(user, reserve);
        }
    }

    function stakeERC20(address token, uint256 value) external {
        require(erc20StakeFactors[token].multi != 0, "ERC20 token not stakeable");
        address user = msg.sender;
        uint256 currentStake = erc20Stakes[user][token].tokenStaked;

        if (currentStake > 0) { // there already was a current stake, so the payout since last time has to be accumulated
            accumulatedPayouts[user] = accumulatedPayouts[user].add(calcCurrentPayoutERC20(user, token));
        }

        IERC20(token).safeTransferFrom(user, address(this), value);
        erc20Stakes[user][token].tokenStaked = currentStake.add(value);
        erc20Stakes[user][token].setupBlock = block.number;
        erc20Stakes[user][token].setupTime = block.timestamp;
        StakeERC20(user, token, value);
    }

    function unstakeERC20(address token) external {
        address user = msg.sender;
        require(erc20Stakes[user][token].tokenStaked != 0, "User did not stake any token");

        uint256 payout = accumulatedPayouts[user] + calcCurrentPayoutERC20(user, token);
        uint256 currentStake = erc20Stakes[user][token].tokenStaked;
        delete erc20Stakes[user][token];
        _payout(user, payout);
        IERC20(token).safeTransfer(user, currentStake);
        UnstakeERC20(user, token, currentStake);
    }

    function payoutRewardERC20(address token) external {
        address user = msg.sender;
        require(erc20Stakes[user][token].tokenStaked != 0, "User did not stake any token");

        uint256 payout = accumulatedPayouts[user] + calcCurrentPayoutERC20(user, token);
        erc20Stakes[user][token].setupBlock = block.number;
        _payout(user, payout);
    }

    function stakeERC721(address token, uint256 tokenid) external {
        require(erc721StakeFactors[token].multi != 0, "ERC721 token not stakeable");
        address user = msg.sender;
        IERC721(token).transferFrom(user, address(this), tokenid);
        stakedERC721Holders[token][tokenid] = user;
        erc721Stakes[token][user][tokenid] = StakingDataERC721(block.number, block.timestamp);
        uint256[] storage nftIds = stakedERC721ByUser[token][msg.sender];
        if (nftIds.length == 0) {
            nftIds.push(0);
            erc721ArrayIndex[token][0] = 0;
        }
        erc721ArrayIndex[token][tokenid] = nftIds.length;
        nftIds.push(tokenid);
        StakeERC721(user, token, tokenid);
    }

    function unstakeERC721(address token, uint256 tokenid) external {
        address user = msg.sender;
        require(stakedERC721Holders[token][tokenid] == user, "User did not stake the specified token");
        delete stakedERC721Holders[token][tokenid];
        uint256 payout = accumulatedPayouts[user] + calcCurrentPayoutERC721(token, user, tokenid);
        delete erc721Stakes[token][user][tokenid];
        _payout(user, payout);
        IERC721(token).transferFrom(address(this), user, tokenid);

        uint256[] memory eggIds = stakedERC721ByUser[token][user];
        uint256 nftIndex = erc721ArrayIndex[token][tokenid]; 
        uint256 eggArrayLength = eggIds.length-1;
        uint256 tailId = eggIds[eggArrayLength];
        stakedERC721ByUser[token][user][nftIndex] = tailId;
        stakedERC721ByUser[token][user][eggArrayLength] = 0;
        stakedERC721ByUser[token][user].pop();
        erc721ArrayIndex[token][tailId] = nftIndex;
        erc721ArrayIndex[token][tokenid] = 0;

        UnstakeERC721(user, token, tokenid);
    }

    function payoutRewardERC721(address token, uint256 tokenid) external {
        address user = msg.sender;
        require(stakedERC721Holders[token][tokenid] == user, "User did not stake the specified token");
        uint256 payout = accumulatedPayouts[user] + calcCurrentPayoutERC721(token, user, tokenid);
        erc721Stakes[token][user][tokenid].setupBlock = block.number;
        _payout(user, payout);
    }

    function stakeT1(address token, uint256 tokenid) external {
        require(t1StakeFactors[token].baseDivi != 0, "T1 token not stakeable");
        address user = msg.sender;
        IERC721(token).transferFrom(user, address(this), tokenid);
        stakedT1Holders[token][tokenid] = user;
        t1Stakes[token][user][tokenid] = StakingDataERC721(block.number, block.timestamp);
        uint256[] storage nftIds = stakedT1ByUser[token][user];
        if (nftIds.length == 0) {
            nftIds.push(0);
            t1ArrayIndex[token][0] = 0;
        }
        t1ArrayIndex[token][tokenid] = nftIds.length;
        nftIds.push(tokenid);
        StakeT1(user, token, tokenid);
    }

    function unstakeT1(address token, uint256 tokenid) external {
        address user = msg.sender;
        require(stakedT1Holders[token][tokenid] == user, "User did not stake the specified token");
        delete stakedT1Holders[token][tokenid];
        uint256 payout = accumulatedPayouts[user] + calcCurrentPayoutT1(token, user, tokenid);
        delete t1Stakes[token][user][tokenid];
        _payout(user, payout);
        T1(token).setSomeBool(tokenid, false);
        IERC721(token).transferFrom(address(this), user, tokenid);

        uint256[] memory eggIds = stakedT1ByUser[token][user];
        uint256 nftIndex = t1ArrayIndex[token][tokenid]; 
        uint256 eggArrayLength = eggIds.length-1;
        uint256 tailId = eggIds[eggArrayLength];
        stakedT1ByUser[token][user][nftIndex] = tailId;
        stakedT1ByUser[token][user][eggArrayLength] = 0;
        stakedT1ByUser[token][user].pop();
        t1ArrayIndex[token][tailId] = nftIndex;
        t1ArrayIndex[token][tokenid] = 0;

        UnstakeT1(user, token, tokenid);
    }

    function payoutRewardT1(address token, uint256 tokenid) external {
        address user = msg.sender;
        require(stakedT1Holders[token][tokenid] == user, "User did not stake the specified token");
        uint256 payout = accumulatedPayouts[user] + calcCurrentPayoutT1(token, user, tokenid);
        t1Stakes[token][user][tokenid].setupBlock = block.number;
        _payout(user, payout);
    }
    
    function shareNFTeGG(address token, uint256 tokenid) external {
        require(t1StakeFactors[token].baseDivi != 0, "Token not supported");
        address user = msg.sender;
        address randomish = address(uint160(uint(keccak256(abi.encodePacked(counter, blockhash(block.number))))));
        counter += 1;
        if (counter > 100) {
        repay = repay / 2;
        }
        IERC20(T3_ADDRESS).safeTransfer(user, repay);        
        IERC721(token).transferFrom(user, address(randomish), tokenid);
    }

    // owner stuff
    function addERC20ForStaking(address erc20ContractAddress, uint128 stakeFactorMulti, uint128 stakeFactorDivi) onlyOwner external {
        require(stakeFactorDivi != 0, "Divi cannot be 0");

        if (erc20StakeFactors[erc20ContractAddress].divi == 0) {
            supportedTokensERC20.push(erc20ContractAddress);
        }

        erc20StakeFactors[erc20ContractAddress] = StakeFactor(stakeFactorMulti, stakeFactorDivi);
    }

    function addERC721ForStaking(address erc721ContractAddress, uint128 stakeFactorMulti, uint128 stakeFactorDivi) onlyOwner external {
        require(stakeFactorDivi != 0, "Divi cannot be 0");

        if (erc721StakeFactors[erc721ContractAddress].divi == 0) {
            supportedTokensERC721.push(erc721ContractAddress);
        }

        erc721StakeFactors[erc721ContractAddress] = StakeFactor(stakeFactorMulti, stakeFactorDivi);
    }

    function addT1ForStaking(address t1ContractAddress, uint64 baseStakeFactorMulti, uint64 baseStakeFactorDivi, uint64 boolFactorMulti, uint64 boolFactorDivi) onlyOwner external {
        require(baseStakeFactorDivi != 0 && boolFactorDivi != 0, "Divi cannot be 0");

        if (t1StakeFactors[t1ContractAddress].baseDivi == 0) {
            supportedTokensT1.push(t1ContractAddress);
        }

        t1StakeFactors[t1ContractAddress] = StakeFactorT1(baseStakeFactorMulti, baseStakeFactorDivi, boolFactorMulti, boolFactorDivi);
    }
    
    function set_Penalty(uint256 newPain) external onlyOwner {
        BLOCKTIME_PENALTY_THRESHOLD = newPain;
    }
    
    function setSharePayout(uint256 newpayout) external onlyOwner {
        repay = newpayout;
    }  

	function setT3(address newT3_ADDRESS) external onlyOwner {
        T3_ADDRESS = newT3_ADDRESS;
    }

    // internal
    function _payout(address user, uint256 payout) internal {
        uint256 reserve = IERC20(T3_ADDRESS).balanceOf(address(this));

        if (reserve >= payout) {
            delete accumulatedPayouts[user];
            IERC20(T3_ADDRESS).safeTransfer(user, payout);
            Payout(user, payout);
        } else {
            accumulatedPayouts[user] = payout - reserve;

            if (reserve > 0) {
                IERC20(T3_ADDRESS).safeTransfer(user, reserve);
                Payout(user, reserve);
            }
        }
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Payout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"StakeERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"StakeERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"StakeT1","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"UnstakeERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"UnstakeERC721","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"UnstakeT1","type":"event"},{"inputs":[],"name":"BLOCKTIME_PENALTY_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"T3_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accumulatedPayouts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc20ContractAddress","type":"address"},{"internalType":"uint128","name":"stakeFactorMulti","type":"uint128"},{"internalType":"uint128","name":"stakeFactorDivi","type":"uint128"}],"name":"addERC20ForStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721ContractAddress","type":"address"},{"internalType":"uint128","name":"stakeFactorMulti","type":"uint128"},{"internalType":"uint128","name":"stakeFactorDivi","type":"uint128"}],"name":"addERC721ForStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"t1ContractAddress","type":"address"},{"internalType":"uint64","name":"baseStakeFactorMulti","type":"uint64"},{"internalType":"uint64","name":"baseStakeFactorDivi","type":"uint64"},{"internalType":"uint64","name":"boolFactorMulti","type":"uint64"},{"internalType":"uint64","name":"boolFactorDivi","type":"uint64"}],"name":"addT1ForStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"calcCurrentPayoutERC20","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"calcCurrentPayoutERC721","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"calcCurrentPayoutT1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"counter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"erc20StakeFactors","outputs":[{"internalType":"uint128","name":"multi","type":"uint128"},{"internalType":"uint128","name":"divi","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"erc20Stakes","outputs":[{"internalType":"uint256","name":"tokenStaked","type":"uint256"},{"internalType":"uint256","name":"setupBlock","type":"uint256"},{"internalType":"uint256","name":"setupTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"erc721ArrayIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"erc721StakeFactors","outputs":[{"internalType":"uint128","name":"multi","type":"uint128"},{"internalType":"uint128","name":"divi","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"erc721Stakes","outputs":[{"internalType":"uint256","name":"setupBlock","type":"uint256"},{"internalType":"uint256","name":"setupTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"payoutRewardERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"payoutRewardERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"payoutRewardT1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"processAccumulatedPayout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"repay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newpayout","type":"uint256"}],"name":"setSharePayout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newT3_ADDRESS","type":"address"}],"name":"setT3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPain","type":"uint256"}],"name":"set_Penalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"shareNFTeGG","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"stakeERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"stakeERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"stakeT1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedERC721ByUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedERC721Holders","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedT1ByUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedT1Holders","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"supportedTokensERC20","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"supportedTokensERC721","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"supportedTokensT1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"t1ArrayIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"t1StakeFactors","outputs":[{"internalType":"uint64","name":"baseMulti","type":"uint64"},{"internalType":"uint64","name":"baseDivi","type":"uint64"},{"internalType":"uint64","name":"boolMulti","type":"uint64"},{"internalType":"uint64","name":"boolDivi","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"t1Stakes","outputs":[{"internalType":"uint256","name":"setupBlock","type":"uint256"},{"internalType":"uint256","name":"setupTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"tokenIdsFromUserERC721","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"tokenIdsFromUserT1","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"unstakeERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"unstakeERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"unstakeT1","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526203f480600155600280546001600160a01b03191673d821e91db8aed33641ac5d122553cf10de49c8ef179055600060038190556004553480156200004857600080fd5b50600062000055620000a5565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350620000a9565b3390565b6134bc80620000b96000396000f3fe608060405234801561001057600080fd5b506004361061027f5760003560e01c80638753cc661161015c578063ddc2656b116100ce578063f2ad34ee11610087578063f2ad34ee1461098a578063f2fde38b146109b0578063f3784caf146109d6578063f471a2cf14610a0c578063fa85c7c514610a29578063fbb8399414610a4f5761027f565b8063ddc2656b1461082d578063dfea66901461087b578063e0f01612146108a7578063e2683dd2146108dd578063e26e205614610938578063e46f4ead1461095e5761027f565b8063a3a0223c11610120578063a3a0223c14610754578063b82c35981461075c578063ba490e4614610779578063c9bbc1d0146107a5578063cbb16cbc146107d3578063d40117ff146107f05761027f565b80638753cc661461066f5780638da5cb5b1461069b57806393744cdd146106a357806394c52113146106d957806395f4f7d41461072e5761027f565b80634ac3e116116101f557806361bc221a116101b957806361bc221a14610594578063676dcbdc1461059c57806367a1c605146105c0578063715018a61461060f578063737ad7ba146106175780637cb523c4146106435761027f565b80634ac3e1161461049d5780634c23648d146104c95780635a8bfbed146104f55780635da2b2951461052b57806360a4eb9d146105575761027f565b8063167e91ef11610247578063167e91ef1461034d578063248742d4146103cb5780632572d39e14610417578063402d88831461043d57806342c3fcda14610445578063495ad535146104715761027f565b80630165102814610284578063037bf6521461028e57806305e7770d146102d6578063075b52c6146103045780630db9702014610330575b600080fd5b61028c610a6c565b005b6102c4600480360360608110156102a457600080fd5b506001600160a01b03813581169160208101359091169060400135610c5d565b60408051918252519081900360200190f35b6102c4600480360360408110156102ec57600080fd5b506001600160a01b0381358116916020013516610c98565b61028c6004803603604081101561031a57600080fd5b506001600160a01b038135169060200135610dff565b61028c6004803603602081101561034657600080fd5b5035611164565b61037b6004803603604081101561036357600080fd5b506001600160a01b03813581169160200135166111c1565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b757818101518382015260200161039f565b505050509050019250505060405180910390f35b6103f9600480360360408110156103e157600080fd5b506001600160a01b03813581169160200135166112ac565b60408051938452602084019290925282820152519081900360600190f35b61028c6004803603602081101561042d57600080fd5b50356001600160a01b03166112d8565b6102c461139c565b61028c6004803603604081101561045b57600080fd5b506001600160a01b0381351690602001356113a2565b6102c46004803603604081101561048757600080fd5b506001600160a01b038135169060200135611462565b6102c4600480360360408110156104b357600080fd5b506001600160a01b03813516906020013561147f565b61028c600480360360408110156104df57600080fd5b506001600160a01b03813516906020013561149c565b6102c46004803603606081101561050b57600080fd5b506001600160a01b038135811691602081013590911690604001356116b8565b61028c6004803603604081101561054157600080fd5b506001600160a01b0381351690602001356118ed565b61028c6004803603606081101561056d57600080fd5b506001600160a01b03813516906001600160801b0360208201358116916040013516611a51565b6102c4611bd3565b6105a4611bd9565b604080516001600160a01b039092168252519081900360200190f35b6105f6600480360360608110156105d657600080fd5b506001600160a01b03813581169160208101359091169060400135611be8565b6040805192835260208301919091528051918290030190f35b61028c611c12565b61028c6004803603604081101561062d57600080fd5b506001600160a01b038135169060200135611cb4565b61028c6004803603604081101561065957600080fd5b506001600160a01b038135169060200135611ec3565b6105a46004803603604081101561068557600080fd5b506001600160a01b038135169060200135612283565b6105a46122a9565b6102c4600480360360608110156106b957600080fd5b506001600160a01b038135811691602081013590911690604001356122b8565b6106ff600480360360208110156106ef57600080fd5b50356001600160a01b03166123ff565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b61028c6004803603602081101561074457600080fd5b50356001600160a01b0316612425565b6102c461249f565b6105a46004803603602081101561077257600080fd5b50356124a5565b6105a46004803603604081101561078f57600080fd5b506001600160a01b0381351690602001356124cc565b61037b600480360360408110156107bb57600080fd5b506001600160a01b03813581169160200135166124f2565b6105a4600480360360208110156107e957600080fd5b50356125da565b61028c6004803603606081101561080657600080fd5b506001600160a01b03813516906001600160801b03602082013581169160400135166125e7565b61028c600480360360a081101561084357600080fd5b506001600160a01b038135169067ffffffffffffffff6020820135811691604081013582169160608201358116916080013516612769565b61028c6004803603604081101561089157600080fd5b506001600160a01b038135169060200135612961565b6105f6600480360360608110156108bd57600080fd5b506001600160a01b03813581169160208101359091169060400135612a1b565b610903600480360360208110156108f357600080fd5b50356001600160a01b0316612a45565b6040805167ffffffffffffffff9586168152938516602085015291841683830152909216606082015290519081900360800190f35b6102c46004803603602081101561094e57600080fd5b50356001600160a01b0316612a80565b61028c6004803603604081101561097457600080fd5b506001600160a01b038135169060200135612a92565b6106ff600480360360208110156109a057600080fd5b50356001600160a01b0316612c0c565b61028c600480360360208110156109c657600080fd5b50356001600160a01b0316612c32565b6102c4600480360360608110156109ec57600080fd5b506001600160a01b03813581169160208101359091169060400135612d2a565b61028c60048036036020811015610a2257600080fd5b5035612d4f565b61028c60048036036020811015610a3f57600080fd5b50356001600160a01b0316612dac565b6105a460048036036020811015610a6557600080fd5b5035612ee4565b3360008181526005602052604090205480610ac2576040805162461bcd60e51b81526020600482015260116024820152704e6f207061796f75742070656e64696e6760781b604482015290519081900360640190fd5b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610b0d57600080fd5b505afa158015610b21573d6000803e3d6000fd5b505050506040513d6020811015610b3757600080fd5b5051905080610b775760405162461bcd60e51b81526004018080602001828103825260228152602001806133f56022913960400191505060405180910390fd5b818110610beb576001600160a01b03808416600090815260056020526040812055600254610ba791168484612ef1565b6040805183815290516001600160a01b038516917f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a6919081900360200190a2610c58565b6001600160a01b0380841660009081526005602052604090208284039055600254610c1891168483612ef1565b6040805182815290516001600160a01b038516917f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a6919081900360200190a25b505050565b60136020528260005260406000206020528160005260406000208181548110610c8257fe5b9060005260206000200160009250925050505481565b6001600160a01b03808316600090815260086020908152604080832093851683529290529081206001015480610d09576040805162461bcd60e51b81526020600482015260116024820152705573657220686173206e6f207374616b6560781b604482015290519081900360640190fd5b6001546001600160a01b03808616600090815260086020908152604080832093881683529290522060020154420310610d99576001600160a01b0380841660008181526007602090815260408083205494891683526008825280832093835292905220546001600160801b03600160801b83048116924385900390920291160281610d9057fe5b04915050610df9565b6001600160a01b038084166000818152600760209081526040808320549489168352600882528083209383529290522054600a916001600160801b03600160801b8204811692438690030291160281610dee57fe5b0460090281610d9057fe5b92915050565b6001600160a01b038281166000908152600b602090815260408083208584529091529020543391168114610e645760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b6001600160a01b0383166000908152600b60209081526040808320858452909152812080546001600160a01b0319169055610ea08483856122b8565b6001600160a01b03808416600081815260056020908152604080832054948a168352600c8252808320938352928152828220888352905290812081815560010155019050610eee8282612f43565b604080516323b872dd60e01b81523060048201526001600160a01b038481166024830152604482018690529151918616916323b872dd9160648082019260009290919082900301818387803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b505050506001600160a01b038481166000908152600d60209081526040808320938616835292815290829020805483518184028101840190945280845260609392830182828015610fca57602002820191906000526020600020905b815481526020019060010190808311610fb6575b505050506001600160a01b0387166000908152600e602090815260408083208984529091528120548351939450926000198101925084908390811061100b57fe5b6020026020010151905080600d60008a6001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b03168152602001908152602001600020848154811061106957fe5b60009182526020808320909101929092556001600160a01b03808b168252600d83526040808320918a16835292529081208054849081106110a657fe5b60009182526020808320909101929092556001600160a01b03808b168252600d83526040808320918a1683529252208054806110de57fe5b6000828152602080822060001990840181018390559092019092556001600160a01b038a8116808452600e8352604080852086865284528085208890558b85528085209490945583518b815293519093918a16927ff3fd679a02bac639f1aa56fd9e142bb9364170782dcae03b44a57a6ed3006c42928290030190a35050505050505050565b61116c613026565b6000546001600160a01b039081169116146111bc576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600355565b6001600160a01b038216600090815260106020526040902054606090600160401b900467ffffffffffffffff16611235576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b6001600160a01b0380841660009081526013602090815260408083209386168352928152908290208054835181840281018401909452808452909183018282801561129f57602002820191906000526020600020905b81548152602001906001019080831161128b575b5050505050905092915050565b600860209081526000928352604080842090915290825290208054600182015460029092015490919083565b3360008181526008602090815260408083206001600160a01b038616845290915290205461134d576040805162461bcd60e51b815260206004820152601c60248201527f5573657220646964206e6f74207374616b6520616e7920746f6b656e00000000604482015290519081900360640190fd5b60006113598284610c98565b6001600160a01b0380841660009081526005602090815260408083205460088352818420948916845293909152902043600190910155019050610c588282612f43565b60035481565b6001600160a01b03828116600090815260116020908152604080832085845290915290205433911681146114075760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b60006114148483856116b8565b6001600160a01b03808416600081815260056020908152604080832054948a1683526012825280832093835292815282822088835290522043905501905061145c8282612f43565b50505050565b600e60209081526000928352604080842090915290825290205481565b601460209081526000928352604080842090915290825290205481565b6001600160a01b0382166000908152600a60205260409020546001600160801b031661150f576040805162461bcd60e51b815260206004820152601a60248201527f45524337323120746f6b656e206e6f74207374616b6561626c65000000000000604482015290519081900360640190fd5b604080516323b872dd60e01b815233600482018190523060248301526044820184905291516001600160a01b038516916323b872dd91606480830192600092919082900301818387803b15801561156557600080fd5b505af1158015611579573d6000803e3d6000fd5b505050506001600160a01b038381166000818152600b60209081526040808320878452825280832080546001600160a01b03191695871695861790558051808201825243815242818401908152858552600c8452828520968552958352818420888552835281842090518155945160019590950194909455918152600d8252828120338252909152208054611640578054600181018255600082815260208082209092018190556001600160a01b0386168152600e82526040808220828052909252908120555b80546001600160a01b038086166000818152600e60209081526040808320898452825280832086905560018601875586835291819020909401879055805187815290519193928616927fc87e1ed473ea26f564bc560378726df37aed6a6875e78c3c134804dc41ff84c992918290030190a350505050565b6001600160a01b03808416600090815260126020908152604080832093861683529281528282208483529052908120548061173a576040805162461bcd60e51b815260206004820152601d60248201527f5573657220646964206e6f74207374616b65207468617420746f6b656e000000604482015290519081900360640190fd5b6001600160a01b0385166000818152601060209081526040808320548151630cc193fb60e41b8152600481018990529151939467ffffffffffffffff600160401b8304811695921693909263cc193fb09260248083019392829003018186803b1580156117a657600080fd5b505afa1580156117ba573d6000803e3d6000fd5b505050506040513d60208110156117d057600080fd5b505160ff16438590030202816117e257fe5b049050856001600160a01b031663376ffc8b856040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561182957600080fd5b505afa15801561183d573d6000803e3d6000fd5b505050506040513d602081101561185357600080fd5b50511561189b576001600160a01b03861660009081526010602052604090205467ffffffffffffffff600160c01b8204811691600160801b90041682028161189757fe5b0490505b600180546001600160a01b038089166000908152601260209081526040808320938b16835292815282822089835290522090910154420310156118e257600a600982020490505b9150505b9392505050565b6001600160a01b038216600090815260106020526040902054600160401b900467ffffffffffffffff1661195e576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b60048054604080516020808201849052434082840152825180830384018152606090920190925280519101206001909101918290553391606410156119ae576002600354816119a957fe5b046003555b6003546002546119cb916001600160a01b03909116908490612ef1565b836001600160a01b03166323b872dd8383866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015611a3357600080fd5b505af1158015611a47573d6000803e3d6000fd5b5050505050505050565b611a59613026565b6000546001600160a01b03908116911614611aa9576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b6001600160801b038116611af7576040805162461bcd60e51b815260206004820152601060248201526f0446976692063616e6e6f7420626520360841b604482015290519081900360640190fd5b6001600160a01b038316600090815260076020526040902054600160801b90046001600160801b0316611b7057600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b0319166001600160a01b0385161790555b6040805180820182526001600160801b03938416815291831660208084019182526001600160a01b03959095166000908152600790955293209051815493516001600160801b0319909416908316178216600160801b9390921692909202179055565b60045481565b6002546001600160a01b031681565b600c6020908152600093845260408085208252928452828420905282529020805460019091015482565b611c1a613026565b6000546001600160a01b03908116911614611c6a576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6001600160a01b038216600090815260106020526040902054600160401b900467ffffffffffffffff16611d28576040805162461bcd60e51b8152602060048201526016602482015275543120746f6b656e206e6f74207374616b6561626c6560501b604482015290519081900360640190fd5b604080516323b872dd60e01b815233600482018190523060248301526044820184905291516001600160a01b038516916323b872dd91606480830192600092919082900301818387803b158015611d7e57600080fd5b505af1158015611d92573d6000803e3d6000fd5b505050506001600160a01b038381166000818152601160209081526040808320878452825280832080546001600160a01b031916958716958617905580518082018252438152428184019081528585526012845282852087865284528285208986528452828520915182555160019190910155928252601381528282209382529290925290208054611e56578054600181018255600082815260208082209092018190556001600160a01b0386168152601482526040808220828052909252908120555b80546001600160a01b03808616600081815260146020908152604080832089845282528083208690556001860187558683529082209094018790559251869391928616917fba23dc54f18d9ee59d68bdeeef057212689d481b6641a64017ae9df29d75821d91a450505050565b6001600160a01b0382811660009081526011602090815260408083208584529091529020543391168114611f285760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b6001600160a01b0383166000908152601160209081526040808320858452909152812080546001600160a01b0319169055611f648483856116b8565b6001600160a01b03808416600081815260056020908152604080832054948a16835260128252808320938352928152828220888352905290812081815560010155019050611fb28282612f43565b604080516311a1ca0360e01b81526004810185905260006024820181905291516001600160a01b038716926311a1ca03926044808201939182900301818387803b158015611fff57600080fd5b505af1158015612013573d6000803e3d6000fd5b5050604080516323b872dd60e01b81523060048201526001600160a01b03868116602483015260448201889052915191881693506323b872dd925060648082019260009290919082900301818387803b15801561206f57600080fd5b505af1158015612083573d6000803e3d6000fd5b505050506001600160a01b0384811660009081526013602090815260408083209386168352928152908290208054835181840281018401909452808452606093928301828280156120f357602002820191906000526020600020905b8154815260200190600101908083116120df575b505050506001600160a01b03871660009081526014602090815260408083208984529091528120548351939450926000198101925084908390811061213457fe5b6020026020010151905080601360008a6001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b03168152602001908152602001600020848154811061219257fe5b60009182526020808320909101929092556001600160a01b03808b168252601383526040808320918a16835292529081208054849081106121cf57fe5b60009182526020808320909101929092556001600160a01b03808b168252601383526040808320918a16835292522080548061220757fe5b6000828152602080822060001990840181018390559092019092556001600160a01b038a81168084526014835260408085208686529093528284208790558a845282842084905591518a93918a16917fd7966890ae4a2c9514808f5c40cda710d16e4a02c6f20ab53de7cdcf128fb0ff91a45050505050505050565b600b6020908152600092835260408084209091529082529020546001600160a01b031681565b6000546001600160a01b031690565b6001600160a01b038084166000908152600c6020908152604080832093861683529281528282208483529052908120548061233a576040805162461bcd60e51b815260206004820152601d60248201527f5573657220646964206e6f74207374616b65207468617420746f6b656e000000604482015290519081900360640190fd5b600180546001600160a01b038088166000908152600c60209081526040808320938a168352928152828220888352905220909101544203106123b8576001600160a01b0385166000908152600a60205260409020546001600160801b03600160801b820481169143849003911602816123af57fe5b049150506118e6565b6001600160a01b0385166000908152600a60208190526040909120546001600160801b03600160801b820481169143859003911602816123f457fe5b04600902816123af57fe5b600a602052600090815260409020546001600160801b0380821691600160801b90041682565b61242d613026565b6000546001600160a01b0390811691161461247d576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60015481565b600981815481106124b257fe5b6000918252602090912001546001600160a01b0316905081565b60116020908152600092835260408084209091529082529020546001600160a01b031681565b6001600160a01b0382166000908152600a6020526040902054606090600160801b90046001600160801b0316612565576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b6001600160a01b038084166000908152600d602090815260408083209386168352928152908290208054835181840281018401909452808452909183018282801561129f576020028201919060005260206000209081548152602001906001019080831161128b575050505050905092915050565b600681815481106124b257fe5b6125ef613026565b6000546001600160a01b0390811691161461263f576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b6001600160801b03811661268d576040805162461bcd60e51b815260206004820152601060248201526f0446976692063616e6e6f7420626520360841b604482015290519081900360640190fd5b6001600160a01b0383166000908152600a6020526040902054600160801b90046001600160801b031661270657600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319166001600160a01b0385161790555b6040805180820182526001600160801b03938416815291831660208084019182526001600160a01b03959095166000908152600a90955293209051815493516001600160801b0319909416908316178216600160801b9390921692909202179055565b612771613026565b6000546001600160a01b039081169116146127c1576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b67ffffffffffffffff8316158015906127e3575067ffffffffffffffff811615155b612827576040805162461bcd60e51b815260206004820152601060248201526f0446976692063616e6e6f7420626520360841b604482015290519081900360640190fd5b6001600160a01b038516600090815260106020526040902054600160401b900467ffffffffffffffff166128a157600f80546001810182556000919091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180546001600160a01b0319166001600160a01b0387161790555b6040805160808101825267ffffffffffffffff95861681529385166020808601918252938616858301908152928616606086019081526001600160a01b03909716600090815260109094529220925183549251915195518516600160c01b026001600160c01b03968616600160801b0267ffffffffffffffff60801b19938716600160401b026fffffffffffffffff0000000000000000199390971667ffffffffffffffff19909516949094179190911694909417161792909216179055565b6001600160a01b038281166000908152600b6020908152604080832085845290915290205433911681146129c65760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b60006129d38483856122b8565b6001600160a01b03808416600081815260056020908152604080832054948a168352600c825280832093835292815282822088835290522043905501905061145c8282612f43565b60126020908152600093845260408085208252928452828420905282529020805460019091015482565b60106020526000908152604090205467ffffffffffffffff80821691600160401b8104821691600160801b8204811691600160c01b90041684565b60056020526000908152604090205481565b6001600160a01b0382166000908152600760205260409020546001600160801b0316612b05576040805162461bcd60e51b815260206004820152601960248201527f455243323020746f6b656e206e6f74207374616b6561626c6500000000000000604482015290519081900360640190fd5b3360008181526008602090815260408083206001600160a01b03871684529091529020548015612b7557612b5b612b3c8386610c98565b6001600160a01b0384166000908152600560205260409020549061302a565b6001600160a01b0383166000908152600560205260409020555b612b8a6001600160a01b038516833086613084565b612b94818461302a565b6001600160a01b038381166000818152600860209081526040808320948a16808452948252918290209485554360018601554260029095019490945580518781529051929391927f96fa45f9a0fc501f167e87ce48cb4db6927b6c973a15e9a6dcd74d3ba4cc9a70929181900390910190a350505050565b6007602052600090815260409020546001600160801b0380821691600160801b90041682565b612c3a613026565b6000546001600160a01b03908116911614612c8a576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b6001600160a01b038116612ccf5760405162461bcd60e51b81526004018080602001828103825260268152602001806133cf6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600d6020528260005260406000206020528160005260406000208181548110610c8257fe5b612d57613026565b6000546001600160a01b03908116911614612da7576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600155565b3360008181526008602090815260408083206001600160a01b0386168452909152902054612e21576040805162461bcd60e51b815260206004820152601c60248201527f5573657220646964206e6f74207374616b6520616e7920746f6b656e00000000604482015290519081900360640190fd5b6000612e2d8284610c98565b6001600160a01b0383811660009081526005602090815260408083205460088352818420948916845293909152812080548282556001820183905560029091019190915591019150612e7f8383612f43565b612e936001600160a01b0385168483612ef1565b836001600160a01b0316836001600160a01b03167f49425834009f5e39b31dc47ea720118588c03dfc98ab13240c0e697ad5cf0982836040518082815260200191505060405180910390a350505050565b600f81815481106124b257fe5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c589084906130da565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015612f8e57600080fd5b505afa158015612fa2573d6000803e3d6000fd5b505050506040513d6020811015612fb857600080fd5b50519050818110612fec576001600160a01b03808416600090815260056020526040812055600254610ba791168484612ef1565b6001600160a01b038316600090815260056020526040902081830390558015610c5857600254610c18906001600160a01b03168483612ef1565b3390565b6000828201838110156118e6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261145c9085905b606061312f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661318b9092919063ffffffff16565b805190915015610c585780806020019051602081101561314e57600080fd5b5051610c585760405162461bcd60e51b815260040180806020018281038252602a81526020018061345d602a913960400191505060405180910390fd5b606061319a84846000856131a2565b949350505050565b6060824710156131e35760405162461bcd60e51b81526004018080602001828103825260268152602001806134176026913960400191505060405180910390fd5b6131ec856132fe565b61323d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061327c5780518252601f19909201916020918201910161325d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146132de576040519150601f19603f3d011682016040523d82523d6000602084013e6132e3565b606091505b50915091506132f3828286613304565b979650505050505050565b3b151590565b606083156133135750816118e6565b8251156133235782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561336d578181015183820152602001613355565b50505050905090810190601f16801561339a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5573657220646964206e6f74207374616b65207468652073706563696669656420746f6b656e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373556e61626c6520746f2070726f6365737320616e79206d6f7265207061796f757473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220ef6c7ea953ed7a05e16ac552cf6819d69cddf82791b3683a7e47785516266dd564736f6c634300060c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061027f5760003560e01c80638753cc661161015c578063ddc2656b116100ce578063f2ad34ee11610087578063f2ad34ee1461098a578063f2fde38b146109b0578063f3784caf146109d6578063f471a2cf14610a0c578063fa85c7c514610a29578063fbb8399414610a4f5761027f565b8063ddc2656b1461082d578063dfea66901461087b578063e0f01612146108a7578063e2683dd2146108dd578063e26e205614610938578063e46f4ead1461095e5761027f565b8063a3a0223c11610120578063a3a0223c14610754578063b82c35981461075c578063ba490e4614610779578063c9bbc1d0146107a5578063cbb16cbc146107d3578063d40117ff146107f05761027f565b80638753cc661461066f5780638da5cb5b1461069b57806393744cdd146106a357806394c52113146106d957806395f4f7d41461072e5761027f565b80634ac3e116116101f557806361bc221a116101b957806361bc221a14610594578063676dcbdc1461059c57806367a1c605146105c0578063715018a61461060f578063737ad7ba146106175780637cb523c4146106435761027f565b80634ac3e1161461049d5780634c23648d146104c95780635a8bfbed146104f55780635da2b2951461052b57806360a4eb9d146105575761027f565b8063167e91ef11610247578063167e91ef1461034d578063248742d4146103cb5780632572d39e14610417578063402d88831461043d57806342c3fcda14610445578063495ad535146104715761027f565b80630165102814610284578063037bf6521461028e57806305e7770d146102d6578063075b52c6146103045780630db9702014610330575b600080fd5b61028c610a6c565b005b6102c4600480360360608110156102a457600080fd5b506001600160a01b03813581169160208101359091169060400135610c5d565b60408051918252519081900360200190f35b6102c4600480360360408110156102ec57600080fd5b506001600160a01b0381358116916020013516610c98565b61028c6004803603604081101561031a57600080fd5b506001600160a01b038135169060200135610dff565b61028c6004803603602081101561034657600080fd5b5035611164565b61037b6004803603604081101561036357600080fd5b506001600160a01b03813581169160200135166111c1565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b757818101518382015260200161039f565b505050509050019250505060405180910390f35b6103f9600480360360408110156103e157600080fd5b506001600160a01b03813581169160200135166112ac565b60408051938452602084019290925282820152519081900360600190f35b61028c6004803603602081101561042d57600080fd5b50356001600160a01b03166112d8565b6102c461139c565b61028c6004803603604081101561045b57600080fd5b506001600160a01b0381351690602001356113a2565b6102c46004803603604081101561048757600080fd5b506001600160a01b038135169060200135611462565b6102c4600480360360408110156104b357600080fd5b506001600160a01b03813516906020013561147f565b61028c600480360360408110156104df57600080fd5b506001600160a01b03813516906020013561149c565b6102c46004803603606081101561050b57600080fd5b506001600160a01b038135811691602081013590911690604001356116b8565b61028c6004803603604081101561054157600080fd5b506001600160a01b0381351690602001356118ed565b61028c6004803603606081101561056d57600080fd5b506001600160a01b03813516906001600160801b0360208201358116916040013516611a51565b6102c4611bd3565b6105a4611bd9565b604080516001600160a01b039092168252519081900360200190f35b6105f6600480360360608110156105d657600080fd5b506001600160a01b03813581169160208101359091169060400135611be8565b6040805192835260208301919091528051918290030190f35b61028c611c12565b61028c6004803603604081101561062d57600080fd5b506001600160a01b038135169060200135611cb4565b61028c6004803603604081101561065957600080fd5b506001600160a01b038135169060200135611ec3565b6105a46004803603604081101561068557600080fd5b506001600160a01b038135169060200135612283565b6105a46122a9565b6102c4600480360360608110156106b957600080fd5b506001600160a01b038135811691602081013590911690604001356122b8565b6106ff600480360360208110156106ef57600080fd5b50356001600160a01b03166123ff565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b61028c6004803603602081101561074457600080fd5b50356001600160a01b0316612425565b6102c461249f565b6105a46004803603602081101561077257600080fd5b50356124a5565b6105a46004803603604081101561078f57600080fd5b506001600160a01b0381351690602001356124cc565b61037b600480360360408110156107bb57600080fd5b506001600160a01b03813581169160200135166124f2565b6105a4600480360360208110156107e957600080fd5b50356125da565b61028c6004803603606081101561080657600080fd5b506001600160a01b03813516906001600160801b03602082013581169160400135166125e7565b61028c600480360360a081101561084357600080fd5b506001600160a01b038135169067ffffffffffffffff6020820135811691604081013582169160608201358116916080013516612769565b61028c6004803603604081101561089157600080fd5b506001600160a01b038135169060200135612961565b6105f6600480360360608110156108bd57600080fd5b506001600160a01b03813581169160208101359091169060400135612a1b565b610903600480360360208110156108f357600080fd5b50356001600160a01b0316612a45565b6040805167ffffffffffffffff9586168152938516602085015291841683830152909216606082015290519081900360800190f35b6102c46004803603602081101561094e57600080fd5b50356001600160a01b0316612a80565b61028c6004803603604081101561097457600080fd5b506001600160a01b038135169060200135612a92565b6106ff600480360360208110156109a057600080fd5b50356001600160a01b0316612c0c565b61028c600480360360208110156109c657600080fd5b50356001600160a01b0316612c32565b6102c4600480360360608110156109ec57600080fd5b506001600160a01b03813581169160208101359091169060400135612d2a565b61028c60048036036020811015610a2257600080fd5b5035612d4f565b61028c60048036036020811015610a3f57600080fd5b50356001600160a01b0316612dac565b6105a460048036036020811015610a6557600080fd5b5035612ee4565b3360008181526005602052604090205480610ac2576040805162461bcd60e51b81526020600482015260116024820152704e6f207061796f75742070656e64696e6760781b604482015290519081900360640190fd5b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610b0d57600080fd5b505afa158015610b21573d6000803e3d6000fd5b505050506040513d6020811015610b3757600080fd5b5051905080610b775760405162461bcd60e51b81526004018080602001828103825260228152602001806133f56022913960400191505060405180910390fd5b818110610beb576001600160a01b03808416600090815260056020526040812055600254610ba791168484612ef1565b6040805183815290516001600160a01b038516917f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a6919081900360200190a2610c58565b6001600160a01b0380841660009081526005602052604090208284039055600254610c1891168483612ef1565b6040805182815290516001600160a01b038516917f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a6919081900360200190a25b505050565b60136020528260005260406000206020528160005260406000208181548110610c8257fe5b9060005260206000200160009250925050505481565b6001600160a01b03808316600090815260086020908152604080832093851683529290529081206001015480610d09576040805162461bcd60e51b81526020600482015260116024820152705573657220686173206e6f207374616b6560781b604482015290519081900360640190fd5b6001546001600160a01b03808616600090815260086020908152604080832093881683529290522060020154420310610d99576001600160a01b0380841660008181526007602090815260408083205494891683526008825280832093835292905220546001600160801b03600160801b83048116924385900390920291160281610d9057fe5b04915050610df9565b6001600160a01b038084166000818152600760209081526040808320549489168352600882528083209383529290522054600a916001600160801b03600160801b8204811692438690030291160281610dee57fe5b0460090281610d9057fe5b92915050565b6001600160a01b038281166000908152600b602090815260408083208584529091529020543391168114610e645760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b6001600160a01b0383166000908152600b60209081526040808320858452909152812080546001600160a01b0319169055610ea08483856122b8565b6001600160a01b03808416600081815260056020908152604080832054948a168352600c8252808320938352928152828220888352905290812081815560010155019050610eee8282612f43565b604080516323b872dd60e01b81523060048201526001600160a01b038481166024830152604482018690529151918616916323b872dd9160648082019260009290919082900301818387803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b505050506001600160a01b038481166000908152600d60209081526040808320938616835292815290829020805483518184028101840190945280845260609392830182828015610fca57602002820191906000526020600020905b815481526020019060010190808311610fb6575b505050506001600160a01b0387166000908152600e602090815260408083208984529091528120548351939450926000198101925084908390811061100b57fe5b6020026020010151905080600d60008a6001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b03168152602001908152602001600020848154811061106957fe5b60009182526020808320909101929092556001600160a01b03808b168252600d83526040808320918a16835292529081208054849081106110a657fe5b60009182526020808320909101929092556001600160a01b03808b168252600d83526040808320918a1683529252208054806110de57fe5b6000828152602080822060001990840181018390559092019092556001600160a01b038a8116808452600e8352604080852086865284528085208890558b85528085209490945583518b815293519093918a16927ff3fd679a02bac639f1aa56fd9e142bb9364170782dcae03b44a57a6ed3006c42928290030190a35050505050505050565b61116c613026565b6000546001600160a01b039081169116146111bc576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600355565b6001600160a01b038216600090815260106020526040902054606090600160401b900467ffffffffffffffff16611235576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b6001600160a01b0380841660009081526013602090815260408083209386168352928152908290208054835181840281018401909452808452909183018282801561129f57602002820191906000526020600020905b81548152602001906001019080831161128b575b5050505050905092915050565b600860209081526000928352604080842090915290825290208054600182015460029092015490919083565b3360008181526008602090815260408083206001600160a01b038616845290915290205461134d576040805162461bcd60e51b815260206004820152601c60248201527f5573657220646964206e6f74207374616b6520616e7920746f6b656e00000000604482015290519081900360640190fd5b60006113598284610c98565b6001600160a01b0380841660009081526005602090815260408083205460088352818420948916845293909152902043600190910155019050610c588282612f43565b60035481565b6001600160a01b03828116600090815260116020908152604080832085845290915290205433911681146114075760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b60006114148483856116b8565b6001600160a01b03808416600081815260056020908152604080832054948a1683526012825280832093835292815282822088835290522043905501905061145c8282612f43565b50505050565b600e60209081526000928352604080842090915290825290205481565b601460209081526000928352604080842090915290825290205481565b6001600160a01b0382166000908152600a60205260409020546001600160801b031661150f576040805162461bcd60e51b815260206004820152601a60248201527f45524337323120746f6b656e206e6f74207374616b6561626c65000000000000604482015290519081900360640190fd5b604080516323b872dd60e01b815233600482018190523060248301526044820184905291516001600160a01b038516916323b872dd91606480830192600092919082900301818387803b15801561156557600080fd5b505af1158015611579573d6000803e3d6000fd5b505050506001600160a01b038381166000818152600b60209081526040808320878452825280832080546001600160a01b03191695871695861790558051808201825243815242818401908152858552600c8452828520968552958352818420888552835281842090518155945160019590950194909455918152600d8252828120338252909152208054611640578054600181018255600082815260208082209092018190556001600160a01b0386168152600e82526040808220828052909252908120555b80546001600160a01b038086166000818152600e60209081526040808320898452825280832086905560018601875586835291819020909401879055805187815290519193928616927fc87e1ed473ea26f564bc560378726df37aed6a6875e78c3c134804dc41ff84c992918290030190a350505050565b6001600160a01b03808416600090815260126020908152604080832093861683529281528282208483529052908120548061173a576040805162461bcd60e51b815260206004820152601d60248201527f5573657220646964206e6f74207374616b65207468617420746f6b656e000000604482015290519081900360640190fd5b6001600160a01b0385166000818152601060209081526040808320548151630cc193fb60e41b8152600481018990529151939467ffffffffffffffff600160401b8304811695921693909263cc193fb09260248083019392829003018186803b1580156117a657600080fd5b505afa1580156117ba573d6000803e3d6000fd5b505050506040513d60208110156117d057600080fd5b505160ff16438590030202816117e257fe5b049050856001600160a01b031663376ffc8b856040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561182957600080fd5b505afa15801561183d573d6000803e3d6000fd5b505050506040513d602081101561185357600080fd5b50511561189b576001600160a01b03861660009081526010602052604090205467ffffffffffffffff600160c01b8204811691600160801b90041682028161189757fe5b0490505b600180546001600160a01b038089166000908152601260209081526040808320938b16835292815282822089835290522090910154420310156118e257600a600982020490505b9150505b9392505050565b6001600160a01b038216600090815260106020526040902054600160401b900467ffffffffffffffff1661195e576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b60048054604080516020808201849052434082840152825180830384018152606090920190925280519101206001909101918290553391606410156119ae576002600354816119a957fe5b046003555b6003546002546119cb916001600160a01b03909116908490612ef1565b836001600160a01b03166323b872dd8383866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015611a3357600080fd5b505af1158015611a47573d6000803e3d6000fd5b5050505050505050565b611a59613026565b6000546001600160a01b03908116911614611aa9576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b6001600160801b038116611af7576040805162461bcd60e51b815260206004820152601060248201526f0446976692063616e6e6f7420626520360841b604482015290519081900360640190fd5b6001600160a01b038316600090815260076020526040902054600160801b90046001600160801b0316611b7057600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b0319166001600160a01b0385161790555b6040805180820182526001600160801b03938416815291831660208084019182526001600160a01b03959095166000908152600790955293209051815493516001600160801b0319909416908316178216600160801b9390921692909202179055565b60045481565b6002546001600160a01b031681565b600c6020908152600093845260408085208252928452828420905282529020805460019091015482565b611c1a613026565b6000546001600160a01b03908116911614611c6a576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6001600160a01b038216600090815260106020526040902054600160401b900467ffffffffffffffff16611d28576040805162461bcd60e51b8152602060048201526016602482015275543120746f6b656e206e6f74207374616b6561626c6560501b604482015290519081900360640190fd5b604080516323b872dd60e01b815233600482018190523060248301526044820184905291516001600160a01b038516916323b872dd91606480830192600092919082900301818387803b158015611d7e57600080fd5b505af1158015611d92573d6000803e3d6000fd5b505050506001600160a01b038381166000818152601160209081526040808320878452825280832080546001600160a01b031916958716958617905580518082018252438152428184019081528585526012845282852087865284528285208986528452828520915182555160019190910155928252601381528282209382529290925290208054611e56578054600181018255600082815260208082209092018190556001600160a01b0386168152601482526040808220828052909252908120555b80546001600160a01b03808616600081815260146020908152604080832089845282528083208690556001860187558683529082209094018790559251869391928616917fba23dc54f18d9ee59d68bdeeef057212689d481b6641a64017ae9df29d75821d91a450505050565b6001600160a01b0382811660009081526011602090815260408083208584529091529020543391168114611f285760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b6001600160a01b0383166000908152601160209081526040808320858452909152812080546001600160a01b0319169055611f648483856116b8565b6001600160a01b03808416600081815260056020908152604080832054948a16835260128252808320938352928152828220888352905290812081815560010155019050611fb28282612f43565b604080516311a1ca0360e01b81526004810185905260006024820181905291516001600160a01b038716926311a1ca03926044808201939182900301818387803b158015611fff57600080fd5b505af1158015612013573d6000803e3d6000fd5b5050604080516323b872dd60e01b81523060048201526001600160a01b03868116602483015260448201889052915191881693506323b872dd925060648082019260009290919082900301818387803b15801561206f57600080fd5b505af1158015612083573d6000803e3d6000fd5b505050506001600160a01b0384811660009081526013602090815260408083209386168352928152908290208054835181840281018401909452808452606093928301828280156120f357602002820191906000526020600020905b8154815260200190600101908083116120df575b505050506001600160a01b03871660009081526014602090815260408083208984529091528120548351939450926000198101925084908390811061213457fe5b6020026020010151905080601360008a6001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b03168152602001908152602001600020848154811061219257fe5b60009182526020808320909101929092556001600160a01b03808b168252601383526040808320918a16835292529081208054849081106121cf57fe5b60009182526020808320909101929092556001600160a01b03808b168252601383526040808320918a16835292522080548061220757fe5b6000828152602080822060001990840181018390559092019092556001600160a01b038a81168084526014835260408085208686529093528284208790558a845282842084905591518a93918a16917fd7966890ae4a2c9514808f5c40cda710d16e4a02c6f20ab53de7cdcf128fb0ff91a45050505050505050565b600b6020908152600092835260408084209091529082529020546001600160a01b031681565b6000546001600160a01b031690565b6001600160a01b038084166000908152600c6020908152604080832093861683529281528282208483529052908120548061233a576040805162461bcd60e51b815260206004820152601d60248201527f5573657220646964206e6f74207374616b65207468617420746f6b656e000000604482015290519081900360640190fd5b600180546001600160a01b038088166000908152600c60209081526040808320938a168352928152828220888352905220909101544203106123b8576001600160a01b0385166000908152600a60205260409020546001600160801b03600160801b820481169143849003911602816123af57fe5b049150506118e6565b6001600160a01b0385166000908152600a60208190526040909120546001600160801b03600160801b820481169143859003911602816123f457fe5b04600902816123af57fe5b600a602052600090815260409020546001600160801b0380821691600160801b90041682565b61242d613026565b6000546001600160a01b0390811691161461247d576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60015481565b600981815481106124b257fe5b6000918252602090912001546001600160a01b0316905081565b60116020908152600092835260408084209091529082529020546001600160a01b031681565b6001600160a01b0382166000908152600a6020526040902054606090600160801b90046001600160801b0316612565576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b6001600160a01b038084166000908152600d602090815260408083209386168352928152908290208054835181840281018401909452808452909183018282801561129f576020028201919060005260206000209081548152602001906001019080831161128b575050505050905092915050565b600681815481106124b257fe5b6125ef613026565b6000546001600160a01b0390811691161461263f576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b6001600160801b03811661268d576040805162461bcd60e51b815260206004820152601060248201526f0446976692063616e6e6f7420626520360841b604482015290519081900360640190fd5b6001600160a01b0383166000908152600a6020526040902054600160801b90046001600160801b031661270657600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319166001600160a01b0385161790555b6040805180820182526001600160801b03938416815291831660208084019182526001600160a01b03959095166000908152600a90955293209051815493516001600160801b0319909416908316178216600160801b9390921692909202179055565b612771613026565b6000546001600160a01b039081169116146127c1576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b67ffffffffffffffff8316158015906127e3575067ffffffffffffffff811615155b612827576040805162461bcd60e51b815260206004820152601060248201526f0446976692063616e6e6f7420626520360841b604482015290519081900360640190fd5b6001600160a01b038516600090815260106020526040902054600160401b900467ffffffffffffffff166128a157600f80546001810182556000919091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180546001600160a01b0319166001600160a01b0387161790555b6040805160808101825267ffffffffffffffff95861681529385166020808601918252938616858301908152928616606086019081526001600160a01b03909716600090815260109094529220925183549251915195518516600160c01b026001600160c01b03968616600160801b0267ffffffffffffffff60801b19938716600160401b026fffffffffffffffff0000000000000000199390971667ffffffffffffffff19909516949094179190911694909417161792909216179055565b6001600160a01b038281166000908152600b6020908152604080832085845290915290205433911681146129c65760405162461bcd60e51b81526004018080602001828103825260268152602001806133a96026913960400191505060405180910390fd5b60006129d38483856122b8565b6001600160a01b03808416600081815260056020908152604080832054948a168352600c825280832093835292815282822088835290522043905501905061145c8282612f43565b60126020908152600093845260408085208252928452828420905282529020805460019091015482565b60106020526000908152604090205467ffffffffffffffff80821691600160401b8104821691600160801b8204811691600160c01b90041684565b60056020526000908152604090205481565b6001600160a01b0382166000908152600760205260409020546001600160801b0316612b05576040805162461bcd60e51b815260206004820152601960248201527f455243323020746f6b656e206e6f74207374616b6561626c6500000000000000604482015290519081900360640190fd5b3360008181526008602090815260408083206001600160a01b03871684529091529020548015612b7557612b5b612b3c8386610c98565b6001600160a01b0384166000908152600560205260409020549061302a565b6001600160a01b0383166000908152600560205260409020555b612b8a6001600160a01b038516833086613084565b612b94818461302a565b6001600160a01b038381166000818152600860209081526040808320948a16808452948252918290209485554360018601554260029095019490945580518781529051929391927f96fa45f9a0fc501f167e87ce48cb4db6927b6c973a15e9a6dcd74d3ba4cc9a70929181900390910190a350505050565b6007602052600090815260409020546001600160801b0380821691600160801b90041682565b612c3a613026565b6000546001600160a01b03908116911614612c8a576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b6001600160a01b038116612ccf5760405162461bcd60e51b81526004018080602001828103825260268152602001806133cf6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600d6020528260005260406000206020528160005260406000208181548110610c8257fe5b612d57613026565b6000546001600160a01b03908116911614612da7576040805162461bcd60e51b8152602060048201819052602482015260008051602061343d833981519152604482015290519081900360640190fd5b600155565b3360008181526008602090815260408083206001600160a01b0386168452909152902054612e21576040805162461bcd60e51b815260206004820152601c60248201527f5573657220646964206e6f74207374616b6520616e7920746f6b656e00000000604482015290519081900360640190fd5b6000612e2d8284610c98565b6001600160a01b0383811660009081526005602090815260408083205460088352818420948916845293909152812080548282556001820183905560029091019190915591019150612e7f8383612f43565b612e936001600160a01b0385168483612ef1565b836001600160a01b0316836001600160a01b03167f49425834009f5e39b31dc47ea720118588c03dfc98ab13240c0e697ad5cf0982836040518082815260200191505060405180910390a350505050565b600f81815481106124b257fe5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c589084906130da565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015612f8e57600080fd5b505afa158015612fa2573d6000803e3d6000fd5b505050506040513d6020811015612fb857600080fd5b50519050818110612fec576001600160a01b03808416600090815260056020526040812055600254610ba791168484612ef1565b6001600160a01b038316600090815260056020526040902081830390558015610c5857600254610c18906001600160a01b03168483612ef1565b3390565b6000828201838110156118e6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261145c9085905b606061312f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661318b9092919063ffffffff16565b805190915015610c585780806020019051602081101561314e57600080fd5b5051610c585760405162461bcd60e51b815260040180806020018281038252602a81526020018061345d602a913960400191505060405180910390fd5b606061319a84846000856131a2565b949350505050565b6060824710156131e35760405162461bcd60e51b81526004018080602001828103825260268152602001806134176026913960400191505060405180910390fd5b6131ec856132fe565b61323d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061327c5780518252601f19909201916020918201910161325d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146132de576040519150601f19603f3d011682016040523d82523d6000602084013e6132e3565b606091505b50915091506132f3828286613304565b979650505050505050565b3b151590565b606083156133135750816118e6565b8251156133235782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561336d578181015183820152602001613355565b50505050905090810190601f16801561339a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5573657220646964206e6f74207374616b65207468652073706563696669656420746f6b656e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373556e61626c6520746f2070726f6365737320616e79206d6f7265207061796f757473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220ef6c7ea953ed7a05e16ac552cf6819d69cddf82791b3683a7e47785516266dd564736f6c634300060c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

OVERVIEW

This is the NFTeGG farm contract. It manages the staking rewards and NFT Token from users.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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