ETH Price: $2,868.35 (-2.80%)

Contract

0xCb3d2a42022741B06f9B38459e3DD1Ee9A64D129

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Execute Automati...386122512026-01-25 17:03:308 hrs ago1769360610IN
0xCb3d2a42...e9A64D129
0 ETH0.000000510.0005625
Execute Automati...385957112026-01-25 12:27:5012 hrs ago1769344070IN
0xCb3d2a42...e9A64D129
0 ETH0.000000320.0005625
Execute Automati...384133532026-01-23 9:48:322 days ago1769161712IN
0xCb3d2a42...e9A64D129
0 ETH0.000000340.0005635
Execute Automati...383043852026-01-22 3:32:243 days ago1769052744IN
0xCb3d2a42...e9A64D129
0 ETH0.000000440.00056606
Execute Automati...382174942026-01-21 3:24:134 days ago1768965853IN
0xCb3d2a42...e9A64D129
0 ETH0.000000490.0005625
Execute Automati...382055822026-01-21 0:05:415 days ago1768953941IN
0xCb3d2a42...e9A64D129
0 ETH0.000000550.0005625
Execute Automati...381849742026-01-20 18:22:135 days ago1768933333IN
0xCb3d2a42...e9A64D129
0 ETH0.000000020.00000029
Execute Automati...381465812026-01-20 7:42:205 days ago1768894940IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...381340452026-01-20 4:13:245 days ago1768882404IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...380470422026-01-19 4:03:216 days ago1768795401IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...380387722026-01-19 1:45:316 days ago1768787131IN
0xCb3d2a42...e9A64D129
0 ETH00.00000029
Execute Automati...380329002026-01-19 0:07:397 days ago1768781259IN
0xCb3d2a42...e9A64D129
0 ETH0.000000990.00099535
Execute Automati...380325692026-01-19 0:02:087 days ago1768780928IN
0xCb3d2a42...e9A64D129
0 ETH0.000002190.00280573
Execute Automati...380031732026-01-18 15:52:127 days ago1768751532IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...379842512026-01-18 10:36:507 days ago1768732610IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...379635432026-01-18 4:51:427 days ago1768711902IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...378770212026-01-17 4:49:408 days ago1768625380IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...378536942026-01-16 22:20:539 days ago1768602053IN
0xCb3d2a42...e9A64D129
0 ETH00.00000028
Execute Automati...377668532026-01-15 22:13:3210 days ago1768515212IN
0xCb3d2a42...e9A64D129
0 ETH0.000000470.00054789
Execute Automati...377426062026-01-15 15:29:2510 days ago1768490965IN
0xCb3d2a42...e9A64D129
0 ETH0.000000030.00000393
Execute Automati...377153192026-01-15 7:54:3810 days ago1768463678IN
0xCb3d2a42...e9A64D129
0 ETH00.00000392
Execute Automati...377032692026-01-15 4:33:4810 days ago1768451628IN
0xCb3d2a42...e9A64D129
0 ETH00.00000035
Execute Automati...376966492026-01-15 2:43:2810 days ago1768445008IN
0xCb3d2a42...e9A64D129
0 ETH00.00000137
Execute Automati...376637362026-01-14 17:34:5511 days ago1768412095IN
0xCb3d2a42...e9A64D129
0 ETH0.000002030.00233592
Execute Automati...376536672026-01-14 14:47:0611 days ago1768402026IN
0xCb3d2a42...e9A64D129
0 ETH0.000000480.00049585
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
386122512026-01-25 17:03:308 hrs ago1769360610
0xCb3d2a42...e9A64D129
0.15611568 ETH
386122512026-01-25 17:03:308 hrs ago1769360610
0xCb3d2a42...e9A64D129
0.03056922 ETH
386122512026-01-25 17:03:308 hrs ago1769360610
0xCb3d2a42...e9A64D129
0.00000032 ETH
386122512026-01-25 17:03:308 hrs ago1769360610
0xCb3d2a42...e9A64D129
0.00003766 ETH
386122512026-01-25 17:03:308 hrs ago1769360610
0xCb3d2a42...e9A64D129
0.12555328 ETH
386122512026-01-25 17:03:308 hrs ago1769360610
0xCb3d2a42...e9A64D129
0 ETH
386122512026-01-25 17:03:308 hrs ago1769360610
0xCb3d2a42...e9A64D129
0.00003118 ETH
385957112026-01-25 12:27:5012 hrs ago1769344070
0xCb3d2a42...e9A64D129
0.00016293 ETH
385957112026-01-25 12:27:5012 hrs ago1769344070
0xCb3d2a42...e9A64D129
0.00000135 ETH
385957112026-01-25 12:27:5012 hrs ago1769344070
0xCb3d2a42...e9A64D129
0.00000025 ETH
385957112026-01-25 12:27:5012 hrs ago1769344070
0xCb3d2a42...e9A64D129
0.0000033 ETH
385957112026-01-25 12:27:5012 hrs ago1769344070
0xCb3d2a42...e9A64D129
0.00016513 ETH
384133532026-01-23 9:48:322 days ago1769161712
0xCb3d2a42...e9A64D129
0.00019424 ETH
384133532026-01-23 9:48:322 days ago1769161712
0xCb3d2a42...e9A64D129
0.00001245 ETH
384133532026-01-23 9:48:322 days ago1769161712
0xCb3d2a42...e9A64D129
0.00000025 ETH
384133532026-01-23 9:48:322 days ago1769161712
0xCb3d2a42...e9A64D129
0.00000422 ETH
384133532026-01-23 9:48:322 days ago1769161712
0xCb3d2a42...e9A64D129
0.00021117 ETH
383043852026-01-22 3:32:243 days ago1769052744
0xCb3d2a42...e9A64D129
0.00020539 ETH
383043852026-01-22 3:32:243 days ago1769052744
0xCb3d2a42...e9A64D129
0.00000044 ETH
383043852026-01-22 3:32:243 days ago1769052744
0xCb3d2a42...e9A64D129
0.00000035 ETH
383043852026-01-22 3:32:243 days ago1769052744
0xCb3d2a42...e9A64D129
0.00000418 ETH
383043852026-01-22 3:32:243 days ago1769052744
0xCb3d2a42...e9A64D129
0.00020949 ETH
382174942026-01-21 3:24:134 days ago1768965853
0xCb3d2a42...e9A64D129
0.15674815 ETH
382174942026-01-21 3:24:134 days ago1768965853
0xCb3d2a42...e9A64D129
0.02470412 ETH
382174942026-01-21 3:24:134 days ago1768965853
0xCb3d2a42...e9A64D129
0.0000004 ETH
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
V4UtilsRouter

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 10000 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.26;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { IERC721Receiver } from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { Pausable } from "@openzeppelin/contracts/utils/Pausable.sol";

import { SharedStorage } from "./libraries/Storage.sol";
import { FeeType } from "./libraries/FeeConstants.sol";

import { EIP712 } from "./base/EIP712.sol";
import { Withdrawable } from "./base/Withdrawable.sol";

/**
 * @title V4UtilsRouter
 * @notice Router contract that delegates calls to the appropriate V4Utils implementation
 * based on the position manager (posm) address provided
 */
