false
true
0

Contract Address Details

0x001ee07196f05d359dDDAeA98f324693Ff72e8aA

Contract Name
HexToysMultiNFTStakingFactory
Creator
0x0bf373–b9b596 at 0x6f4eee–a39693
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
25854081
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
HexToysMultiNFTStakingFactory




Optimization enabled
true
Compiler version
v0.8.17+commit.8df45f5f




Optimization runs
200
EVM Version
default




Verified at
2023-09-30T03:49:57.886052Z

contracts/nft_staking/HexToysMultiNFTStakingFactory.sol

// NFT Staking Factory Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "./HexToysMultiNFTStaking.sol";

interface INFTStaking {
    function initialize(InitializeParam memory param) external;
}

contract HexToysMultiNFTStakingFactory is OwnableUpgradeable {
    using SafeMath for uint256;
    using EnumerableSet for EnumerableSet.UintSet;

    uint256 public constant PERCENTS_DIVIDER = 1000;
    uint256 public constant YEAR_TIMESTAMP = 31536000;

    address[] public stakings;
    address private adminFeeAddress;
    uint256 private adminFeePercent; // 21 for 2.1 %
    uint256 private depositFeePerNft;
    uint256 private withdrawFeePerNft;

    struct Subscription {
        uint256 id;
        string name;
        uint256 period; // calculate with time interval
        uint256 price;
        bool bValid;
    }

    uint256 public currentSubscriptionsId;
    mapping(uint256 => Subscription) private _subscriptions;
    EnumerableSet.UintSet private _subscriptionIndices;

    EnumerableSet.UintSet private _aprs;

    /** Events */
    event SubscriptionCreated(Subscription subscription);
    event SubscriptionDeleted(uint256 subscriptionsId);
    event SubscriptionUpdated(
        uint256 subscriptionsId,
        Subscription subscription
    );

    event MultiNFTStakingCreated(
        address _stake_address,
        InitializeParam _param
    );

    function initialize(address _adminFeeAddress) public initializer {
        __Ownable_init();
        adminFeeAddress = _adminFeeAddress;

        adminFeePercent = 21;
        depositFeePerNft = 100 ether;
        withdrawFeePerNft = 100 ether;
        currentSubscriptionsId = 0;
    }

    function getAdminFeeAddress() external view returns (address) {
        return adminFeeAddress;
    }

    function setAdminFeeAddress(address _adminFeeAddress) external onlyOwner {
        adminFeeAddress = _adminFeeAddress;
    }

    function getAdminFeePercent() external view returns (uint256) {
        return adminFeePercent;
    }

    function setAdminFeePercent(uint256 _adminFeePercent) external onlyOwner {
        adminFeePercent = _adminFeePercent;
    }

    function getDepositFeePerNft() external view returns (uint256) {
        return depositFeePerNft;
    }

    function setDepositFeePerNft(uint256 _depositFeePerNft) external onlyOwner {
        depositFeePerNft = _depositFeePerNft;
    }

    function getWithdrawFeePerNft() external view returns (uint256) {
        return withdrawFeePerNft;
    }

    function setWithdrawFeePerNft(uint256 _withdrawFeePerNft)
        external
        onlyOwner
    {
        withdrawFeePerNft = _withdrawFeePerNft;
    }

    /**
		Subscription Management
	 */
    function addSubscription(
        string memory _name,
        uint256 _period,
        uint256 _price
    ) external onlyOwner {
        currentSubscriptionsId = currentSubscriptionsId.add(1);
        _subscriptions[currentSubscriptionsId].id = currentSubscriptionsId;
        _subscriptions[currentSubscriptionsId].name = _name;
        _subscriptions[currentSubscriptionsId].period = _period;
        _subscriptions[currentSubscriptionsId].price = _price;
        _subscriptions[currentSubscriptionsId].bValid = true;

        _subscriptionIndices.add(currentSubscriptionsId);
        emit SubscriptionCreated(_subscriptions[currentSubscriptionsId]);
    }

    function deleteSubscription(uint256 _subscriptionId) external onlyOwner {
        require(_subscriptions[_subscriptionId].bValid, "not exist");
        _subscriptions[_subscriptionId].bValid = false;

        _subscriptionIndices.remove(_subscriptionId);
        emit SubscriptionDeleted(_subscriptionId);
    }

    function updateSubscription(
        uint256 _subscriptionId,
        string memory _name,
        uint256 _period,
        uint256 _price
    ) external onlyOwner {
        require(_subscriptions[_subscriptionId].bValid, "not exist");

        _subscriptions[_subscriptionId].name = _name;
        _subscriptions[_subscriptionId].period = _period;
        _subscriptions[_subscriptionId].price = _price;

        emit SubscriptionUpdated(
            _subscriptionId,
            _subscriptions[_subscriptionId]
        );
    }

    function subscriptionCount() public view returns (uint256) {
        return _subscriptionIndices.length();
    }

    function subscriptionIdWithIndex(uint256 index)
        public
        view
        returns (uint256)
    {
        return _subscriptionIndices.at(index);
    }

    function viewSubscriptionInfo(uint256 _subscriptionId)
        external
        view
        returns (Subscription memory)
    {
        return _subscriptions[_subscriptionId];
    }

    function allSubscriptions()
        external
        view
        returns (Subscription[] memory scriptions)
    {
        uint256 scriptionCount = subscriptionCount();
        scriptions = new Subscription[](scriptionCount);

        for (uint256 i = 0; i < scriptionCount; i++) {
            scriptions[i] = _subscriptions[subscriptionIdWithIndex(i)];
        }
    }

    /**
		APR Management
	 */
    function addApr(uint256 _value) external onlyOwner {
        _aprs.add(_value);
        emit SubscriptionCreated(_subscriptions[currentSubscriptionsId]);
    }

    function deleteApr(uint256 _value) external onlyOwner {
        _aprs.remove(_value);
        emit SubscriptionDeleted(_value);
    }

    function aprCount() external view returns (uint256) {
        return _aprs.length();
    }

    function aprWithIndex(uint256 index) external view returns (uint256) {
        return _aprs.at(index);
    }

    function allAprs() external view returns (uint256[] memory aprs_) {
        uint256 count = _aprs.length();
        aprs_ = new uint256[](count);

        for (uint256 i = 0; i < count; i++) {
            aprs_[i] = _aprs.at(i);
        }
    }

    function createMultiNFTStaking(
        uint256 startTime,
        uint256 subscriptionId,
        uint256 aprIndex,
        address stakeNftAddress,
        address rewardTokenAddress,
        uint256 stakeNftPrice,
        uint256 maxStakedNfts,
        uint256 maxNftsPerUser
    ) external payable returns (address staking) {
        require(_subscriptions[subscriptionId].bValid, "not exist");

        Subscription storage _subscription = _subscriptions[subscriptionId];
        uint256 _apr = _aprs.at(aprIndex);
        uint256 endTime = startTime.add(_subscription.period);
        uint256 value = msg.value;

        {
            (bool result, ) = payable(adminFeeAddress).call{value: _subscription.price}("");
        	require(result, "Failed to send subscription fee to admin");            
        }

        {
            bytes memory bytecode = type(HexToysMultiNFTStaking).creationCode;
            bytes32 salt = keccak256(abi.encodePacked(stakeNftAddress, rewardTokenAddress, block.timestamp));
            assembly {
                staking := create2(0, add(bytecode, 32), mload(bytecode), salt)
            }                       
        }

        {
            uint256 depositTokenAmount = getDepositTokenAmount(
                stakeNftPrice,
                maxStakedNfts,
                _apr,
                _subscription.period
            );
            if (rewardTokenAddress == address(0x0)) {
                require(
                    value >= _subscription.price.add(depositTokenAmount),
                    "insufficient balance"
                );                
                (bool result, ) = payable(staking).call{value: depositTokenAmount}("");
        	    require(result, "Failed to send deposit Amount fee to staking");

            } else {
                IERC20 governanceToken = IERC20(rewardTokenAddress);
                require(
                    governanceToken.transferFrom(
                        msg.sender,
                        address(this),
                        depositTokenAmount
                    ),
                    "insufficient token balance"
                );
                governanceToken.transfer(staking, depositTokenAmount);
            }
        }

        {
            InitializeParam memory _initializeParam;
            _initializeParam.stakeNftAddress = stakeNftAddress;
            _initializeParam.rewardTokenAddress = rewardTokenAddress;
            _initializeParam.stakeNftPrice = stakeNftPrice;
            _initializeParam.apr = _apr;
            _initializeParam.creatorAddress = msg.sender;
            _initializeParam.maxStakedNfts = maxStakedNfts;
            _initializeParam.maxNftsPerUser = maxNftsPerUser;
            _initializeParam.depositFeePerNft = depositFeePerNft;
            _initializeParam.withdrawFeePerNft = withdrawFeePerNft;
            _initializeParam.startTime = startTime;
            _initializeParam.endTime = endTime;

            INFTStaking(staking).initialize(_initializeParam);
            stakings.push(staking);

            emit MultiNFTStakingCreated(staking, _initializeParam);
        }
    }

    function getDepositTokenAmount(
        uint256 stakeNftPrice_,
        uint256 maxStakedNfts_,
        uint256 apr_,
        uint256 period_
    ) internal pure returns (uint256) {
        uint256 depositTokenAmount = stakeNftPrice_
            .mul(maxStakedNfts_)
            .mul(apr_)
            .mul(period_)
            .div(YEAR_TIMESTAMP)
            .div(PERCENTS_DIVIDER);
        return depositTokenAmount;
    }

    function withdrawCoin() external onlyOwner {
        uint256 balance = address(this).balance;
        require(balance > 0, "insufficient balance");
        (bool result, ) = payable(msg.sender).call{value: balance}("");
        require(result, "Failed to withdraw balance");        
    }

    /**
     * @dev To receive ETH
     */
    receive() external payable {}
}
        

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _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. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
          

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}
          

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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);
        }
    }
}
          

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}
          

@openzeppelin/contracts/security/Pausable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
          

@openzeppelin/contracts/security/ReentrancyGuard.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
          

@openzeppelin/contracts/token/ERC1155/IERC1155.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}
          

@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}
          

@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

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

@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }
}
          

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}
          

@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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);
}
          

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}
          

@openzeppelin/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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);
        }
    }
}
          

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// 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;
    }
}
          

@openzeppelin/contracts/utils/introspection/ERC165.sol

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
          

@openzeppelin/contracts/utils/introspection/IERC165.sol

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

@openzeppelin/contracts/utils/math/SafeMath.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

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

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

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

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

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

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

