false
false
0

Contract Address Details

0xC821d3fF7D3EeEEB5db8F599E9Ee8D3A3E5E62d4

Contract Name
PRONFTMultiStaking
Creator
0x782f79–2e38b6 at 0xfed80f–4e4ac1
Balance
16,149.515025075719571394 SGB
Tokens
Fetching tokens...
Transactions
37,894 Transactions
Transfers
163,990 Transfers
Gas Used
21,172,931,793
Last Balance Update
58420678
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
PRONFTMultiStaking




Optimization enabled
true
Compiler version
v0.8.16+commit.07a7930e




Optimization runs
200
EVM Version
default




Verified at
2023-01-18T03:34:46.533954Z

Constructor Arguments

000000000000000000000000136993b9bea254cc103d08a8965867e123622bd0

Arg [0] (address) : 0x136993b9bea254cc103d08a8965867e123622bd0

              

Contract source code


// File @openzeppelin/contracts/utils/introspection/[email protected]

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts/token/ERC721/[email protected]


// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * 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;

    /**
     * @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 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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


// File @openzeppelin/contracts/token/ERC20/[email protected]


// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}


// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]


// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}


// File @openzeppelin/contracts/utils/[email protected]


// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}


// File @openzeppelin/contracts/token/ERC20/utils/[email protected]


// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;



/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using 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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}


// File @openzeppelin/contracts/utils/structs/[email protected]


// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
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;

            if (lastIndex != toDeleteIndex) {
                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] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // 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) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // 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 Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}


// File @openzeppelin/contracts/utils/[email protected]


// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}


// File @openzeppelin/contracts/token/ERC721/[email protected]


// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts/token/ERC721/utils/[email protected]


// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}


// File @openzeppelin/contracts/access/[email protected]


// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}


// File @openzeppelin/contracts/security/[email protected]


// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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


// File @openzeppelin/contracts/token/ERC721/extensions/[email protected]


// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

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

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


// File @openzeppelin/contracts/utils/structs/[email protected]


// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableMap.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * The following map types are supported:
 *
 * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0
 * - `bytes32 -> bytes32` (`Bytes32ToBytes32`) since v4.6.0
 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an array of EnumerableMap.
 * ====
 */