contract V4UtilsRouter is AccessControl, Pausable, Initializable, EIP712, IERC721Receiver, Withdrawable {
  bytes32 public constant WITHDRAWER_ROLE = keccak256("WITHDRAWER_ROLE");
  bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
  bytes32 public constant AUTOMATION_OPERATOR_ROLE = keccak256("AUTOMATION_OPERATOR_ROLE");

  /// @notice Mapping from position manager address to V4Utils implementation address
  mapping(address posm => address implementation) public v4UtilsImplementations;
  mapping(bytes32 => bool) _cancelledOrder;
  bool public implementationLocked;

  error ZeroAddress();
  error ImplementationLocked();
  error UnsupportedPositionManager(address posm);
  error DelegateCallFailed(bytes data);
  error InvalidSelector();

  event ImplementationSet(address indexed posm, address indexed implementation);
  event DelegatedCall(address indexed target, bytes4 indexed selector, address indexed posm);
  event CancelOrder(address user, bytes order, bytes signature);

  constructor() EIP712("V3AutomationOrder", "5.0") { }

  /**
   * @notice Initialize the contract with the swap router, fee taker, WETH address, admin, and withdrawer
   * @param _swapRouter The address of the swap router
   * @param _feeTaker The address that will take fees
   * @param _weth The address of the WETH token
   * @param admin The address of the admin
   * @param withdrawer The address that can withdraw tokens
   */
  function initialize(address _swapRouter, address _feeTaker, address _weth, address admin, address withdrawer)
    public
    initializer
  {
    require(_feeTaker != address(0), ZeroAddress());
    SharedStorage.Storage storage ss = SharedStorage.getStorage();
    ss.swapRouter = _swapRouter;
    ss.feeTaker = _feeTaker;
    ss.weth = _weth;
    ss.maxFeeX64[uint8(FeeType.GAS_FEE)] = 5_534_023_222_112_865_280; // 30%
    ss.maxFeeX64[uint8(FeeType.PROTOCOL_FEE)] = 5_534_023_222_112_865_280; // 30%
    ss.maxFeeX64[uint8(FeeType.PERFORMANCE_FEE)] = 3_689_348_814_741_910_528; // 20%
    _grantRole(ADMIN_ROLE, admin);
    _grantRole(DEFAULT_ADMIN_ROLE, admin);
    _grantRole(WITHDRAWER_ROLE, withdrawer);
    _grantRole(DEFAULT_ADMIN_ROLE, withdrawer);
  }

  /**
   * @notice Set the V4Utils implementation for a specific position manager
   * @param posm The position manager address
   * @param implementation The V4Utils implementation address
   */
  function setImplementation(address posm, address implementation) external onlyRole(ADMIN_ROLE) {
    require(!implementationLocked, ImplementationLocked());
    require(posm != address(0) && implementation != address(0), ZeroAddress());
    v4UtilsImplementations[posm] = implementation;
    emit ImplementationSet(posm, implementation);
  }

  /**
   * @notice Execute a function call on the appropriate V4Utils implementation
   * @param posm The position manager address to determine which V4Utils to use
   * @param data The encoded function call data including selector
   */
  function execute(address posm, bytes calldata data) external payable whenNotPaused {
    address implementation = v4UtilsImplementations[posm];
    require(implementation != address(0), UnsupportedPositionManager(posm));

    // Extract selector from data for event emission
    bytes4 selector;
    assembly {
      selector := calldataload(data.offset)
    }
    // Make sure we don't delegatecall to onERC721Received
    require(selector != IERC721Receiver.onERC721Received.selector, InvalidSelector());

    _delegateCall(implementation, data, posm, selector);
  }

  /**
   * @notice Execute an automation order by transferring the NFT to this contract
   * @param posm The position manager address
   * @param tokenId The NFT identifier
   * @param instructionData Additional data for the instruction
   * @param abiEncodedUserOrder The user order data encoded in ABI format
   * @param orderSignature The signature of the user order
   */
  function executeAutomation(
    address posm,
    uint256 tokenId,
    bytes calldata instructionData,
    bytes calldata abiEncodedUserOrder,
    bytes calldata orderSignature
  ) external payable onlyRole(AUTOMATION_OPERATOR_ROLE) whenNotPaused {
    address positionOwner = IERC721(posm).ownerOf(tokenId);
    _validateOrder(abiEncodedUserOrder, orderSignature, positionOwner);
    IERC721(posm).safeTransferFrom(positionOwner, address(this), tokenId, instructionData);
  }

  /**
   * @notice ERC721 callback function that routes to the appropriate V4Utils implementation
   * @param operator The address which called `safeTransferFrom`
   * @param from The address which previously owned the token
   * @param tokenId The NFT identifier which is being transferred
   * @param data Additional data with no specified format
   * @return bytes4 The selector to confirm token transfer
   */
  function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
    external
    override
    returns (bytes4)
  {
    address posm = msg.sender; // The position manager is the caller
    address implementation = v4UtilsImplementations[posm];
    require(implementation != address(0), UnsupportedPositionManager(posm));

    bytes memory callData =
      abi.encodeWithSelector(IERC721Receiver.onERC721Received.selector, operator, from, tokenId, data);

    (bool success, bytes memory result) = implementation.delegatecall(callData);
    require(success, DelegateCallFailed(result));

    emit DelegatedCall(implementation, IERC721Receiver.onERC721Received.selector, posm);

    return abi.decode(result, (bytes4));
  }

  /**
   * @notice Execute a delegate call and handle errors
   * @param target The target contract address
   * @param data The call data to execute (includes selector)
   * @param posm The position manager address for event emission
   * @param selector The function selector for event emission
   */
  function _delegateCall(address target, bytes calldata data, address posm, bytes4 selector) internal {
    (bool success, bytes memory result) = target.delegatecall(data);
    if (!success) {
      assembly {
        revert(add(result, 32), mload(result)) // Revert with the original reason
      }
    }

    emit DelegatedCall(target, selector, posm);
  }

  function _validateOrder(bytes memory abiEncodedUserOrder, bytes memory orderSignature, address actor) internal view {
    address userAddress = _recover(abiEncodedUserOrder, orderSignature);
    require(userAddress == actor);
    require(!_cancelledOrder[keccak256(orderSignature)]);
  }

  /**
   * @notice Cancel an order by marking it as cancelled
   * @param abiEncodedUserOrder The user order data encoded in ABI format
   * @param orderSignature The signature of the user order
   */
  function cancelOrder(bytes calldata abiEncodedUserOrder, bytes calldata orderSignature) external {
    _validateOrder(abiEncodedUserOrder, orderSignature, _msgSender());
    _cancelledOrder[keccak256(orderSignature)] = true;
    emit CancelOrder(_msgSender(), abiEncodedUserOrder, orderSignature);
  }

  /// @notice Check if an order has been cancelled
  /// @param orderSignature The signature of the order to check
  /// @return bool True if the order is cancelled, false otherwise
  function isOrderCancelled(bytes calldata orderSignature) external view returns (bool) {
    return _cancelledOrder[keccak256(orderSignature)];
  }

  /// @notice grant operator role to the address
  /// @param _address The address to which the operator role is granted
  function grantOperatorRole(address _address) external onlyRole(DEFAULT_ADMIN_ROLE) {
    grantRole(AUTOMATION_OPERATOR_ROLE, _address);
  }

  /// @notice revoke operator role from the address
  /// @param _address The address from which the operator role is revoked
  function revokeOperatorRole(address _address) external onlyRole(DEFAULT_ADMIN_ROLE) {
    revokeRole(AUTOMATION_OPERATOR_ROLE, _address);
  }

  /// @notice Set the fee taker address
  /// @param _feeTaker The fee taker address
  function setFeeTaker(address _feeTaker) external onlyRole(ADMIN_ROLE) {
    SharedStorage.getStorage().feeTaker = _feeTaker;
  }

  function pause() external onlyRole(ADMIN_ROLE) {
    _pause();
  }

  function unpause() external onlyRole(ADMIN_ROLE) {
    _unpause();
  }

  function withdrawERC20(IERC20[] calldata tokens, address to) public virtual override onlyRole(WITHDRAWER_ROLE) {
    super.withdrawERC20(tokens, to);
  }

  function withdrawNative(address to) public virtual override onlyRole(WITHDRAWER_ROLE) {
    super.withdrawNative(to);
  }

  function withdrawERC721(IERC721 token, uint256 tokenId, address to) public virtual override onlyRole(WITHDRAWER_ROLE) {
    super.withdrawERC721(token, tokenId, to);
  }

  /**
   * @notice Lock the implementation to prevent further changes
   * This function can only be called by an account with the ADMIN_ROLE
   */
  function lockImplementation() external onlyRole(ADMIN_ROLE) {
    implementationLocked = true;
  }

  /**
   * @notice Allow contract to receive ETH
   */
  receive() external payable { }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 3 of 24 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

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

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

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

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.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.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

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

pragma solidity ^0.8.20;

/**
 * @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 Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reinitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._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 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._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() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @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 {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
     *
     * NOTE: Consider following the ERC-7201 formula to derive storage locations.
     */
    function _initializableStorageSlot() internal pure virtual returns (bytes32) {
        return INITIALIZABLE_STORAGE;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        bytes32 slot = _initializableStorageSlot();
        assembly {
            $.slot := slot
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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 {
    bool private _paused;

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

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @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 {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

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

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import { IAllowanceTransfer } from "@pancakeswap/v4-periphery/lib/permit2/src/interfaces/IAllowanceTransfer.sol";

/**
 * @title SharedStorage
 * @notice Diamond storage pattern for V4Utils shared variables
 * @dev Simple storage struct with getter function only
 */
library SharedStorage {
  /// @notice Storage struct containing shared variables
  struct Storage {
    address feeTaker;
    address swapRouter;
    address weth;
    IAllowanceTransfer permit2;
    mapping(uint8 => uint64) maxFeeX64;
  }

  /// @notice Storage slot for diamond storage pattern
  /// @dev keccak256("v4utils.shared.storage") - 1
  bytes32 private constant STORAGE_SLOT = 0x8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c6;

  /// @notice Get the storage struct
  /// @return s The Storage struct
  function getStorage() internal pure returns (Storage storage s) {
    bytes32 slot = STORAGE_SLOT;
    assembly {
      s.slot := slot
    }
  }
}

library ImplStorage {
  struct Storage {
    mapping(address => bool) whitelistedPosm;
  }

  function getStorage(bytes32 slot) internal pure returns (Storage storage s) {
    assembly {
      s.slot := slot
    }
  }
}

File 10 of 24 : FeeConstants.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

enum FeeType {
  GAS_FEE,
  PERFORMANCE_FEE,
  PROTOCOL_FEE
}

// SPDX-License-Identifier: BUSL-1.1
// modified version of @openzeppelin
pragma solidity >=0.8.26;

import "./StructHash.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

abstract contract EIP712 {
  bytes32 private constant TYPE_HASH =
    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

  bytes32 public immutable DOMAIN_SEPARATOR;

  constructor(string memory name, string memory version) {
    DOMAIN_SEPARATOR =
      keccak256(abi.encode(TYPE_HASH, keccak256(bytes(name)), keccak256(bytes(version)), block.chainid, address(this)));
  }

  function _recover(bytes memory order, bytes memory signature) internal view returns (address) {
    bytes32 digest = _hashTypedDataV4(StructHash._hash(order));
    return ECDSA.recover(digest, signature);
  }

  function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
    return toTypedDataHash(DOMAIN_SEPARATOR, structHash);
  }

  /**
   * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
   *
   * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
   * `\x19\x01` and hashing the result. It corresponds to the hash signed by the
   * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
   *
   * See {ECDSA-recover}.
   */
  function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
    /// @solidity memory-safe-assembly
    assembly {
      let ptr := mload(0x40)
      mstore(ptr, hex"1901")
      mstore(add(ptr, 0x02), domainSeparator)
      mstore(add(ptr, 0x22), structHash)
      digest := keccak256(ptr, 0x42)
    }
  }
}

// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8;

import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

abstract contract Withdrawable {
  using SafeERC20 for IERC20;

  /**
   * @notice Withdraws erc20 token balance
   * @param tokens Addresses of erc20 tokens to withdraw
   * @param to Address to send to
   */
  function withdrawERC20(IERC20[] calldata tokens, address to) public virtual {
    uint256 count = tokens.length;
    for (uint256 i = 0; i < count; ++i) {
      uint256 balance = tokens[i].balanceOf(address(this));
      if (balance > 0) tokens[i].safeTransfer(to, balance);
    }
  }

  /**
   * @notice Withdraws native token balance
   * @param to Address to send to
   */
  function withdrawNative(address to) public virtual {
    uint256 nativeBalance = address(this).balance;
    if (nativeBalance > 0) payable(to).transfer(nativeBalance);
  }

  /**
   * @notice Withdraws erc721 token balance
   * @param token Addresses of erc721 tokens to withdraw
   * @param tokenId tokenId of erc721 tokens to withdraw
   * @param to Address to send to
   */
  function withdrawERC721(IERC721 token, uint256 tokenId, address to) public virtual {
    token.transferFrom(address(this), to, tokenId);
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted to signal this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC-165 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);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

import {IEIP712} from "./IEIP712.sol";

/// @title AllowanceTransfer
/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts
/// @dev Requires user's token approval on the Permit2 contract
interface IAllowanceTransfer is IEIP712 {
    /// @notice Thrown when an allowance on a token has expired.
    /// @param deadline The timestamp at which the allowed amount is no longer valid
    error AllowanceExpired(uint256 deadline);

    /// @notice Thrown when an allowance on a token has been depleted.
    /// @param amount The maximum amount allowed
    error InsufficientAllowance(uint256 amount);

    /// @notice Thrown when too many nonces are invalidated.
    error ExcessiveInvalidation();

    /// @notice Emits an event when the owner successfully invalidates an ordered nonce.
    event NonceInvalidation(
        address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce
    );

    /// @notice Emits an event when the owner successfully sets permissions on a token for the spender.
    event Approval(
        address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration
    );

    /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.
    event Permit(
        address indexed owner,
        address indexed token,
        address indexed spender,
        uint160 amount,
        uint48 expiration,
        uint48 nonce
    );

    /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.
    event Lockdown(address indexed owner, address token, address spender);

    /// @notice The permit data for a token
    struct PermitDetails {
        // ERC20 token address
        address token;
        // the maximum amount allowed to spend
        uint160 amount;
        // timestamp at which a spender's token allowances become invalid
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice The permit message signed for a single token allownce
    struct PermitSingle {
        // the permit data for a single token alownce
        PermitDetails details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice The permit message signed for multiple token allowances
    struct PermitBatch {
        // the permit data for multiple token allowances
        PermitDetails[] details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice The saved permissions
    /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    struct PackedAllowance {
        // amount allowed
        uint160 amount;
        // permission expiry
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice A token spender pair.
    struct TokenSpenderPair {
        // the token the spender is approved
        address token;
        // the spender address
        address spender;
    }

    /// @notice Details for a token transfer.
    struct AllowanceTransferDetails {
        // the owner of the token
        address from;
        // the recipient of the token
        address to;
        // the amount of the token
        uint160 amount;
        // the token to be transferred
        address token;
    }

    /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.
    /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]
    /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.
    function allowance(address user, address token, address spender)
        external
        view
        returns (uint160 amount, uint48 expiration, uint48 nonce);

    /// @notice Approves the spender to use up to amount of the specified token up until the expiration
    /// @param token The token to approve
    /// @param spender The spender address to approve
    /// @param amount The approved amount of the token
    /// @param expiration The timestamp at which the approval is no longer valid
    /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    function approve(address token, address spender, uint160 amount, uint48 expiration) external;

    /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature
    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
    /// @param owner The owner of the tokens being approved
    /// @param permitSingle Data signed over by the owner specifying the terms of approval
    /// @param signature The owner's signature over the permit data
    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;

    /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature
    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
    /// @param owner The owner of the tokens being approved
    /// @param permitBatch Data signed over by the owner specifying the terms of approval
    /// @param signature The owner's signature over the permit data
    function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external;

    /// @notice Transfer approved tokens from one address to another
    /// @param from The address to transfer from
    /// @param to The address of the recipient
    /// @param amount The amount of the token to transfer
    /// @param token The token address to transfer
    /// @dev Requires the from address to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(address from, address to, uint160 amount, address token) external;

    /// @notice Transfer approved tokens in a batch
    /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers
    /// @dev Requires the from addresses to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;

    /// @notice Enables performing a "lockdown" of the sender's Permit2 identity
    /// by batch revoking approvals
    /// @param approvals Array of approvals to revoke.
    function lockdown(TokenSpenderPair[] calldata approvals) external;

    /// @notice Invalidate nonces for a given (token, spender) pair
    /// @param token The token to invalidate nonces for
    /// @param spender The spender to invalidate nonces for
    /// @param newNonce The new nonce to set. Invalidates all nonces less than it.
    /// @dev Can't invalidate more than 2**16 nonces per transaction.
    function invalidateNonces(address token, address spender, uint48 newNonce) external;
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.26;

library StructHash {
  function _hash(bytes memory abiEncodedUserOrder) internal pure returns (bytes32) {
    return _hash(abi.decode(abiEncodedUserOrder, (Order)));
  }

  // keccak256(
  //     "RebalanceAutoCompound(RebalanceAutoCompoundAction
  // action)RebalanceAutoCompoundAction(int256 maxGasProportionX64,int256
  // feeToPrincipalRatioThresholdX64)"
  // );
  bytes32 constant RebalanceAutoCompound_TYPEHASH = 0x35d8f787f18def78c8e6fcafa2acf783916baed9dc692c38b4e8a97c853b7477;

  struct RebalanceAutoCompound {
    RebalanceAutoCompoundAction action;
  }

  function _hash(RebalanceAutoCompound memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(RebalanceAutoCompound_TYPEHASH, _hash(obj.action)));
  }

  // keccak256(
  //     "RebalanceAutoCompoundAction(int256 maxGasProportionX64,int256
  // feeToPrincipalRatioThresholdX64)"
  // );
  bytes32 constant RebalanceAutoCompoundAction_TYPEHASH =
    0x3fa522c715dd2d3373663b38d551ef7f7a5beec25a19992cd26eae7d7df39486;

  struct RebalanceAutoCompoundAction {
    int256 maxGasProportionX64;
    int256 feeToPrincipalRatioThresholdX64;
  }

  function _hash(RebalanceAutoCompoundAction memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(RebalanceAutoCompoundAction_TYPEHASH, obj.maxGasProportionX64, obj.feeToPrincipalRatioThresholdX64)
    );
  }

  // keccak256(
  //     "TickOffsetCondition(uint32 gteTickOffset,uint32 lteTickOffset)"
  // );
  bytes32 constant TickOffsetCondition_TYPEHASH = 0x62a0ad438254a5fc08168ddf3cb49a0b3c0e730e76f4fa785b4df532bc2dafb9;

  struct TickOffsetCondition {
    uint32 gteTickOffset;
    uint32 lteTickOffset;
  }

  function _hash(TickOffsetCondition memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(TickOffsetCondition_TYPEHASH, obj.gteTickOffset, obj.lteTickOffset));
  }

  // keccak256(
  //     "PriceOffsetCondition(uint32 baseToken,uint256 gteOffsetSqrtPriceX96,uint256
  // lteOffsetSqrtPriceX96)"
  // );
  bytes32 constant PriceOffsetCondition_TYPEHASH = 0xee7cf2600f91b8ddafa790dd184ce3c665f9dc116423525b336e1edac8e07e12;

  struct PriceOffsetCondition {
    uint32 baseToken;
    uint256 gteOffsetSqrtPriceX96;
    uint256 lteOffsetSqrtPriceX96;
  }

  function _hash(PriceOffsetCondition memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(PriceOffsetCondition_TYPEHASH, obj.baseToken, obj.gteOffsetSqrtPriceX96, obj.lteOffsetSqrtPriceX96)
    );
  }

  // keccak256(
  //     "TokenRatioCondition(int256 lteToken0RatioX64,int256 gteToken0RatioX64)"
  // );
  bytes32 constant TokenRatioCondition_TYPEHASH = 0x45ae7b1ead003f850829121834fe562edded567cc66a42e8315561c98a7735f9;

  struct TokenRatioCondition {
    int256 lteToken0RatioX64;
    int256 gteToken0RatioX64;
  }

  function _hash(TokenRatioCondition memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(TokenRatioCondition_TYPEHASH, obj.lteToken0RatioX64, obj.gteToken0RatioX64));
  }

  // keccak256(
  //     "Condition(string type,int160 sqrtPriceX96,int64 timeBuffer,TickOffsetCondition
  // tickOffsetCondition,PriceOffsetCondition priceOffsetCondition,TokenRatioCondition
  // tokenRatioCondition)PriceOffsetCondition(uint32 baseToken,uint256 gteOffsetSqrtPriceX96,uint256
  // lteOffsetSqrtPriceX96)TickOffsetCondition(uint32 gteTickOffset,uint32
  // lteTickOffset)TokenRatioCondition(int256 lteToken0RatioX64,int256 gteToken0RatioX64)"
  // );
  bytes32 constant Condition_TYPEHASH = 0xaf36b8bda8212b5328e48351dce631ba51b3a66e23916e5bb6bbd603d2d06f08;

  struct Condition {
    string _type;
    int160 sqrtPriceX96;
    int64 timeBuffer;
    TickOffsetCondition tickOffsetCondition;
    PriceOffsetCondition priceOffsetCondition;
    TokenRatioCondition tokenRatioCondition;
  }

  function _hash(Condition memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(
        Condition_TYPEHASH,
        keccak256(bytes(obj._type)),
        obj.sqrtPriceX96,
        obj.timeBuffer,
        _hash(obj.tickOffsetCondition),
        _hash(obj.priceOffsetCondition),
        _hash(obj.tokenRatioCondition)
      )
    );
  }

  // keccak256(
  //     "TickOffsetAction(uint32 tickLowerOffset,uint32 tickUpperOffset)"
  // );
  bytes32 constant TickOffsetAction_TYPEHASH = 0xf5f25bd65589108507b815014b323a5f159027eba9a477039a198a5f7fc368fc;

  struct TickOffsetAction {
    uint32 tickLowerOffset;
    uint32 tickUpperOffset;
  }

  function _hash(TickOffsetAction memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(TickOffsetAction_TYPEHASH, obj.tickLowerOffset, obj.tickUpperOffset));
  }

  // keccak256(
  //     "PriceOffsetAction(uint32 baseToken,int160 lowerOffsetSqrtPriceX96,int160
  // upperOffsetSqrtPriceX96)"
  // );
  bytes32 constant PriceOffsetAction_TYPEHASH = 0x0a6de33fb4ce9e036ea5aa72e73288d926400e8cc438f63c7c1c84b392c5801c;

  struct PriceOffsetAction {
    uint32 baseToken;
    int160 lowerOffsetSqrtPriceX96;
    int160 upperOffsetSqrtPriceX96;
  }

  function _hash(PriceOffsetAction memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(PriceOffsetAction_TYPEHASH, obj.baseToken, obj.lowerOffsetSqrtPriceX96, obj.upperOffsetSqrtPriceX96)
    );
  }

  // keccak256(
  //     "TokenRatioAction(uint32 tickWidth,int256 token0RatioX64)"
  // );
  bytes32 constant TokenRatioAction_TYPEHASH = 0x2d91584261cab64f66268846e106be0b9e325f19b0457d3be9790bff2e4d9259;

  struct TokenRatioAction {
    uint32 tickWidth;
    int256 token0RatioX64;
  }

  function _hash(TokenRatioAction memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(TokenRatioAction_TYPEHASH, obj.tickWidth, obj.token0RatioX64));
  }

  // keccak256(
  //     "RebalanceAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256 liquiditySlippageX64,string
  // gteType,TickOffsetAction tickOffsetGteAction,PriceOffsetAction priceOffsetGteAction,TokenRatioAction
  // tokenRatioGteAction,string lteType,TickOffsetAction tickOffsetLteAction,PriceOffsetAction
  // priceOffsetLteAction,TokenRatioAction tokenRatioLteAction)PriceOffsetAction(uint32 baseToken,int160
  // lowerOffsetSqrtPriceX96,int160 upperOffsetSqrtPriceX96)TickOffsetAction(uint32 tickLowerOffset,uint32
  // tickUpperOffset)TokenRatioAction(uint32 tickWidth,int256 token0RatioX64)"
  // );
  bytes32 constant RebalanceAction_TYPEHASH = 0xebc88669d89a68bc83eee542c09a3d91d8ce9c0af1c90d0ac3f8ff8ade2b9c50;

  struct RebalanceAction {
    int256 maxGasProportionX64;
    int256 swapSlippageX64;
    int256 liquiditySlippageX64;
    string gteType;
    TickOffsetAction tickOffsetGteAction;
    PriceOffsetAction priceOffsetGteAction;
    TokenRatioAction tokenRatioGteAction;
    string lteType;
    TickOffsetAction tickOffsetLteAction;
    PriceOffsetAction priceOffsetLteAction;
    TokenRatioAction tokenRatioLteAction;
  }

  function _hash(RebalanceAction memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(
        RebalanceAction_TYPEHASH,
        obj.maxGasProportionX64,
        obj.swapSlippageX64,
        obj.liquiditySlippageX64,
        keccak256(bytes(obj.gteType)),
        _hash(obj.tickOffsetGteAction),
        _hash(obj.priceOffsetGteAction),
        _hash(obj.tokenRatioGteAction),
        keccak256(bytes(obj.lteType)),
        _hash(obj.tickOffsetLteAction),
        _hash(obj.priceOffsetLteAction),
        _hash(obj.tokenRatioLteAction)
      )
    );
  }

  // keccak256(
  //     "RebalanceConfig(Condition rebalanceCondition,RebalanceAction rebalanceAction,RebalanceAutoCompound
  // autoCompound,bool recurring)Condition(string type,int160 sqrtPriceX96,int64 timeBuffer,TickOffsetCondition
  // tickOffsetCondition,PriceOffsetCondition priceOffsetCondition,TokenRatioCondition
  // tokenRatioCondition)PriceOffsetAction(uint32 baseToken,int160 lowerOffsetSqrtPriceX96,int160
  // upperOffsetSqrtPriceX96)PriceOffsetCondition(uint32 baseToken,uint256 gteOffsetSqrtPriceX96,uint256
  // lteOffsetSqrtPriceX96)RebalanceAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256
  // liquiditySlippageX64,string gteType,TickOffsetAction tickOffsetGteAction,PriceOffsetAction
  // priceOffsetGteAction,TokenRatioAction tokenRatioGteAction,string lteType,TickOffsetAction
  // tickOffsetLteAction,PriceOffsetAction priceOffsetLteAction,TokenRatioAction
  // tokenRatioLteAction)RebalanceAutoCompound(RebalanceAutoCompoundAction action)RebalanceAutoCompoundAction(int256
  // maxGasProportionX64,int256 feeToPrincipalRatioThresholdX64)TickOffsetAction(uint32 tickLowerOffset,uint32
  // tickUpperOffset)TickOffsetCondition(uint32 gteTickOffset,uint32 lteTickOffset)TokenRatioAction(uint32
  // tickWidth,int256 token0RatioX64)TokenRatioCondition(int256 lteToken0RatioX64,int256 gteToken0RatioX64)"
  // );
  bytes32 constant RebalanceConfig_TYPEHASH = 0x5f178dbce6f823ba62e942b9f8ac91282fdf80cd2ad6ada0ee71a16dd42f3b12;

  struct RebalanceConfig {
    Condition rebalanceCondition;
    RebalanceAction rebalanceAction;
    RebalanceAutoCompound autoCompound;
    bool recurring;
  }

  function _hash(RebalanceConfig memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(
        RebalanceConfig_TYPEHASH,
        _hash(obj.rebalanceCondition),
        _hash(obj.rebalanceAction),
        _hash(obj.autoCompound),
        obj.recurring
      )
    );
  }

  // keccak256(
  //     "RangeOrderCondition(bool zeroToOne,int32 gteTickAbsolute,int32 lteTickAbsolute)"
  // );
  bytes32 constant RangeOrderCondition_TYPEHASH = 0xb6800e34595dae872617c5005f10a6a9e2b6a2520654db474bf4750fdd70a0c8;

  struct RangeOrderCondition {
    bool zeroToOne;
    int32 gteTickAbsolute;
    int32 lteTickAbsolute;
  }

  function _hash(RangeOrderCondition memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(RangeOrderCondition_TYPEHASH, obj.zeroToOne, obj.gteTickAbsolute, obj.lteTickAbsolute));
  }

  // keccak256(
  //     "RangeOrderAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256
  // withdrawSlippageX64)"
  // );
  bytes32 constant RangeOrderAction_TYPEHASH = 0xf512215c27c5930c08d4f9d3f8d89d9b5735fb786bebf2231b3e88df5c4015d9;

  struct RangeOrderAction {
    int256 maxGasProportionX64;
    int256 swapSlippageX64;
    int256 withdrawSlippageX64;
  }

  function _hash(RangeOrderAction memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(RangeOrderAction_TYPEHASH, obj.maxGasProportionX64, obj.swapSlippageX64, obj.withdrawSlippageX64)
    );
  }

  // keccak256(
  //     "RangeOrderConfig(RangeOrderCondition condition,RangeOrderAction
  // action)RangeOrderAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256
  // withdrawSlippageX64)RangeOrderCondition(bool zeroToOne,int32 gteTickAbsolute,int32
  // lteTickAbsolute)"
  // );
  bytes32 constant RangeOrderConfig_TYPEHASH = 0x896dec1198540e9a29dda867832b7bb119f2cec50527c0f5ee63ef305b0f539a;

  struct RangeOrderConfig {
    RangeOrderCondition condition;
    RangeOrderAction action;
  }

  function _hash(RangeOrderConfig memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(RangeOrderConfig_TYPEHASH, _hash(obj.condition), _hash(obj.action)));
  }

  // keccak256(
  //     "FeeBasedCondition(int256 minFeeEarnedUsdX64)"
  // );
  bytes32 constant FeeBasedCondition_TYPEHASH = 0x0db5bdb29ccc0083eec5fc69273aba7a8fa98c12cb39bfa1377ade34a3b76e41;

  struct FeeBasedCondition {
    int256 minFeeEarnedUsdX64;
  }

  function _hash(FeeBasedCondition memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(FeeBasedCondition_TYPEHASH, obj.minFeeEarnedUsdX64));
  }

  // keccak256(
  //     "TimeBasedCondition(int256 intervalInSecond)"
  // );
  bytes32 constant TimeBasedCondition_TYPEHASH = 0xf75b2fc8dbd0e2a1eccdee6280f192941a296b909b47921d1a7c7cfd48993252;

  struct TimeBasedCondition {
    int256 intervalInSecond;
  }

  function _hash(TimeBasedCondition memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(TimeBasedCondition_TYPEHASH, obj.intervalInSecond));
  }

  // keccak256(
  //     "AutoCompoundCondition(string type,FeeBasedCondition feeBasedCondition,TimeBasedCondition
  // timeBasedCondition)FeeBasedCondition(int256 minFeeEarnedUsdX64)TimeBasedCondition(int256
  // intervalInSecond)"
  // );
  bytes32 constant AutoCompoundCondition_TYPEHASH = 0x8077238253cf3aae9fc43bae69ede107dc9ecfe05cc3947a0cac4f94212a6223;

  struct AutoCompoundCondition {
    string _type;
    FeeBasedCondition feeBasedCondition;
    TimeBasedCondition timeBasedCondition;
  }

  function _hash(AutoCompoundCondition memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(
        AutoCompoundCondition_TYPEHASH,
        keccak256(bytes(obj._type)),
        _hash(obj.feeBasedCondition),
        _hash(obj.timeBasedCondition)
      )
    );
  }

  // keccak256(
  //     "AutoCompoundAction(int256 maxGasProportionX64,int256 poolSlippageX64,int256
  // swapSlippageX64)"
  // );
  bytes32 constant AutoCompoundAction_TYPEHASH = 0xe17b1ff10b4c0a0b457f201ae45a54a25ec9d424f9f0e068502ea1eab65d6e0e;

  struct AutoCompoundAction {
    int256 maxGasProportionX64;
    int256 poolSlippageX64;
    int256 swapSlippageX64;
  }

  function _hash(AutoCompoundAction memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(AutoCompoundAction_TYPEHASH, obj.maxGasProportionX64, obj.poolSlippageX64, obj.swapSlippageX64)
    );
  }

  // keccak256(
  //     "AutoCompoundConfig(AutoCompoundCondition condition,AutoCompoundAction
  // action)AutoCompoundAction(int256 maxGasProportionX64,int256 poolSlippageX64,int256
  // swapSlippageX64)AutoCompoundCondition(string type,FeeBasedCondition
  // feeBasedCondition,TimeBasedCondition timeBasedCondition)FeeBasedCondition(int256
  // minFeeEarnedUsdX64)TimeBasedCondition(int256 intervalInSecond)"
  // );
  bytes32 constant AutoCompoundConfig_TYPEHASH = 0xbf8ab0c4189cfff5a6148a64201555fddbb74f69f3c9ed9673c79357a2c77217;

  struct AutoCompoundConfig {
    AutoCompoundCondition condition;
    AutoCompoundAction action;
  }

  function _hash(AutoCompoundConfig memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(AutoCompoundConfig_TYPEHASH, _hash(obj.condition), _hash(obj.action)));
  }

  // keccak256(
  //     "AutoExitConfig(Condition condition,AutoExitAction action)AutoExitAction(int256
  // maxGasProportionX64,int256 swapSlippageX64,int256 liquiditySlippageX64,address
  // tokenOutAddress)Condition(string type,int160 sqrtPriceX96,int64 timeBuffer,TickOffsetCondition
  // tickOffsetCondition,PriceOffsetCondition priceOffsetCondition,TokenRatioCondition
  // tokenRatioCondition)PriceOffsetCondition(uint32 baseToken,uint256 gteOffsetSqrtPriceX96,uint256
  // lteOffsetSqrtPriceX96)TickOffsetCondition(uint32 gteTickOffset,uint32
  // lteTickOffset)TokenRatioCondition(int256 lteToken0RatioX64,int256 gteToken0RatioX64)"
  // );
  bytes32 constant AutoExitConfig_TYPEHASH = 0x12abd614ffecf2dd5f160268162f92b4228cb34287cce8936339e98be3db7a86;

  struct AutoExitConfig {
    Condition condition;
    AutoExitAction action;
  }

  function _hash(AutoExitConfig memory obj) internal pure returns (bytes32) {
    return keccak256(abi.encode(AutoExitConfig_TYPEHASH, _hash(obj.condition), _hash(obj.action)));
  }

  // keccak256(
  //     "AutoExitAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256
  // liquiditySlippageX64,address tokenOutAddress)"
  // );
  bytes32 constant AutoExitAction_TYPEHASH = 0x335b4a1f07e5a10cc856257ff4116d238ebc816eb0189c48ede23eab0ba1b164;

  struct AutoExitAction {
    int256 maxGasProportionX64;
    int256 swapSlippageX64;
    int256 liquiditySlippageX64;
    address tokenOutAddress;
  }

  function _hash(AutoExitAction memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(
        AutoExitAction_TYPEHASH,
        obj.maxGasProportionX64,
        obj.swapSlippageX64,
        obj.liquiditySlippageX64,
        obj.tokenOutAddress
      )
    );
  }

  // keccak256(
  //     "AutoHarvestConfig(string type,AutoCompoundCondition condition,AutoExitAction
  // action)AutoCompoundCondition(string type,FeeBasedCondition feeBasedCondition,TimeBasedCondition
  // timeBasedCondition)AutoExitAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256
  // liquiditySlippageX64,address tokenOutAddress)FeeBasedCondition(int256 minFeeEarnedUsdX64)TimeBasedCondition(int256
  // intervalInSecond)"
  // );
  bytes32 constant AutoHarvestConfig_TYPEHASH = 0x078cb4adf5687c5d8012b6cf5f2db36f84c7460eeb9ab0150aa07a1d38e72939;

  struct AutoHarvestConfig {
    string _type;
    AutoCompoundCondition condition;
    AutoExitAction action;
  }

  function _hash(AutoHarvestConfig memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(AutoHarvestConfig_TYPEHASH, keccak256(bytes(obj._type)), _hash(obj.condition), _hash(obj.action))
    );
  }

  // keccak256(
  //     "OrderConfig(RebalanceConfig rebalanceConfig,RangeOrderConfig rangeOrderConfig,AutoCompoundConfig
  // autoCompoundConfig,AutoExitConfig autoExitConfig,AutoHarvestConfig autoHarvestConfig)AutoCompoundAction(int256
  // maxGasProportionX64,int256 poolSlippageX64,int256 swapSlippageX64)AutoCompoundCondition(string
  // type,FeeBasedCondition feeBasedCondition,TimeBasedCondition
  // timeBasedCondition)AutoCompoundConfig(AutoCompoundCondition condition,AutoCompoundAction
  // action)AutoExitAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256 liquiditySlippageX64,address
  // tokenOutAddress)AutoExitConfig(Condition condition,AutoExitAction action)AutoHarvestConfig(string
  // type,AutoCompoundCondition condition,AutoExitAction action)Condition(string type,int160 sqrtPriceX96,int64
  // timeBuffer,TickOffsetCondition tickOffsetCondition,PriceOffsetCondition priceOffsetCondition,TokenRatioCondition
  // tokenRatioCondition)FeeBasedCondition(int256 minFeeEarnedUsdX64)PriceOffsetAction(uint32 baseToken,int160
  // lowerOffsetSqrtPriceX96,int160 upperOffsetSqrtPriceX96)PriceOffsetCondition(uint32 baseToken,uint256
  // gteOffsetSqrtPriceX96,uint256 lteOffsetSqrtPriceX96)RangeOrderAction(int256 maxGasProportionX64,int256
  // swapSlippageX64,int256 withdrawSlippageX64)RangeOrderCondition(bool zeroToOne,int32 gteTickAbsolute,int32
  // lteTickAbsolute)RangeOrderConfig(RangeOrderCondition condition,RangeOrderAction action)RebalanceAction(int256
  // maxGasProportionX64,int256 swapSlippageX64,int256 liquiditySlippageX64,string gteType,TickOffsetAction
  // tickOffsetGteAction,PriceOffsetAction priceOffsetGteAction,TokenRatioAction tokenRatioGteAction,string
  // lteType,TickOffsetAction tickOffsetLteAction,PriceOffsetAction priceOffsetLteAction,TokenRatioAction
  // tokenRatioLteAction)RebalanceAutoCompound(RebalanceAutoCompoundAction action)RebalanceAutoCompoundAction(int256
  // maxGasProportionX64,int256 feeToPrincipalRatioThresholdX64)RebalanceConfig(Condition
  // rebalanceCondition,RebalanceAction rebalanceAction,RebalanceAutoCompound autoCompound,bool
  // recurring)TickOffsetAction(uint32 tickLowerOffset,uint32 tickUpperOffset)TickOffsetCondition(uint32
  // gteTickOffset,uint32 lteTickOffset)TimeBasedCondition(int256 intervalInSecond)TokenRatioAction(uint32
  // tickWidth,int256 token0RatioX64)TokenRatioCondition(int256 lteToken0RatioX64,int256 gteToken0RatioX64)"
  // );
  bytes32 constant OrderConfig_TYPEHASH = 0x5322f0e7ebcd51c97ec5a90f6f72372d960ae06fa718a29977e0970c6cba70aa;

  struct OrderConfig {
    RebalanceConfig rebalanceConfig;
    RangeOrderConfig rangeOrderConfig;
    AutoCompoundConfig autoCompoundConfig;
    AutoExitConfig autoExitConfig;
    AutoHarvestConfig autoHarvestConfig;
  }

  function _hash(OrderConfig memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(
        OrderConfig_TYPEHASH,
        _hash(obj.rebalanceConfig),
        _hash(obj.rangeOrderConfig),
        _hash(obj.autoCompoundConfig),
        _hash(obj.autoExitConfig),
        _hash(obj.autoHarvestConfig)
      )
    );
  }

  // keccak256(
  //     "Order(int64 chainId,address nfpmAddress,uint256 tokenId,string orderType,OrderConfig config,int64
  // signatureTime)AutoCompoundAction(int256 maxGasProportionX64,int256 poolSlippageX64,int256
  // swapSlippageX64)AutoCompoundCondition(string type,FeeBasedCondition feeBasedCondition,TimeBasedCondition
  // timeBasedCondition)AutoCompoundConfig(AutoCompoundCondition condition,AutoCompoundAction
  // action)AutoExitAction(int256 maxGasProportionX64,int256 swapSlippageX64,int256 liquiditySlippageX64,address
  // tokenOutAddress)AutoExitConfig(Condition condition,AutoExitAction action)AutoHarvestConfig(string
  // type,AutoCompoundCondition condition,AutoExitAction action)Condition(string type,int160 sqrtPriceX96,int64
  // timeBuffer,TickOffsetCondition tickOffsetCondition,PriceOffsetCondition priceOffsetCondition,TokenRatioCondition
  // tokenRatioCondition)FeeBasedCondition(int256 minFeeEarnedUsdX64)OrderConfig(RebalanceConfig
  // rebalanceConfig,RangeOrderConfig rangeOrderConfig,AutoCompoundConfig autoCompoundConfig,AutoExitConfig
  // autoExitConfig,AutoHarvestConfig autoHarvestConfig)PriceOffsetAction(uint32 baseToken,int160
  // lowerOffsetSqrtPriceX96,int160 upperOffsetSqrtPriceX96)PriceOffsetCondition(uint32 baseToken,uint256
  // gteOffsetSqrtPriceX96,uint256 lteOffsetSqrtPriceX96)RangeOrderAction(int256 maxGasProportionX64,int256
  // swapSlippageX64,int256 withdrawSlippageX64)RangeOrderCondition(bool zeroToOne,int32 gteTickAbsolute,int32
  // lteTickAbsolute)RangeOrderConfig(RangeOrderCondition condition,RangeOrderAction action)RebalanceAction(int256
  // maxGasProportionX64,int256 swapSlippageX64,int256 liquiditySlippageX64,string gteType,TickOffsetAction
  // tickOffsetGteAction,PriceOffsetAction priceOffsetGteAction,TokenRatioAction tokenRatioGteAction,string
  // lteType,TickOffsetAction tickOffsetLteAction,PriceOffsetAction priceOffsetLteAction,TokenRatioAction
  // tokenRatioLteAction)RebalanceAutoCompound(RebalanceAutoCompoundAction action)RebalanceAutoCompoundAction(int256
  // maxGasProportionX64,int256 feeToPrincipalRatioThresholdX64)RebalanceConfig(Condition
  // rebalanceCondition,RebalanceAction rebalanceAction,RebalanceAutoCompound autoCompound,bool
  // recurring)TickOffsetAction(uint32 tickLowerOffset,uint32 tickUpperOffset)TickOffsetCondition(uint32
  // gteTickOffset,uint32 lteTickOffset)TimeBasedCondition(int256 intervalInSecond)TokenRatioAction(uint32
  // tickWidth,int256 token0RatioX64)TokenRatioCondition(int256 lteToken0RatioX64,int256 gteToken0RatioX64)"
  // );
  bytes32 constant Order_TYPEHASH = 0xc656dbf48bfae7cacbfe27eb73a9a0e9d54fb5d4a0e0a56c9302f5216de62109;

  struct Order {
    int64 chainId;
    address nfpmAddress;
    uint256 tokenId;
    string orderType;
    OrderConfig config;
    int64 signatureTime;
  }

  function _hash(Order memory obj) internal pure returns (bytes32) {
    return keccak256(
      abi.encode(
        Order_TYPEHASH,
        obj.chainId,
        obj.nfpmAddress,
        obj.tokenId,
        keccak256(bytes(obj.orderType)),
        _hash(obj.config),
        obj.signatureTime
      )
    );
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(
        bytes32 hash,
        bytes memory signature
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly ("memory-safe") {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

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

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, 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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

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

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

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

interface IEIP712 {
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 23 of 24 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 24 of 24 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@uniswap/v4-core/=lib/v4-core/",
    "@uniswap/v4-periphery/=lib/v4-periphery/",
    "@pancakeswap/v4-core/=lib/infinity-core/",
    "@pancakeswap/v4-periphery/=lib/infinity-periphery/",
    "@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
    "ds-test/=lib/v4-core/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-gas-snapshot/=lib/infinity-core/lib/forge-gas-snapshot/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
    "hardhat/=lib/v4-core/node_modules/hardhat/",
    "infinity-core/=lib/infinity-core/",
    "infinity-periphery/=lib/infinity-periphery/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "pancake-create3-factory/=lib/infinity-core/lib/pancake-create3-factory/",
    "permit2/=lib/v4-periphery/lib/permit2/",
    "solmate/=lib/v4-core/lib/solmate/",
    "v4-core/=lib/v4-core/src/",
    "v4-periphery/=lib/v4-periphery/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "none",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": true
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"DelegateCallFailed","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"ImplementationLocked","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidSelector","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"posm","type":"address"}],"name":"UnsupportedPositionManager","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bytes","name":"order","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"signature","type":"bytes"}],"name":"CancelOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":true,"internalType":"address","name":"posm","type":"address"}],"name":"DelegatedCall","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"posm","type":"address"},{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"ImplementationSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AUTOMATION_OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"abiEncodedUserOrder","type":"bytes"},{"internalType":"bytes","name":"orderSignature","type":"bytes"}],"name":"cancelOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"posm","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"posm","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"instructionData","type":"bytes"},{"internalType":"bytes","name":"abiEncodedUserOrder","type":"bytes"},{"internalType":"bytes","name":"orderSignature","type":"bytes"}],"name":"executeAutomation","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"grantOperatorRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementationLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_swapRouter","type":"address"},{"internalType":"address","name":"_feeTaker","type":"address"},{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"orderSignature","type":"bytes"}],"name":"isOrderCancelled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"revokeOperatorRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeTaker","type":"address"}],"name":"setFeeTaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"posm","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"setImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"posm","type":"address"}],"name":"v4UtilsImplementations","outputs":[{"internalType":"address","name":"implementation","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a0604052346100d5576040516100176040826100d9565b601181526020810190702b19a0baba37b6b0ba34b7b727b93232b960791b8252604051916100466040846100d9565b600383526020830191620352e360ec1b8352519020915190206040519060208201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8452604083015260608201524660808201523060a082015260a081526100b060c0826100d9565b5190206080526040516138de90816101118239608051818181610aec01526124e20152f35b5f80fd5b601f909101601f19168101906001600160401b038211908210176100fc57604052565b634e487b7160e01b5f52604160045260245ffdfe6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c806301ffc9a7146101f95780631459457a146101f4578063150b7a02146101ef5780631cff79cd146101ea578063248a9ca3146101e557806327ac0c58146101e05780632f2ff15d146101db5780632f622e6b146101d6578063340ed32a146101d157806334a3905c146101cc5780633644e515146101c757806336568abe146101c257806339e8797e146101bd5780633f4ba83a146101b85780634ec5908d146101b357806350d3f9de146101ae578063563166a9146101a95780635c975abb146101a457806375b238fc1461019f5780637ae0c2ec1461019a5780637b9f76b5146101955780638456cb591461019057806385f438c11461018b5780638f8fbab41461018657806391d1485414610181578063a217fddf1461017c578063b219f7d714610177578063c2c0159d14610172578063d547741f1461016d5763eb3f98f80361000e576112dd565b61129d565b611212565b611192565b611178565b611119565b611007565b610fcd565b610f75565b610ea8565b610dbd565b610d83565b610d61565b610d04565b610cdd565b610c36565b610bb7565b610b7d565b610b0f565b610ad5565b610a6c565b610a02565b610995565b610955565b6108d0565b61089e565b61074d565b6105b7565b6102eb565b61022c565b7fffffffff0000000000000000000000000000000000000000000000000000000081160361022857565b5f80fd5b346102285760206003193601126102285760207fffffffff0000000000000000000000000000000000000000000000000000000060043561026c816101fe565b167f7965db0b0000000000000000000000000000000000000000000000000000000081149081156102a3575b506040519015158152f35b7f01ffc9a7000000000000000000000000000000000000000000000000000000009150145f610298565b73ffffffffffffffffffffffffffffffffffffffff81160361022857565b346102285760a060031936011261022857600435610308816102cd565b60243590610315826102cd565b604435610321816102cd565b60643561032d816102cd565b6084359161033a836102cd565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549467ffffffffffffffff61038960ff604089901c161561037b565b1590565b9767ffffffffffffffff1690565b1680159081610581575b6001149081610577575b15908161056e575b5061054657610426948661041d60017fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000007ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005416177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055565b6104cb5761132e565b61042c57005b6104977fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055565b604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29080602081015b0390a1005b610541680100000000000000007fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005416177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055565b61132e565b7ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b9050155f6103a5565b303b15915061039d565b879150610393565b9181601f840112156102285782359167ffffffffffffffff8311610228576020838186019501011161022857565b34610228576080600319360112610228576004356105d4816102cd565b602435906105e1826102cd565b60443560643567ffffffffffffffff8111610228575f92839261060b6106a5933690600401610589565b939096338652600260205261069761063b6040882073ffffffffffffffffffffffffffffffffffffffff90541690565b9573ffffffffffffffffffffffffffffffffffffffff871699610660338c15156115d8565b60405195869460208601987f150b7a02000000000000000000000000000000000000000000000000000000008a5260248701611642565b03601f19810183528261173e565b51915af4906106bc6106b56117ad565b80936117dc565b61074961071e6040519384937f150b7a020000000000000000000000000000000000000000000000000000000033917ff33a2f29ce1529e0c34be406fd7944a76ada4cdd8ad3b3af21c93c031d711ac55f80a46020808251830101910161183d565b7fffffffff000000000000000000000000000000000000000000000000000000001682526020820190565b0390f35b604060031936011261022857600435610765816102cd565b60243567ffffffffffffffff811161022857610785903690600401610589565b9161078e611f1c565b73ffffffffffffffffffffffffffffffffffffffff811692835f5260026020526107d573ffffffffffffffffffffffffffffffffffffffff60405f205416928315156115d8565b7fffffffff00000000000000000000000000000000000000000000000000000000833516927f150b7a0200000000000000000000000000000000000000000000000000000000841461087657815f92918392604051928392833781018381520390845af46108416117ad565b901561086e57507ff33a2f29ce1529e0c34be406fd7944a76ada4cdd8ad3b3af21c93c031d711ac55f80a4005b602081519101fd5b7f7352d91c000000000000000000000000000000000000000000000000000000005f5260045ffd5b346102285760206003193601126102285760206108c86004355f525f602052600160405f20015490565b604051908152f35b34610228576020600319360112610228576100186004356108f0816102cd565b6108f8611f50565b7f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe05f9081526020527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44d5461095090612150565b612150565b611ae2565b3461022857604060031936011261022857610018602435600435610978826102cd565b61099061094b825f525f602052600160405f20015490565b611e5d565b34610228576020600319360112610228576004356109b2816102cd565b6109ba611fb8565b47801580156109c557005b5f9283928392839283916109f8575b73ffffffffffffffffffffffffffffffffffffffff1690f1156109f357005b611ad7565b6108fc91506109d4565b346102285760406003193601126102285760043567ffffffffffffffff811161022857366023820112156102285780600401359067ffffffffffffffff8211610228573660248360051b8301011161022857610018916024803592610a66846102cd565b01611852565b346102285760206003193601126102285773ffffffffffffffffffffffffffffffffffffffff600435610a9e816102cd565b165f526002602052602073ffffffffffffffffffffffffffffffffffffffff60405f205416604051908152f35b5f91031261022857565b34610228575f6003193601126102285760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461022857604060031936011261022857600435602435610b2f816102cd565b3373ffffffffffffffffffffffffffffffffffffffff821603610b5557610018916122f7565b7f6697b232000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610228575f6003193601126102285760206040517f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe08152f35b34610228575f60031936011261022857610bcf612040565b60015460ff811615610c0e5760ff19166001557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b7f8dfc202b000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461022857602060031936011261022857610018600435610c56816102cd565b610c5e612040565b73ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c65416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c655565b34610228575f60031936011261022857610cf5612040565b6004805460ff19166001179055005b346102285760206003193601126102285760043567ffffffffffffffff811161022857610d38610d3f913690600401610589565b369161193d565b602081519101205f526003602052602060ff60405f2054166040519015158152f35b34610228575f60031936011261022857602060ff600154166040519015158152f35b34610228575f6003193601126102285760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b346102285760406003193601126102285760043567ffffffffffffffff811161022857610dee903690600401610589565b906024359167ffffffffffffffff8311610228576104c6610e347f8597445d3e6c82486d8657058b6a42c243329976f148ddd5bede214e979ada96943690600401610589565b610e55610e4236868861193d565b3390610e4f36858761193d565b906123b5565b610e6036828461193d565b602081519101205f52600360205260405f20600160ff19825416179055610e9a604051958695338752606060208801526060870191611622565b918483036040860152611622565b3461022857606060031936011261022857600435610ec5816102cd565b6024359073ffffffffffffffffffffffffffffffffffffffff60443591610eeb836102cd565b610ef3611fb8565b1690813b1561022857606473ffffffffffffffffffffffffffffffffffffffff915f809460405196879586947f23b872dd00000000000000000000000000000000000000000000000000000000865230600487015216602485015260448401525af180156109f357610f6157005b80610f6f5f6100189361173e565b80610acb565b34610228575f60031936011261022857610f8d612040565b610f95611f1c565b600160ff19815416176001557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b34610228575f6003193601126102285760206040517f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e48152f35b3461022857604060031936011261022857600435611024816102cd565b60243590611031826102cd565b611039612040565b60ff600454166110f15773ffffffffffffffffffffffffffffffffffffffff80911691821515806110e6575b61106e906112ff565b825f5260026020526110be8160405f209073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b16907f1acacd74b878778c66cc2abd6987699d6602bfb4b7f244c64c6ed0d61054bb5e5f80a3005b508082161515611065565b7f0657bd51000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461022857604060031936011261022857602060ff61116c602435600435611140826102cd565b5f525f845260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54166040519015158152f35b34610228575f6003193601126102285760206040515f8152f35b34610228576020600319360112610228576100186004356111b2816102cd565b6111ba611f50565b7f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe05f9081526020527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44d5461120d90612150565b612213565b60a06003193601126102285760043561122a816102cd565b60243560443567ffffffffffffffff81116102285761124d903690600401610589565b60649391933567ffffffffffffffff811161022857611270903690600401610589565b916084359567ffffffffffffffff871161022857611295610018973690600401610589565b969095611973565b34610228576040600319360112610228576100186024356004356112c0826102cd565b6112d861094b825f525f602052600160405f20015490565b6122f7565b34610228575f60031936011261022857602060ff600454166040519015158152f35b1561130657565b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b6115cb926114466115d596959373ffffffffffffffffffffffffffffffffffffffff809461135f82841615156112ff565b167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c75416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c75573ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c65416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c655565b167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c85416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c8555f80527f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4ca60205261150e60405f20674ccccccccccccc007fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000825416179055565b7f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4ca6020527f2e2c62dbb7b44281071ae478794b14643fa10a5d0a9fb72d22367cd2e407bca48054674ccccccccccccc007fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009182161790915560015f527fd5c73903e85bbe23080f6182c5a45d3fdebff178f77e8d0a6229766d99744fb680549091166733333333333334001790556115c581611bcd565b50611cb3565b506115c581611d77565b50565b156115e05750565b73ffffffffffffffffffffffffffffffffffffffff907fe7d22c42000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b601f8260209493601f1993818652868601375f8582860101520116010190565b909273ffffffffffffffffffffffffffffffffffffffff6080938161167d989616845216602083015260408201528160608201520191611622565b90565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff8211176116c957604052565b611680565b6060810190811067ffffffffffffffff8211176116c957604052565b60c0810190811067ffffffffffffffff8211176116c957604052565b6020810190811067ffffffffffffffff8211176116c957604052565b6080810190811067ffffffffffffffff8211176116c957604052565b90601f601f19910116810190811067ffffffffffffffff8211176116c957604052565b6040519061177060c08361173e565b565b604051906117706101608361173e565b6040519061177060a08361173e565b67ffffffffffffffff81116116c957601f01601f191660200190565b3d156117d7573d906117be82611791565b916117cc604051938461173e565b82523d5f602084013e565b606090565b156117e45750565b6044602091601f19601f6040519485937ff7a01e4d0000000000000000000000000000000000000000000000000000000085528160048601528051918291826024880152018686015e5f85828601015201168101030190fd5b90816020910312610228575161167d816101fe565b9161185b611fb8565b5f5b82811061186a5750505050565b61189961188061187b8386886121bd565b6121fa565b73ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529190602090839060249082905afa80156109f3576001925f9161190f575b50806118f1575b500161185d565b611909908461190461187b85898b6121bd565b61253f565b5f6118ea565b611930915060203d8111611936575b611928818361173e565b810190612204565b5f6118e3565b503d61191e565b92919261194982611791565b91611957604051938461173e565b829481845281830111610228578281602093845f960137010152565b73ffffffffffffffffffffffffffffffffffffffff90979295969193976119986120c8565b6119a0611f1c565b1693604051967f6352211e000000000000000000000000000000000000000000000000000000008852602088806119df88600483019190602083019252565b0381895afa9788156109f3575f98611a74575b508792611a08611a109593610e4f93369161193d565b92369161193d565b813b15610228575f8094611a55604051978896879586947fb88d4fde000000000000000000000000000000000000000000000000000000008652309060048701611642565b03925af180156109f357611a665750565b80610f6f5f6117709361173e565b611a109492985092611a08611aa4610e4f939560203d602011611ab0575b611a9c818361173e565b810190611ac2565b999395505092906119f2565b503d611a92565b5190611770826102cd565b90816020910312610228575161167d816102cd565b6040513d5f823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c60205260408120805460ff191660011790553391907f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe0907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b505f90565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260408120805460ff191660011790553391907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb560205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4600190565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f10d7f32a6930100c7e03899d583513ff548ac958e569f497049662337b6f49b9602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f10d7f32a6930100c7e03899d583513ff548ac958e569f497049662337b6f49b960205260408120805460ff191660011790553391907f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e4907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b805f525f60205260ff611e918360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b5416611f1657805f525f602052611ec98260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b600160ff1982541617905573ffffffffffffffffffffffffffffffffffffffff339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b60ff60015416611f2857565b7fd93c0665000000000000000000000000000000000000000000000000000000005f5260045ffd5b335f9081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff1615611f8857565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004525f60245260445ffd5b335f9081527f10d7f32a6930100c7e03899d583513ff548ac958e569f497049662337b6f49b9602052604090205460ff1615611ff057565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e460245260445ffd5b335f9081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec602052604090205460ff161561207857565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177560245260445ffd5b335f9081527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c602052604090205460ff161561210057565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe060245260445ffd5b805f525f60205260ff6121843360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54161561218e5750565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f523360045260245260445ffd5b91908110156121cd5760051b0190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b3561167d816102cd565b90816020910312610228575190565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c602052604090205460ff1615611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c60205260408120805460ff191690553391907f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe0907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b805f525f60205260ff61232b8360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b541615611f1657805f525f6020526123648260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b60ff19815416905573ffffffffffffffffffffffffffffffffffffffff339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b1561022857565b908151820190602082019260208184031261022857602081015167ffffffffffffffff811161022857019160c09083900312610228576123f3611761565b906124006020840161261e565b825261240e60408401611ab7565b602083015260608301516040830152608083015167ffffffffffffffff8111610228578460206124409286010161262c565b606083015260a083015167ffffffffffffffff8111610228576117709573ffffffffffffffffffffffffffffffffffffffff806125148561250f6124b6612533996124ac60c08d61253a9f6103779f90602061251e9e6124a1930101612c22565b60808501520161261e565b60a0820152612cf1565b604290604051907f190100000000000000000000000000000000000000000000000000000000000082527f0000000000000000000000000000000000000000000000000000000000000000600283015260228201522090565b612cdb565b92169116146123ae565b602081519101205f52600360205260405f2090565b5460ff1690565b6123ae565b916020915f916040519073ffffffffffffffffffffffffffffffffffffffff858301937fa9059cbb00000000000000000000000000000000000000000000000000000000855216602483015260448201526044815261259f60648261173e565b519082855af115611ad7575f513d612615575073ffffffffffffffffffffffffffffffffffffffff81163b155b6125d35750565b73ffffffffffffffffffffffffffffffffffffffff907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b600114156125cc565b51908160070b820361022857565b81601f820112156102285780519061264382611791565b92612651604051948561173e565b8284526020838301011161022857815f9260208093018386015e8301015290565b51908160130b820361022857565b519063ffffffff8216820361022857565b9190826040910312610228576040516126a9816116ad565b60206126c28183956126ba81612680565b855201612680565b910152565b9190826060910312610228576040516126df816116ce565b60408082946126ed81612680565b8452602081015160208501520151910152565b919082604091031261022857604051612718816116ad565b6020808294805184520151910152565b9190610140838203126102285760405190612742826116ea565b819380519167ffffffffffffffff8311610228576101008261276b8360a0966126c2960161262c565b865261277960208201612672565b602087015261278a6040820161261e565b604087015261279c8360608301612691565b60608701526127ad838683016126c7565b608087015201612700565b9190826060910312610228576040516127d0816116ce565b60406126c28183956127e181612680565b85526127ef60208201612672565b602086015201612672565b919082604091031261022857604051612812816116ad565b602080829461282081612680565b84520151910152565b91906040838203126102285761284c6040519161284583611706565b8294612700565b9052565b5190811515820361022857565b919060a083820312610228576040519061287682611722565b8193805167ffffffffffffffff81116102285782612895918301612728565b8352602081015167ffffffffffffffff811161022857810161026081840312610228576128c0611772565b91815183526020820151602084015260408201516040840152606082015167ffffffffffffffff811161022857846128f991840161262c565b606084015261290b8460808401612691565b608084015261291d8460c084016127b8565b60a08401526129308461012084016127fa565b60c08401526101608201519167ffffffffffffffff831161022857846126c29461299e826102208561296b60609b60809a6129b2990161262c565b60e086015261297e836101808301612691565b610100860152612992836101c083016127b8565b610120860152016127fa565b610140820152602088015260408301612829565b604086015201612850565b51908160030b820361022857565b9190826060910312610228576040516129e3816116ce565b604080829480518452602081015160208501520151910152565b808203929160c084126102285760405191612a17836116ad565b60608395126102285760209160606126c292604051612a35816116ce565b612a3e82612850565b8152612a4b8683016129bd565b86820152612a5b604083016129bd565b60408201528652016129cb565b919082602091031261022857604051612a8081611706565b91518252565b91906060838203126102285760405190612a9f826116ce565b819380519167ffffffffffffffff831161022857604082612ac68383966126c2960161262c565b8652612ad58360208301612a68565b602087015201612a68565b91906080838203126102285760405190612af9826116ad565b819380519167ffffffffffffffff831161022857602082612b208383966126c29601612a86565b8652016129cb565b919082608091031261022857604051612b4081611722565b6060808294805184526020810151602085015260408101516040850152015191612b69836102cd565b0152565b919060a0838203126102285760405190612b86826116ad565b819380519167ffffffffffffffff831161022857602082612bad8383966126c29601612728565b865201612b28565b919060c0838203126102285760405190612bce826116ce565b8193805167ffffffffffffffff81116102285782612bed91830161262c565b835260208101519167ffffffffffffffff831161022857604082612c178383966126c29601612a86565b602087015201612b28565b9190916101408184031261022857612c38611782565b92815167ffffffffffffffff81116102285781612c5691840161285d565b8452612c6581602084016129fd565b602085015260e082015167ffffffffffffffff81116102285781612c8a918401612ae0565b604085015261010082015167ffffffffffffffff81116102285781612cb0918401612b6d565b606085015261012082015167ffffffffffffffff811161022857612cd49201612bb5565b6080830152565b61167d91612ce891612fdc565b9092919261304d565b805160070b90612fd673ffffffffffffffffffffffffffffffffffffffff60208301511661069760408401519360608101516020815191012090612f5d60a060808301518051612d4181516133d4565b90612ebb6020820151805190612e49602082015161069760408401519360608101516020815191012090612d7860808201516137c8565b612d848d83015161381c565b612d9160c084015161387f565b60e08401516020815191012091612dac6101008601516137c8565b93612dc9610140612dc161012089015161381c565b97015161387f565b966040519b8c9a60208c019e8f979491926101609996939c9b9a9794919c6101808a019d7febc88669d89a68bc83eee542c09a3d91d8ce9c0af1c90d0ac3f8ff8ade2b9c508b5260208b015260408a01526060890152608088015260a087015260c086015260e08501526101008401526101208301526101408201520152565b519020610697612e696060612e6160408701516134da565b950151151590565b604051948593602085019788926080929594919560a08501967f5f178dbce6f823ba62e942b9f8ac91282fdf80cd2ad6ada0ee71a16dd42f3b1286526020860152604085015260608401521515910152565b51902090612f51612ecf60208301516131a3565b610697612edf604085015161325c565b93612efa6080612ef26060840151613312565b92015161336e565b90604051958694602086019889919260a093969594919660c08401977f5322f0e7ebcd51c97ec5a90f6f72372d960ae06fa718a29977e0970c6cba70aa855260208501526040840152606083015260808201520152565b51902092015160070b90565b9160405196879560208701998a94919273ffffffffffffffffffffffffffffffffffffffff60c0959298979460e08801997fc656dbf48bfae7cacbfe27eb73a9a0e9d54fb5d4a0e0a56c9302f5216de62109895260070b60208901521660408701526060860152608085015260a084015260070b910152565b51902090565b815191906041830361300c576130059250602082015190606060408401519301515f1a90613114565b9192909190565b50505f9160029190565b6004111561302057565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b61305681613016565b8061305f575050565b61306881613016565b60018103613098577ff645eedf000000000000000000000000000000000000000000000000000000005f5260045ffd5b6130a181613016565b600281036130d557507ffce698f7000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b806130e1600392613016565b146130e95750565b7fd78bce0c000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411613198579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa156109f3575f5173ffffffffffffffffffffffffffffffffffffffff81161561318e57905f905f90565b505f906001905f90565b5050505f9160039190565b610697612fd661321860208451805115159060408382015160030b91015160030b60405191848301937fb6800e34595dae872617c5005f10a6a9e2b6a2520654db474bf4750fdd70a0c885526040840152606083015260808201526080815261320d60a08261173e565b519020940151613569565b6040519283916020830195866040909392919360608101947f896dec1198540e9a29dda867832b7bb119f2cec50527c0f5ee63ef305b0f539a825260208201520152565b602061326882516135c0565b91015180516132ca60406020840151930151604051928391602083019560808701927fe17b1ff10b4c0a0b457f201ae45a54a25ec9d424f9f0e068502ea1eab65d6e0e885260208801526040870152606086015203601f19810183528261173e565b5190206040519060208201927fbf8ab0c4189cfff5a6148a64201555fddbb74f69f3c9ed9673c79357a2c7721784526040830152606082015260608152612fd660808261173e565b613329602061332183516133d4565b9201516136a6565b6040519060208201927f12abd614ffecf2dd5f160268162f92b4228cb34287cce8936339e98be3db7a8684526040830152606082015260608152612fd660808261173e565b8051602081519101209061338a604061332160208401516135c0565b6040519160208301937f078cb4adf5687c5d8012b6cf5f2db36f84c7460eeb9ab0150aa07a1d38e72939855260408401526060830152608082015260808152612fd660a08261173e565b80516020815191012090612fd6602082015160130b610697604084015160070b93606081015161069761345b63ffffffff6020818551169401511660405192839160208301958690929163ffffffff6040918160608501967f62a0ad438254a5fc08168ddf3cb49a0b3c0e730e76f4fa785b4df532bc2dafb9865216602085015216910152565b5190209061347960a0613471608084015161371f565b92015161377c565b9160405196879560208701998a9260c094919796959260e08501987faf36b8bda8212b5328e48351dce631ba51b3a66e23916e5bb6bbd603d2d06f088652602086015260130b604085015260070b6060840152608083015260a08201520152565b51602081519101516040519060208201927f3fa522c715dd2d3373663b38d551ef7f7a5beec25a19992cd26eae7d7df394868452604083015260608201526060815261352760808261173e565b51902060405160208101917f35d8f787f18def78c8e6fcafa2acf783916baed9dc692c38b4e8a97c853b74778352604082015260408152612fd660608261173e565b805190604060208201519101516040519160208301937ff512215c27c5930c08d4f9d3f8d89d9b5735fb786bebf2231b3e88df5c4015d9855260408401526060830152608082015260808152612fd660a08261173e565b80516020815191012090612fd66040602083015151815160208101917f0db5bdb29ccc0083eec5fc69273aba7a8fa98c12cb39bfa1377ade34a3b76e4183528382015282815261361160608261173e565b5190209201515160405160208101917ff75b2fc8dbd0e2a1eccdee6280f192941a296b909b47921d1a7c7cfd48993252835260408201526040815261365760608261173e565b5190209161069760405193849260208401968760609194939260808201957f8077238253cf3aae9fc43bae69ede107dc9ecfe05cc3947a0cac4f94212a62238352602083015260408201520152565b80519060208101519073ffffffffffffffffffffffffffffffffffffffff6060604083015192015116906040519260208401947f335b4a1f07e5a10cc856257ff4116d238ebc816eb0189c48ede23eab0ba1b164865260408501526060840152608083015260a082015260a08152612fd660c08261173e565b63ffffffff81511690604060208201519101516040519160208301937fee7cf2600f91b8ddafa790dd184ce3c665f9dc116423525b336e1edac8e07e12855260408401526060830152608082015260808152612fd660a08261173e565b602081519101516040519060208201927f45ae7b1ead003f850829121834fe562edded567cc66a42e8315561c98a7735f984526040830152606082015260608152612fd660808261173e565b63ffffffff602081835116920151166040519060208201927ff5f25bd65589108507b815014b323a5f159027eba9a477039a198a5f7fc368fc84526040830152606082015260608152612fd660808261173e565b63ffffffff815116906040602082015160130b91015160130b6040519160208301937f0a6de33fb4ce9e036ea5aa72e73288d926400e8cc438f63c7c1c84b392c5801c855260408401526060830152608082015260808152612fd660a08261173e565b602063ffffffff8251169101516040519060208201927f2d91584261cab64f66268846e106be0b9e325f19b0457d3be9790bff2e4d925984526040830152606082015260608152612fd660808261173e56fea164736f6c634300081a000a