@openzeppelin/contracts/utils/structs/EnumerableSet.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

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.
 *
 * ```solidity
 * 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) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

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

        return result;
    }

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

contracts/nft_staking/HexToysMultiNFTStaking.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";

import "./HexToysNFTStaking.sol";

contract HexToysMultiNFTStaking is HexToysNFTStaking, ERC1155Holder {
    using SafeMath for uint256;
    using EnumerableSet for EnumerableSet.UintSet;    

    struct UserInfo {
        EnumerableSet.UintSet stakedNfts; // staked nft tokenid array
        uint256 rewards;
        uint256 lastRewardTimestamp;
    }

    // Info of each user that stakes LP tokens.
    mapping(address => UserInfo) private _userInfo;

    // nft amount of each (user, tokenId).
    mapping(bytes32 => uint256) private _nftAmounts;

    constructor() {
        factory = msg.sender;        
    }

    function viewUserInfo(address account_)
        external
        view
        returns (
            uint256[] memory stakedNfts,
            uint256[] memory stakedNftAmounts,
            uint256 totalstakedNftCount,
            uint256 rewards,
            uint256 lastRewardTimestamp
        )
    {
        UserInfo storage user = _userInfo[account_];
        rewards = user.rewards;
        lastRewardTimestamp = user.lastRewardTimestamp;
        uint256 stakedNftCount = user.stakedNfts.length();
        totalstakedNftCount = userStakedNFTAmount(account_);
        if (stakedNftCount == 0) {
            // Return an empty array
            stakedNfts = new uint256[](0);
            stakedNftAmounts = new uint256[](0);
        } else {
            stakedNfts = new uint256[](stakedNftCount);
            stakedNftAmounts = new uint256[](stakedNftCount);
            uint256 index;
            for (index = 0; index < stakedNftCount; index++) {
                uint256 stakedNftId = user.stakedNfts.at(index);
                bytes32 key = nftKeyOfUser(account_, stakedNftId);
                uint256 nftAmount = _nftAmounts[key];

                stakedNfts[index] = stakedNftId;
                stakedNftAmounts[index] = nftAmount;
            }
        }
    }

    function nftKeyOfUser(address _userAddress, uint256 _tokenId)
        public
        pure
        returns (bytes32)
    {
        return keccak256(abi.encode(_userAddress, _tokenId));
    }

    /**
     * @dev Check if the user staked the nft of token id
     */
    function isStaked(address account_, uint256 tokenId_)
        public
        view
        returns (bool)
    {
        UserInfo storage user = _userInfo[account_];
        return user.stakedNfts.contains(tokenId_);
    }

    function userStakedNFTAmount(address account_)
        public
        view
        returns (uint256)
    {
        UserInfo storage user = _userInfo[account_];
        uint256 stakedNftCount = user.stakedNfts.length();
        uint256 totalstakedNftCount = 0;
        if (stakedNftCount > 0) {
            uint256 index;
            for (index = 0; index < stakedNftCount; index++) {
                uint256 stakedNftId = user.stakedNfts.at(index);
                bytes32 key = nftKeyOfUser(account_, stakedNftId);
                uint256 nftAmount = _nftAmounts[key];
                totalstakedNftCount = totalstakedNftCount.add(nftAmount);
            }
        }
        return totalstakedNftCount;
    }

    /**
     * @dev Get pending reward amount for the account
     */
    function pendingRewards(address account_) public view returns (uint256) {
        UserInfo storage user = _userInfo[account_];

        uint256 fromTimestamp = user.lastRewardTimestamp < stakingParams.startTime
            ? stakingParams.startTime
            : user.lastRewardTimestamp;
        uint256 toTimestamp = block.timestamp < stakingParams.endTime
            ? block.timestamp
            : stakingParams.endTime;
        if (toTimestamp < fromTimestamp) {
            return user.rewards;
        }

        uint256 totalstakedNftCount = userStakedNFTAmount(account_);

        uint256 amount = (toTimestamp.sub(fromTimestamp))
            .mul(totalstakedNftCount)
            .mul(stakingParams.apr)
            .mul(stakingParams.stakeNftPrice)
            .div(PERCENTS_DIVIDER)
            .div(YEAR_TIMESTAMP);

        return user.rewards.add(amount);
    }

    /**
     * @dev Stake nft token ids
     */
    function stake(uint256[] memory tokenIdList_, uint256[] memory amountList_)
        external
        payable
        nonReentrant
        whenNotPaused
    {
        require(
            IERC1155(stakingParams.stakeNftAddress).isApprovedForAll(
                _msgSender(),
                address(this)
            ),
            "Not approve nft to staker address"
        );
        require(tokenIdList_.length == amountList_.length, "Invalid Token ids");

        uint256 countToStake = tokenIdList_.length;
        uint256 amountToStake = 0;
        if (countToStake > 0) {
            for (uint256 i = 0; i < countToStake; i++) {
                amountToStake = amountToStake.add(amountList_[i]);
            }
        }

        UserInfo storage user = _userInfo[_msgSender()];

        uint256 stakedNftAmount = userStakedNFTAmount(_msgSender());
        require(
            stakedNftAmount.add(amountToStake) <= stakingParams.maxNftsPerUser,
            "Exceeds the max limit per user"
        );
        require(
            _totalStakedNfts.add(amountToStake) <= stakingParams.maxStakedNfts,
            "Exceeds the max limit"
        );

        uint256 pendingAmount = pendingRewards(_msgSender());
        if (pendingAmount > 0) {
            uint256 amountSent = safeRewardTransfer(
                _msgSender(),
                pendingAmount
            );
            user.rewards = pendingAmount.sub(amountSent);
            emit Harvested(_msgSender(), amountSent);
        }

        if (amountToStake > 0 && stakingParams.depositFeePerNft > 0) {
            require(
                msg.value >= amountToStake.mul(stakingParams.depositFeePerNft),
                "Insufficient deposit fee"
            );
            uint256 adminFeePercent = INFTStakingFactory(factory)
                .getAdminFeePercent();
            uint256 creatorFeePercent = PERCENTS_DIVIDER.sub(adminFeePercent);
            address adminFeeAddress = INFTStakingFactory(factory).getAdminFeeAddress();

            if (adminFeePercent > 0) {
                (bool result, ) = payable(adminFeeAddress).call{value: msg.value.mul(adminFeePercent).div(PERCENTS_DIVIDER)}("");
        	    require(result, "Failed to send fee to admin");
            }
            if (creatorFeePercent > 0) {
                (bool result, ) = payable(stakingParams.creatorAddress).call{value: msg.value.mul(creatorFeePercent).div(PERCENTS_DIVIDER)}("");
        	    require(result, "Failed to send fee to staking creator");
            }            
        }

        for (uint256 i = 0; i < countToStake; i++) {
            IERC1155(stakingParams.stakeNftAddress).safeTransferFrom(
                _msgSender(),
                address(this),
                tokenIdList_[i],
                amountList_[i],
                "stake"
            );
            if (!isStaked(_msgSender(), tokenIdList_[i])) {
                user.stakedNfts.add(tokenIdList_[i]);
            }

            bytes32 key = nftKeyOfUser(_msgSender(), tokenIdList_[i]);
            _nftAmounts[key] = _nftAmounts[key] + amountList_[i];

            emit Staked(_msgSender(), tokenIdList_[i], amountList_[i]);
        }

        _totalStakedNfts = _totalStakedNfts.add(amountToStake);
        user.lastRewardTimestamp = block.timestamp;
    }

    /**
     * @dev Withdraw nft token ids
     */
    function withdraw(
        uint256[] memory tokenIdList_,
        uint256[] memory amountList_
    ) external payable nonReentrant {
        require(tokenIdList_.length == amountList_.length, "Invalid Token ids");

        UserInfo storage user = _userInfo[_msgSender()];
        uint256 pendingAmount = pendingRewards(_msgSender());
        if (pendingAmount > 0) {
            uint256 amountSent = safeRewardTransfer(
                _msgSender(),
                pendingAmount
            );
            user.rewards = pendingAmount.sub(amountSent);
            emit Harvested(_msgSender(), amountSent);
        }

        uint256 countToWithdraw = tokenIdList_.length;
        uint256 amountToWithdraw = 0;
        if (countToWithdraw > 0) {
            for (uint256 i = 0; i < countToWithdraw; i++) {
                amountToWithdraw = amountToWithdraw.add(amountList_[i]);
            }
        }

        if (amountToWithdraw > 0 && stakingParams.withdrawFeePerNft > 0) {
            require(
                msg.value >= amountToWithdraw.mul(stakingParams.withdrawFeePerNft),
                "Insufficient withdraw fee"
            );
            uint256 adminFeePercent = INFTStakingFactory(factory)
                .getAdminFeePercent();
            uint256 creatorFeePercent = PERCENTS_DIVIDER.sub(adminFeePercent);
            address adminFeeAddress = INFTStakingFactory(factory).getAdminFeeAddress();

            if (adminFeePercent > 0) {
                (bool result, ) = payable(adminFeeAddress).call{value: msg.value.mul(adminFeePercent).div(PERCENTS_DIVIDER)}("");
        	    require(result, "Failed to send fee to admin");
            }
            if (creatorFeePercent > 0) {
                (bool result, ) = payable(stakingParams.creatorAddress).call{value: msg.value.mul(creatorFeePercent).div(PERCENTS_DIVIDER)}("");
        	    require(result, "Failed to send fee to staking creator");
            }
        }

        for (uint256 i = 0; i < countToWithdraw; i++) {
            require(
                isStaked(_msgSender(), tokenIdList_[i]),
                "Not staked this nft"
            );
            bytes32 key = nftKeyOfUser(_msgSender(), tokenIdList_[i]);
            uint256 nftAmounts = _nftAmounts[key];
            require(
                (nftAmounts > 0 && nftAmounts >= amountList_[i]),
                "insufficient withdraw amount"
            );
            IERC1155(stakingParams.stakeNftAddress).safeTransferFrom(
                address(this),
                _msgSender(),
                tokenIdList_[i],
                amountList_[i],
                "Withdraw"
            );
            if (nftAmounts == amountList_[i]) {
                user.stakedNfts.remove(tokenIdList_[i]);
            }
            _nftAmounts[key] = nftAmounts - amountList_[i];

            emit Withdrawn(_msgSender(), tokenIdList_[i], amountList_[i]);
        }
        user.lastRewardTimestamp = block.timestamp;
    }
}
          

contracts/nft_staking/HexToysNFTStaking.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

import "./StructDeclaration.sol";
interface INFTStakingFactory {
    function owner() external view returns (address);
    function getAdminFeePercent() external view returns (uint256);
    function getAdminFeeAddress() external view returns (address);
}

contract HexToysNFTStaking is ReentrancyGuard, Pausable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address public factory;

    uint256 public constant PERCENTS_DIVIDER = 1000;
    uint256 public constant YEAR_TIMESTAMP = 31536000;

    /** Staking NFT address */
    InitializeParam public stakingParams;

    /** total staked NFTs*/
    uint256 public _totalStakedNfts;

    

    event StartTimeUpdated(uint256 _timestamp);
    event EndTimeUpdated(uint256 _timestamp);
    event RewardTokenUpdated(address newTokenAddress);
    event StakeNftPriceUpdated(uint256 newValue);
    event AprUpdated(uint256 newValue);
    event MaxStakedNftsUpdated(uint256 newValue);
    event MaxNftsPerUserUpdated(uint256 newValue);
    event DepositFeePerNftUpdated(uint256 newValue);
    event WithdrawFeePerNftUpdated(uint256 newValue);

    event Staked(address indexed account, uint256 tokenId, uint256 amount);
    event Withdrawn(address indexed account, uint256 tokenId, uint256 amount);
    event Harvested(address indexed account, uint256 amount);

    function getDepositTokenAmount(
        uint256 stakeNftPrice_,
        uint256 maxStakedNfts_,
        uint256 apr_,
        uint256 period_
    ) internal pure returns (uint256) {
        uint256 depositTokenAmount = stakeNftPrice_
            .mul(maxStakedNfts_)
            .mul(apr_)
            .mul(period_)
            .div(YEAR_TIMESTAMP)
            .div(PERCENTS_DIVIDER);
        return depositTokenAmount;
    }

    function initialize(
        InitializeParam memory _param
    ) external {
        require(msg.sender == factory, "Only for factory");        
        stakingParams = _param;
    }

    /**
     * @dev Update start block timestamp
     * Only factory owner has privilege to call this function
     */
    function updateStartTimestamp(uint256 startTimestamp_)
        external        
        onlyFactoryOwner
    {
        require(
            startTimestamp_ <= stakingParams.endTime,
            "Start block must be before end time"
        );
        require(
            startTimestamp_ > block.timestamp,
            "Start block must be after current block"
        );
        require(stakingParams.startTime > block.timestamp, "Staking started already");
        require(stakingParams.startTime != startTimestamp_, "same timestamp");

        stakingParams.startTime = startTimestamp_;
        emit StartTimeUpdated(startTimestamp_);
    }

    /**
     * @dev Update end block timestamp
     * Only factory owner has privilege to call this function
     */
    function updateEndTimestamp(uint256 endTimestamp_)
        external        
        onlyFactoryOwner
    {
        require(
            endTimestamp_ >= stakingParams.startTime,
            "End block must be after start block"
        );
        require(
            endTimestamp_ > block.timestamp,
            "End block must be after current block"
        );
        require(endTimestamp_ != stakingParams.endTime, "same timestamp");

        stakingParams.endTime = endTimestamp_;
        emit EndTimeUpdated(endTimestamp_);
    }

    /**
     * @dev Update reward token address
     * Only factory owner has privilege to call this function
     */
    function updateRewardTokenAddress(address rewardTokenAddress_)
        external        
        onlyFactoryOwner
    {
        require(
            stakingParams.rewardTokenAddress != rewardTokenAddress_,
            "same token address"
        );
        require(stakingParams.startTime > block.timestamp, "Staking started already");
        
        stakingParams.rewardTokenAddress = rewardTokenAddress_;
        emit RewardTokenUpdated(rewardTokenAddress_);
    }

    /**
     * @dev Update nft price
     * Only factory owner has privilege to call this function
     */
    function updateStakeNftPrice(uint256 stakeNftPrice_)
        external        
        onlyFactoryOwner
    {
        require(stakingParams.stakeNftPrice != stakeNftPrice_, "same nft price");
        require(stakingParams.startTime > block.timestamp, "Staking started already");

        stakingParams.stakeNftPrice = stakeNftPrice_;
        emit StakeNftPriceUpdated(stakeNftPrice_);
    }

    /**
     * @dev Update apr value
     * Only factory owner has privilege to call this function
     */
    function updateApr(uint256 apr_) external onlyFactoryOwner {
        require(stakingParams.apr != apr_, "same apr");
        require(stakingParams.startTime > block.timestamp, "Staking started already");

        stakingParams.apr = apr_;
        emit AprUpdated(apr_);
    }

    /**
     * @dev Update maxStakedNfts value
     * Only factory owner has privilege to call this function
     */
    function updateMaxStakedNfts(uint256 maxStakedNfts_)
        external        
        onlyFactoryOwner
    {
        require(stakingParams.maxStakedNfts != maxStakedNfts_, "same maxStakedNfts");
        require(stakingParams.startTime > block.timestamp, "Staking started already");

        stakingParams.maxStakedNfts = maxStakedNfts_;
        emit MaxStakedNftsUpdated(maxStakedNfts_);
    }

    /**
     * @dev Update maxNftsPerUser value
     * Only factory owner has privilege to call this function
     */
    function updateMaxNftsPerUser(uint256 maxNftsPerUser_)
        external        
        onlyFactoryOwner
    {
        stakingParams.maxNftsPerUser = maxNftsPerUser_;
        emit MaxNftsPerUserUpdated(maxNftsPerUser_);
    }

    /**
     * @dev Update depositFeePerNft value
     * Only factory owner has privilege to call this function
     */
    function updateDepositFeePerNft(uint256 depositFeePerNft_)
        external        
        onlyFactoryOwner
    {
        stakingParams.depositFeePerNft = depositFeePerNft_;
        emit DepositFeePerNftUpdated(depositFeePerNft_);
    }

    /**
     * @dev Update withdrawFeePerNft value
     * Only factory owner has privilege to call this function
     */
    function updateWithdrawFeePerNft(uint256 withdrawFeePerNft_)
        external        
        onlyFactoryOwner
    {
        stakingParams.withdrawFeePerNft = withdrawFeePerNft_;
        emit WithdrawFeePerNftUpdated(withdrawFeePerNft_);
    }

    /**
     * @dev Safe transfer reward to the receiver
     */
    function safeRewardTransfer(address _to, uint256 _amount)
        internal
        returns (uint256)
    {
        require(_to != address(0), "Invalid null address");
        if (stakingParams.rewardTokenAddress == address(0x0)) {
            uint256 balance = address(this).balance;
            if (_amount == 0 || balance == 0) {
                return 0;
            }
            if (_amount > balance) {
                _amount = balance;
            }
            (bool result, ) = payable(_to).call{value: _amount}("");
        	require(result, "Failed to transfer coin");

            return _amount;
        } else {
            uint256 tokenBalance = IERC20(stakingParams.rewardTokenAddress).balanceOf(
                address(this)
            );
            if (_amount == 0 || tokenBalance == 0) {
                return 0;
            }
            if (_amount > tokenBalance) {
                _amount = tokenBalance;
            }
            IERC20(stakingParams.rewardTokenAddress).safeTransfer(_to, _amount);
            return _amount;
        }
    }

    /**
     * @notice Pause / Unpause staking
     */
    function pause(bool flag_) public onlyFactoryOwner {
        if (flag_) {
            _pause();
        } else {
            _unpause();
        }
    }

    /**
     * @notice It allows the admin to recover wrong tokens sent to the contract
     * @dev This function is only callable by admin.
     */
    function recoverWrongTokens(address token_, uint256 amount_)
        external
        onlyFactoryOwner
    {
        if (token_ == address(0x0)) {
            (bool result, ) = payable(stakingParams.creatorAddress).call{value: amount_}("");
        	require(result, "Failed to recover coin");
        } else {
            IERC20(token_).safeTransfer(stakingParams.creatorAddress, amount_);
        }
    }

    function withdrawCoin() external onlyFactoryOwner {
        uint256 balance = address(this).balance;
        require(balance > 0, "insufficient balance");  
        (bool result, ) = payable(msg.sender).call{value: balance}("");
        require(result, "Failed to withdraw balance");     
    }

    /**
     * @dev Require _msgSender() to be the creator of the token id
     */
    modifier onlyFactoryOwner() {
        address factoryOwner = INFTStakingFactory(factory).owner();
        require(
            factoryOwner == _msgSender(),
            "caller is not the factory owner"
        );
        _;
    }

    /**
     * @dev To receive ETH
     */
    receive() external payable {}
}
          

contracts/nft_staking/StructDeclaration.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct InitializeParam {
    address stakeNftAddress;
    address rewardTokenAddress;
    uint256 stakeNftPrice;
    uint256 apr;
    address creatorAddress;
    uint256 maxStakedNfts;
    uint256 maxNftsPerUser;
    uint256 depositFeePerNft;
    uint256 withdrawFeePerNft;
    uint256 startTime;
    uint256 endTime;
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
              

Contract ABI

[{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"MultiNFTStakingCreated","inputs":[{"type":"address","name":"_stake_address","internalType":"address","indexed":false},{"type":"tuple","name":"_param","internalType":"struct InitializeParam","indexed":false,"components":[{"type":"address","name":"stakeNftAddress","internalType":"address"},{"type":"address","name":"rewardTokenAddress","internalType":"address"},{"type":"uint256","name":"stakeNftPrice","internalType":"uint256"},{"type":"uint256","name":"apr","internalType":"uint256"},{"type":"address","name":"creatorAddress","internalType":"address"},{"type":"uint256","name":"maxStakedNfts","internalType":"uint256"},{"type":"uint256","name":"maxNftsPerUser","internalType":"uint256"},{"type":"uint256","name":"depositFeePerNft","internalType":"uint256"},{"type":"uint256","name":"withdrawFeePerNft","internalType":"uint256"},{"type":"uint256","name":"startTime","internalType":"uint256"},{"type":"uint256","name":"endTime","internalType":"uint256"}]}],"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":"event","name":"SubscriptionCreated","inputs":[{"type":"tuple","name":"subscription","internalType":"struct HexToysMultiNFTStakingFactory.Subscription","indexed":false,"components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"uint256","name":"period","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bool","name":"bValid","internalType":"bool"}]}],"anonymous":false},{"type":"event","name":"SubscriptionDeleted","inputs":[{"type":"uint256","name":"subscriptionsId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SubscriptionUpdated","inputs":[{"type":"uint256","name":"subscriptionsId","internalType":"uint256","indexed":false},{"type":"tuple","name":"subscription","internalType":"struct HexToysMultiNFTStakingFactory.Subscription","indexed":false,"components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"uint256","name":"period","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bool","name":"bValid","internalType":"bool"}]}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PERCENTS_DIVIDER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"YEAR_TIMESTAMP","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addApr","inputs":[{"type":"uint256","name":"_value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addSubscription","inputs":[{"type":"string","name":"_name","internalType":"string"},{"type":"uint256","name":"_period","internalType":"uint256"},{"type":"uint256","name":"_price","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"aprs_","internalType":"uint256[]"}],"name":"allAprs","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"scriptions","internalType":"struct HexToysMultiNFTStakingFactory.Subscription[]","components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"uint256","name":"period","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bool","name":"bValid","internalType":"bool"}]}],"name":"allSubscriptions","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"aprCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"aprWithIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"address","name":"staking","internalType":"address"}],"name":"createMultiNFTStaking","inputs":[{"type":"uint256","name":"startTime","internalType":"uint256"},{"type":"uint256","name":"subscriptionId","internalType":"uint256"},{"type":"uint256","name":"aprIndex","internalType":"uint256"},{"type":"address","name":"stakeNftAddress","internalType":"address"},{"type":"address","name":"rewardTokenAddress","internalType":"address"},{"type":"uint256","name":"stakeNftPrice","internalType":"uint256"},{"type":"uint256","name":"maxStakedNfts","internalType":"uint256"},{"type":"uint256","name":"maxNftsPerUser","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentSubscriptionsId","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deleteApr","inputs":[{"type":"uint256","name":"_value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deleteSubscription","inputs":[{"type":"uint256","name":"_subscriptionId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getAdminFeeAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getAdminFeePercent","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getDepositFeePerNft","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getWithdrawFeePerNft","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_adminFeeAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdminFeeAddress","inputs":[{"type":"address","name":"_adminFeeAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdminFeePercent","inputs":[{"type":"uint256","name":"_adminFeePercent","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDepositFeePerNft","inputs":[{"type":"uint256","name":"_depositFeePerNft","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWithdrawFeePerNft","inputs":[{"type":"uint256","name":"_withdrawFeePerNft","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"stakings","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"subscriptionCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"subscriptionIdWithIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSubscription","inputs":[{"type":"uint256","name":"_subscriptionId","internalType":"uint256"},{"type":"string","name":"_name","internalType":"string"},{"type":"uint256","name":"_period","internalType":"uint256"},{"type":"uint256","name":"_price","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct HexToysMultiNFTStakingFactory.Subscription","components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"uint256","name":"period","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bool","name":"bValid","internalType":"bool"}]}],"name":"viewSubscriptionInfo","inputs":[{"type":"uint256","name":"_subscriptionId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawCoin","inputs":[]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5061570b806100206000396000f3fe6080604052600436106101d05760003560e01c8063873c4940116100f7578063cec90ecc11610095578063f2fde38b11610064578063f2fde38b146104eb578063f353048b1461050b578063f802a9ea1461052b578063ff0958b21461054b57600080fd5b8063cec90ecc14610475578063d1ff960514610493578063d8b9130f146104b3578063ed48083b146104cb57600080fd5b8063afef0426116100d1578063afef0426146103f5578063c4d66de814610415578063c4f0c1fc14610435578063c8f09e291461045557600080fd5b8063873c4940146103975780638da5cb5b146103c25780639dcd2b92146103e057600080fd5b806349cf912c1161016f5780636727ad201161013e5780636727ad201461032d5780636cf270aa1461034d578063715018a6146103625780637a49244d1461037757600080fd5b806349cf912c146102b457806355b2276f146102c95780636220aea8146102eb578063637872851461030057600080fd5b8063173b6d90116101ab578063173b6d90146102475780632ad1d1761461025c5780633b2af31b1461027e578063415c5bfa1461029e57600080fd5b80624fcec4146101dc57806301c234a81461020f57806304879db21461022557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611807565b610560565b6040519081526020015b60405180910390f35b34801561021b57600080fd5b506101fc6103e881565b34801561023157600080fd5b50610245610240366004611807565b610573565b005b34801561025357600080fd5b506101fc610611565b34801561026857600080fd5b50610271610622565b6040516102069190611820565b34801561028a57600080fd5b50610245610299366004611907565b6106c1565b3480156102aa57600080fd5b506101fc606a5481565b3480156102c057600080fd5b506067546101fc565b3480156102d557600080fd5b506102de610790565b60405161020691906119d7565b3480156102f757600080fd5b50610245610942565b34801561030c57600080fd5b5061032061031b366004611807565b610a2b565b6040516102069190611a39565b34801561033957600080fd5b50610245610348366004611807565b610b43565b34801561035957600080fd5b506069546101fc565b34801561036e57600080fd5b50610245610b50565b34801561038357600080fd5b506101fc610392366004611807565b610b64565b6103aa6103a5366004611a68565b610b71565b6040516001600160a01b039091168152602001610206565b3480156103ce57600080fd5b506033546001600160a01b03166103aa565b3480156103ec57600080fd5b506068546101fc565b34801561040157600080fd5b50610245610410366004611ad3565b6111a2565b34801561042157600080fd5b50610245610430366004611ad3565b6111cc565b34801561044157600080fd5b506103aa610450366004611807565b611314565b34801561046157600080fd5b50610245610470366004611807565b61133e565b34801561048157600080fd5b506066546001600160a01b03166103aa565b34801561049f57600080fd5b506102456104ae366004611807565b611392565b3480156104bf57600080fd5b506101fc6301e1338081565b3480156104d757600080fd5b506102456104e6366004611aee565b61139f565b3480156104f757600080fd5b50610245610506366004611ad3565b611450565b34801561051757600080fd5b50610245610526366004611807565b6114c9565b34801561053757600080fd5b50610245610546366004611807565b6114dc565b34801561055757600080fd5b506101fc6114e9565b600061056d606e836114f5565b92915050565b61057b611508565b6000818152606b602052604090206004015460ff166105b55760405162461bcd60e51b81526004016105ac90611b45565b60405180910390fd5b6000818152606b60205260409020600401805460ff191690556105d9606c82611562565b506040518181527ff026990ac214e8c38e9e15f423e64f03b3c43241b4800b22a9dffa5f7c7d6071906020015b60405180910390a150565b600061061d606c61156e565b905090565b60606000610630606e61156e565b90508067ffffffffffffffff81111561064b5761064b611864565b604051908082528060200260200182016040528015610674578160200160208202803683370190505b50915060005b818110156106bc5761068d606e826114f5565b83828151811061069f5761069f611b68565b6020908102919091010152806106b481611b94565b91505061067a565b505090565b6106c9611508565b606a546106d7906001611578565b606a8190556000818152606b602052604090209081556001016106fa8482611c36565b50606a80546000908152606b602052604080822060020185905582548252808220600301849055825482529020600401805460ff191660011790555461074290606c90611584565b50606a546000908152606b60205260409081902090517f7a76d3ac89e8fd384694d4946fd5c54929e21711e87a91f77b157c06e7714cbf9161078391611db2565b60405180910390a1505050565b6060600061079c610611565b90508067ffffffffffffffff8111156107b7576107b7611864565b60405190808252806020026020018201604052801561081c57816020015b6108096040518060a00160405280600081526020016060815260200160008152602001600081526020016000151581525090565b8152602001906001900390816107d55790505b50915060005b818110156106bc57606b600061083783610b64565b81526020019081526020016000206040518060a00160405290816000820154815260200160018201805461086a90611bad565b80601f016020809104026020016040519081016040528092919081815260200182805461089690611bad565b80156108e35780601f106108b8576101008083540402835291602001916108e3565b820191906000526020600020905b8154815290600101906020018083116108c657829003601f168201915b5050509183525050600282015460208201526003820154604082015260049091015460ff161515606090910152835184908390811061092457610924611b68565b6020026020010181905250808061093a90611b94565b915050610822565b61094a611508565b478061098f5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016105ac565b604051600090339083908381818185875af1925050503d80600081146109d1576040519150601f19603f3d011682016040523d82523d6000602084013e6109d6565b606091505b5050905080610a275760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f2077697468647261772062616c616e636500000000000060448201526064016105ac565b5050565b610a5f6040518060a00160405280600081526020016060815260200160008152602001600081526020016000151581525090565b606b60008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610a9790611bad565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac390611bad565b8015610b105780601f10610ae557610100808354040283529160200191610b10565b820191906000526020600020905b815481529060010190602001808311610af357829003601f168201915b5050509183525050600282015460208201526003820154604082015260049091015460ff16151560609091015292915050565b610b4b611508565b606855565b610b58611508565b610b626000611590565b565b600061056d606c836114f5565b6000878152606b602052604081206004015460ff16610ba25760405162461bcd60e51b81526004016105ac90611b45565b6000888152606b6020526040812090610bbc606e8a6114f5565b90506000610bd783600201548d61157890919063ffffffff16565b606654600385015460405192935034926000926001600160a01b031691908381818185875af1925050503d8060008114610c2d576040519150601f19603f3d011682016040523d82523d6000602084013e610c32565b606091505b5050905080610c945760405162461bcd60e51b815260206004820152602860248201527f4661696c656420746f2073656e6420737562736372697074696f6e20666565206044820152673a379030b236b4b760c11b60648201526084016105ac565b50600060405180602001610ca7906117fa565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff1960608e811b821660208401528d901b166034820152426048820152909150600090606801604051602081830303815290604052805190602001209050808251602084016000f5965050506000610d2689898688600201546115e2565b90506001600160a01b038a16610e49576003850154610d459082611578565b821015610d8b5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016105ac565b6000866001600160a01b03168260405160006040518083038185875af1925050503d8060008114610dd8576040519150601f19603f3d011682016040523d82523d6000602084013e610ddd565b606091505b5050905080610e435760405162461bcd60e51b815260206004820152602c60248201527f4661696c656420746f2073656e64206465706f73697420416d6f756e7420666560448201526b6520746f207374616b696e6760a01b60648201526084016105ac565b50610f84565b6040516323b872dd60e01b8152336004820152306024820152604481018290528a906001600160a01b038216906323b872dd906064016020604051808303816000875af1158015610e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec29190611dc5565b610f0e5760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420746f6b656e2062616c616e636500000000000060448201526064016105ac565b60405163a9059cbb60e01b81526001600160a01b0388811660048301526024820184905282169063a9059cbb906044016020604051808303816000875af1158015610f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f819190611dc5565b50505b50610ffd60405180610160016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b8a81600001906001600160a01b031690816001600160a01b0316815250508981602001906001600160a01b031690816001600160a01b03168152505088816040018181525050838160600181815250503381608001906001600160a01b031690816001600160a01b031681525050878160a0018181525050868160c00181815250506068548160e0018181525050606954816101000181815250508d816101200181815250508281610140018181525050856001600160a01b031663324c3617826040518263ffffffff1660e01b81526004016110da9190611e7e565b600060405180830381600087803b1580156110f457600080fd5b505af1158015611108573d6000803e3d6000fd5b5050606580546001810182556000919091527f8ff97419363ffd7000167f130ef7168fbea05faf9251824ca5043f113cc6a7c70180546001600160a01b0319166001600160a01b038a1617905550506040517f7cf21bbd6f8485b673b03a3fef10dc82c9812c5061aeb28ea8b7a9e1d29b2a52906111899088908490611e8d565b60405180910390a1505050505098975050505050505050565b6111aa611508565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16158080156111ec5750600054600160ff909116105b806112065750303b158015611206575060005460ff166001145b6112695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ac565b6000805460ff19166001179055801561128c576000805461ff0019166101001790555b611294611617565b606680546001600160a01b0319166001600160a01b038416179055601560675568056bc75e2d6310000060688190556069556000606a558015610a27576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6065818154811061132457600080fd5b6000918252602090912001546001600160a01b0316905081565b611346611508565b611351606e82611584565b50606a546000908152606b60205260409081902090517f7a76d3ac89e8fd384694d4946fd5c54929e21711e87a91f77b157c06e7714cbf9161060691611db2565b61139a611508565b606755565b6113a7611508565b6000848152606b602052604090206004015460ff166113d85760405162461bcd60e51b81526004016105ac90611b45565b6000848152606b602052604090206001016113f38482611c36565b506000848152606b602052604090819020600281018490556003810183905590517f768a683652170c01995eedf6ad541a610761fd51c403ac938dbb233831c44eca9161144291879190611eab565b60405180910390a150505050565b611458611508565b6001600160a01b0381166114bd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ac565b6114c681611590565b50565b6114d1611508565b6105d9606e82611562565b6114e4611508565b606955565b600061061d606e61156e565b60006115018383611646565b9392505050565b6033546001600160a01b03163314610b625760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105ac565b60006115018383611670565b600061056d825490565b60006115018284611ecc565b60006115018383611763565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008061160d6103e86116076301e1338081876116018a818e8e6117b2565b906117b2565b906117be565b9695505050505050565b600054610100900460ff1661163e5760405162461bcd60e51b81526004016105ac90611edf565b610b626117ca565b600082600001828154811061165d5761165d611b68565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611759576000611694600183611f2a565b85549091506000906116a890600190611f2a565b905081811461170d5760008660000182815481106116c8576116c8611b68565b90600052602060002001549050808760000184815481106116eb576116eb611b68565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061171e5761171e611f3d565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061056d565b600091505061056d565b60008181526001830160205260408120546117aa5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561056d565b50600061056d565b60006115018284611f53565b60006115018284611f6a565b600054610100900460ff166117f15760405162461bcd60e51b81526004016105ac90611edf565b610b6233611590565b61374980611f8d83390190565b60006020828403121561181957600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156118585783518352928401929184019160010161183c565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261188b57600080fd5b813567ffffffffffffffff808211156118a6576118a6611864565b604051601f8301601f19908116603f011681019082821181831017156118ce576118ce611864565b816040528381528660208588010111156118e757600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561191c57600080fd5b833567ffffffffffffffff81111561193357600080fd5b61193f8682870161187a565b9660208601359650604090950135949350505050565b80518252600060208083015160a08286015280518060a087015260005b8181101561198e5782810184015187820160c001528301611972565b50600060c082880101526040850151604087015260608501516060870152608085015192506119c1608087018415159052565b601f01601f19169490940160c001949350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611a2c57603f19888603018452611a1a858351611955565b945092850192908501906001016119fe565b5092979650505050505050565b6020815260006115016020830184611955565b80356001600160a01b0381168114611a6357600080fd5b919050565b600080600080600080600080610100898b031215611a8557600080fd5b883597506020890135965060408901359550611aa360608a01611a4c565b9450611ab160808a01611a4c565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208284031215611ae557600080fd5b61150182611a4c565b60008060008060808587031215611b0457600080fd5b84359350602085013567ffffffffffffffff811115611b2257600080fd5b611b2e8782880161187a565b949794965050505060408301359260600135919050565b6020808252600990820152681b9bdd08195e1a5cdd60ba1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ba657611ba6611b7e565b5060010190565b600181811c90821680611bc157607f821691505b602082108103611be157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115611c3157600081815260208120601f850160051c81016020861015611c0e5750805b601f850160051c820191505b81811015611c2d57828155600101611c1a565b5050505b505050565b815167ffffffffffffffff811115611c5057611c50611864565b611c6481611c5e8454611bad565b84611be7565b602080601f831160018114611c995760008415611c815750858301515b600019600386901b1c1916600185901b178555611c2d565b600085815260208120601f198616915b82811015611cc857888601518255948401946001909101908401611ca9565b5085821015611ce65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8054825260006001808301602060a08187015260008254611d1681611bad565b8060a08a015260c086831660008114611d365760018114611d5057611d7e565b60ff1984168b83015282151560051b8b0182019450611d7e565b866000528560002060005b84811015611d765781548d8201850152908901908701611d5b565b8c0183019550505b505050506002860154604088015260038601546060880152600486015460ff16801515608089015293509695505050505050565b6020815260006115016020830184611cf6565b600060208284031215611dd757600080fd5b8151801515811461150157600080fd5b80516001600160a01b031682526020810151611e0e60208401826001600160a01b03169052565b5060408101516040830152606081015160608301526080810151611e3d60808401826001600160a01b03169052565b5060a0818101519083015260c0808201519083015260e080820151908301526101008082015190830152610120808201519083015261014090810151910152565b610160810161056d8284611de7565b6001600160a01b038316815261018081016115016020830184611de7565b828152604060208201526000611ec46040830184611cf6565b949350505050565b8082018082111561056d5761056d611b7e565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8181038181111561056d5761056d611b7e565b634e487b7160e01b600052603160045260246000fd5b808202811582820484141761056d5761056d611b7e565b600082611f8757634e487b7160e01b600052601260045260246000fd5b50049056fe608060405234801561001057600080fd5b5060016000819055805433610100026001600160a81b031990911617905561370c8061003d6000396000f3fe6080604052600436106101c65760003560e01c80636e1613fb116100f7578063c45a015511610095578063e683ad4411610064578063e683ad44146105c1578063f23a6e61146105d4578063fd1a239714610600578063fed287ad1461062057600080fd5b8063c45a015514610536578063c87dee1414610573578063d8b9130f14610589578063e67151ae146105a157600080fd5b806387d55ff2116100d157806387d55ff2146104805780638cd1b2ef146104a0578063a37d9850146104c0578063bc197c81146104f157600080fd5b80636e1613fb1461042d57806381c197ed1461044d5780638552bf901461046057600080fd5b8063324c3617116101645780635451da1b1161013e5780635451da1b146103c05780635c975abb146103e05780636220aea8146103f857806364d8c0dd1461040d57600080fd5b8063324c3617146103605780633f138d4b146103805780634c5d23c0146103a057600080fd5b806308dec7a0116101a057806308dec7a01461024d5780631dd113a71461026d57806331d7a2621461032057806332290ed81461034057600080fd5b806301c234a8146101d257806301ffc9a7146101fb57806302329a291461022b57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101e86103e881565b6040519081526020015b60405180910390f35b34801561020757600080fd5b5061021b610216366004612fd1565b610640565b60405190151581526020016101f2565b34801561023757600080fd5b5061024b61024636600461300c565b610677565b005b34801561025957600080fd5b5061024b610268366004613029565b61073b565b34801561027957600080fd5b50600254600354600454600554600654600754600854600954600a54600b54600c546102ba9a6001600160a01b039081169a8116999897169594939291908b565b604080516001600160a01b039c8d1681529a8c1660208c01528a0198909852606089019690965297909316608087015260a086019190915260c085015260e0840152610100830193909352610120820192909252610140810191909152610160016101f2565b34801561032c57600080fd5b506101e861033b366004613067565b61087d565b34801561034c57600080fd5b5061024b61035b366004613029565b610950565b34801561036c57600080fd5b5061024b61037b3660046130f5565b610a26565b34801561038c57600080fd5b5061024b61039b366004613199565b610b04565b3480156103ac57600080fd5b506101e86103bb366004613199565b610c74565b3480156103cc57600080fd5b5061021b6103db366004613199565b610cb1565b3480156103ec57600080fd5b5060015460ff1661021b565b34801561040457600080fd5b5061024b610cdb565b34801561041957600080fd5b5061024b610428366004613029565b610e59565b34801561043957600080fd5b5061024b610448366004613029565b610f2f565b61024b61045b36600461323a565b611102565b34801561046c57600080fd5b5061024b61047b366004613029565b6117f4565b34801561048c57600080fd5b5061024b61049b366004613029565b611928565b3480156104ac57600080fd5b506101e86104bb366004613067565b611a66565b3480156104cc57600080fd5b506104e06104db366004613067565b611af4565b6040516101f29594939291906132d9565b3480156104fd57600080fd5b5061051d61050c36600461338c565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016101f2565b34801561054257600080fd5b5060015461055b9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016101f2565b34801561057f57600080fd5b506101e8600d5481565b34801561059557600080fd5b506101e86301e1338081565b3480156105ad57600080fd5b5061024b6105bc366004613029565b611c83565b61024b6105cf36600461323a565b611e7a565b3480156105e057600080fd5b5061051d6105ef36600461343a565b63f23a6e6160e01b95945050505050565b34801561060c57600080fd5b5061024b61061b366004613067565b612617565b34801561062c57600080fd5b5061024b61063b366004613029565b612779565b60006001600160e01b03198216630271189760e51b148061067157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ee91906134a3565b90506001600160a01b03811633146107215760405162461bcd60e51b8152600401610718906134c0565b60405180910390fd5b81156107335761072f61284f565b5050565b61072f6128a3565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906134a3565b90506001600160a01b03811633146107dc5760405162461bcd60e51b8152600401610718906134c0565b60045482900361081f5760405162461bcd60e51b815260206004820152600e60248201526d73616d65206e667420707269636560901b6044820152606401610718565b600b5442106108405760405162461bcd60e51b8152600401610718906134f7565b60048290556040518281527f8f8e7bb3f81984853eca421991f89748d99432970e97ce8302d4dcb4ef622f60906020015b60405180910390a15050565b6001600160a01b0381166000908152600e60205260408120600b5460038201548391116108ae5781600301546108b2565b600b545b905060006002600a015442106108ca57600c546108cc565b425b9050818110156108e25750506002015492915050565b60006108ed86611a66565b905060006109336301e1338061092d6103e861092d60028001546109276002600301546109278a6109278e8e6128dc90919063ffffffff16565b906128ef565b906128fb565b60028601549091506109459082612907565b979650505050505050565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c791906134a3565b90506001600160a01b03811633146109f15760405162461bcd60e51b8152600401610718906134c0565b600a8290556040518281527f33b7e6b9d339eaf9a25c63f0f50034f98d77fca1a9d5e2f8ba525dd9764e8d0690602001610871565b60015461010090046001600160a01b03163314610a785760405162461bcd60e51b815260206004820152601060248201526f4f6e6c7920666f7220666163746f727960801b6044820152606401610718565b8051600280546001600160a01b039283166001600160a01b0319918216179091556020830151600380549184169183169190911790556040830151600455606083015160055560808301516006805491909316911617905560a081015160075560c081015160085560e0810151600955610100810151600a55610120810151600b556101400151600c55565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7b91906134a3565b90506001600160a01b0381163314610ba55760405162461bcd60e51b8152600401610718906134c0565b6001600160a01b038316610c55576006546040516000916001600160a01b03169084908381818185875af1925050503d8060008114610c00576040519150601f19603f3d011682016040523d82523d6000602084013e610c05565b606091505b5050905080610c4f5760405162461bcd60e51b81526020600482015260166024820152752330b4b632b2103a37903932b1b7bb32b91031b7b4b760511b6044820152606401610718565b50505050565b600654610c6f906001600160a01b03858116911684612913565b505050565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b6001600160a01b0382166000908152600e60205260408120610cd38184612965565b949350505050565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5291906134a3565b90506001600160a01b0381163314610d7c5760405162461bcd60e51b8152600401610718906134c0565b4780610dc15760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610718565b604051600090339083908381818185875af1925050503d8060008114610e03576040519150601f19603f3d011682016040523d82523d6000602084013e610e08565b606091505b5050905080610c6f5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f2077697468647261772062616c616e63650000000000006044820152606401610718565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed091906134a3565b90506001600160a01b0381163314610efa5760405162461bcd60e51b8152600401610718906134c0565b60098290556040518281527f68183e18818723d55c86c9cf5d031f098ba3799cdc8d50985a7e934214c377b290602001610871565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa691906134a3565b90506001600160a01b0381163314610fd05760405162461bcd60e51b8152600401610718906134c0565b600b5482101561102e5760405162461bcd60e51b815260206004820152602360248201527f456e6420626c6f636b206d75737420626520616674657220737461727420626c6044820152626f636b60e81b6064820152608401610718565b42821161108b5760405162461bcd60e51b815260206004820152602560248201527f456e6420626c6f636b206d7573742062652061667465722063757272656e7420604482015264626c6f636b60d81b6064820152608401610718565b600c5482036110cd5760405162461bcd60e51b815260206004820152600e60248201526d073616d652074696d657374616d760941b6044820152606401610718565b600c8290556040518281527f37d37b8940cc1ec723111799f54132501e05042cd219649e575e84e5c36f3b5e90602001610871565b61110a61297d565b805182511461114f5760405162461bcd60e51b8152602060048201526011602482015270496e76616c696420546f6b656e2069647360781b6044820152606401610718565b336000818152600e60205260408120916111689061087d565b905080156111c557600061117d335b836129d6565b905061118982826128dc565b600284015560405181815233907f121c5042302bae5fc561fbc64368f297ca60a880878e1e3a7f7e9380377260bf9060200160405180910390a2505b83516000811561121c5760005b8281101561121a576112068682815181106111ef576111ef61352e565b60200260200101518361290790919063ffffffff16565b9150806112128161355a565b9150506111d2565b505b60008111801561122d5750600a5415155b156114d457600a546112409082906128ef565b34101561128f5760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e7420776974686472617720666565000000000000006044820152606401610718565b600060018054906101000a90046001600160a01b03166001600160a01b03166349cf912c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113069190613573565b905060006113166103e8836128dc565b9050600060018054906101000a90046001600160a01b03166001600160a01b031663cec90ecc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561136b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138f91906134a3565b905082156114475760006001600160a01b0382166113b36103e861092d34886128ef565b604051600081818185875af1925050503d80600081146113ef576040519150601f19603f3d011682016040523d82523d6000602084013e6113f4565b606091505b50509050806114455760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e642066656520746f2061646d696e00000000006044820152606401610718565b505b81156114d0576006546000906001600160a01b031661146c6103e861092d34876128ef565b604051600081818185875af1925050503d80600081146114a8576040519150601f19603f3d011682016040523d82523d6000602084013e6114ad565b606091505b50509050806114ce5760405162461bcd60e51b81526004016107189061358c565b505b5050505b60005b828110156117dc57611502338883815181106114f5576114f561352e565b6020026020010151610cb1565b6115445760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610718565b60006115693389848151811061155c5761155c61352e565b6020026020010151610c74565b6000818152600f602052604090205490915080158015906115a357508783815181106115975761159761352e565b60200260200101518110155b6115ef5760405162461bcd60e51b815260206004820152601c60248201527f696e73756666696369656e7420776974686472617720616d6f756e74000000006044820152606401610718565b6002546001600160a01b031663f242432a30338c87815181106116145761161461352e565b60200260200101518c888151811061162e5761162e61352e565b60209081029190910101516040516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390921660248401526044830152606482015260a06084820152600860a482015267576974686472617760c01b60c482015260e401600060405180830381600087803b1580156116ac57600080fd5b505af11580156116c0573d6000803e3d6000fd5b505050508783815181106116d6576116d661352e565b60200260200101518103611715576117138984815181106116f9576116f961352e565b602002602001015188600001612bbe90919063ffffffff16565b505b8783815181106117275761172761352e565b60200260200101518161173a91906135d1565b6000838152600f6020526040902055336001600160a01b03167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc68a85815181106117865761178661352e565b60200260200101518a86815181106117a0576117a061352e565b60200260200101516040516117bf929190918252602082015260400190565b60405180910390a2505080806117d49061355a565b9150506114d7565b504284600301819055505050505061072f6001600055565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b91906134a3565b90506001600160a01b03811633146118955760405162461bcd60e51b8152600401610718906134c0565b6005548290036118d25760405162461bcd60e51b815260206004820152600860248201526739b0b6b29030b83960c11b6044820152606401610718565b600b5442106118f35760405162461bcd60e51b8152600401610718906134f7565b60058290556040518281527f16bc525116a7ec45cf36d84a97ab6b444a8c5264cc1a9468bfae78613156111590602001610871565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561197b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199f91906134a3565b90506001600160a01b03811633146119c95760405162461bcd60e51b8152600401610718906134c0565b600754829003611a105760405162461bcd60e51b815260206004820152601260248201527173616d65206d61785374616b65644e66747360701b6044820152606401610718565b600b544210611a315760405162461bcd60e51b8152600401610718906134f7565b60078290556040518281527fd20f1ee9eb88abbfa46114f52ec58f042909f2633256b00e7087b2f97bf6cc8d90602001610871565b6001600160a01b0381166000908152600e6020526040812081611a8882612bca565b905060008115610cd35760005b82811015611aeb576000611aa98583612bd4565b90506000611ab78883610c74565b6000818152600f6020526040902054909150611ad38582612907565b94505050508080611ae39061355a565b915050611a95565b50949350505050565b6001600160a01b0381166000908152600e602052604081206002810154600382015460609384939092919083611b2982612bca565b9050611b3488611a66565b945080600003611b5d576040805160008082526020820190815281830190925297509550611c78565b8067ffffffffffffffff811115611b7657611b76613084565b604051908082528060200260200182016040528015611b9f578160200160208202803683370190505b5096508067ffffffffffffffff811115611bbb57611bbb613084565b604051908082528060200260200182016040528015611be4578160200160208202803683370190505b50955060005b81811015611c76576000611bfe8483612bd4565b90506000611c0c8b83610c74565b6000818152600f60205260409020548b519192509083908c9086908110611c3557611c3561352e565b602002602001018181525050808a8581518110611c5457611c5461352e565b6020026020010181815250505050508080611c6e9061355a565b915050611bea565b505b505091939590929450565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfa91906134a3565b90506001600160a01b0381163314611d245760405162461bcd60e51b8152600401610718906134c0565b600c54821115611d825760405162461bcd60e51b815260206004820152602360248201527f537461727420626c6f636b206d757374206265206265666f726520656e642074604482015262696d6560e81b6064820152608401610718565b428211611de15760405162461bcd60e51b815260206004820152602760248201527f537461727420626c6f636b206d7573742062652061667465722063757272656e6044820152667420626c6f636b60c81b6064820152608401610718565b600b544210611e025760405162461bcd60e51b8152600401610718906134f7565b600b54829003611e455760405162461bcd60e51b815260206004820152600e60248201526d073616d652074696d657374616d760941b6044820152606401610718565b600b8290556040518281527f9c5b354b21055675b708256fbf890975529c5e58066b2e826541d253b389cd1490602001610871565b611e8261297d565b611e8a612be0565b6002546001600160a01b031663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015611ee6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0a91906135e4565b611f605760405162461bcd60e51b815260206004820152602160248201527f4e6f7420617070726f7665206e667420746f207374616b6572206164647265736044820152607360f81b6064820152608401610718565b8051825114611fa55760405162461bcd60e51b8152602060048201526011602482015270496e76616c696420546f6b656e2069647360781b6044820152606401610718565b815160008115611fe55760005b82811015611fe357611fcf8482815181106111ef576111ef61352e565b915080611fdb8161355a565b915050611fb2565b505b336000818152600e6020526040812091611ffe90611a66565b60085490915061200e8285612907565b111561205c5760405162461bcd60e51b815260206004820152601e60248201527f4578636565647320746865206d6178206c696d697420706572207573657200006044820152606401610718565b600754600d5461206c9085612907565b11156120b25760405162461bcd60e51b8152602060048201526015602482015274115e18d959591cc81d1a19481b585e081b1a5b5a5d605a1b6044820152606401610718565b60006120bd3361087d565b905080156121185760006120d033611177565b90506120dc82826128dc565b600285015560405181815233907f121c5042302bae5fc561fbc64368f297ca60a880878e1e3a7f7e9380377260bf9060200160405180910390a2505b600084118015612129575060095415155b156123d05760095461213c9085906128ef565b34101561218b5760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e74206465706f7369742066656500000000000000006044820152606401610718565b600060018054906101000a90046001600160a01b03166001600160a01b03166349cf912c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156121de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122029190613573565b905060006122126103e8836128dc565b9050600060018054906101000a90046001600160a01b03166001600160a01b031663cec90ecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228b91906134a3565b905082156123435760006001600160a01b0382166122af6103e861092d34886128ef565b604051600081818185875af1925050503d80600081146122eb576040519150601f19603f3d011682016040523d82523d6000602084013e6122f0565b606091505b50509050806123415760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e642066656520746f2061646d696e00000000006044820152606401610718565b505b81156123cc576006546000906001600160a01b03166123686103e861092d34876128ef565b604051600081818185875af1925050503d80600081146123a4576040519150601f19603f3d011682016040523d82523d6000602084013e6123a9565b606091505b50509050806123ca5760405162461bcd60e51b81526004016107189061358c565b505b5050505b60005b858110156125f0576002546001600160a01b031663f242432a33308b85815181106124005761240061352e565b60200260200101518b868151811061241a5761241a61352e565b60209081029190910101516040516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390921660248401526044830152606482015260a06084820152600560a4820152647374616b6560d81b60c482015260e401600060405180830381600087803b15801561249557600080fd5b505af11580156124a9573d6000803e3d6000fd5b505050506124c96124b73390565b8983815181106114f5576114f561352e565b6124fe576124fc8882815181106124e2576124e261352e565b602002602001015185600001612c2890919063ffffffff16565b505b6000612516338a848151811061155c5761155c61352e565b905087828151811061252a5761252a61352e565b6020026020010151600f6000838152602001908152602001600020546125509190613601565b6000828152600f6020526040902055336001600160a01b03167f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee908a848151811061259c5761259c61352e565b60200260200101518a85815181106125b6576125b661352e565b60200260200101516040516125d5929190918252602082015260400190565b60405180910390a250806125e88161355a565b9150506123d3565b50600d546125fe9085612907565b600d555050426003909101555061072f90506001600055565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561266a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061268e91906134a3565b90506001600160a01b03811633146126b85760405162461bcd60e51b8152600401610718906134c0565b6003546001600160a01b0380841691160361270a5760405162461bcd60e51b815260206004820152601260248201527173616d6520746f6b656e206164647265737360701b6044820152606401610718565b600b54421061272b5760405162461bcd60e51b8152600401610718906134f7565b600380546001600160a01b0319166001600160a01b0384169081179091556040519081527fa5289ba11778999f4dfb9415023783188d42bbb5db0612cbfbe55999069612a090602001610871565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f091906134a3565b90506001600160a01b038116331461281a5760405162461bcd60e51b8152600401610718906134c0565b60088290556040518281527fa9ae1657e9c98d6cda0b021c88ffa02a03d5de8531d8fc75ed6d098c40930f8b90602001610871565b612857612be0565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b6128ab612c34565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612886565b60006128e882846135d1565b9392505050565b60006128e88284613614565b60006128e8828461362b565b60006128e88284613601565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c6f908490612c7d565b600081815260018301602052604081205415156128e8565b6002600054036129cf5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610718565b6002600055565b60006001600160a01b038316612a255760405162461bcd60e51b8152602060048201526014602482015273496e76616c6964206e756c6c206164647265737360601b6044820152606401610718565b6003546001600160a01b0316612b095747821580612a41575080155b15612a50576000915050610671565b80831115612a5c578092505b6000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114612aa9576040519150601f19603f3d011682016040523d82523d6000602084013e612aae565b606091505b5050905080612aff5760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f207472616e7366657220636f696e0000000000000000006044820152606401610718565b8392505050610671565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612b52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b769190613573565b9050821580612b83575080155b15612b92576000915050610671565b80831115612b9e578092505b600354612bb5906001600160a01b03168585612913565b82915050610671565b60006128e88383612d52565b6000610671825490565b60006128e88383612e45565b60015460ff1615612c265760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610718565b565b60006128e88383612e6f565b60015460ff16612c265760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610718565b6000612cd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ebe9092919063ffffffff16565b9050805160001480612cf3575080806020019051810190612cf391906135e4565b610c6f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610718565b60008181526001830160205260408120548015612e3b576000612d766001836135d1565b8554909150600090612d8a906001906135d1565b9050818114612def576000866000018281548110612daa57612daa61352e565b9060005260206000200154905080876000018481548110612dcd57612dcd61352e565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612e0057612e0061364d565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610671565b6000915050610671565b6000826000018281548110612e5c57612e5c61352e565b9060005260206000200154905092915050565b6000818152600183016020526040812054612eb657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610671565b506000610671565b6060610cd3848460008585600080866001600160a01b03168587604051612ee59190613687565b60006040518083038185875af1925050503d8060008114612f22576040519150601f19603f3d011682016040523d82523d6000602084013e612f27565b606091505b50915091506109458783838760608315612fa2578251600003612f9b576001600160a01b0385163b612f9b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610718565b5081610cd3565b610cd38383815115612fb75781518083602001fd5b8060405162461bcd60e51b815260040161071891906136a3565b600060208284031215612fe357600080fd5b81356001600160e01b0319811681146128e857600080fd5b801515811461300957600080fd5b50565b60006020828403121561301e57600080fd5b81356128e881612ffb565b60006020828403121561303b57600080fd5b5035919050565b6001600160a01b038116811461300957600080fd5b803561306281613042565b919050565b60006020828403121561307957600080fd5b81356128e881613042565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff811182821017156130be576130be613084565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156130ed576130ed613084565b604052919050565b6000610160828403121561310857600080fd5b61311061309a565b61311983613057565b815261312760208401613057565b6020820152604083013560408201526060830135606082015261314c60808401613057565b608082015260a0838101359082015260c0808401359082015260e0808401359082015261010080840135908201526101208084013590820152610140928301359281019290925250919050565b600080604083850312156131ac57600080fd5b82356131b781613042565b946020939093013593505050565b600082601f8301126131d657600080fd5b8135602067ffffffffffffffff8211156131f2576131f2613084565b8160051b6132018282016130c4565b928352848101820192828101908785111561321b57600080fd5b83870192505b8483101561094557823582529183019190830190613221565b6000806040838503121561324d57600080fd5b823567ffffffffffffffff8082111561326557600080fd5b613271868387016131c5565b9350602085013591508082111561328757600080fd5b50613294858286016131c5565b9150509250929050565b600081518084526020808501945080840160005b838110156132ce578151875295820195908201906001016132b2565b509495945050505050565b60a0815260006132ec60a083018861329e565b82810360208401526132fe818861329e565b60408401969096525050606081019290925260809091015292915050565b600082601f83011261332d57600080fd5b813567ffffffffffffffff81111561334757613347613084565b61335a601f8201601f19166020016130c4565b81815284602083860101111561336f57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156133a457600080fd5b85356133af81613042565b945060208601356133bf81613042565b9350604086013567ffffffffffffffff808211156133dc57600080fd5b6133e889838a016131c5565b945060608801359150808211156133fe57600080fd5b61340a89838a016131c5565b9350608088013591508082111561342057600080fd5b5061342d8882890161331c565b9150509295509295909350565b600080600080600060a0868803121561345257600080fd5b853561345d81613042565b9450602086013561346d81613042565b93506040860135925060608601359150608086013567ffffffffffffffff81111561349757600080fd5b61342d8882890161331c565b6000602082840312156134b557600080fd5b81516128e881613042565b6020808252601f908201527f63616c6c6572206973206e6f742074686520666163746f7279206f776e657200604082015260600190565b60208082526017908201527f5374616b696e67207374617274656420616c7265616479000000000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161356c5761356c613544565b5060010190565b60006020828403121561358557600080fd5b5051919050565b60208082526025908201527f4661696c656420746f2073656e642066656520746f207374616b696e6720637260408201526432b0ba37b960d91b606082015260800190565b8181038181111561067157610671613544565b6000602082840312156135f657600080fd5b81516128e881612ffb565b8082018082111561067157610671613544565b808202811582820484141761067157610671613544565b60008261364857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603160045260246000fd5b60005b8381101561367e578181015183820152602001613666565b50506000910152565b60008251613699818460208701613663565b9190910192915050565b60208152600082518060208401526136c2816040850160208701613663565b601f01601f1916919091016040019291505056fea264697066735822122043c195954376a81b8e3f2c40fe9b9d60094b6bf50885c095d625e52127f1c11264736f6c63430008110033a26469706673582212204bbc63b6745e56ce3dee7ed15453625092061d0e12f08c740f7966df2288b6fa64736f6c63430008110033

Deployed ByteCode

0x6080604052600436106101d05760003560e01c8063873c4940116100f7578063cec90ecc11610095578063f2fde38b11610064578063f2fde38b146104eb578063f353048b1461050b578063f802a9ea1461052b578063ff0958b21461054b57600080fd5b8063cec90ecc14610475578063d1ff960514610493578063d8b9130f146104b3578063ed48083b146104cb57600080fd5b8063afef0426116100d1578063afef0426146103f5578063c4d66de814610415578063c4f0c1fc14610435578063c8f09e291461045557600080fd5b8063873c4940146103975780638da5cb5b146103c25780639dcd2b92146103e057600080fd5b806349cf912c1161016f5780636727ad201161013e5780636727ad201461032d5780636cf270aa1461034d578063715018a6146103625780637a49244d1461037757600080fd5b806349cf912c146102b457806355b2276f146102c95780636220aea8146102eb578063637872851461030057600080fd5b8063173b6d90116101ab578063173b6d90146102475780632ad1d1761461025c5780633b2af31b1461027e578063415c5bfa1461029e57600080fd5b80624fcec4146101dc57806301c234a81461020f57806304879db21461022557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611807565b610560565b6040519081526020015b60405180910390f35b34801561021b57600080fd5b506101fc6103e881565b34801561023157600080fd5b50610245610240366004611807565b610573565b005b34801561025357600080fd5b506101fc610611565b34801561026857600080fd5b50610271610622565b6040516102069190611820565b34801561028a57600080fd5b50610245610299366004611907565b6106c1565b3480156102aa57600080fd5b506101fc606a5481565b3480156102c057600080fd5b506067546101fc565b3480156102d557600080fd5b506102de610790565b60405161020691906119d7565b3480156102f757600080fd5b50610245610942565b34801561030c57600080fd5b5061032061031b366004611807565b610a2b565b6040516102069190611a39565b34801561033957600080fd5b50610245610348366004611807565b610b43565b34801561035957600080fd5b506069546101fc565b34801561036e57600080fd5b50610245610b50565b34801561038357600080fd5b506101fc610392366004611807565b610b64565b6103aa6103a5366004611a68565b610b71565b6040516001600160a01b039091168152602001610206565b3480156103ce57600080fd5b506033546001600160a01b03166103aa565b3480156103ec57600080fd5b506068546101fc565b34801561040157600080fd5b50610245610410366004611ad3565b6111a2565b34801561042157600080fd5b50610245610430366004611ad3565b6111cc565b34801561044157600080fd5b506103aa610450366004611807565b611314565b34801561046157600080fd5b50610245610470366004611807565b61133e565b34801561048157600080fd5b506066546001600160a01b03166103aa565b34801561049f57600080fd5b506102456104ae366004611807565b611392565b3480156104bf57600080fd5b506101fc6301e1338081565b3480156104d757600080fd5b506102456104e6366004611aee565b61139f565b3480156104f757600080fd5b50610245610506366004611ad3565b611450565b34801561051757600080fd5b50610245610526366004611807565b6114c9565b34801561053757600080fd5b50610245610546366004611807565b6114dc565b34801561055757600080fd5b506101fc6114e9565b600061056d606e836114f5565b92915050565b61057b611508565b6000818152606b602052604090206004015460ff166105b55760405162461bcd60e51b81526004016105ac90611b45565b60405180910390fd5b6000818152606b60205260409020600401805460ff191690556105d9606c82611562565b506040518181527ff026990ac214e8c38e9e15f423e64f03b3c43241b4800b22a9dffa5f7c7d6071906020015b60405180910390a150565b600061061d606c61156e565b905090565b60606000610630606e61156e565b90508067ffffffffffffffff81111561064b5761064b611864565b604051908082528060200260200182016040528015610674578160200160208202803683370190505b50915060005b818110156106bc5761068d606e826114f5565b83828151811061069f5761069f611b68565b6020908102919091010152806106b481611b94565b91505061067a565b505090565b6106c9611508565b606a546106d7906001611578565b606a8190556000818152606b602052604090209081556001016106fa8482611c36565b50606a80546000908152606b602052604080822060020185905582548252808220600301849055825482529020600401805460ff191660011790555461074290606c90611584565b50606a546000908152606b60205260409081902090517f7a76d3ac89e8fd384694d4946fd5c54929e21711e87a91f77b157c06e7714cbf9161078391611db2565b60405180910390a1505050565b6060600061079c610611565b90508067ffffffffffffffff8111156107b7576107b7611864565b60405190808252806020026020018201604052801561081c57816020015b6108096040518060a00160405280600081526020016060815260200160008152602001600081526020016000151581525090565b8152602001906001900390816107d55790505b50915060005b818110156106bc57606b600061083783610b64565b81526020019081526020016000206040518060a00160405290816000820154815260200160018201805461086a90611bad565b80601f016020809104026020016040519081016040528092919081815260200182805461089690611bad565b80156108e35780601f106108b8576101008083540402835291602001916108e3565b820191906000526020600020905b8154815290600101906020018083116108c657829003601f168201915b5050509183525050600282015460208201526003820154604082015260049091015460ff161515606090910152835184908390811061092457610924611b68565b6020026020010181905250808061093a90611b94565b915050610822565b61094a611508565b478061098f5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016105ac565b604051600090339083908381818185875af1925050503d80600081146109d1576040519150601f19603f3d011682016040523d82523d6000602084013e6109d6565b606091505b5050905080610a275760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f2077697468647261772062616c616e636500000000000060448201526064016105ac565b5050565b610a5f6040518060a00160405280600081526020016060815260200160008152602001600081526020016000151581525090565b606b60008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610a9790611bad565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac390611bad565b8015610b105780601f10610ae557610100808354040283529160200191610b10565b820191906000526020600020905b815481529060010190602001808311610af357829003601f168201915b5050509183525050600282015460208201526003820154604082015260049091015460ff16151560609091015292915050565b610b4b611508565b606855565b610b58611508565b610b626000611590565b565b600061056d606c836114f5565b6000878152606b602052604081206004015460ff16610ba25760405162461bcd60e51b81526004016105ac90611b45565b6000888152606b6020526040812090610bbc606e8a6114f5565b90506000610bd783600201548d61157890919063ffffffff16565b606654600385015460405192935034926000926001600160a01b031691908381818185875af1925050503d8060008114610c2d576040519150601f19603f3d011682016040523d82523d6000602084013e610c32565b606091505b5050905080610c945760405162461bcd60e51b815260206004820152602860248201527f4661696c656420746f2073656e6420737562736372697074696f6e20666565206044820152673a379030b236b4b760c11b60648201526084016105ac565b50600060405180602001610ca7906117fa565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff1960608e811b821660208401528d901b166034820152426048820152909150600090606801604051602081830303815290604052805190602001209050808251602084016000f5965050506000610d2689898688600201546115e2565b90506001600160a01b038a16610e49576003850154610d459082611578565b821015610d8b5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016105ac565b6000866001600160a01b03168260405160006040518083038185875af1925050503d8060008114610dd8576040519150601f19603f3d011682016040523d82523d6000602084013e610ddd565b606091505b5050905080610e435760405162461bcd60e51b815260206004820152602c60248201527f4661696c656420746f2073656e64206465706f73697420416d6f756e7420666560448201526b6520746f207374616b696e6760a01b60648201526084016105ac565b50610f84565b6040516323b872dd60e01b8152336004820152306024820152604481018290528a906001600160a01b038216906323b872dd906064016020604051808303816000875af1158015610e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec29190611dc5565b610f0e5760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420746f6b656e2062616c616e636500000000000060448201526064016105ac565b60405163a9059cbb60e01b81526001600160a01b0388811660048301526024820184905282169063a9059cbb906044016020604051808303816000875af1158015610f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f819190611dc5565b50505b50610ffd60405180610160016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b8a81600001906001600160a01b031690816001600160a01b0316815250508981602001906001600160a01b031690816001600160a01b03168152505088816040018181525050838160600181815250503381608001906001600160a01b031690816001600160a01b031681525050878160a0018181525050868160c00181815250506068548160e0018181525050606954816101000181815250508d816101200181815250508281610140018181525050856001600160a01b031663324c3617826040518263ffffffff1660e01b81526004016110da9190611e7e565b600060405180830381600087803b1580156110f457600080fd5b505af1158015611108573d6000803e3d6000fd5b5050606580546001810182556000919091527f8ff97419363ffd7000167f130ef7168fbea05faf9251824ca5043f113cc6a7c70180546001600160a01b0319166001600160a01b038a1617905550506040517f7cf21bbd6f8485b673b03a3fef10dc82c9812c5061aeb28ea8b7a9e1d29b2a52906111899088908490611e8d565b60405180910390a1505050505098975050505050505050565b6111aa611508565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff16158080156111ec5750600054600160ff909116105b806112065750303b158015611206575060005460ff166001145b6112695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ac565b6000805460ff19166001179055801561128c576000805461ff0019166101001790555b611294611617565b606680546001600160a01b0319166001600160a01b038416179055601560675568056bc75e2d6310000060688190556069556000606a558015610a27576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6065818154811061132457600080fd5b6000918252602090912001546001600160a01b0316905081565b611346611508565b611351606e82611584565b50606a546000908152606b60205260409081902090517f7a76d3ac89e8fd384694d4946fd5c54929e21711e87a91f77b157c06e7714cbf9161060691611db2565b61139a611508565b606755565b6113a7611508565b6000848152606b602052604090206004015460ff166113d85760405162461bcd60e51b81526004016105ac90611b45565b6000848152606b602052604090206001016113f38482611c36565b506000848152606b602052604090819020600281018490556003810183905590517f768a683652170c01995eedf6ad541a610761fd51c403ac938dbb233831c44eca9161144291879190611eab565b60405180910390a150505050565b611458611508565b6001600160a01b0381166114bd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ac565b6114c681611590565b50565b6114d1611508565b6105d9606e82611562565b6114e4611508565b606955565b600061061d606e61156e565b60006115018383611646565b9392505050565b6033546001600160a01b03163314610b625760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105ac565b60006115018383611670565b600061056d825490565b60006115018284611ecc565b60006115018383611763565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008061160d6103e86116076301e1338081876116018a818e8e6117b2565b906117b2565b906117be565b9695505050505050565b600054610100900460ff1661163e5760405162461bcd60e51b81526004016105ac90611edf565b610b626117ca565b600082600001828154811061165d5761165d611b68565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611759576000611694600183611f2a565b85549091506000906116a890600190611f2a565b905081811461170d5760008660000182815481106116c8576116c8611b68565b90600052602060002001549050808760000184815481106116eb576116eb611b68565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061171e5761171e611f3d565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061056d565b600091505061056d565b60008181526001830160205260408120546117aa5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561056d565b50600061056d565b60006115018284611f53565b60006115018284611f6a565b600054610100900460ff166117f15760405162461bcd60e51b81526004016105ac90611edf565b610b6233611590565b61374980611f8d83390190565b60006020828403121561181957600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156118585783518352928401929184019160010161183c565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261188b57600080fd5b813567ffffffffffffffff808211156118a6576118a6611864565b604051601f8301601f19908116603f011681019082821181831017156118ce576118ce611864565b816040528381528660208588010111156118e757600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561191c57600080fd5b833567ffffffffffffffff81111561193357600080fd5b61193f8682870161187a565b9660208601359650604090950135949350505050565b80518252600060208083015160a08286015280518060a087015260005b8181101561198e5782810184015187820160c001528301611972565b50600060c082880101526040850151604087015260608501516060870152608085015192506119c1608087018415159052565b601f01601f19169490940160c001949350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611a2c57603f19888603018452611a1a858351611955565b945092850192908501906001016119fe565b5092979650505050505050565b6020815260006115016020830184611955565b80356001600160a01b0381168114611a6357600080fd5b919050565b600080600080600080600080610100898b031215611a8557600080fd5b883597506020890135965060408901359550611aa360608a01611a4c565b9450611ab160808a01611a4c565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208284031215611ae557600080fd5b61150182611a4c565b60008060008060808587031215611b0457600080fd5b84359350602085013567ffffffffffffffff811115611b2257600080fd5b611b2e8782880161187a565b949794965050505060408301359260600135919050565b6020808252600990820152681b9bdd08195e1a5cdd60ba1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ba657611ba6611b7e565b5060010190565b600181811c90821680611bc157607f821691505b602082108103611be157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115611c3157600081815260208120601f850160051c81016020861015611c0e5750805b601f850160051c820191505b81811015611c2d57828155600101611c1a565b5050505b505050565b815167ffffffffffffffff811115611c5057611c50611864565b611c6481611c5e8454611bad565b84611be7565b602080601f831160018114611c995760008415611c815750858301515b600019600386901b1c1916600185901b178555611c2d565b600085815260208120601f198616915b82811015611cc857888601518255948401946001909101908401611ca9565b5085821015611ce65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8054825260006001808301602060a08187015260008254611d1681611bad565b8060a08a015260c086831660008114611d365760018114611d5057611d7e565b60ff1984168b83015282151560051b8b0182019450611d7e565b866000528560002060005b84811015611d765781548d8201850152908901908701611d5b565b8c0183019550505b505050506002860154604088015260038601546060880152600486015460ff16801515608089015293509695505050505050565b6020815260006115016020830184611cf6565b600060208284031215611dd757600080fd5b8151801515811461150157600080fd5b80516001600160a01b031682526020810151611e0e60208401826001600160a01b03169052565b5060408101516040830152606081015160608301526080810151611e3d60808401826001600160a01b03169052565b5060a0818101519083015260c0808201519083015260e080820151908301526101008082015190830152610120808201519083015261014090810151910152565b610160810161056d8284611de7565b6001600160a01b038316815261018081016115016020830184611de7565b828152604060208201526000611ec46040830184611cf6565b949350505050565b8082018082111561056d5761056d611b7e565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8181038181111561056d5761056d611b7e565b634e487b7160e01b600052603160045260246000fd5b808202811582820484141761056d5761056d611b7e565b600082611f8757634e487b7160e01b600052601260045260246000fd5b50049056fe608060405234801561001057600080fd5b5060016000819055805433610100026001600160a81b031990911617905561370c8061003d6000396000f3fe6080604052600436106101c65760003560e01c80636e1613fb116100f7578063c45a015511610095578063e683ad4411610064578063e683ad44146105c1578063f23a6e61146105d4578063fd1a239714610600578063fed287ad1461062057600080fd5b8063c45a015514610536578063c87dee1414610573578063d8b9130f14610589578063e67151ae146105a157600080fd5b806387d55ff2116100d157806387d55ff2146104805780638cd1b2ef146104a0578063a37d9850146104c0578063bc197c81146104f157600080fd5b80636e1613fb1461042d57806381c197ed1461044d5780638552bf901461046057600080fd5b8063324c3617116101645780635451da1b1161013e5780635451da1b146103c05780635c975abb146103e05780636220aea8146103f857806364d8c0dd1461040d57600080fd5b8063324c3617146103605780633f138d4b146103805780634c5d23c0146103a057600080fd5b806308dec7a0116101a057806308dec7a01461024d5780631dd113a71461026d57806331d7a2621461032057806332290ed81461034057600080fd5b806301c234a8146101d257806301ffc9a7146101fb57806302329a291461022b57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101e86103e881565b6040519081526020015b60405180910390f35b34801561020757600080fd5b5061021b610216366004612fd1565b610640565b60405190151581526020016101f2565b34801561023757600080fd5b5061024b61024636600461300c565b610677565b005b34801561025957600080fd5b5061024b610268366004613029565b61073b565b34801561027957600080fd5b50600254600354600454600554600654600754600854600954600a54600b54600c546102ba9a6001600160a01b039081169a8116999897169594939291908b565b604080516001600160a01b039c8d1681529a8c1660208c01528a0198909852606089019690965297909316608087015260a086019190915260c085015260e0840152610100830193909352610120820192909252610140810191909152610160016101f2565b34801561032c57600080fd5b506101e861033b366004613067565b61087d565b34801561034c57600080fd5b5061024b61035b366004613029565b610950565b34801561036c57600080fd5b5061024b61037b3660046130f5565b610a26565b34801561038c57600080fd5b5061024b61039b366004613199565b610b04565b3480156103ac57600080fd5b506101e86103bb366004613199565b610c74565b3480156103cc57600080fd5b5061021b6103db366004613199565b610cb1565b3480156103ec57600080fd5b5060015460ff1661021b565b34801561040457600080fd5b5061024b610cdb565b34801561041957600080fd5b5061024b610428366004613029565b610e59565b34801561043957600080fd5b5061024b610448366004613029565b610f2f565b61024b61045b36600461323a565b611102565b34801561046c57600080fd5b5061024b61047b366004613029565b6117f4565b34801561048c57600080fd5b5061024b61049b366004613029565b611928565b3480156104ac57600080fd5b506101e86104bb366004613067565b611a66565b3480156104cc57600080fd5b506104e06104db366004613067565b611af4565b6040516101f29594939291906132d9565b3480156104fd57600080fd5b5061051d61050c36600461338c565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016101f2565b34801561054257600080fd5b5060015461055b9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016101f2565b34801561057f57600080fd5b506101e8600d5481565b34801561059557600080fd5b506101e86301e1338081565b3480156105ad57600080fd5b5061024b6105bc366004613029565b611c83565b61024b6105cf36600461323a565b611e7a565b3480156105e057600080fd5b5061051d6105ef36600461343a565b63f23a6e6160e01b95945050505050565b34801561060c57600080fd5b5061024b61061b366004613067565b612617565b34801561062c57600080fd5b5061024b61063b366004613029565b612779565b60006001600160e01b03198216630271189760e51b148061067157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ee91906134a3565b90506001600160a01b03811633146107215760405162461bcd60e51b8152600401610718906134c0565b60405180910390fd5b81156107335761072f61284f565b5050565b61072f6128a3565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906134a3565b90506001600160a01b03811633146107dc5760405162461bcd60e51b8152600401610718906134c0565b60045482900361081f5760405162461bcd60e51b815260206004820152600e60248201526d73616d65206e667420707269636560901b6044820152606401610718565b600b5442106108405760405162461bcd60e51b8152600401610718906134f7565b60048290556040518281527f8f8e7bb3f81984853eca421991f89748d99432970e97ce8302d4dcb4ef622f60906020015b60405180910390a15050565b6001600160a01b0381166000908152600e60205260408120600b5460038201548391116108ae5781600301546108b2565b600b545b905060006002600a015442106108ca57600c546108cc565b425b9050818110156108e25750506002015492915050565b60006108ed86611a66565b905060006109336301e1338061092d6103e861092d60028001546109276002600301546109278a6109278e8e6128dc90919063ffffffff16565b906128ef565b906128fb565b60028601549091506109459082612907565b979650505050505050565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c791906134a3565b90506001600160a01b03811633146109f15760405162461bcd60e51b8152600401610718906134c0565b600a8290556040518281527f33b7e6b9d339eaf9a25c63f0f50034f98d77fca1a9d5e2f8ba525dd9764e8d0690602001610871565b60015461010090046001600160a01b03163314610a785760405162461bcd60e51b815260206004820152601060248201526f4f6e6c7920666f7220666163746f727960801b6044820152606401610718565b8051600280546001600160a01b039283166001600160a01b0319918216179091556020830151600380549184169183169190911790556040830151600455606083015160055560808301516006805491909316911617905560a081015160075560c081015160085560e0810151600955610100810151600a55610120810151600b556101400151600c55565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7b91906134a3565b90506001600160a01b0381163314610ba55760405162461bcd60e51b8152600401610718906134c0565b6001600160a01b038316610c55576006546040516000916001600160a01b03169084908381818185875af1925050503d8060008114610c00576040519150601f19603f3d011682016040523d82523d6000602084013e610c05565b606091505b5050905080610c4f5760405162461bcd60e51b81526020600482015260166024820152752330b4b632b2103a37903932b1b7bb32b91031b7b4b760511b6044820152606401610718565b50505050565b600654610c6f906001600160a01b03858116911684612913565b505050565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b6001600160a01b0382166000908152600e60205260408120610cd38184612965565b949350505050565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5291906134a3565b90506001600160a01b0381163314610d7c5760405162461bcd60e51b8152600401610718906134c0565b4780610dc15760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610718565b604051600090339083908381818185875af1925050503d8060008114610e03576040519150601f19603f3d011682016040523d82523d6000602084013e610e08565b606091505b5050905080610c6f5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f2077697468647261772062616c616e63650000000000006044820152606401610718565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed091906134a3565b90506001600160a01b0381163314610efa5760405162461bcd60e51b8152600401610718906134c0565b60098290556040518281527f68183e18818723d55c86c9cf5d031f098ba3799cdc8d50985a7e934214c377b290602001610871565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa691906134a3565b90506001600160a01b0381163314610fd05760405162461bcd60e51b8152600401610718906134c0565b600b5482101561102e5760405162461bcd60e51b815260206004820152602360248201527f456e6420626c6f636b206d75737420626520616674657220737461727420626c6044820152626f636b60e81b6064820152608401610718565b42821161108b5760405162461bcd60e51b815260206004820152602560248201527f456e6420626c6f636b206d7573742062652061667465722063757272656e7420604482015264626c6f636b60d81b6064820152608401610718565b600c5482036110cd5760405162461bcd60e51b815260206004820152600e60248201526d073616d652074696d657374616d760941b6044820152606401610718565b600c8290556040518281527f37d37b8940cc1ec723111799f54132501e05042cd219649e575e84e5c36f3b5e90602001610871565b61110a61297d565b805182511461114f5760405162461bcd60e51b8152602060048201526011602482015270496e76616c696420546f6b656e2069647360781b6044820152606401610718565b336000818152600e60205260408120916111689061087d565b905080156111c557600061117d335b836129d6565b905061118982826128dc565b600284015560405181815233907f121c5042302bae5fc561fbc64368f297ca60a880878e1e3a7f7e9380377260bf9060200160405180910390a2505b83516000811561121c5760005b8281101561121a576112068682815181106111ef576111ef61352e565b60200260200101518361290790919063ffffffff16565b9150806112128161355a565b9150506111d2565b505b60008111801561122d5750600a5415155b156114d457600a546112409082906128ef565b34101561128f5760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e7420776974686472617720666565000000000000006044820152606401610718565b600060018054906101000a90046001600160a01b03166001600160a01b03166349cf912c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113069190613573565b905060006113166103e8836128dc565b9050600060018054906101000a90046001600160a01b03166001600160a01b031663cec90ecc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561136b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138f91906134a3565b905082156114475760006001600160a01b0382166113b36103e861092d34886128ef565b604051600081818185875af1925050503d80600081146113ef576040519150601f19603f3d011682016040523d82523d6000602084013e6113f4565b606091505b50509050806114455760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e642066656520746f2061646d696e00000000006044820152606401610718565b505b81156114d0576006546000906001600160a01b031661146c6103e861092d34876128ef565b604051600081818185875af1925050503d80600081146114a8576040519150601f19603f3d011682016040523d82523d6000602084013e6114ad565b606091505b50509050806114ce5760405162461bcd60e51b81526004016107189061358c565b505b5050505b60005b828110156117dc57611502338883815181106114f5576114f561352e565b6020026020010151610cb1565b6115445760405162461bcd60e51b8152602060048201526013602482015272139bdd081cdd185ad959081d1a1a5cc81b999d606a1b6044820152606401610718565b60006115693389848151811061155c5761155c61352e565b6020026020010151610c74565b6000818152600f602052604090205490915080158015906115a357508783815181106115975761159761352e565b60200260200101518110155b6115ef5760405162461bcd60e51b815260206004820152601c60248201527f696e73756666696369656e7420776974686472617720616d6f756e74000000006044820152606401610718565b6002546001600160a01b031663f242432a30338c87815181106116145761161461352e565b60200260200101518c888151811061162e5761162e61352e565b60209081029190910101516040516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390921660248401526044830152606482015260a06084820152600860a482015267576974686472617760c01b60c482015260e401600060405180830381600087803b1580156116ac57600080fd5b505af11580156116c0573d6000803e3d6000fd5b505050508783815181106116d6576116d661352e565b60200260200101518103611715576117138984815181106116f9576116f961352e565b602002602001015188600001612bbe90919063ffffffff16565b505b8783815181106117275761172761352e565b60200260200101518161173a91906135d1565b6000838152600f6020526040902055336001600160a01b03167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc68a85815181106117865761178661352e565b60200260200101518a86815181106117a0576117a061352e565b60200260200101516040516117bf929190918252602082015260400190565b60405180910390a2505080806117d49061355a565b9150506114d7565b504284600301819055505050505061072f6001600055565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b91906134a3565b90506001600160a01b03811633146118955760405162461bcd60e51b8152600401610718906134c0565b6005548290036118d25760405162461bcd60e51b815260206004820152600860248201526739b0b6b29030b83960c11b6044820152606401610718565b600b5442106118f35760405162461bcd60e51b8152600401610718906134f7565b60058290556040518281527f16bc525116a7ec45cf36d84a97ab6b444a8c5264cc1a9468bfae78613156111590602001610871565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561197b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199f91906134a3565b90506001600160a01b03811633146119c95760405162461bcd60e51b8152600401610718906134c0565b600754829003611a105760405162461bcd60e51b815260206004820152601260248201527173616d65206d61785374616b65644e66747360701b6044820152606401610718565b600b544210611a315760405162461bcd60e51b8152600401610718906134f7565b60078290556040518281527fd20f1ee9eb88abbfa46114f52ec58f042909f2633256b00e7087b2f97bf6cc8d90602001610871565b6001600160a01b0381166000908152600e6020526040812081611a8882612bca565b905060008115610cd35760005b82811015611aeb576000611aa98583612bd4565b90506000611ab78883610c74565b6000818152600f6020526040902054909150611ad38582612907565b94505050508080611ae39061355a565b915050611a95565b50949350505050565b6001600160a01b0381166000908152600e602052604081206002810154600382015460609384939092919083611b2982612bca565b9050611b3488611a66565b945080600003611b5d576040805160008082526020820190815281830190925297509550611c78565b8067ffffffffffffffff811115611b7657611b76613084565b604051908082528060200260200182016040528015611b9f578160200160208202803683370190505b5096508067ffffffffffffffff811115611bbb57611bbb613084565b604051908082528060200260200182016040528015611be4578160200160208202803683370190505b50955060005b81811015611c76576000611bfe8483612bd4565b90506000611c0c8b83610c74565b6000818152600f60205260409020548b519192509083908c9086908110611c3557611c3561352e565b602002602001018181525050808a8581518110611c5457611c5461352e565b6020026020010181815250505050508080611c6e9061355a565b915050611bea565b505b505091939590929450565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfa91906134a3565b90506001600160a01b0381163314611d245760405162461bcd60e51b8152600401610718906134c0565b600c54821115611d825760405162461bcd60e51b815260206004820152602360248201527f537461727420626c6f636b206d757374206265206265666f726520656e642074604482015262696d6560e81b6064820152608401610718565b428211611de15760405162461bcd60e51b815260206004820152602760248201527f537461727420626c6f636b206d7573742062652061667465722063757272656e6044820152667420626c6f636b60c81b6064820152608401610718565b600b544210611e025760405162461bcd60e51b8152600401610718906134f7565b600b54829003611e455760405162461bcd60e51b815260206004820152600e60248201526d073616d652074696d657374616d760941b6044820152606401610718565b600b8290556040518281527f9c5b354b21055675b708256fbf890975529c5e58066b2e826541d253b389cd1490602001610871565b611e8261297d565b611e8a612be0565b6002546001600160a01b031663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015611ee6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0a91906135e4565b611f605760405162461bcd60e51b815260206004820152602160248201527f4e6f7420617070726f7665206e667420746f207374616b6572206164647265736044820152607360f81b6064820152608401610718565b8051825114611fa55760405162461bcd60e51b8152602060048201526011602482015270496e76616c696420546f6b656e2069647360781b6044820152606401610718565b815160008115611fe55760005b82811015611fe357611fcf8482815181106111ef576111ef61352e565b915080611fdb8161355a565b915050611fb2565b505b336000818152600e6020526040812091611ffe90611a66565b60085490915061200e8285612907565b111561205c5760405162461bcd60e51b815260206004820152601e60248201527f4578636565647320746865206d6178206c696d697420706572207573657200006044820152606401610718565b600754600d5461206c9085612907565b11156120b25760405162461bcd60e51b8152602060048201526015602482015274115e18d959591cc81d1a19481b585e081b1a5b5a5d605a1b6044820152606401610718565b60006120bd3361087d565b905080156121185760006120d033611177565b90506120dc82826128dc565b600285015560405181815233907f121c5042302bae5fc561fbc64368f297ca60a880878e1e3a7f7e9380377260bf9060200160405180910390a2505b600084118015612129575060095415155b156123d05760095461213c9085906128ef565b34101561218b5760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e74206465706f7369742066656500000000000000006044820152606401610718565b600060018054906101000a90046001600160a01b03166001600160a01b03166349cf912c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156121de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122029190613573565b905060006122126103e8836128dc565b9050600060018054906101000a90046001600160a01b03166001600160a01b031663cec90ecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228b91906134a3565b905082156123435760006001600160a01b0382166122af6103e861092d34886128ef565b604051600081818185875af1925050503d80600081146122eb576040519150601f19603f3d011682016040523d82523d6000602084013e6122f0565b606091505b50509050806123415760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2073656e642066656520746f2061646d696e00000000006044820152606401610718565b505b81156123cc576006546000906001600160a01b03166123686103e861092d34876128ef565b604051600081818185875af1925050503d80600081146123a4576040519150601f19603f3d011682016040523d82523d6000602084013e6123a9565b606091505b50509050806123ca5760405162461bcd60e51b81526004016107189061358c565b505b5050505b60005b858110156125f0576002546001600160a01b031663f242432a33308b85815181106124005761240061352e565b60200260200101518b868151811061241a5761241a61352e565b60209081029190910101516040516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390921660248401526044830152606482015260a06084820152600560a4820152647374616b6560d81b60c482015260e401600060405180830381600087803b15801561249557600080fd5b505af11580156124a9573d6000803e3d6000fd5b505050506124c96124b73390565b8983815181106114f5576114f561352e565b6124fe576124fc8882815181106124e2576124e261352e565b602002602001015185600001612c2890919063ffffffff16565b505b6000612516338a848151811061155c5761155c61352e565b905087828151811061252a5761252a61352e565b6020026020010151600f6000838152602001908152602001600020546125509190613601565b6000828152600f6020526040902055336001600160a01b03167f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee908a848151811061259c5761259c61352e565b60200260200101518a85815181106125b6576125b661352e565b60200260200101516040516125d5929190918252602082015260400190565b60405180910390a250806125e88161355a565b9150506123d3565b50600d546125fe9085612907565b600d555050426003909101555061072f90506001600055565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561266a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061268e91906134a3565b90506001600160a01b03811633146126b85760405162461bcd60e51b8152600401610718906134c0565b6003546001600160a01b0380841691160361270a5760405162461bcd60e51b815260206004820152601260248201527173616d6520746f6b656e206164647265737360701b6044820152606401610718565b600b54421061272b5760405162461bcd60e51b8152600401610718906134f7565b600380546001600160a01b0319166001600160a01b0384169081179091556040519081527fa5289ba11778999f4dfb9415023783188d42bbb5db0612cbfbe55999069612a090602001610871565b600060018054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f091906134a3565b90506001600160a01b038116331461281a5760405162461bcd60e51b8152600401610718906134c0565b60088290556040518281527fa9ae1657e9c98d6cda0b021c88ffa02a03d5de8531d8fc75ed6d098c40930f8b90602001610871565b612857612be0565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b6128ab612c34565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612886565b60006128e882846135d1565b9392505050565b60006128e88284613614565b60006128e8828461362b565b60006128e88284613601565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c6f908490612c7d565b600081815260018301602052604081205415156128e8565b6002600054036129cf5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610718565b6002600055565b60006001600160a01b038316612a255760405162461bcd60e51b8152602060048201526014602482015273496e76616c6964206e756c6c206164647265737360601b6044820152606401610718565b6003546001600160a01b0316612b095747821580612a41575080155b15612a50576000915050610671565b80831115612a5c578092505b6000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114612aa9576040519150601f19603f3d011682016040523d82523d6000602084013e612aae565b606091505b5050905080612aff5760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f207472616e7366657220636f696e0000000000000000006044820152606401610718565b8392505050610671565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612b52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b769190613573565b9050821580612b83575080155b15612b92576000915050610671565b80831115612b9e578092505b600354612bb5906001600160a01b03168585612913565b82915050610671565b60006128e88383612d52565b6000610671825490565b60006128e88383612e45565b60015460ff1615612c265760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610718565b565b60006128e88383612e6f565b60015460ff16612c265760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610718565b6000612cd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ebe9092919063ffffffff16565b9050805160001480612cf3575080806020019051810190612cf391906135e4565b610c6f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610718565b60008181526001830160205260408120548015612e3b576000612d766001836135d1565b8554909150600090612d8a906001906135d1565b9050818114612def576000866000018281548110612daa57612daa61352e565b9060005260206000200154905080876000018481548110612dcd57612dcd61352e565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612e0057612e0061364d565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610671565b6000915050610671565b6000826000018281548110612e5c57612e5c61352e565b9060005260206000200154905092915050565b6000818152600183016020526040812054612eb657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610671565b506000610671565b6060610cd3848460008585600080866001600160a01b03168587604051612ee59190613687565b60006040518083038185875af1925050503d8060008114612f22576040519150601f19603f3d011682016040523d82523d6000602084013e612f27565b606091505b50915091506109458783838760608315612fa2578251600003612f9b576001600160a01b0385163b612f9b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610718565b5081610cd3565b610cd38383815115612fb75781518083602001fd5b8060405162461bcd60e51b815260040161071891906136a3565b600060208284031215612fe357600080fd5b81356001600160e01b0319811681146128e857600080fd5b801515811461300957600080fd5b50565b60006020828403121561301e57600080fd5b81356128e881612ffb565b60006020828403121561303b57600080fd5b5035919050565b6001600160a01b038116811461300957600080fd5b803561306281613042565b919050565b60006020828403121561307957600080fd5b81356128e881613042565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff811182821017156130be576130be613084565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156130ed576130ed613084565b604052919050565b6000610160828403121561310857600080fd5b61311061309a565b61311983613057565b815261312760208401613057565b6020820152604083013560408201526060830135606082015261314c60808401613057565b608082015260a0838101359082015260c0808401359082015260e0808401359082015261010080840135908201526101208084013590820152610140928301359281019290925250919050565b600080604083850312156131ac57600080fd5b82356131b781613042565b946020939093013593505050565b600082601f8301126131d657600080fd5b8135602067ffffffffffffffff8211156131f2576131f2613084565b8160051b6132018282016130c4565b928352848101820192828101908785111561321b57600080fd5b83870192505b8483101561094557823582529183019190830190613221565b6000806040838503121561324d57600080fd5b823567ffffffffffffffff8082111561326557600080fd5b613271868387016131c5565b9350602085013591508082111561328757600080fd5b50613294858286016131c5565b9150509250929050565b600081518084526020808501945080840160005b838110156132ce578151875295820195908201906001016132b2565b509495945050505050565b60a0815260006132ec60a083018861329e565b82810360208401526132fe818861329e565b60408401969096525050606081019290925260809091015292915050565b600082601f83011261332d57600080fd5b813567ffffffffffffffff81111561334757613347613084565b61335a601f8201601f19166020016130c4565b81815284602083860101111561336f57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156133a457600080fd5b85356133af81613042565b945060208601356133bf81613042565b9350604086013567ffffffffffffffff808211156133dc57600080fd5b6133e889838a016131c5565b945060608801359150808211156133fe57600080fd5b61340a89838a016131c5565b9350608088013591508082111561342057600080fd5b5061342d8882890161331c565b9150509295509295909350565b600080600080600060a0868803121561345257600080fd5b853561345d81613042565b9450602086013561346d81613042565b93506040860135925060608601359150608086013567ffffffffffffffff81111561349757600080fd5b61342d8882890161331c565b6000602082840312156134b557600080fd5b81516128e881613042565b6020808252601f908201527f63616c6c6572206973206e6f742074686520666163746f7279206f776e657200604082015260600190565b60208082526017908201527f5374616b696e67207374617274656420616c7265616479000000000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161356c5761356c613544565b5060010190565b60006020828403121561358557600080fd5b5051919050565b60208082526025908201527f4661696c656420746f2073656e642066656520746f207374616b696e6720637260408201526432b0ba37b960d91b606082015260800190565b8181038181111561067157610671613544565b6000602082840312156135f657600080fd5b81516128e881612ffb565b8082018082111561067157610671613544565b808202811582820484141761067157610671613544565b60008261364857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603160045260246000fd5b60005b8381101561367e578181015183820152602001613666565b50506000910152565b60008251613699818460208701613663565b9190910192915050565b60208152600082518060208401526136c2816040850160208701613663565b601f01601f1916919091016040019291505056fea264697066735822122043c195954376a81b8e3f2c40fe9b9d60094b6bf50885c095d625e52127f1c11264736f6c63430008110033a26469706673582212204bbc63b6745e56ce3dee7ed15453625092061d0e12f08c740f7966df2288b6fa64736f6c63430008110033