library EnumerableMap {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    // 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 Bytes32ToBytes32Map {
        // Storage of keys
        EnumerableSet.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @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(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        bytes32 value
    ) internal returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @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(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

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

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
        return map._keys.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(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {
        bytes32 key = map._keys.at(index);
        return (key, map._values[key]);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function get(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), errorMessage);
        return value;
    }

    // UintToUintMap

    struct UintToUintMap {
        Bytes32ToBytes32Map _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(
        UintToUintMap storage map,
        uint256 key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(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(UintToUintMap 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(UintToUintMap 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(UintToUintMap 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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (uint256(key), uint256(value));
    }

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

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

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

    // UintToAddressMap

    struct UintToAddressMap {
        Bytes32ToBytes32Map _inner;
    }

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

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

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

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

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

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

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

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

    // AddressToUintMap

    struct AddressToUintMap {
        Bytes32ToBytes32Map _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(
        AddressToUintMap storage map,
        address key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(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(AddressToUintMap storage map, address key) internal returns (bool) {
        return remove(map._inner, bytes32(uint256(uint160(key))));
    }

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(AddressToUintMap 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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (address(uint160(uint256(key))), uint256(value));
    }

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

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

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

    // Bytes32ToUintMap

    struct Bytes32ToUintMap {
        Bytes32ToBytes32Map _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(
        Bytes32ToUintMap storage map,
        bytes32 key,
        uint256 value
    ) internal returns (bool) {
        return set(map._inner, key, bytes32(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(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {
        return remove(map._inner, key);
    }

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(Bytes32ToUintMap 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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {
        (bytes32 key, bytes32 value) = at(map._inner, index);
        return (key, uint256(value));
    }

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

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

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


// File contracts/IOracleNFTWeight.sol


pragma solidity ^0.8.16;

interface IOracleNFTWeight {
    function oracleNFTWeight(uint256 tokenId)
        external
        view
        returns (uint256 weight);
}


// File contracts/Staking.sol



pragma solidity ^0.8.16;
contract PRONFTMultiStaking is Ownable, ReentrancyGuard, ERC721Holder {
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.AddressToUintMap;
    using SafeERC20 for IERC20;

    event OnTokenLock(
        address indexed owner,
        uint256 amount,
        uint256 unlockTime,
        uint8 lockMode
    );

    event OnTokenUnlock(address user);

    event OnLockWithdrawal(address user, uint256 amount, uint8 mode);

    event OnLockAmountIncreased(address user, uint256 amount);

    event OnLockDurationIncreased(address user, uint256 newUnlockTime);

    uint256 public PRECISION_FACTOR = 10**8;

    // The staked token
    address public constant xOracle =
        0x5795377c85e0fdF6370fae1B74Fe03b930C4a892;
    address public constant oracle = 0xD7565b16b65376e2Ddb6c71E7971c7185A7Ff3Ff;
    address public constant wsgb = 0x02f0826ef6aD107Cfc861152B32B52fD11BaB9ED;
    address public constant proToken =
        0xf810576A68C3731875BDe07404BE815b16fC0B4e;

    address public constant deadAddress =
        0x000000000000000000000000000000000000dEaD;

    uint256[] public LOCK_TIME_MULTIPLIER = [10, 15, 70, 150, 310];

    uint256[] public LOCK_TIME_DURATION = [
        0,
        30 days,
        90 days,
        180 days,
        365 days
    ];

    address public oracleNFT = 0xCdB019C0990c033724DA55f5A04bE6fd6ec1809d;

    uint256 public minProAmount = 1111 * 10**18;

    uint256 public minxOracleAmount = 100 * 10**18;

    uint256 private constant PERCENT_FACTOR = 1e4;

    address public oracleWeight;

    struct TokenLock {
        uint256 totalWeight;
        uint256 unlockTime;
        uint256 nftWeight;
        uint256 lockedAmount; // How many staked tokens the user has provided,
        uint256 lockMode; // duration
        uint256 xOracleLock;
    }

    struct Reward {
        address token;
        uint256 amount;
    }

    address public distributor;

    modifier onlyDistributorOrOwner() {
        require(
            msg.sender == distributor || msg.sender == owner(),
            "caller is not distributor or owner"
        );
        _;
    }

    mapping(address => TokenLock) public userLocks;

    mapping(address => EnumerableSet.UintSet) private userNFTBalances;

    uint256 public totalPoolWeight;

    uint256 public totalXOracleLocked;

    uint256 public totalNFTWeight;

    bool public enableEmergency;

    uint256[] public proAmountForLock = new uint256[](5);

    EnumerableMap.AddressToUintMap private accRewardPerWeight;

    EnumerableMap.AddressToUintMap private totalReward;

    mapping(address => EnumerableMap.AddressToUintMap) private userDebtRewards;

    mapping(address => EnumerableMap.AddressToUintMap) private userTotalReward;

    EnumerableSet.UintSet private rewardHistoryTimes;

    mapping(uint256 => Reward) private rewardHistory;

    receive() external payable {}

    fallback() external payable {}

    constructor(address _oracleWeight) {
        require(_oracleWeight != address(0), "wrong weighter");
        oracleWeight = _oracleWeight;
    }

    function totalStakedNFTCount() public view returns (uint256 tokenCount) {
        tokenCount = IERC721Enumerable(oracleNFT).balanceOf(address(this));
    }

    function totalStakedNFT() external view returns (uint256[] memory) {
        uint256 tokenCount = IERC721Enumerable(oracleNFT).balanceOf(
            address(this)
        );
        if (tokenCount == 0) {
            // Return an empty array
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](tokenCount);
            uint256 index;
            for (index = 0; index < tokenCount; index++) {
                result[index] = IERC721Enumerable(oracleNFT)
                    .tokenOfOwnerByIndex(address(this), index);
            }
            return result;
        }
    }

    function userWalletNFT(address _owner)
        external
        view
        returns (uint256[] memory)
    {
        uint256 tokenCount = IERC721Enumerable(oracleNFT).balanceOf(_owner);
        if (tokenCount == 0) {
            // Return an empty array
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](tokenCount);
            uint256 index;
            for (index = 0; index < tokenCount; index++) {
                result[index] = IERC721Enumerable(oracleNFT)
                    .tokenOfOwnerByIndex(_owner, index);
            }
            return result;
        }
    }

    function userStakedNFT(address _owner)
        public
        view
        returns (uint256[] memory)
    {
        return userNFTBalances[_owner].values();
    }

    function userStakedNFTCount(address _owner) public view returns (uint256) {
        return userNFTBalances[_owner].length();
    }

    function isStaked(address account, uint256 tokenId)
        public
        view
        returns (bool)
    {
        return userNFTBalances[account].contains(tokenId);
    }

    function distributeReward(address token, uint256 _amount)
        public
        payable
        onlyDistributorOrOwner
    {
        require(_amount > 0, "zero reward");

        if (token != address(0)) {
            uint256 beforeBalance = IERC20(token).balanceOf(address(this));

            IERC20(token).safeTransferFrom(
                address(msg.sender),
                address(this),
                _amount
            );

            uint256 afterBalance = IERC20(token).balanceOf(address(this));

            _amount = afterBalance - beforeBalance;
        } else {
            _amount = msg.value;
        }

        if (totalPoolWeight > 0) {
            (, uint256 lastValue) = accRewardPerWeight.tryGet(token);

            uint256 newValue = lastValue +
                (_amount * PRECISION_FACTOR) /
                totalPoolWeight;
            accRewardPerWeight.set(token, newValue);
        }

        (, uint256 lastTotalValue) = totalReward.tryGet(token);
        uint256 newTotalValue = lastTotalValue + _amount;
        totalReward.set(token, newTotalValue);

        rewardHistoryTimes.add(block.timestamp);

        rewardHistory[block.timestamp] = Reward({
            token: token,
            amount: _amount
        });
    }

    function backToPool(address token, uint256 _amount) private {
        if (totalPoolWeight > 0) {
            (, uint256 lastValue) = accRewardPerWeight.tryGet(token);
            uint256 newValue = lastValue +
                (_amount * PRECISION_FACTOR) /
                totalPoolWeight;
            accRewardPerWeight.set(token, newValue);
        }

        (, uint256 lastTotalValue) = totalReward.tryGet(token);
        uint256 newTotalValue = lastTotalValue + _amount;
        totalReward.set(token, newTotalValue);

        rewardHistoryTimes.add(block.timestamp);

        rewardHistory[block.timestamp] = Reward({
            token: token,
            amount: _amount
        });
    }

    function distributedUserTotalReward(address user)
        external
        view
        returns (Reward[] memory rewards)
    {
        uint256 rewardCount = userTotalReward[user].length();

        rewards = new Reward[](rewardCount);

        for (uint256 i; i < rewardCount; ) {
            (address token, uint256 distributed) = userTotalReward[user].at(i);
            rewards[i] = Reward({token: token, amount: distributed});

            unchecked {
                i++;
            }
        }
    }

    function distributedTotalReward()
        external
        view
        returns (Reward[] memory rewards)
    {
        uint256 rewardCount = totalReward.length();

        rewards = new Reward[](rewardCount);

        for (uint256 i; i < rewardCount; ) {
            (address token, uint256 distributed) = totalReward.at(i);
            rewards[i] = Reward({token: token, amount: distributed});

            unchecked {
                i++;
            }
        }
    }

    function updateDebt() private {
        TokenLock storage lock = userLocks[msg.sender];

        if (lock.totalWeight > 0) {
            uint256 rewardCount = accRewardPerWeight.length();

            for (uint256 i; i < rewardCount; ) {
                (address token, uint256 acc) = accRewardPerWeight.at(i);

                uint256 newDebt = (lock.totalWeight * acc) / PRECISION_FACTOR;

                userDebtRewards[msg.sender].set(token, newDebt);

                unchecked {
                    i++;
                }
            }
        }
    }

    function pendingRewards(address user)
        external
        view
        returns (Reward[] memory rewards)
    {
        TokenLock memory lock = userLocks[user];

        if (lock.totalWeight > 0) {
            uint256 rewardCount = accRewardPerWeight.length();

            rewards = new Reward[](rewardCount);

            for (uint256 i; i < rewardCount; ) {
                (address token, uint256 acc) = accRewardPerWeight.at(i);

                (, uint256 debtReward) = userDebtRewards[user].tryGet(token);

                uint256 reward = (lock.totalWeight * acc) /
                    PRECISION_FACTOR -
                    debtReward;

                rewards[i] = Reward({token: token, amount: reward});

                unchecked {
                    i++;
                }
            }
        }
    }

    function harvest() public {
        TokenLock storage lock = userLocks[msg.sender];

        if (lock.totalWeight > 0) {
            uint256 rewardCount = accRewardPerWeight.length();

            for (uint256 i; i < rewardCount; ) {
                (address token, uint256 acc) = accRewardPerWeight.at(i);
                (, uint256 debtReward) = userDebtRewards[msg.sender].tryGet(
                    token
                );

                uint256 reward = (lock.totalWeight * acc) /
                    PRECISION_FACTOR -
                    debtReward;

                if (reward > 0) {
                    if (token == address(0)) {
                        transferETH(msg.sender, reward);
                    } else {
                        IERC20(token).safeTransfer(msg.sender, reward);
                    }

                    (, uint256 lastTotalValue) = userTotalReward[msg.sender]
                        .tryGet(token);
                    uint256 newTotalValue = lastTotalValue + reward;
                    userTotalReward[msg.sender].set(token, newTotalValue);
                }

                uint256 newDebt = (lock.totalWeight * acc) / PRECISION_FACTOR;

                userDebtRewards[msg.sender].set(token, newDebt);

                unchecked {
                    i++;
                }
            }
        }
    }

    function rewardBackToPool() private {
        TokenLock storage lock = userLocks[msg.sender];

        if (lock.totalWeight > 0) {
            uint256 rewardCount = accRewardPerWeight.length();

            for (uint256 i; i < rewardCount; ) {
                (address token, uint256 acc) = accRewardPerWeight.at(i);
                (, uint256 debtReward) = userDebtRewards[msg.sender].tryGet(
                    token
                );

                uint256 reward = (lock.totalWeight * acc) /
                    PRECISION_FACTOR -
                    debtReward;

                if (reward > 0) {
                    if (totalPoolWeight > 0) {
                        (, uint256 lastValue) = accRewardPerWeight.tryGet(
                            token
                        );

                        uint256 newValue = lastValue +
                            (reward * PRECISION_FACTOR) /
                            totalPoolWeight;
                        accRewardPerWeight.set(token, newValue);
                    }

                    (, uint256 lastTotalValue) = totalReward.tryGet(token);
                    uint256 newTotalValue = lastTotalValue + reward;
                    totalReward.set(token, newTotalValue);

                    rewardHistoryTimes.add(block.timestamp + i);

                    rewardHistory[block.timestamp + i] = Reward({
                        token: token,
                        amount: reward
                    });
                }

                uint256 newDebt = (lock.totalWeight * acc) / PRECISION_FACTOR;

                userDebtRewards[msg.sender].set(token, newDebt);

                unchecked {
                    i++;
                }
            }
        }
    }

    function depositOracleBar(uint256 amount) private {
        require(amount > 0, "zero amount");

        require(
            IERC20(xOracle).balanceOf(msg.sender) >= amount,
            "small xOracle balance to stake"
        );

        require(
            IERC20(xOracle).allowance(msg.sender, address(this)) >= amount,
            "small xOracle allowance to stake"
        );

        uint256 beforeBalance = IERC20(xOracle).balanceOf(address(this));

        IERC20(xOracle).safeTransferFrom(
            address(msg.sender),
            address(this),
            amount
        );

        uint256 afterBalance = IERC20(xOracle).balanceOf(address(this));

        amount = afterBalance - beforeBalance;

        TokenLock storage lock = userLocks[msg.sender];

        lock.xOracleLock += amount;

        totalXOracleLocked += amount;
    }

    function withdrawOracleBar(uint256 amount) private {
        require(amount > 0, "zero amount");


        TokenLock storage lock = userLocks[msg.sender];

        // require(lock.xOracleLock >= amount, "small lock amount");

        uint8 mode = 0;

        if (block.timestamp < lock.unlockTime) {
            mode = 1;
        }

        uint256 tokenFee = (amount * 50 * mode) / 100;

        uint256 amountWithdraw = amount - tokenFee;

        IERC20(xOracle).safeTransfer(msg.sender, amountWithdraw);

        if (mode == 1) {
            uint256 burnAmount = (tokenFee * 50) / 100;

            IERC20(xOracle).safeTransfer(deadAddress, burnAmount);

            backToPool(xOracle, tokenFee - burnAmount);
        }

        lock.xOracleLock -= amount;

        totalXOracleLocked -= amount;
    }

    function batchNFTStake(uint256[] calldata tokenIds) public nonReentrant {
        require(
            IERC721(oracleNFT).isApprovedForAll(_msgSender(), address(this)),
            "Not approve nft to staker address"
        );

        uint256 count = tokenIds.length;

        require(count > 0, "zero stake nft");

        TokenLock storage lock = userLocks[msg.sender];

        if (lock.lockMode != 0) {
            if (lock.lockedAmount > 0) {
                require(lock.lockedAmount >= minProAmount, "small pro staked");
                depositOracleBar(minxOracleAmount * count);
            }
        }

        uint256 newWeight = lock.nftWeight;

        uint256 addedWeight = 0;

        for (uint256 i = 0; i < count; ) {
            uint256 tokenId = tokenIds[i];

            require(
                IERC721(oracleNFT).ownerOf(tokenId) == _msgSender(),
                "wrong owner"
            );

            IERC721(oracleNFT).safeTransferFrom(
                _msgSender(),
                address(this),
                tokenId
            );

            userNFTBalances[_msgSender()].add(tokenId);

            uint256 oracleNFTWeight = IOracleNFTWeight(oracleWeight)
                .oracleNFTWeight(tokenId) * 10**18;
            newWeight += oracleNFTWeight;

            // addedWeight +=
            //     (oracleNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) /
            //     10;

            if (lock.lockedAmount > 0) {
                addedWeight +=
                    (oracleNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) /
                    10;
            } else {
                addedWeight += oracleNFTWeight;
            }

            unchecked {
                i++;
            }
        }

        harvest();

        lock.nftWeight = newWeight;

        lock.totalWeight = addedWeight + lock.totalWeight;

        totalPoolWeight += addedWeight;
        updateDebt();
    }

    function NFTStake(uint256 tokenId) public nonReentrant {
        require(
            IERC721(oracleNFT).ownerOf(tokenId) == _msgSender(),
            "wrong owner"
        );

        require(
            IERC721(oracleNFT).isApprovedForAll(_msgSender(), address(this)) ||
                IERC721(oracleNFT).getApproved(tokenId) == address(this),
            "not approved"
        );

        TokenLock storage lock = userLocks[msg.sender];

        if (lock.lockMode != 0) {
            if (lock.lockedAmount > 0) {
                require(lock.lockedAmount >= minProAmount, "small pro staked");
                depositOracleBar(minxOracleAmount);
            }
        }

        IERC721(oracleNFT).safeTransferFrom(
            _msgSender(),
            address(this),
            tokenId
        );

        harvest();

        userNFTBalances[_msgSender()].add(tokenId);

        uint256 oldWeight = lock.nftWeight;
        uint256 oracleNFTWeight = IOracleNFTWeight(oracleWeight)
            .oracleNFTWeight(tokenId) * 10**18;
        uint256 newWeight = oldWeight + oracleNFTWeight;

        lock.nftWeight = newWeight;
        uint256 addedWeight;
        if (lock.lockedAmount > 0) {
            addedWeight =
                (oracleNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) /
                10;
        } else {
            addedWeight = oracleNFTWeight;
        }
        lock.totalWeight += addedWeight;
        totalPoolWeight += addedWeight;
        updateDebt();
    }

    function NFTWithdraw(uint256 tokenId) public nonReentrant {
        require(isStaked(_msgSender(), tokenId), "Not staked this nft");

        IERC721(oracleNFT).safeTransferFrom(
            address(this),
            _msgSender(),
            tokenId
        );

        TokenLock storage lock = userLocks[msg.sender];

        if (lock.xOracleLock >= minxOracleAmount) {
            withdrawOracleBar(minxOracleAmount);
        }else if(lock.xOracleLock > 0){
            withdrawOracleBar(lock.xOracleLock);
        }

        userNFTBalances[_msgSender()].remove(tokenId);

        harvest();

        uint256 oldWeight = lock.nftWeight;

        uint256 oracleNFTWeight = IOracleNFTWeight(oracleWeight)
            .oracleNFTWeight(tokenId) * 10**18;

        uint256 newWeight = oldWeight - oracleNFTWeight;

        lock.nftWeight = newWeight;

        uint256 reduceddWeight;

        //  (oracleNFTWeight *
        //     LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10;

        if (lock.lockedAmount > 0) {
            reduceddWeight =
                (oracleNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) /
                10;
        } else {
            reduceddWeight = oracleNFTWeight;
        }

        lock.totalWeight -= reduceddWeight;
        totalPoolWeight -= reduceddWeight;

        updateDebt();

        if (lock.lockedAmount == 0) {
            if (userStakedNFTCount(msg.sender) == 0) {
                delete userLocks[msg.sender];
            }
            emit OnTokenUnlock(msg.sender);
        }
    }

    function batchNFTWithdraw(uint256[] calldata tokenIds) public nonReentrant {
        uint256 count = tokenIds.length;

        require(count > 0, "zero stake nft");

        TokenLock storage lock = userLocks[msg.sender];

        uint256 newWeight = lock.nftWeight;

        uint256 reduceddWeight = 0;

        for (uint256 i = 0; i < count; ) {
            uint256 tokenId = tokenIds[i];

            require(isStaked(_msgSender(), tokenId), "Not staked this nft");

            IERC721(oracleNFT).safeTransferFrom(
                address(this),
                _msgSender(),
                tokenId
            );

            userNFTBalances[_msgSender()].remove(tokenId);

            uint256 oracleNFTWeight = IOracleNFTWeight(oracleWeight)
                .oracleNFTWeight(tokenId) * 10**18;

            newWeight -= oracleNFTWeight;

            // reduceddWeight +=
            //     (oracleNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) /
            //     10;

            if (lock.lockedAmount > 0) {
                reduceddWeight +=
                    (oracleNFTWeight * LOCK_TIME_MULTIPLIER[lock.lockMode]) /
                    10;
            } else {
                reduceddWeight += oracleNFTWeight;
            }

            unchecked {
                i++;
            }
        }

        harvest();

        if (lock.xOracleLock >= minxOracleAmount * count) {
            withdrawOracleBar(minxOracleAmount * count);
        }else if(lock.xOracleLock > 0){
            withdrawOracleBar(lock.xOracleLock);
        }

        lock.nftWeight = newWeight;

        lock.totalWeight -= reduceddWeight;
        totalPoolWeight -= reduceddWeight;

        updateDebt();

        if (lock.lockedAmount == 0) {
            if (userStakedNFTCount(msg.sender) == 0) {
                delete userLocks[msg.sender];
            }
            emit OnTokenUnlock(msg.sender);
        }
    }

    function calculateUserNFTWeight(address _account)
        public
        view
        returns (uint256 weight)
    {
        uint256 tokenCount = userNFTBalances[_account].length();
        if (tokenCount == 0) {
            return 0;
        } else {
            uint256[] memory staked = userStakedNFT(_account);
            uint256 i;
            for (i; i < tokenCount; ) {
                weight +=
                    IOracleNFTWeight(oracleWeight).oracleNFTWeight(staked[i]) *
                    10**18;
                unchecked {
                    i++;
                }
            }
        }
    }

    /**
     * @notice locks pro token until specified time
     * @param amount amount of tokens to lock
     * @param lockMode unix time in seconds after that tokens can be withdrawn
     */
    function deposit(uint256 amount, uint8 lockMode)
        external
        payable
        nonReentrant
    {
        require(amount > 0, "ZERO AMOUNT");

        require(
            IERC20(proToken).balanceOf(msg.sender) >= amount,
            "small PRO balance to stake"
        );

        require(
            IERC20(proToken).allowance(msg.sender, address(this)) >= amount,
            "small PRO allowance to stake"
        );

        require(lockMode >= 0 && lockMode < 5, "Invalid lock mode");

        TokenLock storage lock = userLocks[msg.sender];

        require(lock.lockedAmount == 0, "already deposit");

        uint256 beforeBalance = IERC20(proToken).balanceOf(address(this));

        IERC20(proToken).safeTransferFrom(
            address(msg.sender),
            address(this),
            amount
        );

        uint256 afterBalance = IERC20(proToken).balanceOf(address(this));

        amount = afterBalance - beforeBalance;

        uint256 unlockTime = block.timestamp + LOCK_TIME_DURATION[lockMode];

        uint256 addeddWeight = (amount * LOCK_TIME_MULTIPLIER[lockMode]) / 10;

        if (lock.nftWeight > 0) {
            addeddWeight +=
                (lock.nftWeight * (LOCK_TIME_MULTIPLIER[lockMode] - 10)) /
                10;

            if (lockMode > 0) {

                require(amount >= minProAmount, "small pro amount for nft");

                uint256 count = userStakedNFTCount(msg.sender);

                if (count > 0 && minxOracleAmount * count > lock.xOracleLock) {
                    depositOracleBar(
                        minxOracleAmount * count - lock.xOracleLock
                    );
                }
            }
        }

        harvest();

        totalPoolWeight += addeddWeight;

        proAmountForLock[lockMode] += amount;

        lock.totalWeight += addeddWeight;
        lock.lockedAmount += amount;

        if(lock.unlockTime < unlockTime){
            lock.unlockTime = unlockTime;
        }
       
        lock.lockMode = lockMode;
        updateDebt();

        emit OnTokenLock(msg.sender, amount, unlockTime, lockMode);
    }

    function extendLockTime(uint256 lockMode) external nonReentrant {
        require(lockMode > 0 && lockMode < 5, "Invalid lock mode");

        TokenLock storage lock = userLocks[msg.sender];

        require(lock.lockedAmount > 0, "no lock");

        require(lock.lockMode < lockMode, "NOT INCREASING UNLOCK TIME");

        uint256 count = userStakedNFTCount(msg.sender);

        if (count > 0) {
            if (lock.xOracleLock == 0) {
                depositOracleBar(minxOracleAmount * count);
            }
            require(lock.lockedAmount >= minProAmount, "small pro staked");
        }

        uint256 unlockTime = lock.unlockTime +
            LOCK_TIME_DURATION[lockMode] -
            LOCK_TIME_DURATION[lock.lockMode];

        uint256 addeddWeight = ((lock.lockedAmount + lock.nftWeight) *
            (LOCK_TIME_MULTIPLIER[lockMode] -
                LOCK_TIME_MULTIPLIER[lock.lockMode])) / 10;

        harvest();

        totalPoolWeight += addeddWeight;

        proAmountForLock[lock.lockMode] -= lock.lockedAmount;

        proAmountForLock[lockMode] += lock.lockedAmount;

        lock.totalWeight += addeddWeight;

        lock.lockMode = lockMode;

        lock.unlockTime = unlockTime;

        updateDebt();

        emit OnLockDurationIncreased(msg.sender, unlockTime);
    }

    function shortenLockTime(uint256 lockMode) external nonReentrant {
        require(lockMode >= 0 && lockMode < 5, "Invalid lock mode");

        TokenLock storage lock = userLocks[msg.sender];

        require(lock.lockMode > lockMode, "NOT DECREASING UNLOCK TIME");

        require(lock.unlockTime < block.timestamp, "original lock duration");

        uint256 unlockTime = block.timestamp + LOCK_TIME_DURATION[lockMode];

        uint256 reducedWeight = ((lock.lockedAmount + lock.nftWeight) *
            (LOCK_TIME_MULTIPLIER[lock.lockMode] -
                LOCK_TIME_MULTIPLIER[lockMode])) / 10;

        harvest();

        totalPoolWeight -= reducedWeight;

        proAmountForLock[lock.lockMode] -= lock.lockedAmount;

        proAmountForLock[lockMode] += lock.lockedAmount;

        lock.totalWeight -= reducedWeight;

        lock.lockMode = lockMode;

        lock.unlockTime = unlockTime;

        updateDebt();
    }

    /**
     * @notice add tokens to an existing lock
     * @param amount tokens amount to add
     */
    function increaseLockAmount(uint256 amount) external payable nonReentrant {
        require(amount > 0, "ZERO AMOUNT");

        TokenLock storage lock = userLocks[msg.sender];

        require(lock.lockedAmount > 0, "no original lock");

        uint256 beforeBalance = IERC20(proToken).balanceOf(address(this));

        IERC20(proToken).safeTransferFrom(
            address(msg.sender),
            address(this),
            amount
        );

        uint256 afterBalance = IERC20(proToken).balanceOf(address(this));

        amount = afterBalance - beforeBalance;

        harvest();

        uint256 addeddWeight = ((amount) *
            LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10;

        totalPoolWeight += addeddWeight;

        proAmountForLock[lock.lockMode] += amount;

        lock.totalWeight += addeddWeight;
        lock.lockedAmount += amount;

        updateDebt();

        emit OnLockAmountIncreased(msg.sender, amount);
    }

    /**
     * @notice withdraw specified amount of tokens from lock. Current time must be greater than unlock time
     * @param amount amount of tokens to withdraw
     */
    function withdraw(uint256 amount) public nonReentrant {
        TokenLock storage lock = userLocks[msg.sender];

        require(lock.lockedAmount >= amount, "more withdraw");

        require(amount > 0, "zero amount");

        uint8 mode = 0;

        if (block.timestamp < lock.unlockTime) {
            mode = 1;
            rewardBackToPool();
        } else {
            harvest();
        }

        uint256 tokenFee = (amount * 50 * mode) / 100;

        uint256 amountWithdraw = amount - tokenFee;

        if (amountWithdraw > 0) {
            IERC20(proToken).safeTransfer(msg.sender, amountWithdraw);
        }

        if (mode == 1) {
            uint256 burnAmount = (tokenFee * 5) / 10;
            IERC20(proToken).safeTransfer(deadAddress, burnAmount);
            backToPool(proToken, tokenFee - burnAmount);
        }

        proAmountForLock[lock.lockMode] -= amount;

        lock.lockedAmount -= amount;

        if (lock.lockedAmount == 0) {
            totalPoolWeight =
                totalPoolWeight +
                lock.nftWeight -
                lock.totalWeight;

            if (userStakedNFTCount(msg.sender) == 0) {
                delete userLocks[msg.sender];
            } else {
                // lock.lockMode = 0;
                lock.totalWeight = lock.nftWeight;
            }
        } else {
            uint256 reducedWeight = (amount *
                LOCK_TIME_MULTIPLIER[lock.lockMode]) / 10;

            totalPoolWeight -= reducedWeight;

            lock.totalWeight -= reducedWeight;
        }

        updateDebt();

        if (lock.lockedAmount == 0) {
            emit OnTokenUnlock(msg.sender);
        } else {
            emit OnLockWithdrawal(msg.sender, amount, mode);
        }
    }

    function transferETH(address recipient, uint256 amount) private {
        (bool res, ) = payable(recipient).call{value: amount}("");
        require(res, "ETH TRANSFER FAILED");
    }

    function totalProLocked() public view returns (uint256 amount) {
        for (uint256 i; i < proAmountForLock.length; ) {
            amount += proAmountForLock[i];
            unchecked {
                i++;
            }
        }
    }

    function setOracleWeight(address _oracleWeight) external onlyOwner {
        require(_oracleWeight != address(0), "wrong address");
        oracleWeight = _oracleWeight;
    }

    function setMinxOracle(uint256 _min) external onlyOwner {
        minxOracleAmount = _min;
    }

    function setMinPro(uint256 _min) external onlyOwner {
        minProAmount = _min;
    }

    function setEmergency(bool _flag) external onlyOwner {
        enableEmergency = _flag;
    }

    function setDistributor(address _distributor) external onlyOwner {
        distributor = _distributor;
    }

    function emergencyWithdraw() public nonReentrant {
        require(enableEmergency, "not emergency feature");

        // TokenLock storage lock = userLocks[msg.sender];

        uint256[] memory staked = userStakedNFT(msg.sender);

        uint256 count = staked.length;

        for (uint256 i = 0; i < count; ) {
            uint256 tokenId = staked[i];

            IERC721(oracleNFT).safeTransferFrom(
                address(this),
                _msgSender(),
                tokenId
            );

            userNFTBalances[_msgSender()].remove(tokenId);

            unchecked {
                i++;
            }
        }
    }

    function getGlobalStatus()
        external
        view
        returns (
            uint256 poolSize,
            uint256 proAmount,
            uint256 nftCount,
            uint256 xOracleAmount
        )
    {
        poolSize = totalPoolWeight;
        proAmount = totalProLocked();
        nftCount = totalStakedNFTCount();
        xOracleAmount = totalXOracleLocked;
    }

    function getRewardHistory()
        external
        view
        returns (uint256[] memory times, Reward[] memory rewards)
    {
        uint256 rewardCount = rewardHistoryTimes.length();
        times = new uint256[](rewardCount);
        rewards = new Reward[](rewardCount);

        for (uint256 i; i < rewardCount; ) {
            uint256 rewardTime = rewardHistoryTimes.at(i);
            rewards[i] = rewardHistory[rewardTime];
            times[i] = rewardTime;

            unchecked {
                i++;
            }
        }
    }

    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_oracleWeight","internalType":"address"}]},{"type":"event","name":"OnLockAmountIncreased","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OnLockDurationIncreased","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"newUnlockTime","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OnLockWithdrawal","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint8","name":"mode","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"OnTokenLock","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"unlockTime","internalType":"uint256","indexed":false},{"type":"uint8","name":"lockMode","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"OnTokenUnlock","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"LOCK_TIME_DURATION","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"LOCK_TIME_MULTIPLIER","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"NFTStake","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"NFTWithdraw","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PRECISION_FACTOR","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchNFTStake","inputs":[{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchNFTWithdraw","inputs":[{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"weight","internalType":"uint256"}],"name":"calculateUserNFTWeight","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"deadAddress","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint8","name":"lockMode","internalType":"uint8"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"distributeReward","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"rewards","internalType":"struct PRONFTMultiStaking.Reward[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]}],"name":"distributedTotalReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"rewards","internalType":"struct PRONFTMultiStaking.Reward[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]}],"name":"distributedUserTotalReward","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"distributor","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"enableEmergency","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"extendLockTime","inputs":[{"type":"uint256","name":"lockMode","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"poolSize","internalType":"uint256"},{"type":"uint256","name":"proAmount","internalType":"uint256"},{"type":"uint256","name":"nftCount","internalType":"uint256"},{"type":"uint256","name":"xOracleAmount","internalType":"uint256"}],"name":"getGlobalStatus","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"times","internalType":"uint256[]"},{"type":"tuple[]","name":"rewards","internalType":"struct PRONFTMultiStaking.Reward[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]}],"name":"getRewardHistory","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"harvest","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"increaseLockAmount","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isStaked","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minProAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minxOracleAmount","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC721Received","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"oracle","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"oracleNFT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"oracleWeight","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"rewards","internalType":"struct PRONFTMultiStaking.Reward[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]}],"name":"pendingRewards","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"proAmountForLock","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDistributor","inputs":[{"type":"address","name":"_distributor","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEmergency","inputs":[{"type":"bool","name":"_flag","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinPro","inputs":[{"type":"uint256","name":"_min","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinxOracle","inputs":[{"type":"uint256","name":"_min","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setOracleWeight","inputs":[{"type":"address","name":"_oracleWeight","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"shortenLockTime","inputs":[{"type":"uint256","name":"lockMode","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalNFTWeight","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPoolWeight","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"}],"name":"totalProLocked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"totalStakedNFT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"tokenCount","internalType":"uint256"}],"name":"totalStakedNFTCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalXOracleLocked","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"totalWeight","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"},{"type":"uint256","name":"nftWeight","internalType":"uint256"},{"type":"uint256","name":"lockedAmount","internalType":"uint256"},{"type":"uint256","name":"lockMode","internalType":"uint256"},{"type":"uint256","name":"xOracleLock","internalType":"uint256"}],"name":"userLocks","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"userStakedNFT","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userStakedNFTCount","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"userWalletNFT","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"wsgb","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"xOracle","inputs":[]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x6305f5e100600255610120604052600a6080908152600f60a052604660c052609660e052610136610100526200003a906003906005620001f3565b506040805160a0810182526000815262278d0060208201526276a7009181019190915262ed4e0060608201526301e1338060808201526200008090600490600562000249565b50600580546001600160a01b03191673cdb019c0990c033724da55f5a04be6fd6ec1809d178155683c3a38e5ab72fc000060065568056bc75e2d631000006007556040805182815260c08101909152906020820160a08036833750508151620000f19260109250602001906200028f565b50348015620000ff57600080fd5b50604051620051b8380380620051b88339810160408190526200012291620002e4565b6200012d33620001a3565b600180556001600160a01b0381166200017d5760405162461bcd60e51b815260206004820152600e60248201526d3bb937b733903bb2b4b3b43a32b960911b604482015260640160405180910390fd5b600880546001600160a01b0319166001600160a01b039290921691909117905562000316565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b82805482825590600052602060002090810192821562000237579160200282015b8281111562000237578251829061ffff1690559160200191906001019062000214565b5062000245929150620002cd565b5090565b82805482825590600052602060002090810192821562000237579160200282015b8281111562000237578251829063ffffffff169055916020019190600101906200026a565b82805482825590600052602060002090810192821562000237579160200282015b8281111562000237578251825591602001919060010190620002b0565b5b80821115620002455760008155600101620002ce565b600060208284031215620002f757600080fd5b81516001600160a01b03811681146200030f57600080fd5b9392505050565b614e9280620003266000396000f3fe6080604052600436106102f75760003560e01c806375619ab511610196578063cd0559eb116100eb578063e5baa10c1161008f578063ec3417ff1161006c578063ec3417ff14610977578063f2fde38b14610997578063f30ce16f146109b7578063fdd93214146109cc57005b8063e5baa10c14610917578063e66891db14610937578063e9ac2ee11461095757005b8063dc1518cc116100c8578063dc1518cc14610880578063dcfc2006146108a0578063e2d31d9a146108d5578063e42c4e63146108fd57005b8063cd0559eb1461082b578063d3a38e501461084b578063db2e21bc1461086b57005b80639231e9ad11610152578063964e7ee51161012f578063964e7ee5146107b5578063bfe10928146107d5578063cc6f6163146107f5578063ccd34cd51461081557005b80639231e9ad1461076b5780639445956214610780578063946de4a1146107a057005b806375619ab51461069d57806379fafc69146106bd5780637dc0d1d0146106e5578063808e61861461070d578063828047a51461072d5780638da5cb5b1461074d57005b806335b419eb1161024c5780635451da1b11610208578063654cfdff116101e5578063654cfdff146106405780636ef8d8f314610653578063715018a61461067357806375233e321461068857005b80635451da1b146105cd5780635ccedd95146105fd5780636317cea51461062057005b806335b419eb146105225780633960b9501461054257806340376ba214610562578063403f44471461058f5780634641257d146105a257806353a45706146105b757005b80631ec8bb8c116102b357806327c8f8351161029057806327c8f835146104b65780632c4145ed146104cc5780632e1a7d4d146104e257806331d7a2621461050257005b80631ec8bb8c1461044d578063230d971814610460578063272346cd146104a057005b806302559004146103005780630259ef58146103295780630501d556146103a65780630e41ef22146103c657806313785cd4146103f3578063150b7a021461040957005b366102fe57005b005b34801561030c57600080fd5b50610316600c5481565b6040519081526020015b60405180910390f35b34801561033557600080fd5b506103796103443660046148fe565b600a60205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909186565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610320565b3480156103b257600080fd5b506102fe6103c1366004614929565b6109ec565b3480156103d257600080fd5b506103e66103e13660046148fe565b610a07565b6040516103209190614995565b3480156103ff57600080fd5b5061031660075481565b34801561041557600080fd5b506104346104243660046149be565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610320565b6102fe61045b366004614a9e565b610b0e565b34801561046c57600080fd5b506104887302f0826ef6ad107cfc861152b32b52fd11bab9ed81565b6040516001600160a01b039091168152602001610320565b3480156104ac57600080fd5b5061031660065481565b3480156104c257600080fd5b5061048861dead81565b3480156104d857600080fd5b50610316600d5481565b3480156104ee57600080fd5b506102fe6104fd366004614aca565b610db6565b34801561050e57600080fd5b506103e661051d3660046148fe565b611121565b34801561052e57600080fd5b5061031661053d366004614aca565b6112c1565b34801561054e57600080fd5b506102fe61055d3660046148fe565b6112e2565b34801561056e57600080fd5b5061058261057d3660046148fe565b611352565b6040516103209190614b13565b6102fe61059d366004614aca565b61137c565b3480156105ae57600080fd5b506102fe611654565b3480156105c357600080fd5b50610316600e5481565b3480156105d957600080fd5b506105ed6105e8366004614a9e565b6117b5565b6040519015158152602001610320565b34801561060957600080fd5b506106126117de565b604051610320929190614b26565b34801561062c57600080fd5b506102fe61063b366004614aca565b61192c565b6102fe61064e366004614b54565b611c33565b34801561065f57600080fd5b506102fe61066e366004614aca565b612232565b34801561067f57600080fd5b506102fe61265a565b34801561069457600080fd5b5061058261266e565b3480156106a957600080fd5b506102fe6106b83660046148fe565b6127fd565b3480156106c957600080fd5b5061048873f810576a68c3731875bde07404be815b16fc0b4e81565b3480156106f157600080fd5b5061048873d7565b16b65376e2ddb6c71e7971c7185a7ff3ff81565b34801561071957600080fd5b506105826107283660046148fe565b612827565b34801561073957600080fd5b506102fe610748366004614aca565b6129b4565b34801561075957600080fd5b506000546001600160a01b0316610488565b34801561077757600080fd5b506103e6612cc5565b34801561078c57600080fd5b50600854610488906001600160a01b031681565b3480156107ac57600080fd5b50610316612d9d565b3480156107c157600080fd5b506102fe6107d0366004614aca565b612e0f565b3480156107e157600080fd5b50600954610488906001600160a01b031681565b34801561080157600080fd5b506102fe610810366004614b8a565b612e1c565b34801561082157600080fd5b5061031660025481565b34801561083757600080fd5b506103166108463660046148fe565b61311f565b34801561085757600080fd5b506102fe610866366004614aca565b613140565b34801561087757600080fd5b506102fe61314d565b34801561088c57600080fd5b5061031661089b366004614aca565b613281565b3480156108ac57600080fd5b506108b5613291565b604080519485526020850193909352918301526060820152608001610320565b3480156108e157600080fd5b50610488735795377c85e0fdf6370fae1b74fe03b930c4a89281565b34801561090957600080fd5b50600f546105ed9060ff1681565b34801561092357600080fd5b506103166109323660046148fe565b6132b7565b34801561094357600080fd5b506102fe610952366004614b8a565b6133bb565b34801561096357600080fd5b50600554610488906001600160a01b031681565b34801561098357600080fd5b506102fe610992366004614aca565b6137dc565b3480156109a357600080fd5b506102fe6109b23660046148fe565b613a41565b3480156109c357600080fd5b50610316613ab7565b3480156109d857600080fd5b506103166109e7366004614aca565b613af8565b6109f4613b08565b600f805460ff1916911515919091179055565b6001600160a01b038116600090815260186020526040812060609190610a2c90613b62565b90508067ffffffffffffffff811115610a4757610a476149a8565b604051908082528060200260200182016040528015610a8c57816020015b6040805180820190915260008082526020820152815260200190600190039081610a655790505b50915060005b81811015610b07576001600160a01b03841660009081526018602052604081208190610abe9084613b6d565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110610af257610af2614bff565b60209081029190910101525050600101610a92565b5050919050565b6009546001600160a01b0316331480610b3157506000546001600160a01b031633145b610b8d5760405162461bcd60e51b815260206004820152602260248201527f63616c6c6572206973206e6f74206469737472696275746f72206f72206f776e60448201526132b960f11b60648201526084015b60405180910390fd5b60008111610bcb5760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc81c995dd85c9960aa1b6044820152606401610b84565b6001600160a01b03821615610cdc576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610c21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c459190614c15565b9050610c5c6001600160a01b038416333085613b8b565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc79190614c15565b9050610cd38282614c44565b92505050610cdf565b50345b600c5415610d30576000610cf4601184613be9565b9150506000600c5460025484610d0a9190614c57565b610d149190614c76565b610d1e9083614c98565b9050610d2c60118583613c01565b5050505b6000610d3d601484613be9565b915060009050610d4d8383614c98565b9050610d5b60148583613c01565b50610d67601942613c1f565b50506040805180820182526001600160a01b0394851681526020808201948552426000908152601b90915291909120905181546001600160a01b03191694169390931783555051600190910155565b600260015403610dd85760405162461bcd60e51b8152600401610b8490614cab565b6002600155336000908152600a602052604090206003810154821115610e305760405162461bcd60e51b815260206004820152600d60248201526c6d6f726520776974686472617760981b6044820152606401610b84565b60008211610e505760405162461bcd60e51b8152600401610b8490614ce2565b60008160010154421015610e6e57506001610e69613c2b565b610e76565b610e76611654565b6000606460ff8316610e89866032614c57565b610e939190614c57565b610e9d9190614c76565b90506000610eab8286614c44565b90508015610ed257610ed273f810576a68c3731875bde07404be815b16fc0b4e3383613e02565b8260ff16600103610f42576000600a610eec846005614c57565b610ef69190614c76565b9050610f1973f810576a68c3731875bde07404be815b16fc0b4e61dead83613e02565b610f4073f810576a68c3731875bde07404be815b16fc0b4e610f3b8386614c44565b610cdf565b505b846010856004015481548110610f5a57610f5a614bff565b906000526020600020016000828254610f739190614c44565b9250508190555084846003016000828254610f8e9190614c44565b909155505060038401546000036110135783546002850154600c54610fb39190614c98565b610fbd9190614c44565b600c55610fc93361311f565b60000361100757336000908152600a602052604081208181556001810182905560028101829055600381018290556004810182905560050155611082565b60028401548455611082565b6000600a600386600401548154811061102e5761102e614bff565b9060005260206000200154876110449190614c57565b61104e9190614c76565b905080600c60008282546110629190614c44565b909155505084548190869060009061107b908490614c44565b9091555050505b61108a613e32565b83600301546000036110ce576040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a1611116565b604080513381526020810187905260ff8516918101919091527f704f033850f47d833e5cf47aa6ea3fd43639cb4cac971745ef4f98bb5b0b78dd906060015b60405180910390a15b505060018055505050565b6001600160a01b0381166000908152600a6020908152604091829020825160c081018452815480825260018301549382019390935260028201549381019390935260038101546060848101919091526004820154608085015260059091015460a08401529190156112bb5760006111986011613b62565b90508067ffffffffffffffff8111156111b3576111b36149a8565b6040519080825280602002602001820160405280156111f857816020015b60408051808201909152600080825260208201528152602001906001900390816111d15790505b50925060005b818110156112b857600080611214601184613b6d565b6001600160a01b03891660009081526017602052604081209294509092509061123d9084613be9565b9150506000816002548489600001516112569190614c57565b6112609190614c76565b61126a9190614c44565b90506040518060400160405280856001600160a01b031681526020018281525088868151811061129c5761129c614bff565b60200260200101819052508480600101955050505050506111fe565b50505b50919050565b600481815481106112d157600080fd5b600091825260209091200154905081565b6112ea613b08565b6001600160a01b0381166113305760405162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b6044820152606401610b84565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600b6020526040902060609061137690613ebf565b92915050565b60026001540361139e5760405162461bcd60e51b8152600401610b8490614cab565b6002600155806113de5760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610b84565b336000908152600a6020526040902060038101546114315760405162461bcd60e51b815260206004820152601060248201526f6e6f206f726967696e616c206c6f636b60801b6044820152606401610b84565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611483573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a79190614c15565b90506114c973f810576a68c3731875bde07404be815b16fc0b4e333086613b8b565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa15801561151b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153f9190614c15565b905061154b8282614c44565b9350611555611654565b6000600a600385600401548154811061157057611570614bff565b9060005260206000200154866115869190614c57565b6115909190614c76565b905080600c60008282546115a49190614c98565b925050819055508460108560040154815481106115c3576115c3614bff565b9060005260206000200160008282546115dc9190614c98565b90915550508354819085906000906115f5908490614c98565b92505081905550848460030160008282546116109190614c98565b9091555061161e9050613e32565b60408051338152602081018790527f6a8757d829ee8d3cfb766d2dcfcb8ef4cef7d832778893fa7a1f3fa0cbaef6c3910161110d565b336000908152600a602052604090208054156117b25760006116766011613b62565b905060005b818110156117af57600080611691601184613b6d565b336000908152601760205260408120929450909250906116b19084613be9565b9150506000816002548489600001546116ca9190614c57565b6116d49190614c76565b6116de9190614c44565b90508015611761576001600160a01b038416611703576116fe3382613ecc565b611717565b6117176001600160a01b0385163383613e02565b3360009081526018602052604081206117309086613be9565b9150600090506117408383614c98565b33600090815260186020526040902090915061175d908783613c01565b5050505b60006002548489600001546117769190614c57565b6117809190614c76565b33600090815260176020526040902090915061179d908683613c01565b50506001909401935061167b92505050565b50505b50565b6001600160a01b0382166000908152600b602052604081206117d79083613f65565b9392505050565b60608060006117ed6019613f7d565b90508067ffffffffffffffff811115611808576118086149a8565b604051908082528060200260200182016040528015611831578160200160208202803683370190505b5092508067ffffffffffffffff81111561184d5761184d6149a8565b60405190808252806020026020018201604052801561189257816020015b604080518082019091526000808252602082015281526020019060019003908161186b5790505b50915060005b818110156119265760006118ad601983613f87565b6000818152601b6020908152604091829020825180840190935280546001600160a01b0316835260010154908201528551919250908590849081106118f4576118f4614bff565b60200260200101819052508085838151811061191257611912614bff565b602090810291909101015250600101611898565b50509091565b60026001540361194e5760405162461bcd60e51b8152600401610b8490614cab565b600260015561195e335b826117b5565b6119a05760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610b84565b6005546001600160a01b03166342842e0e3033846040518463ffffffff1660e01b81526004016119d293929190614d07565b600060405180830381600087803b1580156119ec57600080fd5b505af1158015611a00573d6000803e3d6000fd5b5050336000908152600a602052604090206007546005820154919350119050611a3357611a2e600754613f93565b611a4a565b600581015415611a4a57611a4a8160050154613f93565b611a7382600b6000335b6001600160a01b031681526020810191909152604001600020906140cf565b50611a7c611654565b600281015460085460405163c8fe2d3960e01b8152600481018590526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190614c15565b611b0190670de0b6b3a7640000614c57565b90506000611b0f8284614c44565b60028501819055600385015490915060009015611b6657600a6003866004015481548110611b3f57611b3f614bff565b906000526020600020015484611b559190614c57565b611b5f9190614c76565b9050611b69565b50815b80856000016000828254611b7d9190614c44565b9250508190555080600c6000828254611b969190614c44565b90915550611ba49050613e32565b8460030154600003611c2757611bb93361311f565b600003611bf357336000908152600a6020526040812081815560018101829055600281018290556003810182905560048101829055600501555b6040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a15b50506001805550505050565b600260015403611c555760405162461bcd60e51b8152600401610b8490614cab565b600260015581611c955760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610b84565b6040516370a0823160e01b8152336004820152829073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0a9190614c15565b1015611d585760405162461bcd60e51b815260206004820152601a60248201527f736d616c6c2050524f2062616c616e636520746f207374616b650000000000006044820152606401610b84565b604051636eb1769f60e11b8152336004820152306024820152829073f810576a68c3731875bde07404be815b16fc0b4e9063dd62ed3e90604401602060405180830381865afa158015611daf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd39190614c15565b1015611e215760405162461bcd60e51b815260206004820152601c60248201527f736d616c6c2050524f20616c6c6f77616e636520746f207374616b65000000006044820152606401610b84565b60058160ff1610611e445760405162461bcd60e51b8152600401610b8490614d2b565b336000908152600a60205260409020600381015415611e975760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4819195c1bdcda5d608a1b6044820152606401610b84565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611ee9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0d9190614c15565b9050611f2f73f810576a68c3731875bde07404be815b16fc0b4e333087613b8b565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa59190614c15565b9050611fb18282614c44565b9450600060048560ff1681548110611fcb57611fcb614bff565b906000526020600020015442611fe19190614c98565b90506000600a60038760ff1681548110611ffd57611ffd614bff565b9060005260206000200154886120139190614c57565b61201d9190614c76565b60028601549091501561213157600a8060038860ff168154811061204357612043614bff565b90600052602060002001546120589190614c44565b86600201546120679190614c57565b6120719190614c76565b61207b9082614c98565b905060ff861615612131576006548710156120d85760405162461bcd60e51b815260206004820152601860248201527f736d616c6c2070726f20616d6f756e7420666f72206e667400000000000000006044820152606401610b84565b60006120e33361311f565b905060008111801561210557508560050154816007546121039190614c57565b115b1561212f5761212f8660050154826007546121209190614c57565b61212a9190614c44565b6140db565b505b612139611654565b80600c600082825461214b9190614c98565b925050819055508660108760ff168154811061216957612169614bff565b9060005260206000200160008282546121829190614c98565b909155505084548190869060009061219b908490614c98565b92505081905550868560030160008282546121b69190614c98565b909155505060018501548211156121cf57600185018290555b60ff861660048601556121e0613e32565b604080518881526020810184905260ff881681830152905133917f33a7e23572980d21f64adcd089e8f9555c21859f029b3b67aa3dc68eb74ea8c1919081900360600190a25050600180555050505050565b6002600154036122545760405162461bcd60e51b8152600401610b8490614cab565b6002600155336005546040516331a9108f60e11b8152600481018490526001600160a01b039283169290911690636352211e90602401602060405180830381865afa1580156122a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cb9190614d56565b6001600160a01b03161461230f5760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610b84565b6005546001600160a01b031663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa15801561236b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061238f9190614d73565b8061240d575060055460405163020604bf60e21b81526004810183905230916001600160a01b03169063081812fc90602401602060405180830381865afa1580156123de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124029190614d56565b6001600160a01b0316145b6124485760405162461bcd60e51b815260206004820152600c60248201526b1b9bdd08185c1c1c9bdd995960a21b6044820152606401610b84565b336000908152600a6020526040902060048101541561249c5760038101541561249c57600654816003015410156124915760405162461bcd60e51b8152600401610b8490614d90565b61249c6007546140db565b6005546001600160a01b03166342842e0e3330856040518463ffffffff1660e01b81526004016124ce93929190614d07565b600060405180830381600087803b1580156124e857600080fd5b505af11580156124fc573d6000803e3d6000fd5b50505050612508611654565b61253182600b6000335b6001600160a01b03168152602081019190915260400160002090613c1f565b50600281015460085460405163c8fe2d3960e01b8152600481018590526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa158015612581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a59190614c15565b6125b790670de0b6b3a7640000614c57565b905060006125c58284614c98565b6002850181905560038501549091506000901561261c57600a60038660040154815481106125f5576125f5614bff565b90600052602060002001548461260b9190614c57565b6126159190614c76565b905061261f565b50815b808560000160008282546126339190614c98565b9250508190555080600c600082825461264c9190614c98565b90915550611c279050613e32565b612662613b08565b61266c60006143ed565b565b6005546040516370a0823160e01b81523060048201526060916000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156126bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e09190614c15565b9050806000036126fe57505060408051600081526020810190915290565b60008167ffffffffffffffff811115612719576127196149a8565b604051908082528060200260200182016040528015612742578160200160208202803683370190505b50905060005b828110156127f257600554604051632f745c5960e01b8152306004820152602481018390526001600160a01b0390911690632f745c5990604401602060405180830381865afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190614c15565b8282815181106127d5576127d5614bff565b6020908102919091010152806127ea81614dba565b915050612748565b5092915050565b5090565b612805613b08565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6005546040516370a0823160e01b81526001600160a01b0383811660048301526060926000929116906370a0823190602401602060405180830381865afa158015612876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289a9190614c15565b9050806000036128be5760408051600080825260208201909252905b509392505050565b60008167ffffffffffffffff8111156128d9576128d96149a8565b604051908082528060200260200182016040528015612902578160200160208202803683370190505b50905060005b828110156128b657600554604051632f745c5960e01b81526001600160a01b0387811660048301526024820184905290911690632f745c5990604401602060405180830381865afa158015612961573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129859190614c15565b82828151811061299757612997614bff565b6020908102919091010152806129ac81614dba565b915050612908565b6002600154036129d65760405162461bcd60e51b8152600401610b8490614cab565b600260015580158015906129ea5750600581105b612a065760405162461bcd60e51b8152600401610b8490614d2b565b336000908152600a602052604090206003810154612a505760405162461bcd60e51b81526020600482015260076024820152666e6f206c6f636b60c81b6044820152606401610b84565b81816004015410612aa35760405162461bcd60e51b815260206004820152601a60248201527f4e4f5420494e4352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610b84565b6000612aae3361311f565b90508015612af9578160050154600003612ad357612ad38160075461212a9190614c57565b60065482600301541015612af95760405162461bcd60e51b8152600401610b8490614d90565b60006004836004015481548110612b1257612b12614bff565b906000526020600020015460048581548110612b3057612b30614bff565b90600052602060002001548460010154612b4a9190614c98565b612b549190614c44565b90506000600a6003856004015481548110612b7157612b71614bff565b906000526020600020015460038781548110612b8f57612b8f614bff565b9060005260206000200154612ba49190614c44565b85600201548660030154612bb89190614c98565b612bc29190614c57565b612bcc9190614c76565b9050612bd6611654565b80600c6000828254612be89190614c98565b9250508190555083600301546010856004015481548110612c0b57612c0b614bff565b906000526020600020016000828254612c249190614c44565b909155505060038401546010805487908110612c4257612c42614bff565b906000526020600020016000828254612c5b9190614c98565b9091555050835481908590600090612c74908490614c98565b90915550506004840185905560018401829055612c8f613e32565b60408051338152602081018490527f753995fad25c940c55e7593d632fd28103c8a8f3b44a67b472e0c07a7231f7e5910161110d565b60606000612cd36014613b62565b90508067ffffffffffffffff811115612cee57612cee6149a8565b604051908082528060200260200182016040528015612d3357816020015b6040805180820190915260008082526020820152815260200190600190039081612d0c5790505b50915060005b81811015612d9857600080612d4f601484613b6d565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110612d8357612d83614bff565b60209081029190910101525050600101612d39565b505090565b6005546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e0a9190614c15565b905090565b612e17613b08565b600655565b600260015403612e3e5760405162461bcd60e51b8152600401610b8490614cab565b60026001558080612e825760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610b84565b336000908152600a6020526040812060028101549091805b84811015613079576000878783818110612eb657612eb6614bff565b905060200201359050612ec96119583390565b612f0b5760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610b84565b6005546001600160a01b03166342842e0e3033846040518463ffffffff1660e01b8152600401612f3d93929190614d07565b600060405180830381600087803b158015612f5757600080fd5b505af1158015612f6b573d6000803e3d6000fd5b50505050612f7e81600b6000611a543390565b5060085460405163c8fe2d3960e01b8152600481018390526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa158015612fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fed9190614c15565b612fff90670de0b6b3a7640000614c57565b905061300b8186614c44565b60038701549095501561306257600a600387600401548154811061303157613031614bff565b9060005260206000200154826130479190614c57565b6130519190614c76565b61305b9085614c98565b935061306f565b61306c8185614c98565b93505b5050600101612e9a565b50613082611654565b836007546130909190614c57565b8360050154106130b5576130b0846007546130ab9190614c57565b613f93565b6130cc565b6005830154156130cc576130cc8360050154613f93565b600283018290558254819084906000906130e7908490614c44565b9250508190555080600c60008282546131009190614c44565b9091555061310e9050613e32565b8260030154600003611c2757611bb9335b6001600160a01b0381166000908152600b6020526040812061137690613f7d565b613148613b08565b600755565b60026001540361316f5760405162461bcd60e51b8152600401610b8490614cab565b6002600155600f5460ff166131be5760405162461bcd60e51b81526020600482015260156024820152746e6f7420656d657267656e6379206665617475726560581b6044820152606401610b84565b60006131c933611352565b805190915060005b818110156132785760008382815181106131ed576131ed614bff565b6020908102919091010151600554604051632142170760e11b81529192506001600160a01b0316906342842e0e9061322d90309033908690600401614d07565b600060405180830381600087803b15801561324757600080fd5b505af115801561325b573d6000803e3d6000fd5b5050505061326e81600b6000611a543390565b50506001016131d1565b50506001805550565b601081815481106112d157600080fd5b600c54600080806132a0613ab7565b92506132aa612d9d565b9150600d54905090919293565b6001600160a01b0381166000908152600b6020526040812081906132da90613f7d565b9050806000036132ed5750600092915050565b60006132f884611352565b905060005b828110156112b85760085482516001600160a01b039091169063c8fe2d399084908490811061332e5761332e614bff565b60200260200101516040518263ffffffff1660e01b815260040161335491815260200190565b602060405180830381865afa158015613371573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133959190614c15565b6133a790670de0b6b3a7640000614c57565b6133b19085614c98565b93506001016132fd565b6002600154036133dd5760405162461bcd60e51b8152600401610b8490614cab565b60026001556005546001600160a01b031663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa15801561343e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134629190614d73565b6134b85760405162461bcd60e51b815260206004820152602160248201527f4e6f7420617070726f7665206e667420746f207374616b6572206164647265736044820152607360f81b6064820152608401610b84565b80806134f75760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610b84565b336000908152600a602052604090206004810154156135515760038101541561355157600654816003015410156135405760405162461bcd60e51b8152600401610b8490614d90565b6135518260075461212a9190614c57565b60028101546000805b848110156137a957600087878381811061357657613576614bff565b9050602002013590506135863390565b6005546040516331a9108f60e11b8152600481018490526001600160a01b039283169290911690636352211e90602401602060405180830381865afa1580156135d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f79190614d56565b6001600160a01b03161461363b5760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610b84565b6005546001600160a01b03166342842e0e3330846040518463ffffffff1660e01b815260040161366d93929190614d07565b600060405180830381600087803b15801561368757600080fd5b505af115801561369b573d6000803e3d6000fd5b505050506136ae81600b60006125123390565b5060085460405163c8fe2d3960e01b8152600481018390526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa1580156136f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061371d9190614c15565b61372f90670de0b6b3a7640000614c57565b905061373b8186614c98565b60038701549095501561379257600a600387600401548154811061376157613761614bff565b9060005260206000200154826137779190614c57565b6137819190614c76565b61378b9085614c98565b935061379f565b61379c8185614c98565b93505b505060010161355a565b506137b2611654565b6002830182905582546137c59082614c98565b8355600c805482919060009061264c908490614c98565b6002600154036137fe5760405162461bcd60e51b8152600401610b8490614cab565b6002600155600581106138235760405162461bcd60e51b8152600401610b8490614d2b565b336000908152600a60205260409020600481015482106138855760405162461bcd60e51b815260206004820152601a60248201527f4e4f542044454352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610b84565b428160010154106138d15760405162461bcd60e51b815260206004820152601660248201527537b934b3b4b730b6103637b1b590323ab930ba34b7b760511b6044820152606401610b84565b6000600483815481106138e6576138e6614bff565b9060005260206000200154426138fc9190614c98565b90506000600a6003858154811061391557613915614bff565b9060005260206000200154600385600401548154811061393757613937614bff565b906000526020600020015461394c9190614c44565b846002015485600301546139609190614c98565b61396a9190614c57565b6139749190614c76565b905061397e611654565b80600c60008282546139909190614c44565b92505081905550826003015460108460040154815481106139b3576139b3614bff565b9060005260206000200160008282546139cc9190614c44565b9091555050600383015460108054869081106139ea576139ea614bff565b906000526020600020016000828254613a039190614c98565b9091555050825481908490600090613a1c908490614c44565b90915550506004830184905560018301829055613a37613e32565b5050600180555050565b613a49613b08565b6001600160a01b038116613aae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b84565b6117b2816143ed565b6000805b6010548110156127f95760108181548110613ad857613ad8614bff565b906000526020600020015482613aee9190614c98565b9150600101613abb565b600381815481106112d157600080fd5b6000546001600160a01b0316331461266c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b84565b60006113768261443d565b6000808080613b7c8686614448565b909450925050505b9250929050565b613be3846323b872dd60e01b858585604051602401613bac93929190614d07565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614473565b50505050565b6000808080613b7c866001600160a01b038716614545565b6000613c17846001600160a01b0385168461457f565b949350505050565b60006117d7838361459c565b336000908152600a602052604090208054156117b2576000613c4d6011613b62565b905060005b818110156117af57600080613c68601184613b6d565b33600090815260176020526040812092945090925090613c889084613be9565b915050600081600254848960000154613ca19190614c57565b613cab9190614c76565b613cb59190614c44565b90508015613db457600c5415613d0e576000613cd2601186613be9565b9150506000600c5460025484613ce89190614c57565b613cf29190614c76565b613cfc9083614c98565b9050613d0a60118783613c01565b5050505b6000613d1b601486613be9565b915060009050613d2b8383614c98565b9050613d3960148783613c01565b50613d4f613d478842614c98565b601990613c1f565b50604080518082019091526001600160a01b038716815260208101849052601b6000613d7b8a42614c98565b8152602080820192909252604001600020825181546001600160a01b0319166001600160a01b0390911617815591015160019091015550505b6000600254848960000154613dc99190614c57565b613dd39190614c76565b336000908152601760205260409020909150613df0908683613c01565b505060019094019350613c5292505050565b6040516001600160a01b0383166024820152604481018290526117af90849063a9059cbb60e01b90606401613bac565b336000908152600a602052604090208054156117b2576000613e546011613b62565b905060005b818110156117af57600080613e6f601184613b6d565b915091506000600254828760000154613e889190614c57565b613e929190614c76565b336000908152601760205260409020909150613eaf908483613c01565b505060019092019150613e599050565b606060006117d7836145eb565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613f19576040519150601f19603f3d011682016040523d82523d6000602084013e613f1e565b606091505b50509050806117af5760405162461bcd60e51b8152602060048201526013602482015272115512081514905394d1915488119052531151606a1b6044820152606401610b84565b600081815260018301602052604081205415156117d7565b6000611376825490565b60006117d78383614647565b60008111613fb35760405162461bcd60e51b8152600401610b8490614ce2565b336000908152600a602052604081206001810154909190421015613fd5575060015b6000606460ff8316613fe8866032614c57565b613ff29190614c57565b613ffc9190614c76565b9050600061400a8286614c44565b905061402b735795377c85e0fdf6370fae1b74fe03b930c4a8923383613e02565b8260ff166001036140965760006064614045846032614c57565b61404f9190614c76565b9050614072735795377c85e0fdf6370fae1b74fe03b930c4a89261dead83613e02565b614094735795377c85e0fdf6370fae1b74fe03b930c4a892610f3b8386614c44565b505b848460050160008282546140aa9190614c44565b9250508190555084600d60008282546140c39190614c44565b90915550505050505050565b60006117d78383614671565b600081116140fb5760405162461bcd60e51b8152600401610b8490614ce2565b6040516370a0823160e01b81523360048201528190735795377c85e0fdf6370fae1b74fe03b930c4a892906370a0823190602401602060405180830381865afa15801561414c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141709190614c15565b10156141be5760405162461bcd60e51b815260206004820152601e60248201527f736d616c6c20784f7261636c652062616c616e636520746f207374616b6500006044820152606401610b84565b604051636eb1769f60e11b81523360048201523060248201528190735795377c85e0fdf6370fae1b74fe03b930c4a8929063dd62ed3e90604401602060405180830381865afa158015614215573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142399190614c15565b10156142875760405162461bcd60e51b815260206004820181905260248201527f736d616c6c20784f7261636c6520616c6c6f77616e636520746f207374616b656044820152606401610b84565b6040516370a0823160e01b8152306004820152600090735795377c85e0fdf6370fae1b74fe03b930c4a892906370a0823190602401602060405180830381865afa1580156142d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142fd9190614c15565b905061431f735795377c85e0fdf6370fae1b74fe03b930c4a892333085613b8b565b6040516370a0823160e01b8152306004820152600090735795377c85e0fdf6370fae1b74fe03b930c4a892906370a0823190602401602060405180830381865afa158015614371573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143959190614c15565b90506143a18282614c44565b336000908152600a6020526040812060058101805493965090928692906143c9908490614c98565b9250508190555083600d60008282546143e29190614c98565b909155505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061137682613f7d565b600080806144568585613f87565b600081815260029690960160205260409095205494959350505050565b60006144c8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147649092919063ffffffff16565b8051909150156117af57808060200190518101906144e69190614d73565b6117af5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b84565b6000818152600283016020526040812054819080614574576145678585614773565b925060009150613b849050565b600192509050613b84565b60008281526002840160205260408120829055613c178484613c1f565b60008181526001830160205260408120546145e357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611376565b506000611376565b60608160000180548060200260200160405190810160405280929190818152602001828054801561463b57602002820191906000526020600020905b815481526020019060010190808311614627575b50505050509050919050565b600082600001828154811061465e5761465e614bff565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561475a576000614695600183614c44565b85549091506000906146a990600190614c44565b905081811461470e5760008660000182815481106146c9576146c9614bff565b90600052602060002001549050808760000184815481106146ec576146ec614bff565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061471f5761471f614dd3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611376565b6000915050611376565b6060613c17848460008561477f565b60006117d78383613f65565b6060824710156147e05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b84565b6001600160a01b0385163b6148375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b84565b600080866001600160a01b031685876040516148539190614e0d565b60006040518083038185875af1925050503d8060008114614890576040519150601f19603f3d011682016040523d82523d6000602084013e614895565b606091505b50915091506148a58282866148b0565b979650505050505050565b606083156148bf5750816117d7565b8251156148cf5782518084602001fd5b8160405162461bcd60e51b8152600401610b849190614e29565b6001600160a01b03811681146117b257600080fd5b60006020828403121561491057600080fd5b81356117d7816148e9565b80151581146117b257600080fd5b60006020828403121561493b57600080fd5b81356117d78161491b565b600081518084526020808501945080840160005b8381101561498a57815180516001600160a01b03168852830151838801526040909601959082019060010161495a565b509495945050505050565b6020815260006117d76020830184614946565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156149d457600080fd5b84356149df816148e9565b935060208501356149ef816148e9565b925060408501359150606085013567ffffffffffffffff80821115614a1357600080fd5b818701915087601f830112614a2757600080fd5b813581811115614a3957614a396149a8565b604051601f8201601f19908116603f01168101908382118183101715614a6157614a616149a8565b816040528281528a6020848701011115614a7a57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215614ab157600080fd5b8235614abc816148e9565b946020939093013593505050565b600060208284031215614adc57600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561498a57815187529582019590820190600101614af7565b6020815260006117d76020830184614ae3565b604081526000614b396040830185614ae3565b8281036020840152614b4b8185614946565b95945050505050565b60008060408385031215614b6757600080fd5b82359150602083013560ff81168114614b7f57600080fd5b809150509250929050565b60008060208385031215614b9d57600080fd5b823567ffffffffffffffff80821115614bb557600080fd5b818501915085601f830112614bc957600080fd5b813581811115614bd857600080fd5b8660208260051b8501011115614bed57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614c2757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561137657611376614c2e565b6000816000190483118215151615614c7157614c71614c2e565b500290565b600082614c9357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561137657611376614c2e565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600b908201526a1e995c9bc8185b5bdd5b9d60aa1b604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b602080825260119082015270496e76616c6964206c6f636b206d6f646560781b604082015260600190565b600060208284031215614d6857600080fd5b81516117d7816148e9565b600060208284031215614d8557600080fd5b81516117d78161491b565b60208082526010908201526f1cdb585b1b081c1c9bc81cdd185ad95960821b604082015260600190565b600060018201614dcc57614dcc614c2e565b5060010190565b634e487b7160e01b600052603160045260246000fd5b60005b83811015614e04578181015183820152602001614dec565b50506000910152565b60008251614e1f818460208701614de9565b9190910192915050565b6020815260008251806020840152614e48816040850160208701614de9565b601f01601f1916919091016040019291505056fea2646970667358221220c13ad74623f9c6fec196a71303616c6d301dde5e5be2d196eafabb36df0be74d64736f6c63430008100033000000000000000000000000136993b9bea254cc103d08a8965867e123622bd0

Deployed ByteCode

0x6080604052600436106102f75760003560e01c806375619ab511610196578063cd0559eb116100eb578063e5baa10c1161008f578063ec3417ff1161006c578063ec3417ff14610977578063f2fde38b14610997578063f30ce16f146109b7578063fdd93214146109cc57005b8063e5baa10c14610917578063e66891db14610937578063e9ac2ee11461095757005b8063dc1518cc116100c8578063dc1518cc14610880578063dcfc2006146108a0578063e2d31d9a146108d5578063e42c4e63146108fd57005b8063cd0559eb1461082b578063d3a38e501461084b578063db2e21bc1461086b57005b80639231e9ad11610152578063964e7ee51161012f578063964e7ee5146107b5578063bfe10928146107d5578063cc6f6163146107f5578063ccd34cd51461081557005b80639231e9ad1461076b5780639445956214610780578063946de4a1146107a057005b806375619ab51461069d57806379fafc69146106bd5780637dc0d1d0146106e5578063808e61861461070d578063828047a51461072d5780638da5cb5b1461074d57005b806335b419eb1161024c5780635451da1b11610208578063654cfdff116101e5578063654cfdff146106405780636ef8d8f314610653578063715018a61461067357806375233e321461068857005b80635451da1b146105cd5780635ccedd95146105fd5780636317cea51461062057005b806335b419eb146105225780633960b9501461054257806340376ba214610562578063403f44471461058f5780634641257d146105a257806353a45706146105b757005b80631ec8bb8c116102b357806327c8f8351161029057806327c8f835146104b65780632c4145ed146104cc5780632e1a7d4d146104e257806331d7a2621461050257005b80631ec8bb8c1461044d578063230d971814610460578063272346cd146104a057005b806302559004146103005780630259ef58146103295780630501d556146103a65780630e41ef22146103c657806313785cd4146103f3578063150b7a021461040957005b366102fe57005b005b34801561030c57600080fd5b50610316600c5481565b6040519081526020015b60405180910390f35b34801561033557600080fd5b506103796103443660046148fe565b600a60205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909186565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610320565b3480156103b257600080fd5b506102fe6103c1366004614929565b6109ec565b3480156103d257600080fd5b506103e66103e13660046148fe565b610a07565b6040516103209190614995565b3480156103ff57600080fd5b5061031660075481565b34801561041557600080fd5b506104346104243660046149be565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610320565b6102fe61045b366004614a9e565b610b0e565b34801561046c57600080fd5b506104887302f0826ef6ad107cfc861152b32b52fd11bab9ed81565b6040516001600160a01b039091168152602001610320565b3480156104ac57600080fd5b5061031660065481565b3480156104c257600080fd5b5061048861dead81565b3480156104d857600080fd5b50610316600d5481565b3480156104ee57600080fd5b506102fe6104fd366004614aca565b610db6565b34801561050e57600080fd5b506103e661051d3660046148fe565b611121565b34801561052e57600080fd5b5061031661053d366004614aca565b6112c1565b34801561054e57600080fd5b506102fe61055d3660046148fe565b6112e2565b34801561056e57600080fd5b5061058261057d3660046148fe565b611352565b6040516103209190614b13565b6102fe61059d366004614aca565b61137c565b3480156105ae57600080fd5b506102fe611654565b3480156105c357600080fd5b50610316600e5481565b3480156105d957600080fd5b506105ed6105e8366004614a9e565b6117b5565b6040519015158152602001610320565b34801561060957600080fd5b506106126117de565b604051610320929190614b26565b34801561062c57600080fd5b506102fe61063b366004614aca565b61192c565b6102fe61064e366004614b54565b611c33565b34801561065f57600080fd5b506102fe61066e366004614aca565b612232565b34801561067f57600080fd5b506102fe61265a565b34801561069457600080fd5b5061058261266e565b3480156106a957600080fd5b506102fe6106b83660046148fe565b6127fd565b3480156106c957600080fd5b5061048873f810576a68c3731875bde07404be815b16fc0b4e81565b3480156106f157600080fd5b5061048873d7565b16b65376e2ddb6c71e7971c7185a7ff3ff81565b34801561071957600080fd5b506105826107283660046148fe565b612827565b34801561073957600080fd5b506102fe610748366004614aca565b6129b4565b34801561075957600080fd5b506000546001600160a01b0316610488565b34801561077757600080fd5b506103e6612cc5565b34801561078c57600080fd5b50600854610488906001600160a01b031681565b3480156107ac57600080fd5b50610316612d9d565b3480156107c157600080fd5b506102fe6107d0366004614aca565b612e0f565b3480156107e157600080fd5b50600954610488906001600160a01b031681565b34801561080157600080fd5b506102fe610810366004614b8a565b612e1c565b34801561082157600080fd5b5061031660025481565b34801561083757600080fd5b506103166108463660046148fe565b61311f565b34801561085757600080fd5b506102fe610866366004614aca565b613140565b34801561087757600080fd5b506102fe61314d565b34801561088c57600080fd5b5061031661089b366004614aca565b613281565b3480156108ac57600080fd5b506108b5613291565b604080519485526020850193909352918301526060820152608001610320565b3480156108e157600080fd5b50610488735795377c85e0fdf6370fae1b74fe03b930c4a89281565b34801561090957600080fd5b50600f546105ed9060ff1681565b34801561092357600080fd5b506103166109323660046148fe565b6132b7565b34801561094357600080fd5b506102fe610952366004614b8a565b6133bb565b34801561096357600080fd5b50600554610488906001600160a01b031681565b34801561098357600080fd5b506102fe610992366004614aca565b6137dc565b3480156109a357600080fd5b506102fe6109b23660046148fe565b613a41565b3480156109c357600080fd5b50610316613ab7565b3480156109d857600080fd5b506103166109e7366004614aca565b613af8565b6109f4613b08565b600f805460ff1916911515919091179055565b6001600160a01b038116600090815260186020526040812060609190610a2c90613b62565b90508067ffffffffffffffff811115610a4757610a476149a8565b604051908082528060200260200182016040528015610a8c57816020015b6040805180820190915260008082526020820152815260200190600190039081610a655790505b50915060005b81811015610b07576001600160a01b03841660009081526018602052604081208190610abe9084613b6d565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110610af257610af2614bff565b60209081029190910101525050600101610a92565b5050919050565b6009546001600160a01b0316331480610b3157506000546001600160a01b031633145b610b8d5760405162461bcd60e51b815260206004820152602260248201527f63616c6c6572206973206e6f74206469737472696275746f72206f72206f776e60448201526132b960f11b60648201526084015b60405180910390fd5b60008111610bcb5760405162461bcd60e51b815260206004820152600b60248201526a1e995c9bc81c995dd85c9960aa1b6044820152606401610b84565b6001600160a01b03821615610cdc576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610c21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c459190614c15565b9050610c5c6001600160a01b038416333085613b8b565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc79190614c15565b9050610cd38282614c44565b92505050610cdf565b50345b600c5415610d30576000610cf4601184613be9565b9150506000600c5460025484610d0a9190614c57565b610d149190614c76565b610d1e9083614c98565b9050610d2c60118583613c01565b5050505b6000610d3d601484613be9565b915060009050610d4d8383614c98565b9050610d5b60148583613c01565b50610d67601942613c1f565b50506040805180820182526001600160a01b0394851681526020808201948552426000908152601b90915291909120905181546001600160a01b03191694169390931783555051600190910155565b600260015403610dd85760405162461bcd60e51b8152600401610b8490614cab565b6002600155336000908152600a602052604090206003810154821115610e305760405162461bcd60e51b815260206004820152600d60248201526c6d6f726520776974686472617760981b6044820152606401610b84565b60008211610e505760405162461bcd60e51b8152600401610b8490614ce2565b60008160010154421015610e6e57506001610e69613c2b565b610e76565b610e76611654565b6000606460ff8316610e89866032614c57565b610e939190614c57565b610e9d9190614c76565b90506000610eab8286614c44565b90508015610ed257610ed273f810576a68c3731875bde07404be815b16fc0b4e3383613e02565b8260ff16600103610f42576000600a610eec846005614c57565b610ef69190614c76565b9050610f1973f810576a68c3731875bde07404be815b16fc0b4e61dead83613e02565b610f4073f810576a68c3731875bde07404be815b16fc0b4e610f3b8386614c44565b610cdf565b505b846010856004015481548110610f5a57610f5a614bff565b906000526020600020016000828254610f739190614c44565b9250508190555084846003016000828254610f8e9190614c44565b909155505060038401546000036110135783546002850154600c54610fb39190614c98565b610fbd9190614c44565b600c55610fc93361311f565b60000361100757336000908152600a602052604081208181556001810182905560028101829055600381018290556004810182905560050155611082565b60028401548455611082565b6000600a600386600401548154811061102e5761102e614bff565b9060005260206000200154876110449190614c57565b61104e9190614c76565b905080600c60008282546110629190614c44565b909155505084548190869060009061107b908490614c44565b9091555050505b61108a613e32565b83600301546000036110ce576040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a1611116565b604080513381526020810187905260ff8516918101919091527f704f033850f47d833e5cf47aa6ea3fd43639cb4cac971745ef4f98bb5b0b78dd906060015b60405180910390a15b505060018055505050565b6001600160a01b0381166000908152600a6020908152604091829020825160c081018452815480825260018301549382019390935260028201549381019390935260038101546060848101919091526004820154608085015260059091015460a08401529190156112bb5760006111986011613b62565b90508067ffffffffffffffff8111156111b3576111b36149a8565b6040519080825280602002602001820160405280156111f857816020015b60408051808201909152600080825260208201528152602001906001900390816111d15790505b50925060005b818110156112b857600080611214601184613b6d565b6001600160a01b03891660009081526017602052604081209294509092509061123d9084613be9565b9150506000816002548489600001516112569190614c57565b6112609190614c76565b61126a9190614c44565b90506040518060400160405280856001600160a01b031681526020018281525088868151811061129c5761129c614bff565b60200260200101819052508480600101955050505050506111fe565b50505b50919050565b600481815481106112d157600080fd5b600091825260209091200154905081565b6112ea613b08565b6001600160a01b0381166113305760405162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b6044820152606401610b84565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600b6020526040902060609061137690613ebf565b92915050565b60026001540361139e5760405162461bcd60e51b8152600401610b8490614cab565b6002600155806113de5760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610b84565b336000908152600a6020526040902060038101546114315760405162461bcd60e51b815260206004820152601060248201526f6e6f206f726967696e616c206c6f636b60801b6044820152606401610b84565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611483573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a79190614c15565b90506114c973f810576a68c3731875bde07404be815b16fc0b4e333086613b8b565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa15801561151b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153f9190614c15565b905061154b8282614c44565b9350611555611654565b6000600a600385600401548154811061157057611570614bff565b9060005260206000200154866115869190614c57565b6115909190614c76565b905080600c60008282546115a49190614c98565b925050819055508460108560040154815481106115c3576115c3614bff565b9060005260206000200160008282546115dc9190614c98565b90915550508354819085906000906115f5908490614c98565b92505081905550848460030160008282546116109190614c98565b9091555061161e9050613e32565b60408051338152602081018790527f6a8757d829ee8d3cfb766d2dcfcb8ef4cef7d832778893fa7a1f3fa0cbaef6c3910161110d565b336000908152600a602052604090208054156117b25760006116766011613b62565b905060005b818110156117af57600080611691601184613b6d565b336000908152601760205260408120929450909250906116b19084613be9565b9150506000816002548489600001546116ca9190614c57565b6116d49190614c76565b6116de9190614c44565b90508015611761576001600160a01b038416611703576116fe3382613ecc565b611717565b6117176001600160a01b0385163383613e02565b3360009081526018602052604081206117309086613be9565b9150600090506117408383614c98565b33600090815260186020526040902090915061175d908783613c01565b5050505b60006002548489600001546117769190614c57565b6117809190614c76565b33600090815260176020526040902090915061179d908683613c01565b50506001909401935061167b92505050565b50505b50565b6001600160a01b0382166000908152600b602052604081206117d79083613f65565b9392505050565b60608060006117ed6019613f7d565b90508067ffffffffffffffff811115611808576118086149a8565b604051908082528060200260200182016040528015611831578160200160208202803683370190505b5092508067ffffffffffffffff81111561184d5761184d6149a8565b60405190808252806020026020018201604052801561189257816020015b604080518082019091526000808252602082015281526020019060019003908161186b5790505b50915060005b818110156119265760006118ad601983613f87565b6000818152601b6020908152604091829020825180840190935280546001600160a01b0316835260010154908201528551919250908590849081106118f4576118f4614bff565b60200260200101819052508085838151811061191257611912614bff565b602090810291909101015250600101611898565b50509091565b60026001540361194e5760405162461bcd60e51b8152600401610b8490614cab565b600260015561195e335b826117b5565b6119a05760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610b84565b6005546001600160a01b03166342842e0e3033846040518463ffffffff1660e01b81526004016119d293929190614d07565b600060405180830381600087803b1580156119ec57600080fd5b505af1158015611a00573d6000803e3d6000fd5b5050336000908152600a602052604090206007546005820154919350119050611a3357611a2e600754613f93565b611a4a565b600581015415611a4a57611a4a8160050154613f93565b611a7382600b6000335b6001600160a01b031681526020810191909152604001600020906140cf565b50611a7c611654565b600281015460085460405163c8fe2d3960e01b8152600481018590526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190614c15565b611b0190670de0b6b3a7640000614c57565b90506000611b0f8284614c44565b60028501819055600385015490915060009015611b6657600a6003866004015481548110611b3f57611b3f614bff565b906000526020600020015484611b559190614c57565b611b5f9190614c76565b9050611b69565b50815b80856000016000828254611b7d9190614c44565b9250508190555080600c6000828254611b969190614c44565b90915550611ba49050613e32565b8460030154600003611c2757611bb93361311f565b600003611bf357336000908152600a6020526040812081815560018101829055600281018290556003810182905560048101829055600501555b6040513381527f510594aa7d4b7defde21f416953d6d840cf15eb758df21a11a543dd0fdbdf72a9060200160405180910390a15b50506001805550505050565b600260015403611c555760405162461bcd60e51b8152600401610b8490614cab565b600260015581611c955760405162461bcd60e51b815260206004820152600b60248201526a16915493c8105353d5539560aa1b6044820152606401610b84565b6040516370a0823160e01b8152336004820152829073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0a9190614c15565b1015611d585760405162461bcd60e51b815260206004820152601a60248201527f736d616c6c2050524f2062616c616e636520746f207374616b650000000000006044820152606401610b84565b604051636eb1769f60e11b8152336004820152306024820152829073f810576a68c3731875bde07404be815b16fc0b4e9063dd62ed3e90604401602060405180830381865afa158015611daf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd39190614c15565b1015611e215760405162461bcd60e51b815260206004820152601c60248201527f736d616c6c2050524f20616c6c6f77616e636520746f207374616b65000000006044820152606401610b84565b60058160ff1610611e445760405162461bcd60e51b8152600401610b8490614d2b565b336000908152600a60205260409020600381015415611e975760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4819195c1bdcda5d608a1b6044820152606401610b84565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611ee9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0d9190614c15565b9050611f2f73f810576a68c3731875bde07404be815b16fc0b4e333087613b8b565b6040516370a0823160e01b815230600482015260009073f810576a68c3731875bde07404be815b16fc0b4e906370a0823190602401602060405180830381865afa158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa59190614c15565b9050611fb18282614c44565b9450600060048560ff1681548110611fcb57611fcb614bff565b906000526020600020015442611fe19190614c98565b90506000600a60038760ff1681548110611ffd57611ffd614bff565b9060005260206000200154886120139190614c57565b61201d9190614c76565b60028601549091501561213157600a8060038860ff168154811061204357612043614bff565b90600052602060002001546120589190614c44565b86600201546120679190614c57565b6120719190614c76565b61207b9082614c98565b905060ff861615612131576006548710156120d85760405162461bcd60e51b815260206004820152601860248201527f736d616c6c2070726f20616d6f756e7420666f72206e667400000000000000006044820152606401610b84565b60006120e33361311f565b905060008111801561210557508560050154816007546121039190614c57565b115b1561212f5761212f8660050154826007546121209190614c57565b61212a9190614c44565b6140db565b505b612139611654565b80600c600082825461214b9190614c98565b925050819055508660108760ff168154811061216957612169614bff565b9060005260206000200160008282546121829190614c98565b909155505084548190869060009061219b908490614c98565b92505081905550868560030160008282546121b69190614c98565b909155505060018501548211156121cf57600185018290555b60ff861660048601556121e0613e32565b604080518881526020810184905260ff881681830152905133917f33a7e23572980d21f64adcd089e8f9555c21859f029b3b67aa3dc68eb74ea8c1919081900360600190a25050600180555050505050565b6002600154036122545760405162461bcd60e51b8152600401610b8490614cab565b6002600155336005546040516331a9108f60e11b8152600481018490526001600160a01b039283169290911690636352211e90602401602060405180830381865afa1580156122a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cb9190614d56565b6001600160a01b03161461230f5760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610b84565b6005546001600160a01b031663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa15801561236b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061238f9190614d73565b8061240d575060055460405163020604bf60e21b81526004810183905230916001600160a01b03169063081812fc90602401602060405180830381865afa1580156123de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124029190614d56565b6001600160a01b0316145b6124485760405162461bcd60e51b815260206004820152600c60248201526b1b9bdd08185c1c1c9bdd995960a21b6044820152606401610b84565b336000908152600a6020526040902060048101541561249c5760038101541561249c57600654816003015410156124915760405162461bcd60e51b8152600401610b8490614d90565b61249c6007546140db565b6005546001600160a01b03166342842e0e3330856040518463ffffffff1660e01b81526004016124ce93929190614d07565b600060405180830381600087803b1580156124e857600080fd5b505af11580156124fc573d6000803e3d6000fd5b50505050612508611654565b61253182600b6000335b6001600160a01b03168152602081019190915260400160002090613c1f565b50600281015460085460405163c8fe2d3960e01b8152600481018590526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa158015612581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a59190614c15565b6125b790670de0b6b3a7640000614c57565b905060006125c58284614c98565b6002850181905560038501549091506000901561261c57600a60038660040154815481106125f5576125f5614bff565b90600052602060002001548461260b9190614c57565b6126159190614c76565b905061261f565b50815b808560000160008282546126339190614c98565b9250508190555080600c600082825461264c9190614c98565b90915550611c279050613e32565b612662613b08565b61266c60006143ed565b565b6005546040516370a0823160e01b81523060048201526060916000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156126bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e09190614c15565b9050806000036126fe57505060408051600081526020810190915290565b60008167ffffffffffffffff811115612719576127196149a8565b604051908082528060200260200182016040528015612742578160200160208202803683370190505b50905060005b828110156127f257600554604051632f745c5960e01b8152306004820152602481018390526001600160a01b0390911690632f745c5990604401602060405180830381865afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190614c15565b8282815181106127d5576127d5614bff565b6020908102919091010152806127ea81614dba565b915050612748565b5092915050565b5090565b612805613b08565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6005546040516370a0823160e01b81526001600160a01b0383811660048301526060926000929116906370a0823190602401602060405180830381865afa158015612876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289a9190614c15565b9050806000036128be5760408051600080825260208201909252905b509392505050565b60008167ffffffffffffffff8111156128d9576128d96149a8565b604051908082528060200260200182016040528015612902578160200160208202803683370190505b50905060005b828110156128b657600554604051632f745c5960e01b81526001600160a01b0387811660048301526024820184905290911690632f745c5990604401602060405180830381865afa158015612961573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129859190614c15565b82828151811061299757612997614bff565b6020908102919091010152806129ac81614dba565b915050612908565b6002600154036129d65760405162461bcd60e51b8152600401610b8490614cab565b600260015580158015906129ea5750600581105b612a065760405162461bcd60e51b8152600401610b8490614d2b565b336000908152600a602052604090206003810154612a505760405162461bcd60e51b81526020600482015260076024820152666e6f206c6f636b60c81b6044820152606401610b84565b81816004015410612aa35760405162461bcd60e51b815260206004820152601a60248201527f4e4f5420494e4352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610b84565b6000612aae3361311f565b90508015612af9578160050154600003612ad357612ad38160075461212a9190614c57565b60065482600301541015612af95760405162461bcd60e51b8152600401610b8490614d90565b60006004836004015481548110612b1257612b12614bff565b906000526020600020015460048581548110612b3057612b30614bff565b90600052602060002001548460010154612b4a9190614c98565b612b549190614c44565b90506000600a6003856004015481548110612b7157612b71614bff565b906000526020600020015460038781548110612b8f57612b8f614bff565b9060005260206000200154612ba49190614c44565b85600201548660030154612bb89190614c98565b612bc29190614c57565b612bcc9190614c76565b9050612bd6611654565b80600c6000828254612be89190614c98565b9250508190555083600301546010856004015481548110612c0b57612c0b614bff565b906000526020600020016000828254612c249190614c44565b909155505060038401546010805487908110612c4257612c42614bff565b906000526020600020016000828254612c5b9190614c98565b9091555050835481908590600090612c74908490614c98565b90915550506004840185905560018401829055612c8f613e32565b60408051338152602081018490527f753995fad25c940c55e7593d632fd28103c8a8f3b44a67b472e0c07a7231f7e5910161110d565b60606000612cd36014613b62565b90508067ffffffffffffffff811115612cee57612cee6149a8565b604051908082528060200260200182016040528015612d3357816020015b6040805180820190915260008082526020820152815260200190600190039081612d0c5790505b50915060005b81811015612d9857600080612d4f601484613b6d565b915091506040518060400160405280836001600160a01b0316815260200182815250858481518110612d8357612d83614bff565b60209081029190910101525050600101612d39565b505090565b6005546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e0a9190614c15565b905090565b612e17613b08565b600655565b600260015403612e3e5760405162461bcd60e51b8152600401610b8490614cab565b60026001558080612e825760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610b84565b336000908152600a6020526040812060028101549091805b84811015613079576000878783818110612eb657612eb6614bff565b905060200201359050612ec96119583390565b612f0b5760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610b84565b6005546001600160a01b03166342842e0e3033846040518463ffffffff1660e01b8152600401612f3d93929190614d07565b600060405180830381600087803b158015612f5757600080fd5b505af1158015612f6b573d6000803e3d6000fd5b50505050612f7e81600b6000611a543390565b5060085460405163c8fe2d3960e01b8152600481018390526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa158015612fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fed9190614c15565b612fff90670de0b6b3a7640000614c57565b905061300b8186614c44565b60038701549095501561306257600a600387600401548154811061303157613031614bff565b9060005260206000200154826130479190614c57565b6130519190614c76565b61305b9085614c98565b935061306f565b61306c8185614c98565b93505b5050600101612e9a565b50613082611654565b836007546130909190614c57565b8360050154106130b5576130b0846007546130ab9190614c57565b613f93565b6130cc565b6005830154156130cc576130cc8360050154613f93565b600283018290558254819084906000906130e7908490614c44565b9250508190555080600c60008282546131009190614c44565b9091555061310e9050613e32565b8260030154600003611c2757611bb9335b6001600160a01b0381166000908152600b6020526040812061137690613f7d565b613148613b08565b600755565b60026001540361316f5760405162461bcd60e51b8152600401610b8490614cab565b6002600155600f5460ff166131be5760405162461bcd60e51b81526020600482015260156024820152746e6f7420656d657267656e6379206665617475726560581b6044820152606401610b84565b60006131c933611352565b805190915060005b818110156132785760008382815181106131ed576131ed614bff565b6020908102919091010151600554604051632142170760e11b81529192506001600160a01b0316906342842e0e9061322d90309033908690600401614d07565b600060405180830381600087803b15801561324757600080fd5b505af115801561325b573d6000803e3d6000fd5b5050505061326e81600b6000611a543390565b50506001016131d1565b50506001805550565b601081815481106112d157600080fd5b600c54600080806132a0613ab7565b92506132aa612d9d565b9150600d54905090919293565b6001600160a01b0381166000908152600b6020526040812081906132da90613f7d565b9050806000036132ed5750600092915050565b60006132f884611352565b905060005b828110156112b85760085482516001600160a01b039091169063c8fe2d399084908490811061332e5761332e614bff565b60200260200101516040518263ffffffff1660e01b815260040161335491815260200190565b602060405180830381865afa158015613371573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133959190614c15565b6133a790670de0b6b3a7640000614c57565b6133b19085614c98565b93506001016132fd565b6002600154036133dd5760405162461bcd60e51b8152600401610b8490614cab565b60026001556005546001600160a01b031663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa15801561343e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134629190614d73565b6134b85760405162461bcd60e51b815260206004820152602160248201527f4e6f7420617070726f7665206e667420746f207374616b6572206164647265736044820152607360f81b6064820152608401610b84565b80806134f75760405162461bcd60e51b815260206004820152600e60248201526d1e995c9bc81cdd185ad9481b999d60921b6044820152606401610b84565b336000908152600a602052604090206004810154156135515760038101541561355157600654816003015410156135405760405162461bcd60e51b8152600401610b8490614d90565b6135518260075461212a9190614c57565b60028101546000805b848110156137a957600087878381811061357657613576614bff565b9050602002013590506135863390565b6005546040516331a9108f60e11b8152600481018490526001600160a01b039283169290911690636352211e90602401602060405180830381865afa1580156135d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f79190614d56565b6001600160a01b03161461363b5760405162461bcd60e51b815260206004820152600b60248201526a3bb937b7339037bbb732b960a91b6044820152606401610b84565b6005546001600160a01b03166342842e0e3330846040518463ffffffff1660e01b815260040161366d93929190614d07565b600060405180830381600087803b15801561368757600080fd5b505af115801561369b573d6000803e3d6000fd5b505050506136ae81600b60006125123390565b5060085460405163c8fe2d3960e01b8152600481018390526000916001600160a01b03169063c8fe2d3990602401602060405180830381865afa1580156136f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061371d9190614c15565b61372f90670de0b6b3a7640000614c57565b905061373b8186614c98565b60038701549095501561379257600a600387600401548154811061376157613761614bff565b9060005260206000200154826137779190614c57565b6137819190614c76565b61378b9085614c98565b935061379f565b61379c8185614c98565b93505b505060010161355a565b506137b2611654565b6002830182905582546137c59082614c98565b8355600c805482919060009061264c908490614c98565b6002600154036137fe5760405162461bcd60e51b8152600401610b8490614cab565b6002600155600581106138235760405162461bcd60e51b8152600401610b8490614d2b565b336000908152600a60205260409020600481015482106138855760405162461bcd60e51b815260206004820152601a60248201527f4e4f542044454352454153494e4720554e4c4f434b2054494d450000000000006044820152606401610b84565b428160010154106138d15760405162461bcd60e51b815260206004820152601660248201527537b934b3b4b730b6103637b1b590323ab930ba34b7b760511b6044820152606401610b84565b6000600483815481106138e6576138e6614bff565b9060005260206000200154426138fc9190614c98565b90506000600a6003858154811061391557613915614bff565b9060005260206000200154600385600401548154811061393757613937614bff565b906000526020600020015461394c9190614c44565b846002015485600301546139609190614c98565b61396a9190614c57565b6139749190614c76565b905061397e611654565b80600c60008282546139909190614c44565b92505081905550826003015460108460040154815481106139b3576139b3614bff565b9060005260206000200160008282546139cc9190614c44565b9091555050600383015460108054869081106139ea576139ea614bff565b906000526020600020016000828254613a039190614c98565b9091555050825481908490600090613a1c908490614c44565b90915550506004830184905560018301829055613a37613e32565b5050600180555050565b613a49613b08565b6001600160a01b038116613aae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b84565b6117b2816143ed565b6000805b6010548110156127f95760108181548110613ad857613ad8614bff565b906000526020600020015482613aee9190614c98565b9150600101613abb565b600381815481106112d157600080fd5b6000546001600160a01b0316331461266c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b84565b60006113768261443d565b6000808080613b7c8686614448565b909450925050505b9250929050565b613be3846323b872dd60e01b858585604051602401613bac93929190614d07565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614473565b50505050565b6000808080613b7c866001600160a01b038716614545565b6000613c17846001600160a01b0385168461457f565b949350505050565b60006117d7838361459c565b336000908152600a602052604090208054156117b2576000613c4d6011613b62565b905060005b818110156117af57600080613c68601184613b6d565b33600090815260176020526040812092945090925090613c889084613be9565b915050600081600254848960000154613ca19190614c57565b613cab9190614c76565b613cb59190614c44565b90508015613db457600c5415613d0e576000613cd2601186613be9565b9150506000600c5460025484613ce89190614c57565b613cf29190614c76565b613cfc9083614c98565b9050613d0a60118783613c01565b5050505b6000613d1b601486613be9565b915060009050613d2b8383614c98565b9050613d3960148783613c01565b50613d4f613d478842614c98565b601990613c1f565b50604080518082019091526001600160a01b038716815260208101849052601b6000613d7b8a42614c98565b8152602080820192909252604001600020825181546001600160a01b0319166001600160a01b0390911617815591015160019091015550505b6000600254848960000154613dc99190614c57565b613dd39190614c76565b336000908152601760205260409020909150613df0908683613c01565b505060019094019350613c5292505050565b6040516001600160a01b0383166024820152604481018290526117af90849063a9059cbb60e01b90606401613bac565b336000908152600a602052604090208054156117b2576000613e546011613b62565b905060005b818110156117af57600080613e6f601184613b6d565b915091506000600254828760000154613e889190614c57565b613e929190614c76565b336000908152601760205260409020909150613eaf908483613c01565b505060019092019150613e599050565b606060006117d7836145eb565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613f19576040519150601f19603f3d011682016040523d82523d6000602084013e613f1e565b606091505b50509050806117af5760405162461bcd60e51b8152602060048201526013602482015272115512081514905394d1915488119052531151606a1b6044820152606401610b84565b600081815260018301602052604081205415156117d7565b6000611376825490565b60006117d78383614647565b60008111613fb35760405162461bcd60e51b8152600401610b8490614ce2565b336000908152600a602052604081206001810154909190421015613fd5575060015b6000606460ff8316613fe8866032614c57565b613ff29190614c57565b613ffc9190614c76565b9050600061400a8286614c44565b905061402b735795377c85e0fdf6370fae1b74fe03b930c4a8923383613e02565b8260ff166001036140965760006064614045846032614c57565b61404f9190614c76565b9050614072735795377c85e0fdf6370fae1b74fe03b930c4a89261dead83613e02565b614094735795377c85e0fdf6370fae1b74fe03b930c4a892610f3b8386614c44565b505b848460050160008282546140aa9190614c44565b9250508190555084600d60008282546140c39190614c44565b90915550505050505050565b60006117d78383614671565b600081116140fb5760405162461bcd60e51b8152600401610b8490614ce2565b6040516370a0823160e01b81523360048201528190735795377c85e0fdf6370fae1b74fe03b930c4a892906370a0823190602401602060405180830381865afa15801561414c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141709190614c15565b10156141be5760405162461bcd60e51b815260206004820152601e60248201527f736d616c6c20784f7261636c652062616c616e636520746f207374616b6500006044820152606401610b84565b604051636eb1769f60e11b81523360048201523060248201528190735795377c85e0fdf6370fae1b74fe03b930c4a8929063dd62ed3e90604401602060405180830381865afa158015614215573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142399190614c15565b10156142875760405162461bcd60e51b815260206004820181905260248201527f736d616c6c20784f7261636c6520616c6c6f77616e636520746f207374616b656044820152606401610b84565b6040516370a0823160e01b8152306004820152600090735795377c85e0fdf6370fae1b74fe03b930c4a892906370a0823190602401602060405180830381865afa1580156142d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142fd9190614c15565b905061431f735795377c85e0fdf6370fae1b74fe03b930c4a892333085613b8b565b6040516370a0823160e01b8152306004820152600090735795377c85e0fdf6370fae1b74fe03b930c4a892906370a0823190602401602060405180830381865afa158015614371573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143959190614c15565b90506143a18282614c44565b336000908152600a6020526040812060058101805493965090928692906143c9908490614c98565b9250508190555083600d60008282546143e29190614c98565b909155505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061137682613f7d565b600080806144568585613f87565b600081815260029690960160205260409095205494959350505050565b60006144c8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147649092919063ffffffff16565b8051909150156117af57808060200190518101906144e69190614d73565b6117af5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b84565b6000818152600283016020526040812054819080614574576145678585614773565b925060009150613b849050565b600192509050613b84565b60008281526002840160205260408120829055613c178484613c1f565b60008181526001830160205260408120546145e357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611376565b506000611376565b60608160000180548060200260200160405190810160405280929190818152602001828054801561463b57602002820191906000526020600020905b815481526020019060010190808311614627575b50505050509050919050565b600082600001828154811061465e5761465e614bff565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561475a576000614695600183614c44565b85549091506000906146a990600190614c44565b905081811461470e5760008660000182815481106146c9576146c9614bff565b90600052602060002001549050808760000184815481106146ec576146ec614bff565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061471f5761471f614dd3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611376565b6000915050611376565b6060613c17848460008561477f565b60006117d78383613f65565b6060824710156147e05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b84565b6001600160a01b0385163b6148375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b84565b600080866001600160a01b031685876040516148539190614e0d565b60006040518083038185875af1925050503d8060008114614890576040519150601f19603f3d011682016040523d82523d6000602084013e614895565b606091505b50915091506148a58282866148b0565b979650505050505050565b606083156148bf5750816117d7565b8251156148cf5782518084602001fd5b8160405162461bcd60e51b8152600401610b849190614e29565b6001600160a01b03811681146117b257600080fd5b60006020828403121561491057600080fd5b81356117d7816148e9565b80151581146117b257600080fd5b60006020828403121561493b57600080fd5b81356117d78161491b565b600081518084526020808501945080840160005b8381101561498a57815180516001600160a01b03168852830151838801526040909601959082019060010161495a565b509495945050505050565b6020815260006117d76020830184614946565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156149d457600080fd5b84356149df816148e9565b935060208501356149ef816148e9565b925060408501359150606085013567ffffffffffffffff80821115614a1357600080fd5b818701915087601f830112614a2757600080fd5b813581811115614a3957614a396149a8565b604051601f8201601f19908116603f01168101908382118183101715614a6157614a616149a8565b816040528281528a6020848701011115614a7a57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215614ab157600080fd5b8235614abc816148e9565b946020939093013593505050565b600060208284031215614adc57600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561498a57815187529582019590820190600101614af7565b6020815260006117d76020830184614ae3565b604081526000614b396040830185614ae3565b8281036020840152614b4b8185614946565b95945050505050565b60008060408385031215614b6757600080fd5b82359150602083013560ff81168114614b7f57600080fd5b809150509250929050565b60008060208385031215614b9d57600080fd5b823567ffffffffffffffff80821115614bb557600080fd5b818501915085601f830112614bc957600080fd5b813581811115614bd857600080fd5b8660208260051b8501011115614bed57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614c2757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561137657611376614c2e565b6000816000190483118215151615614c7157614c71614c2e565b500290565b600082614c9357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561137657611376614c2e565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600b908201526a1e995c9bc8185b5bdd5b9d60aa1b604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b602080825260119082015270496e76616c6964206c6f636b206d6f646560781b604082015260600190565b600060208284031215614d6857600080fd5b81516117d7816148e9565b600060208284031215614d8557600080fd5b81516117d78161491b565b60208082526010908201526f1cdb585b1b081c1c9bc81cdd185ad95960821b604082015260600190565b600060018201614dcc57614dcc614c2e565b5060010190565b634e487b7160e01b600052603160045260246000fd5b60005b83811015614e04578181015183820152602001614dec565b50506000910152565b60008251614e1f818460208701614de9565b9190910192915050565b6020815260008251806020840152614e48816040850160208701614de9565b601f01601f1916919091016040019291505056fea2646970667358221220c13ad74623f9c6fec196a71303616c6d301dde5e5be2d196eafabb36df0be74d64736f6c63430008100033