Deployed Bytecode

0x6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c806301ffc9a7146101f95780631459457a146101f4578063150b7a02146101ef5780631cff79cd146101ea578063248a9ca3146101e557806327ac0c58146101e05780632f2ff15d146101db5780632f622e6b146101d6578063340ed32a146101d157806334a3905c146101cc5780633644e515146101c757806336568abe146101c257806339e8797e146101bd5780633f4ba83a146101b85780634ec5908d146101b357806350d3f9de146101ae578063563166a9146101a95780635c975abb146101a457806375b238fc1461019f5780637ae0c2ec1461019a5780637b9f76b5146101955780638456cb591461019057806385f438c11461018b5780638f8fbab41461018657806391d1485414610181578063a217fddf1461017c578063b219f7d714610177578063c2c0159d14610172578063d547741f1461016d5763eb3f98f80361000e576112dd565b61129d565b611212565b611192565b611178565b611119565b611007565b610fcd565b610f75565b610ea8565b610dbd565b610d83565b610d61565b610d04565b610cdd565b610c36565b610bb7565b610b7d565b610b0f565b610ad5565b610a6c565b610a02565b610995565b610955565b6108d0565b61089e565b61074d565b6105b7565b6102eb565b61022c565b7fffffffff0000000000000000000000000000000000000000000000000000000081160361022857565b5f80fd5b346102285760206003193601126102285760207fffffffff0000000000000000000000000000000000000000000000000000000060043561026c816101fe565b167f7965db0b0000000000000000000000000000000000000000000000000000000081149081156102a3575b506040519015158152f35b7f01ffc9a7000000000000000000000000000000000000000000000000000000009150145f610298565b73ffffffffffffffffffffffffffffffffffffffff81160361022857565b346102285760a060031936011261022857600435610308816102cd565b60243590610315826102cd565b604435610321816102cd565b60643561032d816102cd565b6084359161033a836102cd565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549467ffffffffffffffff61038960ff604089901c161561037b565b1590565b9767ffffffffffffffff1690565b1680159081610581575b6001149081610577575b15908161056e575b5061054657610426948661041d60017fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000007ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005416177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055565b6104cb5761132e565b61042c57005b6104977fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055565b604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29080602081015b0390a1005b610541680100000000000000007fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005416177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055565b61132e565b7ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b9050155f6103a5565b303b15915061039d565b879150610393565b9181601f840112156102285782359167ffffffffffffffff8311610228576020838186019501011161022857565b34610228576080600319360112610228576004356105d4816102cd565b602435906105e1826102cd565b60443560643567ffffffffffffffff8111610228575f92839261060b6106a5933690600401610589565b939096338652600260205261069761063b6040882073ffffffffffffffffffffffffffffffffffffffff90541690565b9573ffffffffffffffffffffffffffffffffffffffff871699610660338c15156115d8565b60405195869460208601987f150b7a02000000000000000000000000000000000000000000000000000000008a5260248701611642565b03601f19810183528261173e565b51915af4906106bc6106b56117ad565b80936117dc565b61074961071e6040519384937f150b7a020000000000000000000000000000000000000000000000000000000033917ff33a2f29ce1529e0c34be406fd7944a76ada4cdd8ad3b3af21c93c031d711ac55f80a46020808251830101910161183d565b7fffffffff000000000000000000000000000000000000000000000000000000001682526020820190565b0390f35b604060031936011261022857600435610765816102cd565b60243567ffffffffffffffff811161022857610785903690600401610589565b9161078e611f1c565b73ffffffffffffffffffffffffffffffffffffffff811692835f5260026020526107d573ffffffffffffffffffffffffffffffffffffffff60405f205416928315156115d8565b7fffffffff00000000000000000000000000000000000000000000000000000000833516927f150b7a0200000000000000000000000000000000000000000000000000000000841461087657815f92918392604051928392833781018381520390845af46108416117ad565b901561086e57507ff33a2f29ce1529e0c34be406fd7944a76ada4cdd8ad3b3af21c93c031d711ac55f80a4005b602081519101fd5b7f7352d91c000000000000000000000000000000000000000000000000000000005f5260045ffd5b346102285760206003193601126102285760206108c86004355f525f602052600160405f20015490565b604051908152f35b34610228576020600319360112610228576100186004356108f0816102cd565b6108f8611f50565b7f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe05f9081526020527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44d5461095090612150565b612150565b611ae2565b3461022857604060031936011261022857610018602435600435610978826102cd565b61099061094b825f525f602052600160405f20015490565b611e5d565b34610228576020600319360112610228576004356109b2816102cd565b6109ba611fb8565b47801580156109c557005b5f9283928392839283916109f8575b73ffffffffffffffffffffffffffffffffffffffff1690f1156109f357005b611ad7565b6108fc91506109d4565b346102285760406003193601126102285760043567ffffffffffffffff811161022857366023820112156102285780600401359067ffffffffffffffff8211610228573660248360051b8301011161022857610018916024803592610a66846102cd565b01611852565b346102285760206003193601126102285773ffffffffffffffffffffffffffffffffffffffff600435610a9e816102cd565b165f526002602052602073ffffffffffffffffffffffffffffffffffffffff60405f205416604051908152f35b5f91031261022857565b34610228575f6003193601126102285760206040517fe9219848a342180e7e8019a04896ed1f6cd8e25aa953ce64c805ac70fa7d73fe8152f35b3461022857604060031936011261022857600435602435610b2f816102cd565b3373ffffffffffffffffffffffffffffffffffffffff821603610b5557610018916122f7565b7f6697b232000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610228575f6003193601126102285760206040517f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe08152f35b34610228575f60031936011261022857610bcf612040565b60015460ff811615610c0e5760ff19166001557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b7f8dfc202b000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461022857602060031936011261022857610018600435610c56816102cd565b610c5e612040565b73ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c65416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c655565b34610228575f60031936011261022857610cf5612040565b6004805460ff19166001179055005b346102285760206003193601126102285760043567ffffffffffffffff811161022857610d38610d3f913690600401610589565b369161193d565b602081519101205f526003602052602060ff60405f2054166040519015158152f35b34610228575f60031936011261022857602060ff600154166040519015158152f35b34610228575f6003193601126102285760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b346102285760406003193601126102285760043567ffffffffffffffff811161022857610dee903690600401610589565b906024359167ffffffffffffffff8311610228576104c6610e347f8597445d3e6c82486d8657058b6a42c243329976f148ddd5bede214e979ada96943690600401610589565b610e55610e4236868861193d565b3390610e4f36858761193d565b906123b5565b610e6036828461193d565b602081519101205f52600360205260405f20600160ff19825416179055610e9a604051958695338752606060208801526060870191611622565b918483036040860152611622565b3461022857606060031936011261022857600435610ec5816102cd565b6024359073ffffffffffffffffffffffffffffffffffffffff60443591610eeb836102cd565b610ef3611fb8565b1690813b1561022857606473ffffffffffffffffffffffffffffffffffffffff915f809460405196879586947f23b872dd00000000000000000000000000000000000000000000000000000000865230600487015216602485015260448401525af180156109f357610f6157005b80610f6f5f6100189361173e565b80610acb565b34610228575f60031936011261022857610f8d612040565b610f95611f1c565b600160ff19815416176001557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b34610228575f6003193601126102285760206040517f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e48152f35b3461022857604060031936011261022857600435611024816102cd565b60243590611031826102cd565b611039612040565b60ff600454166110f15773ffffffffffffffffffffffffffffffffffffffff80911691821515806110e6575b61106e906112ff565b825f5260026020526110be8160405f209073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b16907f1acacd74b878778c66cc2abd6987699d6602bfb4b7f244c64c6ed0d61054bb5e5f80a3005b508082161515611065565b7f0657bd51000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461022857604060031936011261022857602060ff61116c602435600435611140826102cd565b5f525f845260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54166040519015158152f35b34610228575f6003193601126102285760206040515f8152f35b34610228576020600319360112610228576100186004356111b2816102cd565b6111ba611f50565b7f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe05f9081526020527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44d5461120d90612150565b612213565b60a06003193601126102285760043561122a816102cd565b60243560443567ffffffffffffffff81116102285761124d903690600401610589565b60649391933567ffffffffffffffff811161022857611270903690600401610589565b916084359567ffffffffffffffff871161022857611295610018973690600401610589565b969095611973565b34610228576040600319360112610228576100186024356004356112c0826102cd565b6112d861094b825f525f602052600160405f20015490565b6122f7565b34610228575f60031936011261022857602060ff600454166040519015158152f35b1561130657565b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b6115cb926114466115d596959373ffffffffffffffffffffffffffffffffffffffff809461135f82841615156112ff565b167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c75416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c75573ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c65416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c655565b167fffffffffffffffffffffffff00000000000000000000000000000000000000007f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c85416177f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4c8555f80527f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4ca60205261150e60405f20674ccccccccccccc007fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000825416179055565b7f8a22373512790c48b83a1fe1c0048e02673acc5986e87a2b0a6a8dd60bb3b4ca6020527f2e2c62dbb7b44281071ae478794b14643fa10a5d0a9fb72d22367cd2e407bca48054674ccccccccccccc007fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009182161790915560015f527fd5c73903e85bbe23080f6182c5a45d3fdebff178f77e8d0a6229766d99744fb680549091166733333333333334001790556115c581611bcd565b50611cb3565b506115c581611d77565b50565b156115e05750565b73ffffffffffffffffffffffffffffffffffffffff907fe7d22c42000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b601f8260209493601f1993818652868601375f8582860101520116010190565b909273ffffffffffffffffffffffffffffffffffffffff6080938161167d989616845216602083015260408201528160608201520191611622565b90565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff8211176116c957604052565b611680565b6060810190811067ffffffffffffffff8211176116c957604052565b60c0810190811067ffffffffffffffff8211176116c957604052565b6020810190811067ffffffffffffffff8211176116c957604052565b6080810190811067ffffffffffffffff8211176116c957604052565b90601f601f19910116810190811067ffffffffffffffff8211176116c957604052565b6040519061177060c08361173e565b565b604051906117706101608361173e565b6040519061177060a08361173e565b67ffffffffffffffff81116116c957601f01601f191660200190565b3d156117d7573d906117be82611791565b916117cc604051938461173e565b82523d5f602084013e565b606090565b156117e45750565b6044602091601f19601f6040519485937ff7a01e4d0000000000000000000000000000000000000000000000000000000085528160048601528051918291826024880152018686015e5f85828601015201168101030190fd5b90816020910312610228575161167d816101fe565b9161185b611fb8565b5f5b82811061186a5750505050565b61189961188061187b8386886121bd565b6121fa565b73ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529190602090839060249082905afa80156109f3576001925f9161190f575b50806118f1575b500161185d565b611909908461190461187b85898b6121bd565b61253f565b5f6118ea565b611930915060203d8111611936575b611928818361173e565b810190612204565b5f6118e3565b503d61191e565b92919261194982611791565b91611957604051938461173e565b829481845281830111610228578281602093845f960137010152565b73ffffffffffffffffffffffffffffffffffffffff90979295969193976119986120c8565b6119a0611f1c565b1693604051967f6352211e000000000000000000000000000000000000000000000000000000008852602088806119df88600483019190602083019252565b0381895afa9788156109f3575f98611a74575b508792611a08611a109593610e4f93369161193d565b92369161193d565b813b15610228575f8094611a55604051978896879586947fb88d4fde000000000000000000000000000000000000000000000000000000008652309060048701611642565b03925af180156109f357611a665750565b80610f6f5f6117709361173e565b611a109492985092611a08611aa4610e4f939560203d602011611ab0575b611a9c818361173e565b810190611ac2565b999395505092906119f2565b503d611a92565b5190611770826102cd565b90816020910312610228575161167d816102cd565b6040513d5f823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c60205260408120805460ff191660011790553391907f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe0907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b505f90565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260408120805460ff191660011790553391907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb560205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4600190565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f10d7f32a6930100c7e03899d583513ff548ac958e569f497049662337b6f49b9602052604090205460ff16611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f10d7f32a6930100c7e03899d583513ff548ac958e569f497049662337b6f49b960205260408120805460ff191660011790553391907f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e4907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b805f525f60205260ff611e918360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b5416611f1657805f525f602052611ec98260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b600160ff1982541617905573ffffffffffffffffffffffffffffffffffffffff339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b60ff60015416611f2857565b7fd93c0665000000000000000000000000000000000000000000000000000000005f5260045ffd5b335f9081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff1615611f8857565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004525f60245260445ffd5b335f9081527f10d7f32a6930100c7e03899d583513ff548ac958e569f497049662337b6f49b9602052604090205460ff1615611ff057565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e460245260445ffd5b335f9081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec602052604090205460ff161561207857565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177560245260445ffd5b335f9081527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c602052604090205460ff161561210057565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f52336004527f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe060245260445ffd5b805f525f60205260ff6121843360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b54161561218e5750565b7fe2517d3f000000000000000000000000000000000000000000000000000000005f523360045260245260445ffd5b91908110156121cd5760051b0190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b3561167d816102cd565b90816020910312610228575190565b73ffffffffffffffffffffffffffffffffffffffff81165f9081527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c602052604090205460ff1615611bc85773ffffffffffffffffffffffffffffffffffffffff165f8181527f9007207a3b80b72f9b075768d90c5ae40a03bd72ef9470e5b7b466be5efda44c60205260408120805460ff191690553391907f97f3b70d16a4958ceb12eca234140cb4138d248ff7c06f9865d3f3fd2892dbe0907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b805f525f60205260ff61232b8360405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b541615611f1657805f525f6020526123648260405f209073ffffffffffffffffffffffffffffffffffffffff165f5260205260405f2090565b60ff19815416905573ffffffffffffffffffffffffffffffffffffffff339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b1561022857565b908151820190602082019260208184031261022857602081015167ffffffffffffffff811161022857019160c09083900312610228576123f3611761565b906124006020840161261e565b825261240e60408401611ab7565b602083015260608301516040830152608083015167ffffffffffffffff8111610228578460206124409286010161262c565b606083015260a083015167ffffffffffffffff8111610228576117709573ffffffffffffffffffffffffffffffffffffffff806125148561250f6124b6612533996124ac60c08d61253a9f6103779f90602061251e9e6124a1930101612c22565b60808501520161261e565b60a0820152612cf1565b604290604051907f190100000000000000000000000000000000000000000000000000000000000082527fe9219848a342180e7e8019a04896ed1f6cd8e25aa953ce64c805ac70fa7d73fe600283015260228201522090565b612cdb565b92169116146123ae565b602081519101205f52600360205260405f2090565b5460ff1690565b6123ae565b916020915f916040519073ffffffffffffffffffffffffffffffffffffffff858301937fa9059cbb00000000000000000000000000000000000000000000000000000000855216602483015260448201526044815261259f60648261173e565b519082855af115611ad7575f513d612615575073ffffffffffffffffffffffffffffffffffffffff81163b155b6125d35750565b73ffffffffffffffffffffffffffffffffffffffff907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b600114156125cc565b51908160070b820361022857565b81601f820112156102285780519061264382611791565b92612651604051948561173e565b8284526020838301011161022857815f9260208093018386015e8301015290565b51908160130b820361022857565b519063ffffffff8216820361022857565b9190826040910312610228576040516126a9816116ad565b60206126c28183956126ba81612680565b855201612680565b910152565b9190826060910312610228576040516126df816116ce565b60408082946126ed81612680565b8452602081015160208501520151910152565b919082604091031261022857604051612718816116ad565b6020808294805184520151910152565b9190610140838203126102285760405190612742826116ea565b819380519167ffffffffffffffff8311610228576101008261276b8360a0966126c2960161262c565b865261277960208201612672565b602087015261278a6040820161261e565b604087015261279c8360608301612691565b60608701526127ad838683016126c7565b608087015201612700565b9190826060910312610228576040516127d0816116ce565b60406126c28183956127e181612680565b85526127ef60208201612672565b602086015201612672565b919082604091031261022857604051612812816116ad565b602080829461282081612680565b84520151910152565b91906040838203126102285761284c6040519161284583611706565b8294612700565b9052565b5190811515820361022857565b919060a083820312610228576040519061287682611722565b8193805167ffffffffffffffff81116102285782612895918301612728565b8352602081015167ffffffffffffffff811161022857810161026081840312610228576128c0611772565b91815183526020820151602084015260408201516040840152606082015167ffffffffffffffff811161022857846128f991840161262c565b606084015261290b8460808401612691565b608084015261291d8460c084016127b8565b60a08401526129308461012084016127fa565b60c08401526101608201519167ffffffffffffffff831161022857846126c29461299e826102208561296b60609b60809a6129b2990161262c565b60e086015261297e836101808301612691565b610100860152612992836101c083016127b8565b610120860152016127fa565b610140820152602088015260408301612829565b604086015201612850565b51908160030b820361022857565b9190826060910312610228576040516129e3816116ce565b604080829480518452602081015160208501520151910152565b808203929160c084126102285760405191612a17836116ad565b60608395126102285760209160606126c292604051612a35816116ce565b612a3e82612850565b8152612a4b8683016129bd565b86820152612a5b604083016129bd565b60408201528652016129cb565b919082602091031261022857604051612a8081611706565b91518252565b91906060838203126102285760405190612a9f826116ce565b819380519167ffffffffffffffff831161022857604082612ac68383966126c2960161262c565b8652612ad58360208301612a68565b602087015201612a68565b91906080838203126102285760405190612af9826116ad565b819380519167ffffffffffffffff831161022857602082612b208383966126c29601612a86565b8652016129cb565b919082608091031261022857604051612b4081611722565b6060808294805184526020810151602085015260408101516040850152015191612b69836102cd565b0152565b919060a0838203126102285760405190612b86826116ad565b819380519167ffffffffffffffff831161022857602082612bad8383966126c29601612728565b865201612b28565b919060c0838203126102285760405190612bce826116ce565b8193805167ffffffffffffffff81116102285782612bed91830161262c565b835260208101519167ffffffffffffffff831161022857604082612c178383966126c29601612a86565b602087015201612b28565b9190916101408184031261022857612c38611782565b92815167ffffffffffffffff81116102285781612c5691840161285d565b8452612c6581602084016129fd565b602085015260e082015167ffffffffffffffff81116102285781612c8a918401612ae0565b604085015261010082015167ffffffffffffffff81116102285781612cb0918401612b6d565b606085015261012082015167ffffffffffffffff811161022857612cd49201612bb5565b6080830152565b61167d91612ce891612fdc565b9092919261304d565b805160070b90612fd673ffffffffffffffffffffffffffffffffffffffff60208301511661069760408401519360608101516020815191012090612f5d60a060808301518051612d4181516133d4565b90612ebb6020820151805190612e49602082015161069760408401519360608101516020815191012090612d7860808201516137c8565b612d848d83015161381c565b612d9160c084015161387f565b60e08401516020815191012091612dac6101008601516137c8565b93612dc9610140612dc161012089015161381c565b97015161387f565b966040519b8c9a60208c019e8f979491926101609996939c9b9a9794919c6101808a019d7febc88669d89a68bc83eee542c09a3d91d8ce9c0af1c90d0ac3f8ff8ade2b9c508b5260208b015260408a01526060890152608088015260a087015260c086015260e08501526101008401526101208301526101408201520152565b519020610697612e696060612e6160408701516134da565b950151151590565b604051948593602085019788926080929594919560a08501967f5f178dbce6f823ba62e942b9f8ac91282fdf80cd2ad6ada0ee71a16dd42f3b1286526020860152604085015260608401521515910152565b51902090612f51612ecf60208301516131a3565b610697612edf604085015161325c565b93612efa6080612ef26060840151613312565b92015161336e565b90604051958694602086019889919260a093969594919660c08401977f5322f0e7ebcd51c97ec5a90f6f72372d960ae06fa718a29977e0970c6cba70aa855260208501526040840152606083015260808201520152565b51902092015160070b90565b9160405196879560208701998a94919273ffffffffffffffffffffffffffffffffffffffff60c0959298979460e08801997fc656dbf48bfae7cacbfe27eb73a9a0e9d54fb5d4a0e0a56c9302f5216de62109895260070b60208901521660408701526060860152608085015260a084015260070b910152565b51902090565b815191906041830361300c576130059250602082015190606060408401519301515f1a90613114565b9192909190565b50505f9160029190565b6004111561302057565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b61305681613016565b8061305f575050565b61306881613016565b60018103613098577ff645eedf000000000000000000000000000000000000000000000000000000005f5260045ffd5b6130a181613016565b600281036130d557507ffce698f7000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b806130e1600392613016565b146130e95750565b7fd78bce0c000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411613198579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa156109f3575f5173ffffffffffffffffffffffffffffffffffffffff81161561318e57905f905f90565b505f906001905f90565b5050505f9160039190565b610697612fd661321860208451805115159060408382015160030b91015160030b60405191848301937fb6800e34595dae872617c5005f10a6a9e2b6a2520654db474bf4750fdd70a0c885526040840152606083015260808201526080815261320d60a08261173e565b519020940151613569565b6040519283916020830195866040909392919360608101947f896dec1198540e9a29dda867832b7bb119f2cec50527c0f5ee63ef305b0f539a825260208201520152565b602061326882516135c0565b91015180516132ca60406020840151930151604051928391602083019560808701927fe17b1ff10b4c0a0b457f201ae45a54a25ec9d424f9f0e068502ea1eab65d6e0e885260208801526040870152606086015203601f19810183528261173e565b5190206040519060208201927fbf8ab0c4189cfff5a6148a64201555fddbb74f69f3c9ed9673c79357a2c7721784526040830152606082015260608152612fd660808261173e565b613329602061332183516133d4565b9201516136a6565b6040519060208201927f12abd614ffecf2dd5f160268162f92b4228cb34287cce8936339e98be3db7a8684526040830152606082015260608152612fd660808261173e565b8051602081519101209061338a604061332160208401516135c0565b6040519160208301937f078cb4adf5687c5d8012b6cf5f2db36f84c7460eeb9ab0150aa07a1d38e72939855260408401526060830152608082015260808152612fd660a08261173e565b80516020815191012090612fd6602082015160130b610697604084015160070b93606081015161069761345b63ffffffff6020818551169401511660405192839160208301958690929163ffffffff6040918160608501967f62a0ad438254a5fc08168ddf3cb49a0b3c0e730e76f4fa785b4df532bc2dafb9865216602085015216910152565b5190209061347960a0613471608084015161371f565b92015161377c565b9160405196879560208701998a9260c094919796959260e08501987faf36b8bda8212b5328e48351dce631ba51b3a66e23916e5bb6bbd603d2d06f088652602086015260130b604085015260070b6060840152608083015260a08201520152565b51602081519101516040519060208201927f3fa522c715dd2d3373663b38d551ef7f7a5beec25a19992cd26eae7d7df394868452604083015260608201526060815261352760808261173e565b51902060405160208101917f35d8f787f18def78c8e6fcafa2acf783916baed9dc692c38b4e8a97c853b74778352604082015260408152612fd660608261173e565b805190604060208201519101516040519160208301937ff512215c27c5930c08d4f9d3f8d89d9b5735fb786bebf2231b3e88df5c4015d9855260408401526060830152608082015260808152612fd660a08261173e565b80516020815191012090612fd66040602083015151815160208101917f0db5bdb29ccc0083eec5fc69273aba7a8fa98c12cb39bfa1377ade34a3b76e4183528382015282815261361160608261173e565b5190209201515160405160208101917ff75b2fc8dbd0e2a1eccdee6280f192941a296b909b47921d1a7c7cfd48993252835260408201526040815261365760608261173e565b5190209161069760405193849260208401968760609194939260808201957f8077238253cf3aae9fc43bae69ede107dc9ecfe05cc3947a0cac4f94212a62238352602083015260408201520152565b80519060208101519073ffffffffffffffffffffffffffffffffffffffff6060604083015192015116906040519260208401947f335b4a1f07e5a10cc856257ff4116d238ebc816eb0189c48ede23eab0ba1b164865260408501526060840152608083015260a082015260a08152612fd660c08261173e565b63ffffffff81511690604060208201519101516040519160208301937fee7cf2600f91b8ddafa790dd184ce3c665f9dc116423525b336e1edac8e07e12855260408401526060830152608082015260808152612fd660a08261173e565b602081519101516040519060208201927f45ae7b1ead003f850829121834fe562edded567cc66a42e8315561c98a7735f984526040830152606082015260608152612fd660808261173e565b63ffffffff602081835116920151166040519060208201927ff5f25bd65589108507b815014b323a5f159027eba9a477039a198a5f7fc368fc84526040830152606082015260608152612fd660808261173e565b63ffffffff815116906040602082015160130b91015160130b6040519160208301937f0a6de33fb4ce9e036ea5aa72e73288d926400e8cc438f63c7c1c84b392c5801c855260408401526060830152608082015260808152612fd660a08261173e565b602063ffffffff8251169101516040519060208201927f2d91584261cab64f66268846e106be0b9e325f19b0457d3be9790bff2e4d925984526040830152606082015260608152612fd660808261173e56fea164736f6c634300081a000a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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