creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/math/SafeMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `+` operator.\n     *\n     * Requirements:\n     *\n     * - Addition cannot overflow.\n     */\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a + b;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting on\n     * overflow (when the result is negative).\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a - b;\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `*` operator.\n     *\n     * Requirements:\n     *\n     * - Multiplication cannot overflow.\n     */\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a * b;\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers, reverting on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity's `/` operator.\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a / b;\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * reverting when dividing by zero.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a % b;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n     * overflow (when the result is negative).\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {trySub}.\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        unchecked {\n            require(b <= a, errorMessage);\n            return a - b;\n        }\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity's `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        unchecked {\n            require(b > 0, errorMessage);\n            return a / b;\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * reverting with custom message when dividing by zero.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryMod}.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        unchecked {\n            require(b > 0, errorMessage);\n            return a % b;\n        }\n    }\n}\n"
      },
      "contracts/LPLockerV3/LpFee/LPv3LockV2Deployer.sol": {
        "content": "/**\n* @title DXLock - Empowering Trust through Token Locking\n* @dev Secure, User-Friendly Smart Contract to Lock Liquidity and Regular Tokens.\n*\n* 🚀 Introduction:\n* Welcome to DXLock, the pinnacle of token locking on the blockchain! Developed with passion and precision,\n* DXLock stands out as a beacon of trust and commitment in the crypto world. This smart contract is meticulously\n* crafted to lock both liquidity tokens and regular ERC20 tokens, ensuring a secure and transparent environment\n* for your assets.\n*\n* 🌐 Visit DXLock:\n* Dive deeper into the world of DXLock by visiting our platform at [dx.app](\nhttps://dx.app).\nDiscover a treasure trove of features,\n* tutorials, and support to elevate your token locking experience!\n*\n* 💡 Features:\n* 1. **Liquidity Locking**: Cement your project's credibility by locking liquidity tokens. Show the world that you're here to stay!\n* 2. **Token Locking**: Not just for liquidity! Lock any ERC20 tokens with ease and confidence.\n* 3. **Time-locked Security**: Your tokens are safe and sound until the predetermined unlock time hits the clock.\n* 4. **Transparent and Trustworthy**: Open-source and audited, DXLock is a fortress of reliability.\n*\n* 🛡️ Security:\n* Your trust is our top priority. DXLock is fortified with industry-leading security practices to shield your assets\n* and ensure a seamless experience. Though thorough audits have been conducted, we encourage users to do their own\n* research and verify the contract's integrity before engaging.\n*\n* 📖 How to Use:\n* Engaging with DXLock is a breeze! Simply deposit your tokens, set the lock duration, and rest easy knowing\n* your assets are in good hands. Once the lock period concludes, withdrawing is just a click away.\n*\n* 👥 Community and Support:\n* Join our vibrant community and connect with the DXLock team and fellow users! Your feedback and questions are invaluable\n* to us, as we continually strive to enhance DXLock’s functionality and user experience.\n*\n* 📜 License:\n* DXLock is proudly released under the MIT License. We believe in openness and the power of community-driven innovation.\n*\n* @author The DXLock Team\n* @notice Utilize DXLock at your own discretion. We’ve done everything to ensure its security, but the final responsibility lies with the user.\n*/\n// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\n\ninterface decentralizedStorage {\n    function addNewLock(\n        address _lpAddress,\n        uint256 _locktime,\n        address _lockContract,\n        uint256 _tokenAmount,\n        string memory _logo\n    ) external;\n\n    function extendLockerTime(\n        uint256 _userLockerNumber,\n        uint256 _newLockTime\n    ) external;\n\n    function transferLocker(\n        address _newOwner,\n        uint256 _userLockerNumber\n    ) external;\n\n    function unlockLocker(uint256 _userLockerNumber) external;\n\n    function changeLogo(\n        string memory _newLogo,\n        uint256 _userLockerNumber\n    ) external;\n\n    function getPersonalLockerCount(address _owner) external returns (uint256);\n\n    function getBurnContractAddress() external view returns (address);\n}\n\ninterface ReferralContract {\n    function getDiscountedPrice(string memory _code) external returns (uint256);\n\n    function validateCode(string memory _code) external returns (bool);\n\n    function fetchCodeOwner(string memory _code) external returns (address);\n\n    function fetchCodeOwnerPercentage(\n        string memory _code\n    ) external returns (uint256);\n\n    function updateReferrerAmounts(\n        address _referrer,\n        uint256 _updateAmount\n    ) external returns (bool);\n\n    function updateCodeUseNumber(\n        string memory _code,\n        address _presaleAddress\n    ) external returns (bool);\n}\n\ninterface INonfungiblePositionManager {\n    function approve(address to, uint256 tokenId) external;\n\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n\n    struct MintParams {\n        address token0;\n        address token1;\n        uint24 fee;\n        int24 tickLower;\n        int24 tickUpper;\n        uint256 amount0Desired;\n        uint256 amount1Desired;\n        uint256 amount0Min;\n        uint256 amount1Min;\n        address recipient;\n        uint256 deadline;\n    }\n\n    function mint(\n        MintParams calldata params\n    )\n        external\n        payable\n        returns (\n            uint256 tokenId,\n            uint128 liquidity,\n            uint256 amount0,\n            uint256 amount1\n        );\n\n    struct Position {\n        uint96 nonce;\n        address operator;\n        address token0;\n        address token1;\n        uint24 fee;\n        int24 tickLower;\n        int24 tickUpper;\n        uint128 liquidity;\n        uint256 feeGrowthInside0LastX128;\n        uint256 feeGrowthInside1LastX128;\n        uint128 tokensOwed0;\n        uint128 tokensOwed1;\n    }\n\n    function positions(\n        uint256 tokenId\n    )\n        external\n        view\n        returns (\n            uint96 nonce,\n            address operator,\n            address token0,\n            address token1,\n            uint24 fee,\n            int24 tickLower,\n            int24 tickUpper,\n            uint128 liquidity,\n            uint256 feeGrowthInside0LastX128,\n            uint256 feeGrowthInside1LastX128,\n            uint128 tokensOwed0,\n            uint128 tokensOwed1\n        );\n\n    struct IncreaseLiquidityParams {\n        uint256 tokenId;\n        uint256 amount0Desired;\n        uint256 amount1Desired;\n        uint256 amount0Min;\n        uint256 amount1Min;\n        uint256 deadline;\n    }\n\n    /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`\n    /// @param params tokenId The ID of the token for which liquidity is being increased,\n    /// amount0Desired The desired amount of token0 to be spent,\n    /// amount1Desired The desired amount of token1 to be spent,\n    /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check,\n    /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check,\n    /// deadline The time by which the transaction must be included to effect the change\n    /// @return liquidity The new liquidity amount as a result of the increase\n    /// @return amount0 The amount of token0 to acheive resulting liquidity\n    /// @return amount1 The amount of token1 to acheive resulting liquidity\n    function increaseLiquidity(\n        IncreaseLiquidityParams calldata params\n    )\n        external\n        payable\n        returns (uint128 liquidity, uint256 amount0, uint256 amount1);\n\n    struct DecreaseLiquidityParams {\n        uint256 tokenId;\n        uint128 liquidity;\n        uint256 amount0Min;\n        uint256 amount1Min;\n        uint256 deadline;\n    }\n\n    /// @notice Decreases the amount of liquidity in a position and accounts it to the position\n    /// @param params tokenId The ID of the token for which liquidity is being decreased,\n    /// amount The amount by which liquidity will be decreased,\n    /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,\n    /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,\n    /// deadline The time by which the transaction must be included to effect the change\n    /// @return amount0 The amount of token0 accounted to the position's tokens owed\n    /// @return amount1 The amount of token1 accounted to the position's tokens owed\n    function decreaseLiquidity(\n        DecreaseLiquidityParams calldata params\n    ) external payable returns (uint256 amount0, uint256 amount1);\n\n    struct CollectParams {\n        uint256 tokenId;\n        address recipient;\n        uint128 amount0Max;\n        uint128 amount1Max;\n    }\n\n    function collect(\n        CollectParams calldata params\n    ) external payable returns (uint256 amount0, uint256 amount1);\n\n    function factory() external view returns (address);\n\n    function burn(uint256 tokenId) external payable;\n}\n\ncontract PersonalLPv3LockerLPFee is IERC721Receiver, Ownable, ReentrancyGuard {\n    uint256 public LockerType = 4;\n\n    uint256 public personalLockerCount;\n    address public storagePersonal;\n\n    uint256 public LockExpireTimestamp;\n    uint256 public LockerCreationTimestamp;\n\n    uint256 public tokenId;\n    bool public tokenWithdrawn;\n\n    address internal feeDeposit;\n    uint256 public relockFee;\n    uint256 public collectFee;\n\n    bool public relockAfterExpire = true;\n\n    INonfungiblePositionManager public immutable nftPositionManager;\n\n    uint256 public constant FEE_DENOMINATOR = 10000; // denominator for lp fees\n\n    constructor(\n        address _lockTokenAddress,\n        uint256 _tokenId,\n        uint256 _lockTimeEnd,\n        uint256 _personalLockerCount,\n        address _lockerStorage,\n        uint256 _collectFee,\n        uint256 _relockFee,\n        address _feeDeposit\n    ) {\n        require(\n            _lockTimeEnd > (block.timestamp + 600),\n            \"Please lock longer than now\"\n        );\n\n        nftPositionManager = INonfungiblePositionManager(_lockTokenAddress);\n        tokenId = _tokenId;\n\n        LockExpireTimestamp = _lockTimeEnd;\n        personalLockerCount = _personalLockerCount;\n        storagePersonal = _lockerStorage;\n\n        LockerCreationTimestamp = block.timestamp;\n\n        collectFee = _collectFee;\n        relockFee = _relockFee;\n        feeDeposit = _feeDeposit;\n\n        _transferOwnership(tx.origin);\n    }\n\n    receive() external payable {}\n\n    function changeLogo(string memory _logo) external onlyOwner {\n        decentralizedStorage(storagePersonal).changeLogo(\n            _logo,\n            personalLockerCount\n        );\n    }\n\n    function CheckLockedTokenId() public view returns (uint256) {\n        return tokenId;\n    }\n\n    function ExtendPersonalLocker(\n        uint256 _newLockTime\n    ) external payable nonReentrant onlyOwner {\n        require(\n            LockExpireTimestamp < _newLockTime,\n            \"You cant reduce locktime...\"\n        );\n        require(\n            block.timestamp < _newLockTime,\n            \"You cant extend locktime in the past\"\n        );\n        require(!tokenWithdrawn, \"Tokens were already withdrawn\");\n\n        (, , uint128 liquidity) = _getLPTokensAndLiquidity();\n\n        _takeRelockLPFee(liquidity);\n\n        LockExpireTimestamp = _newLockTime;\n        decentralizedStorage(storagePersonal).extendLockerTime(\n            LockExpireTimestamp,\n            personalLockerCount\n        );\n    }\n\n    function _takeRelockLPFee(uint128 liquidity) internal {\n        nftPositionManager.decreaseLiquidity(\n            INonfungiblePositionManager.DecreaseLiquidityParams(\n                tokenId,\n                uint128((liquidity * relockFee) / FEE_DENOMINATOR),\n                0,\n                0,\n                block.timestamp\n            )\n        );\n        nftPositionManager.collect(\n            INonfungiblePositionManager.CollectParams(\n                tokenId,\n                feeDeposit,\n                type(uint128).max,\n                type(uint128).max\n            )\n        );\n    }\n\n    function _getLPTokensAndLiquidity()\n        internal\n        view\n        returns (address token0, address token1, uint128 liquidity)\n    {\n        (, , token0, token1, , , , liquidity, , , , ) = nftPositionManager\n            .positions(tokenId);\n    }\n\n    function transferOwnership(address _newOwner) public override onlyOwner {\n        _transferOwnership(_newOwner);\n        decentralizedStorage(storagePersonal).transferLocker(\n            _newOwner,\n            personalLockerCount\n        );\n    }\n\n    function unlockTokenAfterTimestamp() external onlyOwner nonReentrant {\n        require(\n            block.timestamp >= LockExpireTimestamp,\n            \"Token is still Locked\"\n        );\n        IERC721(address(nftPositionManager)).safeTransferFrom(\n            address(this),\n            owner(),\n            tokenId\n        );\n\n        if (!tokenWithdrawn) {\n            decentralizedStorage(storagePersonal).unlockLocker(\n                personalLockerCount\n            );\n            tokenWithdrawn = true;\n        }\n    }\n\n    /**\n     * @dev Collect fees to _recipient if msg.sender is the owner of tokenId\n     */\n    function collect()\n        external\n        nonReentrant\n        onlyOwner\n        returns (uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1)\n    {\n        (amount0, amount1, fee0, fee1) = _collect();\n    }\n\n    function _collect()\n        private\n        returns (uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1)\n    {\n        if (collectFee == 0) {\n            (amount0, amount1) = nftPositionManager.collect(\n                INonfungiblePositionManager.CollectParams(\n                    tokenId,\n                    owner(),\n                    type(uint128).max,\n                    type(uint128).max\n                )\n            );\n        } else {\n            (address token0, address token1, ) = _getLPTokensAndLiquidity();\n            nftPositionManager.collect(\n                INonfungiblePositionManager.CollectParams(\n                    tokenId,\n                    address(this),\n                    type(uint128).max,\n                    type(uint128).max\n                )\n            );\n\n            uint256 balance0 = IERC20(token0).balanceOf(address(this));\n            uint256 balance1 = IERC20(token1).balanceOf(address(this));\n            address feeTo = feeDeposit;\n            address remainderTo = owner();\n\n            if (balance0 > 0) {\n                fee0 = (balance0 * collectFee) / FEE_DENOMINATOR;\n                require(\n                    IERC20(token0).transfer(feeTo, fee0),\n                    \"erc20 transfer failed\"\n                );\n                amount0 = balance0 - fee0;\n                require(\n                    IERC20(token0).transfer(remainderTo, amount0),\n                    \"erc20 transfer failed\"\n                );\n            }\n\n            if (balance1 > 0) {\n                fee1 = (balance1 * collectFee) / FEE_DENOMINATOR;\n                require(\n                    IERC20(token1).transfer(feeTo, fee1),\n                    \"erc20 transfer failed\"\n                );\n                amount1 = balance1 - fee1;\n                require(\n                    IERC20(token1).transfer(remainderTo, amount1),\n                    \"erc20 transfer failed\"\n                );\n            }\n        }\n    }\n\n    function withdrawNativeToken(\n        address payable user\n    ) public onlyOwner nonReentrant {\n        require(user != address(0), \"zero address\");\n        Address.sendValue(user, address(this).balance);\n    }\n\n    function withdrawStuckCurrency(\n        address payable user,\n        address _token\n    ) external onlyOwner nonReentrant {\n        uint256 amount = IERC20(_token).balanceOf(address(this));\n        IERC20(_token).transfer(user, amount);\n    }\n\n    function onERC721Received(\n        address,\n        address,\n        uint256,\n        bytes calldata\n    ) external override returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n}\n\ncontract DxLockLPV3DepLPFee is Ownable, ReentrancyGuard, IERC721Receiver {\n    uint256 public constant FEE_DENOMINATOR = 10000; // denominator for lp fees\n    uint256 public constant HUNDRED = 100;\n    address public PersonalLockerStorage;\n    address public referralDappAddr;\n    bool public referralDisabled;\n    string public dappFeeName = \"dxlockFeesTokenLPv3v2\";\n    uint256 public lpFee = 1;\n    uint256 public collectFee = 1;\n    uint256 public relockFee = 1;\n    address public tokenFeeAddress = 0xb44ea272f317E379567Ce54Acd94a2891597024E;\n    address[] public LockerContractStorage;\n    mapping(address => bool) public whitelistedNFTPositionManagers;\n\n    constructor(address _lockerStorage, address _referralContract) {\n        PersonalLockerStorage = _lockerStorage;\n        referralDappAddr = _referralContract;\n    }\n\n    function whitelistNFTPositionManager(\n        address _nftPositionManager\n    ) external onlyOwner {\n        require(_nftPositionManager != address(0), \"address(0)\");\n        require(\n            !whitelistedNFTPositionManagers[_nftPositionManager],\n            \"already whitelisted\"\n        );\n        whitelistedNFTPositionManagers[_nftPositionManager] = true;\n    }\n\n    function blacklistNFTPositionManager(\n        address _nftPositionManager\n    ) external onlyOwner {\n        require(_nftPositionManager != address(0), \"address(0)\");\n        require(\n            whitelistedNFTPositionManagers[_nftPositionManager],\n            \"not whitelisted\"\n        );\n        whitelistedNFTPositionManagers[_nftPositionManager] = false;\n    }\n\n    function createLPLocker(\n        INonfungiblePositionManager _nftPositionManager,\n        uint256 _tokenId,\n        uint256 _lockerEndTimeStamp,\n        string memory _logo,\n        string memory _referralCode\n    ) public nonReentrant returns (address newLock) {\n        require(address(_nftPositionManager) != address(0), \"address(0)\");\n        require(address(referralDappAddr) != address(0), \"address(0)\");\n        require(address(PersonalLockerStorage) != address(0), \"address(0)\");\n        require(\n            whitelistedNFTPositionManagers[address(_nftPositionManager)],\n            \"not whitelisted NFTPositionManager\"\n        );\n        require(_tokenId != 0, \"invalid tokenId\");\n\n        (\n            address token0,\n            address token1,\n            uint128 liquidity\n        ) = _getLPTokensAndLiquidity(_nftPositionManager, _tokenId);\n\n        if (lpFee > 0) {\n            uint256 balance0 = IERC20(token0).balanceOf(address(this));\n            uint256 balance1 = IERC20(token1).balanceOf(address(this));\n\n            _takeLPFee((_nftPositionManager), _tokenId, liquidity);\n\n            uint256 balance0After = IERC20(token0).balanceOf(address(this));\n            uint256 balance1After = IERC20(token1).balanceOf(address(this));\n\n            _distributeReferralFee(\n                _referralCode,\n                token0,\n                token1,\n                balance0After - balance0,\n                balance1After - balance1\n            );\n\n            _sendLPFeeToFeeAddress(token0, token1);\n        }\n\n        address lock = _createLockerAndLockNFT(\n            address(_nftPositionManager),\n            _tokenId,\n            _lockerEndTimeStamp,\n            _logo\n        );\n\n        if (!referralDisabled) {\n            require(\n                ReferralContract(referralDappAddr).updateCodeUseNumber(\n                    _referralCode,\n                    address(lock)\n                ),\n                \"code use update failed\"\n            );\n        }\n\n        return address(lock);\n    }\n\n    function _takeLPFee(\n        INonfungiblePositionManager nftPositionManager,\n        uint256 tokenId,\n        uint128 liquidity\n    ) internal {\n        IERC721(address(nftPositionManager)).safeTransferFrom(\n            msg.sender,\n            address(this),\n            tokenId,\n            \"\"\n        );\n\n        nftPositionManager.decreaseLiquidity(\n            INonfungiblePositionManager.DecreaseLiquidityParams(\n                tokenId,\n                uint128((liquidity * lpFee) / FEE_DENOMINATOR),\n                0,\n                0,\n                block.timestamp\n            )\n        );\n        nftPositionManager.collect(\n            INonfungiblePositionManager.CollectParams(\n                tokenId,\n                address(this),\n                type(uint128).max,\n                type(uint128).max\n            )\n        );\n    }\n\n    function _distributeReferralFee(\n        string memory _referralCode,\n        address token0,\n        address token1,\n        uint256 amount0,\n        uint256 amount1\n    ) internal {\n        bytes32 referralCode = keccak256(abi.encodePacked(_referralCode));\n        bytes32 defaultReferralCode = keccak256(abi.encodePacked(\"default\"));\n\n        if (referralDisabled) {\n            require(\n                referralCode == defaultReferralCode,\n                \"only default code allowed\"\n            );\n        }\n        if (referralCode != defaultReferralCode) {\n            require(\n                ReferralContract(referralDappAddr).validateCode(_referralCode),\n                \"invalid discount code\"\n            );\n\n            uint256 referrerPerc = ReferralContract(referralDappAddr)\n                .fetchCodeOwnerPercentage(_referralCode);\n\n            address referrerAddress = ReferralContract(referralDappAddr)\n                .fetchCodeOwner(_referralCode);\n\n            uint256 referrerToken0Amount = ((amount0) * (referrerPerc)) /\n                HUNDRED;\n\n            uint256 referrerToken1Amount = ((amount1) * (referrerPerc)) /\n                HUNDRED;\n\n            if (referrerToken0Amount > 0) {\n                require(\n                    IERC20(token0).transfer(\n                        referrerAddress,\n                        referrerToken0Amount\n                    ),\n                    \"erc20 transfer failed\"\n                );\n            }\n\n            if (referrerToken1Amount > 0) {\n                require(\n                    IERC20(token1).transfer(\n                        referrerAddress,\n                        referrerToken1Amount\n                    ),\n                    \"erc20 transfer failed\"\n                );\n            }\n        }\n    }\n\n    function _sendLPFeeToFeeAddress(address token0, address token1) internal {\n        require(\n            IERC20(token0).transfer(\n                tokenFeeAddress,\n                IERC20(token0).balanceOf(address(this))\n            ),\n            \"erc20 transfer failed\"\n        );\n        require(\n            IERC20(token1).transfer(\n                tokenFeeAddress,\n                IERC20(token1).balanceOf(address(this))\n            ),\n            \"erc20 transfer failed\"\n        );\n    }\n\n    function _createLockerAndLockNFT(\n        address _lockingToken,\n        uint256 _tokenId,\n        uint256 _lockerEndTimeStamp,\n        string memory _logo\n    ) internal returns (address lock) {\n        uint256 _counter = decentralizedStorage(PersonalLockerStorage)\n            .getPersonalLockerCount(msg.sender);\n\n        PersonalLPv3LockerLPFee createNewLock;\n        createNewLock = new PersonalLPv3LockerLPFee(\n            _lockingToken,\n            _tokenId,\n            _lockerEndTimeStamp,\n            _counter,\n            PersonalLockerStorage,\n            collectFee,\n            relockFee,\n            tokenFeeAddress\n        );\n\n        IERC721(_lockingToken).safeTransferFrom(\n            address(this),\n            address(createNewLock),\n            _tokenId,\n            \"\"\n        );\n\n        decentralizedStorage(PersonalLockerStorage).addNewLock(\n            _lockingToken,\n            _lockerEndTimeStamp,\n            address(createNewLock),\n            _tokenId,\n            _logo\n        );\n        LockerContractStorage.push(address(createNewLock));\n\n        return address(createNewLock);\n    }\n\n    function changeStorageContract(address _lockerStorage) external onlyOwner {\n        PersonalLockerStorage = _lockerStorage;\n    }\n\n    function changeReferralContract(\n        address _newRefContract\n    ) external onlyOwner {\n        referralDappAddr = _newRefContract;\n    }\n\n    function disableReferral() external onlyOwner {\n        require(!referralDisabled, \"referral already disabled\");\n        referralDisabled = true;\n    }\n\n    function enableReferral() external onlyOwner {\n        require(referralDisabled, \"referral already enabled\");\n        referralDisabled = false;\n    }\n\n    function changeLPFee(uint256 _lpFee) external onlyOwner {\n        require(_lpFee <= 10, \"LP fee out of bounds\");\n        lpFee = _lpFee;\n    }\n\n    function changeRelockFee(uint256 _relockFee) external onlyOwner {\n        require(_relockFee <= 10, \"Relock fee out of bounds\");\n        relockFee = _relockFee;\n    }\n\n    function changeCollectFee(uint256 _collectFee) external onlyOwner {\n        require(_collectFee <= 10, \"Collect fee out of bounds\");\n        collectFee = _collectFee;\n    }\n\n    function changeTokenFeeAddress(address _feeAddress) external onlyOwner {\n        require(\n            _feeAddress != address(0),\n            \"token fee address cannot be zero address\"\n        );\n        tokenFeeAddress = _feeAddress;\n    }\n\n    function updateFeesName(string memory _newFeesName) external onlyOwner {\n        dappFeeName = _newFeesName;\n    }\n\n    function _getLPTokensAndLiquidity(\n        INonfungiblePositionManager nftPositionManager,\n        uint256 tokenId\n    )\n        internal\n        view\n        returns (address token0, address token1, uint128 liquidity)\n    {\n        (, , token0, token1, , , , liquidity, , , , ) = nftPositionManager\n            .positions(tokenId);\n    }\n\n    function getLockerCount() public view returns (uint256 isSize) {\n        return LockerContractStorage.length;\n    }\n\n    function getAllLockers() public view returns (address[] memory) {\n        address[] memory allTokens = new address[](\n            LockerContractStorage.length\n        );\n        for (uint256 i = 0; i < LockerContractStorage.length; i++) {\n            allTokens[i] = LockerContractStorage[i];\n        }\n        return allTokens;\n    }\n\n    function withdrawNativeToken(\n        address payable user\n    ) public onlyOwner nonReentrant {\n        require(user != address(0), \"zero address\");\n        Address.sendValue(user, address(this).balance);\n    }\n\n    function withdrawStuckCurrency(\n        address user,\n        address _token\n    ) external onlyOwner nonReentrant {\n        require(user != address(0), \"zero address\");\n        IERC20 token = IERC20(_token);\n        require(\n            token.transfer(user, token.balanceOf(address(this))),\n            \"token transfer failed\"\n        );\n    }\n\n    function onERC721Received(\n        address,\n        address,\n        uint256,\n        bytes calldata\n    ) external override returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n\n    receive() external payable {}\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 1
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}