creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/MichiHelper.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"erc6551/interfaces/IERC6551Registry.sol\";\nimport \"tokenbound/src/AccountV3Upgradable.sol\";\nimport \"tokenbound/src/AccountProxy.sol\";\n\nimport \"./interfaces/IMichiWalletNFT.sol\";\n\ncontract MichiHelper is Ownable {\n    using SafeERC20 for IERC20;\n\n    /// @notice instance of Michi Wallet NFT (NFT that represents 6551 wallet)\n    IMichiWalletNFT public michiWalletNFT;\n\n    /// @notice instance of ERC6551 Registry\n    IERC6551Registry public erc6551Registry;\n\n    /// @notice instance of current 6551 wallet implementation\n    address public erc6551Implementation;\n\n    /// @notice instance of current 6551 wallet proxy\n    address public erc6551Proxy;\n\n    /// @notice address that receives fees (if applicable)\n    address public feeReceiver;\n\n    uint256 public depositFee;\n\n    uint256 public feePrecision;\n\n    /// @notice tracks total deposits indexed by user and token\n    mapping(address => mapping(address => uint256)) public depositsByAccountByToken;\n\n    /// @notice tracks total deposits indexed by token\n    mapping(address => uint256) public depositsByToken;\n\n    /// @notice tracks total fees indexed by token\n    mapping(address => uint256) public feesCollectedByToken;\n\n    /// @notice tracks if token is approved to be deposited\n    mapping(address => bool) public approvedToken;\n\n    /// @notice array of approved tokens to be deposited\n    address[] public listApprovedTokens;\n\n    /// @notice emitted when a new wallet NFT is minted and corresponding 6551 wallet is initialized\n    event WalletCreated(address indexed sender, address indexed walletAddress, address nftContract, uint256 tokenId);\n\n    /// @notice emitted when an ERC-6551 wallet receives a deposit\n    event Deposit(\n        address indexed sender,\n        address indexed walletAddress,\n        address indexed token,\n        uint256 amountAfterFees,\n        uint256 feeTaken\n    );\n\n    /// @notice error returned when a user sends an invalid eth amount\n    error InvalidPayableAmount(uint256 amount);\n\n    /// @notice error returned when a user tries to deposit an unauthorized token\n    error UnauthorizedToken(address token);\n\n    /// @notice error returned when depositor is not the owner of 6551 wallet (safety precaution to prevent wrong deposits)\n    error UnauthorizedUser(address user);\n\n    /// @notice error returned when 6551 wallet owner is not sender\n    error OwnerMismatch();\n\n    /// @notice error returned when proposed deposit fee exceeds 5%\n    error InvalidDepositFee(uint256 depositFee);\n\n    /// @notice error returned when proposed fee recipient is zero address\n    error InvalidFeeReceiver(address feeRecipient);\n\n    /// @notice error returned when attempting to add an already approved token\n    error TokenAlreadyApproved(address token);\n\n    /// @notice error returned when attempting to remove an unapproved token\n    error TokenNotApproved(address token);\n\n    /// @notice constructor for MichiHelper contract\n    /// @param erc6551Registry_ address of 6551 registry\n    /// @param erc6551Implementation_ address of current 6551 implementation\n    /// @param erc6551Proxy_ address of current 6551 proxy\n    /// @param michiWalletNFT_ address of MichiWalletNFT ERC721\n    /// @param feeReceiver_ address to receive deposit fees\n    /// @param depositFee_ initial deposit fee\n    /// @param feePrecision_ denominiator for fees\n    constructor(\n        address erc6551Registry_,\n        address erc6551Implementation_,\n        address erc6551Proxy_,\n        address michiWalletNFT_,\n        address feeReceiver_,\n        uint256 depositFee_,\n        uint256 feePrecision_\n    ) {\n        erc6551Registry = IERC6551Registry(erc6551Registry_);\n        erc6551Implementation = erc6551Implementation_;\n        erc6551Proxy = erc6551Proxy_;\n        michiWalletNFT = IMichiWalletNFT(michiWalletNFT_);\n        feeReceiver = feeReceiver_;\n        depositFee = depositFee_;\n        feePrecision = feePrecision_;\n    }\n\n    /// @notice mint MichiWalletNFT, deploy 6551 wallet owned by NFT, and initialize to current implementation\n    /// @param quantity number of NFTs and wallets to setup\n    function createWallet(uint256 quantity) external payable {\n        uint256 mintPrice = michiWalletNFT.getMintPrice();\n        if (msg.value != mintPrice * quantity) revert InvalidPayableAmount(msg.value);\n        for (uint256 i = 0; i < quantity; i++) {\n            uint256 currentIndex = michiWalletNFT.getCurrentIndex();\n            michiWalletNFT.mint{value: mintPrice}(msg.sender);\n            bytes32 salt = bytes32(abi.encode(0));\n            address payable newWallet = payable(\n                erc6551Registry.createAccount(erc6551Proxy, salt, block.chainid, address(michiWalletNFT), currentIndex)\n            );\n            AccountProxy(newWallet).initialize(erc6551Implementation);\n            if (AccountV3Upgradable(newWallet).owner() != msg.sender) revert OwnerMismatch();\n            emit WalletCreated(msg.sender, newWallet, address(michiWalletNFT), currentIndex);\n        }\n    }\n\n    /// @notice deposit a supported token into EERC-6551 wallet\n    /// @param token address of supported token to deposit\n    /// @param walletAddress address of wallet to deposit into\n    /// @param amount token amount of deposit\n    /// @param takeFee boolean to pay a deposit fee\n    function depositToken(address token, address walletAddress, uint256 amount, bool takeFee) external {\n        if (AccountV3Upgradable(payable(walletAddress)).owner() != msg.sender) revert UnauthorizedUser(msg.sender);\n        uint256 fee;\n        if (!approvedToken[token]) revert UnauthorizedToken(token);\n        if (takeFee && depositFee > 0) {\n            fee = amount * depositFee / feePrecision;\n            IERC20(token).safeTransferFrom(msg.sender, feeReceiver, fee);\n            IERC20(token).safeTransferFrom(msg.sender, walletAddress, amount - fee);\n\n            depositsByAccountByToken[walletAddress][token] += amount - fee;\n            depositsByToken[token] += amount - fee;\n            feesCollectedByToken[token] += fee;\n        } else {\n            IERC20(token).safeTransferFrom(msg.sender, walletAddress, amount);\n            depositsByAccountByToken[walletAddress][token] += amount;\n            depositsByToken[token] += amount;\n        }\n\n        emit Deposit(msg.sender, walletAddress, token, amount - fee, fee);\n    }\n\n    function addApprovedToken(address token) external onlyOwner {\n        if (approvedToken[token]) revert TokenAlreadyApproved(token);\n        approvedToken[token] = true;\n        listApprovedTokens.push(token);\n    }\n\n    function removeApprovedToken(address token) external onlyOwner {\n        if (!approvedToken[token]) revert TokenNotApproved(token);\n        approvedToken[token] = false;\n        uint256 arrayLength = listApprovedTokens.length;\n        for (uint256 i = 0; i < arrayLength; i++) {\n            if (listApprovedTokens[i] == token) {\n                listApprovedTokens[i] = listApprovedTokens[arrayLength - 1];\n                listApprovedTokens.pop();\n                break;\n            }\n        }\n    }\n\n    function getApprovedTokens() external view returns (address[] memory) {\n        return listApprovedTokens;\n    }\n\n    function setDepositFee(uint256 newDepositFee) external onlyOwner {\n        if (newDepositFee > 500) revert InvalidDepositFee(newDepositFee);\n        depositFee = newDepositFee;\n    }\n\n    function setFeeReceiver(address newFeeReceiver) external onlyOwner {\n        if (newFeeReceiver == address(0)) revert InvalidFeeReceiver(newFeeReceiver);\n        feeReceiver = newFeeReceiver;\n    }\n\n    function updateImplementation(address newImplementation) external onlyOwner {\n        erc6551Implementation = newImplementation;\n    }\n\n    function updateProxy(address newProxy) external onlyOwner {\n        erc6551Proxy = newProxy;\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(IERC20 token, address spender, uint256 value) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n     * Revert on invalid signature.\n     */\n    function safePermit(\n        IERC20Permit token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return\n            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n    }\n}\n"
      },
      "lib/tokenbound/lib/erc6551/src/interfaces/IERC6551Registry.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC6551Registry {\n    /**\n     * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n     */\n    event ERC6551AccountCreated(\n        address account,\n        address indexed implementation,\n        bytes32 salt,\n        uint256 chainId,\n        address indexed tokenContract,\n        uint256 indexed tokenId\n    );\n\n    /**\n     * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n     */\n    error AccountCreationFailed();\n\n    /**\n     * @dev Creates a token bound account for a non-fungible token.\n     *\n     * If account has already been created, returns the account address without calling create2.\n     *\n     * Emits ERC6551AccountCreated event.\n     *\n     * @return account The address of the token bound account\n     */\n    function createAccount(\n        address implementation,\n        bytes32 salt,\n        uint256 chainId,\n        address tokenContract,\n        uint256 tokenId\n    ) external returns (address account);\n\n    /**\n     * @dev Returns the computed token bound account address for a non-fungible token.\n     *\n     * @return account The address of the token bound account\n     */\n    function account(\n        address implementation,\n        bytes32 salt,\n        uint256 chainId,\n        address tokenContract,\n        uint256 tokenId\n    ) external view returns (address account);\n}\n"
      },
      "lib/tokenbound/src/AccountV3Upgradable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\";\nimport \"./AccountV3.sol\";\n\ncontract AccountV3Upgradable is AccountV3, UUPSUpgradeable {\n    constructor(\n        address entryPoint_,\n        address multicallForwarder,\n        address erc6551Registry,\n        address guardian\n    ) AccountV3(entryPoint_, multicallForwarder, erc6551Registry, guardian) {}\n\n    function _authorizeUpgrade(address implementation) internal virtual override {\n        if (!guardian.isTrustedImplementation(implementation)) revert InvalidImplementation();\n        if (!_isValidExecutor(_msgSender())) revert NotAuthorized();\n    }\n}\n"
      },
      "lib/tokenbound/src/AccountProxy.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\n\nimport \"./interfaces/IAccountGuardian.sol\";\nimport \"./utils/Errors.sol\";\n\ncontract AccountProxy is Proxy, ERC1967Upgrade {\n    address immutable guardian;\n    address immutable initialImplementation;\n\n    constructor(address _guardian, address _initialImplementation) {\n        if (_guardian == address(0) || _initialImplementation == address(0)) {\n            revert InvalidImplementation();\n        }\n        guardian = _guardian;\n        initialImplementation = _initialImplementation;\n    }\n\n    function initialize(address implementation) external {\n        if (implementation != initialImplementation) {\n            if (!IAccountGuardian(guardian).isTrustedImplementation(implementation)) {\n                revert InvalidImplementation();\n            }\n        }\n        if (ERC1967Upgrade._getImplementation() != address(0)) revert AlreadyInitialized();\n        ERC1967Upgrade._upgradeTo(implementation);\n    }\n\n    function _implementation() internal view override returns (address) {\n        return ERC1967Upgrade._getImplementation();\n    }\n}\n"
      },
      "src/interfaces/IMichiWalletNFT.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ninterface IMichiWalletNFT {\n    function getCurrentIndex() external view returns (uint256);\n\n    function getMintPrice() external view returns (uint256);\n\n    function mint(address recipient) external payable;\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade {\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n    address private immutable __self = address(this);\n\n    /**\n     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n     * fail.\n     */\n    modifier onlyProxy() {\n        require(address(this) != __self, \"Function must be called through delegatecall\");\n        require(_getImplementation() == __self, \"Function must be called through active proxy\");\n        _;\n    }\n\n    /**\n     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n     * callable on the implementing contract but not through proxies.\n     */\n    modifier notDelegated() {\n        require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n        _;\n    }\n\n    /**\n     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n     */\n    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n        return _IMPLEMENTATION_SLOT;\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     *\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function upgradeTo(address newImplementation) public virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n     * encoded in `data`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     *\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, data, true);\n    }\n\n    /**\n     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n     * {upgradeTo} and {upgradeToAndCall}.\n     *\n     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n     *\n     * ```solidity\n     * function _authorizeUpgrade(address) internal override onlyOwner {}\n     * ```\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual;\n}\n"
      },
      "lib/tokenbound/src/AccountV3.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\";\n\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\n\nimport \"./abstract/Lockable.sol\";\nimport \"./abstract/Overridable.sol\";\nimport \"./abstract/Permissioned.sol\";\nimport \"./abstract/ERC6551Account.sol\";\nimport \"./abstract/ERC4337Account.sol\";\nimport \"./abstract/execution/TokenboundExecutor.sol\";\n\nimport \"./lib/OPAddressAliasHelper.sol\";\n\nimport \"./interfaces/IAccountGuardian.sol\";\n\n/**\n * @title Tokenbound ERC-6551 Account Implementation\n */\ncontract AccountV3 is\n    ERC721Holder,\n    ERC1155Holder,\n    Lockable,\n    Overridable,\n    Permissioned,\n    ERC6551Account,\n    ERC4337Account,\n    TokenboundExecutor\n{\n    IAccountGuardian immutable guardian;\n\n    /**\n     * @param entryPoint_ The ERC-4337 EntryPoint address\n     * @param multicallForwarder The MulticallForwarder address\n     * @param erc6551Registry The ERC-6551 Registry address\n     * @param _guardian The AccountGuardian address\n     */\n    constructor(\n        address entryPoint_,\n        address multicallForwarder,\n        address erc6551Registry,\n        address _guardian\n    ) ERC4337Account(entryPoint_) TokenboundExecutor(multicallForwarder, erc6551Registry) {\n        guardian = IAccountGuardian(_guardian);\n    }\n\n    /**\n     * @notice Called whenever this account received Ether\n     *\n     * @dev Can be overriden via Overridable\n     */\n    receive() external payable override {\n        _handleOverride();\n    }\n\n    /**\n     * @notice Called whenever the calldata function selector does not match a defined function\n     *\n     * @dev Can be overriden via Overridable\n     */\n    fallback() external payable {\n        _handleOverride();\n    }\n\n    /**\n     * @notice Returns the owner of the token this account is bound to (if available)\n     *\n     * @dev Returns zero address if token is on a foreign chain or token contract does not exist\n     *\n     * @return address The address which owns the token this account is bound to\n     */\n    function owner() public view returns (address) {\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n        return _tokenOwner(chainId, tokenContract, tokenId);\n    }\n\n    /**\n     * @notice Returns whether a given ERC165 interface ID is supported\n     *\n     * @dev Can be overriden via Overridable except for base interfaces.\n     *\n     * @param interfaceId The interface ID to query for\n     * @return bool True if the interface is supported, false otherwise\n     */\n    function supportsInterface(bytes4 interfaceId)\n        public\n        view\n        virtual\n        override(ERC1155Receiver, ERC6551Account, ERC6551Executor)\n        returns (bool)\n    {\n        bool interfaceSupported = super.supportsInterface(interfaceId);\n\n        if (interfaceSupported) return true;\n\n        _handleOverrideStatic();\n\n        return false;\n    }\n\n    /**\n     * @dev called whenever an ERC-721 token is received. Can be overriden via Overridable. Reverts\n     * if token being received is the token the account is bound to.\n     */\n    function onERC721Received(address, address, uint256 tokenId, bytes memory)\n        public\n        virtual\n        override\n        returns (bytes4)\n    {\n        (uint256 chainId, address tokenContract, uint256 _tokenId) = ERC6551AccountLib.token();\n\n        if (msg.sender == tokenContract && tokenId == _tokenId && chainId == block.chainid) {\n            revert OwnershipCycle();\n        }\n\n        _handleOverride();\n\n        return this.onERC721Received.selector;\n    }\n\n    /**\n     * @dev called whenever an ERC-1155 token is received. Can be overriden via Overridable.\n     */\n    function onERC1155Received(address, address, uint256, uint256, bytes memory)\n        public\n        virtual\n        override\n        returns (bytes4)\n    {\n        _handleOverride();\n        return this.onERC1155Received.selector;\n    }\n\n    /**\n     * @dev called whenever a batch of ERC-1155 tokens are received. Can be overriden via Overridable.\n     */\n    function onERC1155BatchReceived(\n        address,\n        address,\n        uint256[] memory,\n        uint256[] memory,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        _handleOverride();\n        return this.onERC1155BatchReceived.selector;\n    }\n\n    /**\n     * @notice Returns whether a given account is authorized to sign on behalf of this account\n     *\n     * @param signer The address to query authorization for\n     * @return True if the signer is valid, false otherwise\n     */\n    function _isValidSigner(address signer, bytes memory)\n        internal\n        view\n        virtual\n        override\n        returns (bool)\n    {\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n\n        // Single level accuont owner is valid signer\n        address _owner = _tokenOwner(chainId, tokenContract, tokenId);\n        if (signer == _owner) return true;\n\n        // Root owner of accuont tree is valid signer\n        address _rootOwner = _rootTokenOwner(_owner, chainId, tokenContract, tokenId);\n        if (signer == _rootOwner) return true;\n\n        // Accounts granted permission by root owner are valid signers\n        return hasPermission(signer, _rootOwner);\n    }\n\n    /**\n     * Determines if a given hash and signature are valid for this account\n     * @param hash Hash of signed data\n     * @param signature ECDSA signature or encoded contract signature (v=0)\n     */\n    function _isValidSignature(bytes32 hash, bytes calldata signature)\n        internal\n        view\n        override(ERC4337Account, Signatory)\n        returns (bool)\n    {\n        uint8 v = uint8(signature[64]);\n        address signer;\n\n        // Smart contract signature\n        if (v == 0) {\n            // Signer address encoded in r\n            signer = address(uint160(uint256(bytes32(signature[:32]))));\n\n            // Allow recursive signature verification\n            if (!_isValidSigner(signer, \"\") && signer != address(this)) {\n                return false;\n            }\n\n            // Signature offset encoded in s\n            bytes calldata _signature = signature[uint256(bytes32(signature[32:64])):];\n\n            return SignatureChecker.isValidERC1271SignatureNow(signer, hash, _signature);\n        }\n\n        ECDSA.RecoverError _error;\n        (signer, _error) = ECDSA.tryRecover(hash, signature);\n\n        if (_error != ECDSA.RecoverError.NoError) return false;\n\n        return _isValidSigner(signer, \"\");\n    }\n\n    /**\n     * @notice Returns whether a given account is authorized to execute transactions on behalf of\n     * this account\n     *\n     * @param executor The address to query authorization for\n     * @return True if the executor is authorized, false otherwise\n     */\n    function _isValidExecutor(address executor) internal view virtual override returns (bool) {\n        // Allow execution from ERC-4337 EntryPoint\n        if (executor == address(entryPoint())) return true;\n\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n\n        // Allow cross chain execution\n        if (chainId != block.chainid) {\n            // Allow execution from L1 account on OPStack chains\n            if (OPAddressAliasHelper.undoL1ToL2Alias(_msgSender()) == address(this)) {\n                return true;\n            }\n\n            // Allow execution from trusted cross chain bridges\n            if (guardian.isTrustedExecutor(executor)) return true;\n        }\n\n        // Allow execution from owner\n        address _owner = _tokenOwner(chainId, tokenContract, tokenId);\n        if (executor == _owner) return true;\n\n        // Allow execution from root owner of account tree\n        address _rootOwner = _rootTokenOwner(_owner, chainId, tokenContract, tokenId);\n        if (executor == _rootOwner) return true;\n\n        // Allow execution from permissioned account\n        if (hasPermission(executor, _rootOwner)) return true;\n\n        return false;\n    }\n\n    /**\n     * @dev Updates account state based on previous state and msg.data\n     */\n    function _updateState() internal virtual {\n        _state = uint256(keccak256(abi.encode(_state, _msgData())));\n    }\n\n    /**\n     * @dev Called before executing an operation. Reverts if account is locked. Ensures state is\n     * updated prior to execution.\n     */\n    function _beforeExecute() internal override {\n        if (isLocked()) revert AccountLocked();\n        _updateState();\n    }\n\n    /**\n     * @dev Called before locking the account. Reverts if account is locked. Updates account state.\n     */\n    function _beforeLock() internal override {\n        if (isLocked()) revert AccountLocked();\n        _updateState();\n    }\n\n    /**\n     * @dev Called before setting overrides on the account. Reverts if account is locked. Updates\n     * account state.\n     */\n    function _beforeSetOverrides() internal override {\n        if (isLocked()) revert AccountLocked();\n        _updateState();\n    }\n\n    /**\n     * @dev Called before setting permissions on the account. Reverts if account is locked. Updates\n     * account state.\n     */\n    function _beforeSetPermissions() internal override {\n        if (isLocked()) revert AccountLocked();\n        _updateState();\n    }\n\n    /**\n     * @dev Returns the root owner of an account. If account is not owned by a TBA, returns the\n     * owner of the NFT bound to this account. If account is owned by a TBA, iterates up token\n     * ownership tree and returns root owner.\n     *\n     * *Security Warning*: the return value of this function can only be trusted if it is also the\n     * address of the sender (as the code of the NFT contract cannot be trusted). This function\n     * should therefore only be used for authorization and never authentication.\n     */\n    function _rootTokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)\n        internal\n        view\n        virtual\n        override(Overridable, Permissioned, Lockable)\n        returns (address)\n    {\n        address _owner = _tokenOwner(chainId, tokenContract, tokenId);\n\n        return _rootTokenOwner(_owner, chainId, tokenContract, tokenId);\n    }\n\n    /**\n     * @dev Returns the root owner of an account given a known account owner address (saves an\n     * additional external call).\n     */\n    function _rootTokenOwner(\n        address owner_,\n        uint256 chainId,\n        address tokenContract,\n        uint256 tokenId\n    ) internal view virtual returns (address) {\n        address _owner = owner_;\n\n        while (ERC6551AccountLib.isERC6551Account(_owner, __self, erc6551Registry)) {\n            (chainId, tokenContract, tokenId) = IERC6551Account(payable(_owner)).token();\n            _owner = _tokenOwner(chainId, tokenContract, tokenId);\n        }\n\n        return _owner;\n    }\n\n    /**\n     * @dev Returns the owner of the token which this account is bound to. Returns the zero address\n     * if token does not exist on the current chain or if the token contract does not exist\n     */\n    function _tokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)\n        internal\n        view\n        virtual\n        returns (address)\n    {\n        if (chainId != block.chainid) return address(0);\n        if (tokenContract.code.length == 0) return address(0);\n\n        try IERC721(tokenContract).ownerOf(tokenId) returns (address _owner) {\n            return _owner;\n        } catch {\n            return address(0);\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Upgrade.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n    // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _getImplementation() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Perform implementation upgrade\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeTo(address newImplementation) internal {\n        _setImplementation(newImplementation);\n        emit Upgraded(newImplementation);\n    }\n\n    /**\n     * @dev Perform implementation upgrade with additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n        _upgradeTo(newImplementation);\n        if (data.length > 0 || forceCall) {\n            Address.functionDelegateCall(newImplementation, data);\n        }\n    }\n\n    /**\n     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n        // Upgrades from old implementations will perform a rollback test. This test requires the new\n        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n        // this special case will break upgrade paths from old UUPS implementation to new ones.\n        if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n            _setImplementation(newImplementation);\n        } else {\n            try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n                require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n            } catch {\n                revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n            }\n            _upgradeToAndCall(newImplementation, data, forceCall);\n        }\n    }\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Returns the current admin.\n     */\n    function _getAdmin() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {AdminChanged} event.\n     */\n    function _changeAdmin(address newAdmin) internal {\n        emit AdminChanged(_getAdmin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n     */\n    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n    /**\n     * @dev Returns the current beacon.\n     */\n    function _getBeacon() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the EIP1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n        require(\n            Address.isContract(IBeacon(newBeacon).implementation()),\n            \"ERC1967: beacon implementation is not a contract\"\n        );\n        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n    }\n\n    /**\n     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n     *\n     * Emits a {BeaconUpgraded} event.\n     */\n    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n        _setBeacon(newBeacon);\n        emit BeaconUpgraded(newBeacon);\n        if (data.length > 0 || forceCall) {\n            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/proxy/Proxy.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n    /**\n     * @dev Delegates the current call to `implementation`.\n     *\n     * This function does not return to its internal call site, it will return directly to the external caller.\n     */\n    function _delegate(address implementation) internal virtual {\n        assembly {\n            // Copy msg.data. We take full control of memory in this inline assembly\n            // block because it will not return to Solidity code. We overwrite the\n            // Solidity scratch pad at memory position 0.\n            calldatacopy(0, 0, calldatasize())\n\n            // Call the implementation.\n            // out and outsize are 0 because we don't know the size yet.\n            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n            // Copy the returned data.\n            returndatacopy(0, 0, returndatasize())\n\n            switch result\n            // delegatecall returns 0 on error.\n            case 0 {\n                revert(0, returndatasize())\n            }\n            default {\n                return(0, returndatasize())\n            }\n        }\n    }\n\n    /**\n     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n     * and {_fallback} should delegate.\n     */\n    function _implementation() internal view virtual returns (address);\n\n    /**\n     * @dev Delegates the current call to the address returned by `_implementation()`.\n     *\n     * This function does not return to its internal call site, it will return directly to the external caller.\n     */\n    function _fallback() internal virtual {\n        _beforeFallback();\n        _delegate(_implementation());\n    }\n\n    /**\n     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n     * function in the contract matches the call data.\n     */\n    fallback() external payable virtual {\n        _fallback();\n    }\n\n    /**\n     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n     * is empty.\n     */\n    receive() external payable virtual {\n        _fallback();\n    }\n\n    /**\n     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n     * call, or as part of the Solidity `fallback` or `receive` functions.\n     *\n     * If overridden should call `super._beforeFallback()`.\n     */\n    function _beforeFallback() internal virtual {}\n}\n"
      },
      "lib/tokenbound/src/interfaces/IAccountGuardian.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ninterface IAccountGuardian {\n    function setTrustedImplementation(address implementation, bool trusted) external;\n\n    function setTrustedExecutor(address executor, bool trusted) external;\n\n    function defaultImplementation() external view returns (address);\n\n    function isTrustedImplementation(address implementation) external view returns (bool);\n\n    function isTrustedExecutor(address implementation) external view returns (bool);\n}\n"
      },
      "lib/tokenbound/src/utils/Errors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nerror InvalidOperation();\nerror ContractCreationFailed();\nerror NotAuthorized();\nerror InvalidInput();\nerror ExceedsMaxLockTime();\nerror AccountLocked();\nerror InvalidAccountProof();\nerror InvalidGuardian();\nerror InvalidImplementation();\nerror AlreadyInitialized();\nerror InvalidEntryPoint();\nerror InvalidMulticallForwarder();\nerror InvalidERC6551Registry();\nerror OwnershipCycle();\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n    /**\n     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n     * address.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy.\n     */\n    function proxiableUUID() external view returns (bytes32);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/cryptography/SignatureChecker.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n    /**\n     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {\n        (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n        return\n            (error == ECDSA.RecoverError.NoError && recovered == signer) ||\n            isValidERC1271SignatureNow(signer, hash, signature);\n    }\n\n    /**\n     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated\n     * against the signer smart contract using ERC1271.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function isValidERC1271SignatureNow(\n        address signer,\n        bytes32 hash,\n        bytes memory signature\n    ) internal view returns (bool) {\n        (bool success, bytes memory result) = signer.staticcall(\n            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n        );\n        return (success &&\n            result.length >= 32 &&\n            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Receiver.sol\";\n\n/**\n * @dev Implementation of the {IERC721Receiver} interface.\n *\n * Accepts all token transfers.\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.\n */\ncontract ERC721Holder is IERC721Receiver {\n    /**\n     * @dev See {IERC721Receiver-onERC721Received}.\n     *\n     * Always returns `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC1155Receiver.sol\";\n\n/**\n * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\n *\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\n * stuck.\n *\n * @dev _Available since v3.1._\n */\ncontract ERC1155Holder is ERC1155Receiver {\n    function onERC1155Received(\n        address,\n        address,\n        uint256,\n        uint256,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155Received.selector;\n    }\n\n    function onERC1155BatchReceived(\n        address,\n        address,\n        uint256[] memory,\n        uint256[] memory,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155BatchReceived.selector;\n    }\n}\n"
      },
      "lib/tokenbound/lib/erc6551/src/lib/ERC6551AccountLib.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Create2.sol\";\nimport \"./ERC6551BytecodeLib.sol\";\n\nlibrary ERC6551AccountLib {\n    function computeAddress(\n        address registry,\n        address _implementation,\n        bytes32 _salt,\n        uint256 chainId,\n        address tokenContract,\n        uint256 tokenId\n    ) internal pure returns (address) {\n        bytes32 bytecodeHash = keccak256(\n            ERC6551BytecodeLib.getCreationCode(\n                _implementation, _salt, chainId, tokenContract, tokenId\n            )\n        );\n\n        return Create2.computeAddress(_salt, bytecodeHash, registry);\n    }\n\n    function isERC6551Account(address account, address expectedImplementation, address registry)\n        internal\n        view\n        returns (bool)\n    {\n        // invalid bytecode size\n        if (account.code.length != 0xAD) return false;\n\n        address _implementation = implementation(account);\n\n        // implementation does not exist\n        if (_implementation.code.length == 0) return false;\n\n        // invalid implementation\n        if (_implementation != expectedImplementation) return false;\n\n        (bytes32 _salt, uint256 chainId, address tokenContract, uint256 tokenId) = context(account);\n\n        return account\n            == computeAddress(registry, _implementation, _salt, chainId, tokenContract, tokenId);\n    }\n\n    function implementation(address account) internal view returns (address _implementation) {\n        assembly {\n            // copy proxy implementation (0x14 bytes)\n            extcodecopy(account, 0xC, 0xA, 0x14)\n            _implementation := mload(0x00)\n        }\n    }\n\n    function implementation() internal view returns (address _implementation) {\n        return implementation(address(this));\n    }\n\n    function token(address account) internal view returns (uint256, address, uint256) {\n        bytes memory encodedData = new bytes(0x60);\n\n        assembly {\n            // copy 0x60 bytes from end of context\n            extcodecopy(account, add(encodedData, 0x20), 0x4d, 0x60)\n        }\n\n        return abi.decode(encodedData, (uint256, address, uint256));\n    }\n\n    function token() internal view returns (uint256, address, uint256) {\n        return token(address(this));\n    }\n\n    function salt(address account) internal view returns (bytes32) {\n        bytes memory encodedData = new bytes(0x20);\n\n        assembly {\n            // copy 0x20 bytes from beginning of context\n            extcodecopy(account, add(encodedData, 0x20), 0x2d, 0x20)\n        }\n\n        return abi.decode(encodedData, (bytes32));\n    }\n\n    function salt() internal view returns (bytes32) {\n        return salt(address(this));\n    }\n\n    function context(address account) internal view returns (bytes32, uint256, address, uint256) {\n        bytes memory encodedData = new bytes(0x80);\n\n        assembly {\n            // copy full context (0x80 bytes)\n            extcodecopy(account, add(encodedData, 0x20), 0x2D, 0x80)\n        }\n\n        return abi.decode(encodedData, (bytes32, uint256, address, uint256));\n    }\n\n    function context() internal view returns (bytes32, uint256, address, uint256) {\n        return context(address(this));\n    }\n}\n"
      },
      "lib/tokenbound/src/abstract/Lockable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\n\nimport \"../utils/Errors.sol\";\n\n/**\n * @title Account Lock\n * @dev Allows the root owner of a token bound account to lock access to an account until a\n * certain timestamp\n */\nabstract contract Lockable {\n    /**\n     * @notice The timestamp at which this account will be unlocked\n     */\n    uint256 public lockedUntil;\n\n    event LockUpdated(uint256 lockedUntil);\n\n    /**\n     * @dev Locks the account until a certain timestamp\n     *\n     * @param _lockedUntil The time at which this account will no longer be locke\n     */\n    function lock(uint256 _lockedUntil) external virtual {\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);\n\n        if (_owner == address(0)) revert NotAuthorized();\n        if (msg.sender != _owner) revert NotAuthorized();\n\n        if (_lockedUntil > block.timestamp + 365 days) {\n            revert ExceedsMaxLockTime();\n        }\n\n        _beforeLock();\n\n        lockedUntil = _lockedUntil;\n\n        emit LockUpdated(_lockedUntil);\n    }\n\n    /**\n     * @dev Returns the current lock status of the account as a boolean\n     */\n    function isLocked() public view virtual returns (bool) {\n        return lockedUntil > block.timestamp;\n    }\n\n    function _rootTokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)\n        internal\n        view\n        virtual\n        returns (address);\n\n    function _beforeLock() internal virtual {}\n}\n"
      },
      "lib/tokenbound/src/abstract/Overridable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\n\nimport \"../utils/Errors.sol\";\nimport \"../lib/LibSandbox.sol\";\n\n/**\n * @title Account Overrides\n * @dev Allows the root owner of a token bound account to override the implementation of a given\n * function selector on the account. Overrides are keyed by the root owner address, so will be\n * disabled upon transfer of the token which owns this account tree.\n */\nabstract contract Overridable {\n    /**\n     * @dev mapping from owner => selector => implementation\n     */\n    mapping(address => mapping(bytes4 => address)) public overrides;\n\n    event OverrideUpdated(address owner, bytes4 selector, address implementation);\n\n    /**\n     * @dev Sets the implementation address for a given array of function selectors. Can only be\n     * called by the root owner of the account\n     *\n     * @param selectors Array of selectors to override\n     * @param implementations Array of implementation address corresponding to selectors\n     */\n    function setOverrides(bytes4[] calldata selectors, address[] calldata implementations)\n        external\n        virtual\n    {\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);\n\n        if (_owner == address(0)) revert NotAuthorized();\n        if (msg.sender != _owner) revert NotAuthorized();\n\n        _beforeSetOverrides();\n\n        address sandbox = LibSandbox.sandbox(address(this));\n        if (sandbox.code.length == 0) LibSandbox.deploy(address(this));\n\n        uint256 length = selectors.length;\n\n        if (implementations.length != length) revert InvalidInput();\n\n        for (uint256 i = 0; i < length; i++) {\n            overrides[_owner][selectors[i]] = implementations[i];\n            emit OverrideUpdated(_owner, selectors[i], implementations[i]);\n        }\n    }\n\n    /**\n     * @dev Calls into the implementation address using sandbox if override is set for the current\n     * function selector. If an implementation is defined, this funciton will either revert or\n     * return with the return value of the implementation\n     */\n    function _handleOverride() internal virtual {\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);\n\n        address implementation = overrides[_owner][msg.sig];\n\n        if (implementation != address(0)) {\n            address sandbox = LibSandbox.sandbox(address(this));\n            (bool success, bytes memory result) =\n                sandbox.call(abi.encodePacked(implementation, msg.data, msg.sender));\n            assembly {\n                if iszero(success) { revert(add(result, 32), mload(result)) }\n                return(add(result, 32), mload(result))\n            }\n        }\n    }\n\n    /**\n     * @dev Static calls into the implementation addressif override is set for the current function\n     * selector. If an implementation is defined, this funciton will either revert or return with\n     * the return value of the implementation\n     */\n    function _handleOverrideStatic() internal view virtual {\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);\n\n        address implementation = overrides[_owner][msg.sig];\n\n        if (implementation != address(0)) {\n            (bool success, bytes memory result) = implementation.staticcall(msg.data);\n            assembly {\n                if iszero(success) { revert(add(result, 32), mload(result)) }\n                return(add(result, 32), mload(result))\n            }\n        }\n    }\n\n    function _beforeSetOverrides() internal virtual {}\n\n    function _rootTokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)\n        internal\n        view\n        virtual\n        returns (address);\n}\n"
      },
      "lib/tokenbound/src/abstract/Permissioned.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\nimport \"../utils/Errors.sol\";\n\n/**\n * @title Account Permissions\n * @dev Allows the root owner of a token bound account to allow another account to execute\n * operations from this account. Permissions are keyed by the root owner address, so will be\n * disabled upon transfer of the token which owns this account tree.\n */\nabstract contract Permissioned {\n    /**\n     * @dev mapping from owner => caller => has permissions\n     */\n    mapping(address => mapping(address => bool)) public permissions;\n\n    event PermissionUpdated(address owner, address caller, bool hasPermission);\n\n    /**\n     * @dev Grants or revokes execution permissions for a given array of callers on this account.\n     * Can only be called by the root owner of the account\n     *\n     * @param callers Array of callers to grant permissions to\n     * @param _permissions Array of booleans, true if execution permissions should be granted,\n     * false if permissions should be revoked\n     */\n    function setPermissions(address[] calldata callers, bool[] calldata _permissions)\n        external\n        virtual\n    {\n        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);\n\n        if (_owner == address(0)) revert NotAuthorized();\n        if (msg.sender != _owner) revert NotAuthorized();\n\n        _beforeSetPermissions();\n\n        uint256 length = callers.length;\n\n        if (_permissions.length != length) revert InvalidInput();\n\n        for (uint256 i = 0; i < length; i++) {\n            permissions[_owner][callers[i]] = _permissions[i];\n            emit PermissionUpdated(_owner, callers[i], _permissions[i]);\n        }\n    }\n\n    /**\n     * @dev Returns true if caller has permissions to act on behalf of owner\n     *\n     * @param caller Address to query permissions for\n     * @param owner Root owner address for which to query permissions\n     */\n    function hasPermission(address caller, address owner) internal view returns (bool) {\n        return permissions[owner][caller];\n    }\n\n    function _beforeSetPermissions() internal virtual {}\n\n    function _rootTokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)\n        internal\n        view\n        virtual\n        returns (address);\n}\n"
      },
      "lib/tokenbound/src/abstract/ERC6551Account.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\nimport \"erc6551/interfaces/IERC6551Account.sol\";\n\nimport \"./Signatory.sol\";\n\n/**\n * @title ERC-6551 Account Support\n * @dev Implements the ERC-6551 Account interface\n */\nabstract contract ERC6551Account is IERC6551Account, ERC165, Signatory {\n    uint256 _state;\n\n    receive() external payable virtual {}\n\n    /**\n     * @dev See: {IERC6551Account-isValidSigner}\n     */\n    function isValidSigner(address signer, bytes calldata data)\n        external\n        view\n        returns (bytes4 magicValue)\n    {\n        if (_isValidSigner(signer, data)) {\n            return IERC6551Account.isValidSigner.selector;\n        }\n\n        return bytes4(0);\n    }\n\n    /**\n     * @dev See: {IERC6551Account-token}\n     */\n    function token()\n        public\n        view\n        returns (uint256 chainId, address tokenContract, uint256 tokenId)\n    {\n        return ERC6551AccountLib.token();\n    }\n\n    /**\n     * @dev See: {IERC6551Account-state}\n     */\n    function state() public view returns (uint256) {\n        return _state;\n    }\n\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return\n            interfaceId == type(IERC6551Account).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns true if a given signer is authorized to use this account\n     */\n    function _isValidSigner(address signer, bytes memory) internal view virtual returns (bool);\n}\n"
      },
      "lib/tokenbound/src/abstract/ERC4337Account.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport {IEntryPoint} from \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport {UserOperation} from \"account-abstraction/interfaces/UserOperation.sol\";\nimport {BaseAccount as BaseERC4337Account} from \"account-abstraction/core/BaseAccount.sol\";\n\nimport \"../utils/Errors.sol\";\n\n/**\n * @title ERC-4337 Support\n * @dev Implements ERC-4337 account support\n */\nabstract contract ERC4337Account is BaseERC4337Account {\n    using ECDSA for bytes32;\n\n    IEntryPoint immutable _entryPoint;\n\n    constructor(address entryPoint_) {\n        if (entryPoint_ == address(0)) revert InvalidEntryPoint();\n        _entryPoint = IEntryPoint(entryPoint_);\n    }\n\n    /**\n     * @dev See {BaseERC4337Account-entryPoint}\n     */\n    function entryPoint() public view override returns (IEntryPoint) {\n        return _entryPoint;\n    }\n\n    /**\n     * @dev See {BaseERC4337Account-_validateSignature}\n     */\n    function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)\n        internal\n        view\n        virtual\n        override\n        returns (uint256)\n    {\n        if (_isValidSignature(_getUserOpSignatureHash(userOp, userOpHash), userOp.signature)) {\n            return 0;\n        }\n\n        return 1;\n    }\n\n    /**\n     * @dev Returns the user operation hash that should be signed by the account owner\n     */\n    function _getUserOpSignatureHash(UserOperation calldata, bytes32 userOpHash)\n        internal\n        view\n        virtual\n        returns (bytes32)\n    {\n        return userOpHash.toEthSignedMessageHash();\n    }\n\n    function _isValidSignature(bytes32 hash, bytes calldata signature)\n        internal\n        view\n        virtual\n        returns (bool);\n}\n"
      },
      "lib/tokenbound/src/abstract/execution/TokenboundExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/metatx/ERC2771Context.sol\";\n\nimport \"erc6551/interfaces/IERC6551Executable.sol\";\nimport \"erc6551/interfaces/IERC6551Account.sol\";\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\n\nimport \"../../utils/Errors.sol\";\nimport \"../../lib/LibExecutor.sol\";\nimport \"../../lib/LibSandbox.sol\";\nimport \"./ERC6551Executor.sol\";\nimport \"./BatchExecutor.sol\";\nimport \"./NestedAccountExecutor.sol\";\n\n/**\n * @title Tokenbound Executor\n * @dev Enables basic ERC-6551 execution as well as batch, nested, and mult-account execution\n */\nabstract contract TokenboundExecutor is\n    ERC6551Executor,\n    BatchExecutor,\n    NestedAccountExecutor,\n    ERC2771Context\n{\n    constructor(address multicallForwarder, address _erc6551Registry)\n        ERC2771Context(multicallForwarder)\n        NestedAccountExecutor(_erc6551Registry)\n    {\n        if (multicallForwarder == address(0)) revert InvalidMulticallForwarder();\n    }\n\n    function _msgSender()\n        internal\n        view\n        virtual\n        override(Context, ERC2771Context)\n        returns (address sender)\n    {\n        return super._msgSender();\n    }\n\n    function _msgData()\n        internal\n        view\n        virtual\n        override(Context, ERC2771Context)\n        returns (bytes calldata)\n    {\n        return super._msgData();\n    }\n}\n"
      },
      "lib/tokenbound/src/lib/OPAddressAliasHelper.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\n// Source: https://github.com/ethereum-optimism/optimism/blob/96562692558e5c3851899488bcebe51fbe3b7f09/packages/contracts-bedrock/src/vendor/AddressAliasHelper.sol\nlibrary OPAddressAliasHelper {\n    uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);\n\n    /// @notice Utility function that converts the address in the L1 that submitted a tx to\n    /// the inbox to the msg.sender viewed in the L2\n    /// @param l1Address the address in the L1 that triggered the tx to L2\n    /// @return l2Address L2 address as viewed in msg.sender\n    function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n        unchecked {\n            l2Address = address(uint160(l1Address) + offset);\n        }\n    }\n\n    /// @notice Utility function that converts the msg.sender viewed in the L2 to the\n    /// address in the L1 that submitted a tx to the inbox\n    /// @param l2Address L2 address as viewed in msg.sender\n    /// @return l1Address the address in the L1 that triggered the tx to L2\n    function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {\n        unchecked {\n            l1Address = address(uint160(l2Address) - offset);\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {BeaconProxy} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     */\n    event Upgraded(address indexed implementation);\n\n    /**\n     * @dev Emitted when the admin account has changed.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Emitted when the beacon is changed.\n     */\n    event BeaconUpgraded(address indexed beacon);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS,\n        InvalidSignatureV // Deprecated in v4.8\n    }\n\n    function _throwError(RecoverError error) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert(\"ECDSA: invalid signature\");\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert(\"ECDSA: invalid signature length\");\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert(\"ECDSA: invalid signature 's' value\");\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature` or error string. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength);\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, signature);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n        uint8 v = uint8((uint256(vs) >> 255) + 27);\n        return tryRecover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     *\n     * _Available since v4.2._\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature);\n        }\n\n        return (signer, RecoverError.NoError);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n            mstore(0x1c, hash)\n            message := keccak256(0x00, 0x3c)\n        }\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(ptr, \"\\x19\\x01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            data := keccak256(ptr, 0x42)\n        }\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Data with intended validator, created from a\n     * `validator` and `data` according to the version 0 of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n    /**\n     * @dev Should return whether the signature provided is valid for the provided data\n     * @param hash      Hash of the data to be signed\n     * @param signature Signature byte array associated with _data\n     */\n    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/Create2.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n    /**\n     * @dev Deploys a contract using `CREATE2`. The address where the contract\n     * will be deployed can be known in advance via {computeAddress}.\n     *\n     * The bytecode for a contract can be obtained from Solidity with\n     * `type(contractName).creationCode`.\n     *\n     * Requirements:\n     *\n     * - `bytecode` must not be empty.\n     * - `salt` must have not been used for `bytecode` already.\n     * - the factory must have a balance of at least `amount`.\n     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n     */\n    function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\n        require(address(this).balance >= amount, \"Create2: insufficient balance\");\n        require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n        /// @solidity memory-safe-assembly\n        assembly {\n            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n        }\n        require(addr != address(0), \"Create2: Failed on deploy\");\n    }\n\n    /**\n     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n     * `bytecodeHash` or `salt` will result in a new destination address.\n     */\n    function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n        return computeAddress(salt, bytecodeHash, address(this));\n    }\n\n    /**\n     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n     */\n    function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40) // Get free memory pointer\n\n            // |                   | ↓ ptr ...  ↓ ptr + 0x0B (start) ...  ↓ ptr + 0x20 ...  ↓ ptr + 0x40 ...   |\n            // |-------------------|---------------------------------------------------------------------------|\n            // | bytecodeHash      |                                                        CCCCCCCCCCCCC...CC |\n            // | salt              |                                      BBBBBBBBBBBBB...BB                   |\n            // | deployer          | 000000...0000AAAAAAAAAAAAAAAAAAA...AA                                     |\n            // | 0xFF              |            FF                                                             |\n            // |-------------------|---------------------------------------------------------------------------|\n            // | memory            | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n            // | keccak(start, 85) |            ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n            mstore(add(ptr, 0x40), bytecodeHash)\n            mstore(add(ptr, 0x20), salt)\n            mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n            let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n            mstore8(start, 0xff)\n            addr := keccak256(start, 85)\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/erc6551/src/lib/ERC6551BytecodeLib.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary ERC6551BytecodeLib {\n    /**\n     * @dev Returns the creation code of the token bound account for a non-fungible token.\n     *\n     * @return result The creation code of the token bound account\n     */\n    function getCreationCode(\n        address implementation,\n        bytes32 salt,\n        uint256 chainId,\n        address tokenContract,\n        uint256 tokenId\n    ) internal pure returns (bytes memory result) {\n        assembly {\n            result := mload(0x40) // Grab the free memory pointer\n            // Layout the variables and bytecode backwards\n            mstore(add(result, 0xb7), tokenId)\n            mstore(add(result, 0x97), shr(96, shl(96, tokenContract)))\n            mstore(add(result, 0x77), chainId)\n            mstore(add(result, 0x57), salt)\n            mstore(add(result, 0x37), 0x5af43d82803e903d91602b57fd5bf3)\n            mstore(add(result, 0x28), implementation)\n            mstore(add(result, 0x14), 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73)\n            mstore(result, 0xb7) // Store the length\n            mstore(0x40, add(result, 0xd7)) // Allocate the memory\n        }\n    }\n\n    /**\n     * @dev Returns the create2 address computed from `salt`, `bytecodeHash`, `deployer`.\n     *\n     * @return result The create2 address computed from `salt`, `bytecodeHash`, `deployer`\n     */\n    function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer)\n        internal\n        pure\n        returns (address result)\n    {\n        assembly {\n            result := mload(0x40) // Grab the free memory pointer\n            mstore8(result, 0xff)\n            mstore(add(result, 0x35), bytecodeHash)\n            mstore(add(result, 0x01), shl(96, deployer))\n            mstore(add(result, 0x15), salt)\n            result := keccak256(result, 0x55)\n        }\n    }\n}\n"
      },
      "lib/tokenbound/src/lib/LibSandbox.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"openzeppelin-contracts/contracts/utils/Create2.sol\";\n\nlibrary LibSandbox {\n    bytes public constant header = hex\"604380600d600039806000f3fe73\";\n    bytes public constant footer =\n        hex\"3314601d573d3dfd5b363d3d373d3d6014360360143d5160601c5af43d6000803e80603e573d6000fd5b3d6000f3\";\n\n    function bytecode(address owner) internal pure returns (bytes memory) {\n        return abi.encodePacked(header, owner, footer);\n    }\n\n    function sandbox(address owner) internal view returns (address) {\n        return\n            Create2.computeAddress(keccak256(\"org.tokenbound.sandbox\"), keccak256(bytecode(owner)));\n    }\n\n    function deploy(address owner) internal {\n        Create2.deploy(0, keccak256(\"org.tokenbound.sandbox\"), bytecode(owner));\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "lib/tokenbound/lib/erc6551/src/interfaces/IERC6551Account.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @dev the ERC-165 identifier for this interface is `0x6faff5f1`\ninterface IERC6551Account {\n    /**\n     * @dev Allows the account to receive Ether.\n     *\n     * Accounts MUST implement a `receive` function.\n     *\n     * Accounts MAY perform arbitrary logic to restrict conditions\n     * under which Ether can be received.\n     */\n    receive() external payable;\n\n    /**\n     * @dev Returns the identifier of the non-fungible token which owns the account.\n     *\n     * The return value of this function MUST be constant - it MUST NOT change over time.\n     *\n     * @return chainId       The EIP-155 ID of the chain the token exists on\n     * @return tokenContract The contract address of the token\n     * @return tokenId       The ID of the token\n     */\n    function token()\n        external\n        view\n        returns (uint256 chainId, address tokenContract, uint256 tokenId);\n\n    /**\n     * @dev Returns a value that SHOULD be modified each time the account changes state.\n     *\n     * @return The current account state\n     */\n    function state() external view returns (uint256);\n\n    /**\n     * @dev Returns a magic value indicating whether a given signer is authorized to act on behalf\n     * of the account.\n     *\n     * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid.\n     *\n     * By default, the holder of the non-fungible token the account is bound to MUST be considered\n     * a valid signer.\n     *\n     * Accounts MAY implement additional authorization logic which invalidates the holder as a\n     * signer or grants signing permissions to other non-holder accounts.\n     *\n     * @param  signer     The address to check signing authorization for\n     * @param  context    Additional data used to determine whether the signer is valid\n     * @return magicValue Magic value indicating whether the signer is valid\n     */\n    function isValidSigner(address signer, bytes calldata context)\n        external\n        view\n        returns (bytes4 magicValue);\n}\n"
      },
      "lib/tokenbound/src/abstract/Signatory.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\n\n/**\n * @title Signatory\n * @dev Implements ERC-1271 signature verification\n */\nabstract contract Signatory is IERC1271 {\n    /**\n     * @dev See {IERC1721-isValidSignature}\n     */\n    function isValidSignature(bytes32 hash, bytes calldata signature)\n        external\n        view\n        returns (bytes4 magicValue)\n    {\n        if (_isValidSignature(hash, signature)) {\n            return IERC1271.isValidSignature.selector;\n        }\n\n        return bytes4(0);\n    }\n\n    function _isValidSignature(bytes32 hash, bytes calldata signature)\n        internal\n        view\n        virtual\n        returns (bool);\n}\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/interfaces/IEntryPoint.sol": {
        "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./UserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\n\n    /***\n     * An event emitted after each successful request\n     * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\n     * @param sender - the account that generates this request.\n     * @param paymaster - if non-null, the paymaster that pays for this request.\n     * @param nonce - the nonce value from the request.\n     * @param success - true if the sender transaction succeeded, false if reverted.\n     * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\n     * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\n     */\n    event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\n\n    /**\n     * account \"sender\" was deployed.\n     * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\n     * @param sender the account that is deployed\n     * @param factory the factory used to deploy this account (in the initCode)\n     * @param paymaster the paymaster used by this UserOp\n     */\n    event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\n\n    /**\n     * An event emitted if the UserOperation \"callData\" reverted with non-zero length\n     * @param userOpHash the request unique identifier.\n     * @param sender the sender of this request\n     * @param nonce the nonce used in the request\n     * @param revertReason - the return bytes from the (reverted) call to \"callData\".\n     */\n    event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\n\n    /**\n     * an event emitted by handleOps(), before starting the execution loop.\n     * any event emitted before this event, is part of the validation.\n     */\n    event BeforeExecution();\n\n    /**\n     * signature aggregator used by the following UserOperationEvents within this bundle.\n     */\n    event SignatureAggregatorChanged(address indexed aggregator);\n\n    /**\n     * a custom revert error of handleOps, to identify the offending op.\n     *  NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\n     *  @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\n     *  @param reason - revert reason\n     *      The string starts with a unique code \"AAmn\", where \"m\" is \"1\" for factory, \"2\" for account and \"3\" for paymaster issues,\n     *      so a failure can be attributed to the correct entity.\n     *   Should be caught in off-chain handleOps simulation and not happen on-chain.\n     *   Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\n     */\n    error FailedOp(uint256 opIndex, string reason);\n\n    /**\n     * error case when a signature aggregator fails to verify the aggregated signature it had created.\n     */\n    error SignatureValidationFailed(address aggregator);\n\n    /**\n     * Successful result from simulateValidation.\n     * @param returnInfo gas and time-range returned values\n     * @param senderInfo stake information about the sender\n     * @param factoryInfo stake information about the factory (if any)\n     * @param paymasterInfo stake information about the paymaster (if any)\n     */\n    error ValidationResult(ReturnInfo returnInfo,\n        StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\n\n    /**\n     * Successful result from simulateValidation, if the account returns a signature aggregator\n     * @param returnInfo gas and time-range returned values\n     * @param senderInfo stake information about the sender\n     * @param factoryInfo stake information about the factory (if any)\n     * @param paymasterInfo stake information about the paymaster (if any)\n     * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\n     *      bundler MUST use it to verify the signature, or reject the UserOperation\n     */\n    error ValidationResultWithAggregation(ReturnInfo returnInfo,\n        StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\n        AggregatorStakeInfo aggregatorInfo);\n\n    /**\n     * return value of getSenderAddress\n     */\n    error SenderAddressResult(address sender);\n\n    /**\n     * return value of simulateHandleOp\n     */\n    error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\n\n    //UserOps handled, per aggregator\n    struct UserOpsPerAggregator {\n        UserOperation[] userOps;\n\n        // aggregator address\n        IAggregator aggregator;\n        // aggregated signature\n        bytes signature;\n    }\n\n    /**\n     * Execute a batch of UserOperation.\n     * no signature aggregator is used.\n     * if any account requires an aggregator (that is, it returned an aggregator when\n     * performing simulateValidation), then handleAggregatedOps() must be used instead.\n     * @param ops the operations to execute\n     * @param beneficiary the address to receive the fees\n     */\n    function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\n\n    /**\n     * Execute a batch of UserOperation with Aggregators\n     * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\n     * @param beneficiary the address to receive the fees\n     */\n    function handleAggregatedOps(\n        UserOpsPerAggregator[] calldata opsPerAggregator,\n        address payable beneficiary\n    ) external;\n\n    /**\n     * generate a request Id - unique identifier for this request.\n     * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n     */\n    function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\n\n    /**\n     * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n     * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n     * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n     * @param userOp the user operation to validate.\n     */\n    function simulateValidation(UserOperation calldata userOp) external;\n\n    /**\n     * gas and return values during simulation\n     * @param preOpGas the gas used for validation (including preValidationGas)\n     * @param prefund the required prefund for this operation\n     * @param sigFailed validateUserOp's (or paymaster's) signature check failed\n     * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\n     * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\n     * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\n     */\n    struct ReturnInfo {\n        uint256 preOpGas;\n        uint256 prefund;\n        bool sigFailed;\n        uint48 validAfter;\n        uint48 validUntil;\n        bytes paymasterContext;\n    }\n\n    /**\n     * returned aggregated signature info.\n     * the aggregator returned by the account, and its current stake.\n     */\n    struct AggregatorStakeInfo {\n        address aggregator;\n        StakeInfo stakeInfo;\n    }\n\n    /**\n     * Get counterfactual sender address.\n     *  Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n     * this method always revert, and returns the address in SenderAddressResult error\n     * @param initCode the constructor code to be passed into the UserOperation.\n     */\n    function getSenderAddress(bytes memory initCode) external;\n\n\n    /**\n     * simulate full execution of a UserOperation (including both validation and target execution)\n     * this method will always revert with \"ExecutionResult\".\n     * it performs full validation of the UserOperation, but ignores signature error.\n     * an optional target address is called after the userop succeeds, and its value is returned\n     * (before the entire call is reverted)\n     * Note that in order to collect the the success/failure of the target call, it must be executed\n     * with trace enabled to track the emitted events.\n     * @param op the UserOperation to simulate\n     * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\n     *        are set to the return from that call.\n     * @param targetCallData callData to pass to target address\n     */\n    function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\n}\n\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/interfaces/UserOperation.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\nimport {calldataKeccak} from \"../core/Helpers.sol\";\n\n/**\n * User Operation struct\n * @param sender the sender account of this request.\n     * @param nonce unique value the sender uses to verify it is not a replay.\n     * @param initCode if set, the account contract will be created by this constructor/\n     * @param callData the method call to execute on this account.\n     * @param callGasLimit the gas limit passed to the callData method call.\n     * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\n     * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\n     * @param maxFeePerGas same as EIP-1559 gas parameter.\n     * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\n     * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\n     * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n     */\n    struct UserOperation {\n\n        address sender;\n        uint256 nonce;\n        bytes initCode;\n        bytes callData;\n        uint256 callGasLimit;\n        uint256 verificationGasLimit;\n        uint256 preVerificationGas;\n        uint256 maxFeePerGas;\n        uint256 maxPriorityFeePerGas;\n        bytes paymasterAndData;\n        bytes signature;\n    }\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n    function getSender(UserOperation calldata userOp) internal pure returns (address) {\n        address data;\n        //read sender from userOp, which is first userOp member (saves 800 gas...)\n        assembly {data := calldataload(userOp)}\n        return address(uint160(data));\n    }\n\n    //relayer/block builder might submit the TX with higher priorityFee, but the user should not\n    // pay above what he signed for.\n    function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\n    unchecked {\n        uint256 maxFeePerGas = userOp.maxFeePerGas;\n        uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n        if (maxFeePerGas == maxPriorityFeePerGas) {\n            //legacy mode (for networks that don't support basefee opcode)\n            return maxFeePerGas;\n        }\n        return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n    }\n    }\n\n    function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\n        address sender = getSender(userOp);\n        uint256 nonce = userOp.nonce;\n        bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n        bytes32 hashCallData = calldataKeccak(userOp.callData);\n        uint256 callGasLimit = userOp.callGasLimit;\n        uint256 verificationGasLimit = userOp.verificationGasLimit;\n        uint256 preVerificationGas = userOp.preVerificationGas;\n        uint256 maxFeePerGas = userOp.maxFeePerGas;\n        uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n        bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n        return abi.encode(\n            sender, nonce,\n            hashInitCode, hashCallData,\n            callGasLimit, verificationGasLimit, preVerificationGas,\n            maxFeePerGas, maxPriorityFeePerGas,\n            hashPaymasterAndData\n        );\n    }\n\n    function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\n        return keccak256(pack(userOp));\n    }\n\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n}\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/core/BaseAccount.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-empty-blocks */\n\nimport \"../interfaces/IAccount.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\nimport \"./Helpers.sol\";\n\n/**\n * Basic account implementation.\n * this contract provides the basic logic for implementing the IAccount interface  - validateUserOp\n * specific account implementation should inherit it and provide the account-specific logic\n */\nabstract contract BaseAccount is IAccount {\n    using UserOperationLib for UserOperation;\n\n    //return value in case of signature failure, with no time-range.\n    // equivalent to _packValidationData(true,0,0);\n    uint256 constant internal SIG_VALIDATION_FAILED = 1;\n\n    /**\n     * Return the account nonce.\n     * This method returns the next sequential nonce.\n     * For a nonce of a specific key, use `entrypoint.getNonce(account, key)`\n     */\n    function getNonce() public view virtual returns (uint256) {\n        return entryPoint().getNonce(address(this), 0);\n    }\n\n    /**\n     * return the entryPoint used by this account.\n     * subclass should return the current entryPoint used by this account.\n     */\n    function entryPoint() public view virtual returns (IEntryPoint);\n\n    /**\n     * Validate user's signature and nonce.\n     * subclass doesn't need to override this method. Instead, it should override the specific internal validation methods.\n     */\n    function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n    external override virtual returns (uint256 validationData) {\n        _requireFromEntryPoint();\n        validationData = _validateSignature(userOp, userOpHash);\n        _validateNonce(userOp.nonce);\n        _payPrefund(missingAccountFunds);\n    }\n\n    /**\n     * ensure the request comes from the known entrypoint.\n     */\n    function _requireFromEntryPoint() internal virtual view {\n        require(msg.sender == address(entryPoint()), \"account: not from EntryPoint\");\n    }\n\n    /**\n     * validate the signature is valid for this message.\n     * @param userOp validate the userOp.signature field\n     * @param userOpHash convenient field: the hash of the request, to check the signature against\n     *          (also hashes the entrypoint and chain id)\n     * @return validationData signature and time-range of this operation\n     *      <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n     *         otherwise, an address of an \"authorizer\" contract.\n     *      <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n     *      <6-byte> validAfter - first timestamp this operation is valid\n     *      If the account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n     *      Note that the validation code cannot use block.timestamp (or block.number) directly.\n     */\n    function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)\n    internal virtual returns (uint256 validationData);\n\n    /**\n     * Validate the nonce of the UserOperation.\n     * This method may validate the nonce requirement of this account.\n     * e.g.\n     * To limit the nonce to use sequenced UserOps only (no \"out of order\" UserOps):\n     *      `require(nonce < type(uint64).max)`\n     * For a hypothetical account that *requires* the nonce to be out-of-order:\n     *      `require(nonce & type(uint64).max == 0)`\n     *\n     * The actual nonce uniqueness is managed by the EntryPoint, and thus no other\n     * action is needed by the account itself.\n     *\n     * @param nonce to validate\n     *\n     * solhint-disable-next-line no-empty-blocks\n     */\n    function _validateNonce(uint256 nonce) internal view virtual {\n    }\n\n    /**\n     * sends to the entrypoint (msg.sender) the missing funds for this transaction.\n     * subclass MAY override this method for better funds management\n     * (e.g. send to the entryPoint more than the minimum required, so that in future transactions\n     * it will not be required to send again)\n     * @param missingAccountFunds the minimum value this method should send the entrypoint.\n     *  this value MAY be zero, in case there is enough deposit, or the userOp has a paymaster.\n     */\n    function _payPrefund(uint256 missingAccountFunds) internal virtual {\n        if (missingAccountFunds != 0) {\n            (bool success,) = payable(msg.sender).call{value : missingAccountFunds, gas : type(uint256).max}(\"\");\n            (success);\n            //ignore failure (its EntryPoint's job to verify, not account.)\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (metatx/ERC2771Context.sol)\n\npragma solidity ^0.8.9;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Context variant with ERC2771 support.\n */\nabstract contract ERC2771Context is Context {\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    address private immutable _trustedForwarder;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor(address trustedForwarder) {\n        _trustedForwarder = trustedForwarder;\n    }\n\n    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n        return forwarder == _trustedForwarder;\n    }\n\n    function _msgSender() internal view virtual override returns (address sender) {\n        if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n            // The assembly code is more direct than the Solidity version using `abi.decode`.\n            /// @solidity memory-safe-assembly\n            assembly {\n                sender := shr(96, calldataload(sub(calldatasize(), 20)))\n            }\n        } else {\n            return super._msgSender();\n        }\n    }\n\n    function _msgData() internal view virtual override returns (bytes calldata) {\n        if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n            return msg.data[:msg.data.length - 20];\n        } else {\n            return super._msgData();\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/erc6551/src/interfaces/IERC6551Executable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @dev the ERC-165 identifier for this interface is `0x51945447`\ninterface IERC6551Executable {\n    /**\n     * @dev Executes a low-level operation if the caller is a valid signer on the account.\n     *\n     * Reverts and bubbles up error if operation fails.\n     *\n     * Accounts implementing this interface MUST accept the following operation parameter values:\n     * - 0 = CALL\n     * - 1 = DELEGATECALL\n     * - 2 = CREATE\n     * - 3 = CREATE2\n     *\n     * Accounts implementing this interface MAY support additional operations or restrict a signer's\n     * ability to execute certain operations.\n     *\n     * @param to        The target address of the operation\n     * @param value     The Ether value to be sent to the target\n     * @param data      The encoded operation calldata\n     * @param operation A value indicating the type of operation to perform\n     * @return The result of the operation\n     */\n    function execute(address to, uint256 value, bytes calldata data, uint8 operation)\n        external\n        payable\n        returns (bytes memory);\n}\n"
      },
      "lib/tokenbound/src/lib/LibExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"../utils/Errors.sol\";\nimport \"./LibSandbox.sol\";\n\nlibrary LibExecutor {\n    uint8 constant OP_CALL = 0;\n    uint8 constant OP_DELEGATECALL = 1;\n    uint8 constant OP_CREATE = 2;\n    uint8 constant OP_CREATE2 = 3;\n\n    function _execute(address to, uint256 value, bytes calldata data, uint8 operation)\n        internal\n        returns (bytes memory)\n    {\n        if (operation == OP_CALL) return _call(to, value, data);\n        if (operation == OP_DELEGATECALL) {\n            address sandbox = LibSandbox.sandbox(address(this));\n            if (sandbox.code.length == 0) LibSandbox.deploy(address(this));\n            return _call(sandbox, value, abi.encodePacked(to, data));\n        }\n        if (operation == OP_CREATE) return abi.encodePacked(_create(value, data));\n        if (operation == OP_CREATE2) {\n            bytes32 salt = bytes32(data[:32]);\n            bytes calldata bytecode = data[32:];\n            return abi.encodePacked(_create2(value, salt, bytecode));\n        }\n\n        revert InvalidOperation();\n    }\n\n    function _call(address to, uint256 value, bytes memory data)\n        internal\n        returns (bytes memory result)\n    {\n        bool success;\n        (success, result) = to.call{value: value}(data);\n\n        if (!success) {\n            assembly {\n                revert(add(result, 32), mload(result))\n            }\n        }\n    }\n\n    function _create(uint256 value, bytes memory data) internal returns (address created) {\n        bytes memory bytecode = data;\n\n        assembly {\n            created := create(value, add(bytecode, 0x20), mload(bytecode))\n        }\n\n        if (created == address(0)) revert ContractCreationFailed();\n    }\n\n    function _create2(uint256 value, bytes32 salt, bytes calldata data)\n        internal\n        returns (address created)\n    {\n        bytes memory bytecode = data;\n\n        assembly {\n            created := create2(value, add(bytecode, 0x20), mload(bytecode), salt)\n        }\n\n        if (created == address(0)) revert ContractCreationFailed();\n    }\n}\n"
      },
      "lib/tokenbound/src/abstract/execution/ERC6551Executor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/metatx/ERC2771Context.sol\";\nimport \"@openzeppelin/contracts/utils/Context.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nimport \"erc6551/interfaces/IERC6551Executable.sol\";\nimport \"erc6551/interfaces/IERC6551Account.sol\";\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\n\nimport \"../../utils/Errors.sol\";\nimport \"../../lib/LibExecutor.sol\";\nimport \"../../lib/LibSandbox.sol\";\nimport \"./SandboxExecutor.sol\";\nimport \"./BaseExecutor.sol\";\n\n/**\n * @title ERC-6551 Executor\n * @dev Basic executor which implements the IERC6551Executable execution interface\n */\nabstract contract ERC6551Executor is IERC6551Executable, ERC165, BaseExecutor {\n    /**\n     * Executes a low-level operation from this account if the caller is a valid executor\n     *\n     * @param to Account to operate on\n     * @param value Value to send with operation\n     * @param data Encoded calldata of operation\n     * @param operation Operation type (0=CALL, 1=DELEGATECALL, 2=CREATE, 3=CREATE2)\n     */\n    function execute(address to, uint256 value, bytes calldata data, uint8 operation)\n        external\n        payable\n        virtual\n        returns (bytes memory)\n    {\n        if (!_isValidExecutor(_msgSender())) revert NotAuthorized();\n\n        _beforeExecute();\n\n        return LibExecutor._execute(to, value, data, operation);\n    }\n\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC6551Executable).interfaceId\n            || super.supportsInterface(interfaceId);\n    }\n}\n"
      },
      "lib/tokenbound/src/abstract/execution/BatchExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"../../utils/Errors.sol\";\n\nimport \"./BaseExecutor.sol\";\n\n/**\n * @title Batch Executor\n * @dev Allows multiple operations to be executed from this account in a single transaction\n */\nabstract contract BatchExecutor is BaseExecutor {\n    struct Operation {\n        address to;\n        uint256 value;\n        bytes data;\n        uint8 operation;\n    }\n\n    /**\n     * @notice Executes a batch of operations if the caller is authorized\n     * @param operations Operations to execute\n     */\n    function executeBatch(Operation[] calldata operations)\n        external\n        payable\n        returns (bytes[] memory)\n    {\n        if (!_isValidExecutor(_msgSender())) revert NotAuthorized();\n\n        _beforeExecute();\n\n        uint256 length = operations.length;\n        bytes[] memory results = new bytes[](length);\n\n        for (uint256 i = 0; i < length; i++) {\n            results[i] = LibExecutor._execute(\n                operations[i].to, operations[i].value, operations[i].data, operations[i].operation\n            );\n        }\n\n        return results;\n    }\n}\n"
      },
      "lib/tokenbound/src/abstract/execution/NestedAccountExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/metatx/ERC2771Context.sol\";\n\nimport \"erc6551/interfaces/IERC6551Executable.sol\";\nimport \"erc6551/interfaces/IERC6551Account.sol\";\nimport \"erc6551/lib/ERC6551AccountLib.sol\";\n\nimport \"../../utils/Errors.sol\";\nimport \"../../lib/LibExecutor.sol\";\nimport \"../../lib/LibSandbox.sol\";\nimport \"./SandboxExecutor.sol\";\nimport \"./BaseExecutor.sol\";\n\nimport \"../Lockable.sol\";\n\n/**\n * @title Nested Account Executor\n * @dev Allows the root owner of a nested token bound account to execute transactions directly\n * against the nested account, even if intermediate accounts have not been created.\n */\nabstract contract NestedAccountExecutor is BaseExecutor {\n    address immutable __self = address(this);\n    address public immutable erc6551Registry;\n\n    struct ERC6551AccountInfo {\n        bytes32 salt;\n        address tokenContract;\n        uint256 tokenId;\n    }\n\n    constructor(address _erc6551Registry) {\n        if (_erc6551Registry == address(0)) revert InvalidERC6551Registry();\n        erc6551Registry = _erc6551Registry;\n    }\n\n    /**\n     * Executes a low-level operation from this account if the caller is a valid signer on the\n     * parent TBA specified in the proof\n     *\n     * @param to Account to operate on\n     * @param value Value to send with operation\n     * @param data Encoded calldata of operation\n     * @param operation Operation type (0=CALL, 1=DELEGATECALL, 2=CREATE, 3=CREATE2)\n     * @param proof An array of ERC-6551 account information specifying the ownership path from this\n     * account to its parent\n     */\n    function executeNested(\n        address to,\n        uint256 value,\n        bytes calldata data,\n        uint8 operation,\n        ERC6551AccountInfo[] calldata proof\n    ) external payable returns (bytes memory) {\n        uint256 length = proof.length;\n        address current = _msgSender();\n\n        ERC6551AccountInfo calldata accountInfo;\n        for (uint256 i = 0; i < length; i++) {\n            accountInfo = proof[i];\n            address tokenContract = accountInfo.tokenContract;\n            uint256 tokenId = accountInfo.tokenId;\n\n            address next = ERC6551AccountLib.computeAddress(\n                erc6551Registry, __self, accountInfo.salt, block.chainid, tokenContract, tokenId\n            );\n\n            if (tokenContract.code.length == 0) revert InvalidAccountProof();\n\n            if (next.code.length > 0) {\n                if (Lockable(next).isLocked()) revert AccountLocked();\n            }\n\n            try IERC721(tokenContract).ownerOf(tokenId) returns (address _owner) {\n                if (_owner != current) revert InvalidAccountProof();\n                current = next;\n            } catch {\n                revert InvalidAccountProof();\n            }\n        }\n\n        if (!_isValidExecutor(current)) revert NotAuthorized();\n\n        _beforeExecute();\n\n        return LibExecutor._execute(to, value, data, operation);\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toString(int256 value) internal pure returns (string memory) {\n        return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n    /**\n     * @dev Handles the receipt of a single ERC1155 token type. This function is\n     * called at the end of a `safeTransferFrom` after the balance has been updated.\n     *\n     * NOTE: To accept the transfer, this must return\n     * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n     * (i.e. 0xf23a6e61, or its own function selector).\n     *\n     * @param operator The address which initiated the transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param id The ID of the token being transferred\n     * @param value The amount of tokens being transferred\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n     */\n    function onERC1155Received(\n        address operator,\n        address from,\n        uint256 id,\n        uint256 value,\n        bytes calldata data\n    ) external returns (bytes4);\n\n    /**\n     * @dev Handles the receipt of a multiple ERC1155 token types. This function\n     * is called at the end of a `safeBatchTransferFrom` after the balances have\n     * been updated.\n     *\n     * NOTE: To accept the transfer(s), this must return\n     * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n     * (i.e. 0xbc197c81, or its own function selector).\n     *\n     * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param ids An array containing ids of each token being transferred (order and length must match values array)\n     * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n     */\n    function onERC1155BatchReceived(\n        address operator,\n        address from,\n        uint256[] calldata ids,\n        uint256[] calldata values,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/interfaces/IStakeManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n\n    event Deposited(\n        address indexed account,\n        uint256 totalDeposit\n    );\n\n    event Withdrawn(\n        address indexed account,\n        address withdrawAddress,\n        uint256 amount\n    );\n\n    /// Emitted when stake or unstake delay are modified\n    event StakeLocked(\n        address indexed account,\n        uint256 totalStaked,\n        uint256 unstakeDelaySec\n    );\n\n    /// Emitted once a stake is scheduled for withdrawal\n    event StakeUnlocked(\n        address indexed account,\n        uint256 withdrawTime\n    );\n\n    event StakeWithdrawn(\n        address indexed account,\n        address withdrawAddress,\n        uint256 amount\n    );\n\n    /**\n     * @param deposit the entity's deposit\n     * @param staked true if this entity is staked.\n     * @param stake actual amount of ether staked for this entity.\n     * @param unstakeDelaySec minimum delay to withdraw the stake.\n     * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\n     * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\n     *    and the rest fit into a 2nd cell.\n     *    112 bit allows for 10^15 eth\n     *    48 bit for full timestamp\n     *    32 bit allows 150 years for unstake delay\n     */\n    struct DepositInfo {\n        uint112 deposit;\n        bool staked;\n        uint112 stake;\n        uint32 unstakeDelaySec;\n        uint48 withdrawTime;\n    }\n\n    //API struct used by getStakeInfo and simulateValidation\n    struct StakeInfo {\n        uint256 stake;\n        uint256 unstakeDelaySec;\n    }\n\n    /// @return info - full deposit information of given account\n    function getDepositInfo(address account) external view returns (DepositInfo memory info);\n\n    /// @return the deposit (for gas payment) of the account\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * add to the deposit of the given account\n     */\n    function depositTo(address account) external payable;\n\n    /**\n     * add to the account's stake - amount and delay\n     * any pending unstake is first cancelled.\n     * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n     */\n    function addStake(uint32 _unstakeDelaySec) external payable;\n\n    /**\n     * attempt to unlock the stake.\n     * the value can be withdrawn (using withdrawStake) after the unstake delay.\n     */\n    function unlockStake() external;\n\n    /**\n     * withdraw from the (unlocked) stake.\n     * must first call unlockStake and wait for the unstakeDelay to pass\n     * @param withdrawAddress the address to send withdrawn value.\n     */\n    function withdrawStake(address payable withdrawAddress) external;\n\n    /**\n     * withdraw from the deposit.\n     * @param withdrawAddress the address to send withdrawn value.\n     * @param withdrawAmount the amount to withdraw.\n     */\n    function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\n}\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/interfaces/IAggregator.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n\n    /**\n     * validate aggregated signature.\n     * revert if the aggregated signature does not match the given list of operations.\n     */\n    function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\n\n    /**\n     * validate signature of a single userOp\n     * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\n     * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n     * @param userOp the userOperation received from the user.\n     * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\n     *    (usually empty, unless account and aggregator support some kind of \"multisig\"\n     */\n    function validateUserOpSignature(UserOperation calldata userOp)\n    external view returns (bytes memory sigForUserOp);\n\n    /**\n     * aggregate multiple signatures into a single value.\n     * This method is called off-chain to calculate the signature to pass with handleOps()\n     * bundler MAY use optimized custom code perform this aggregation\n     * @param userOps array of UserOperations to collect the signatures from.\n     * @return aggregatedSignature the aggregated signature\n     */\n    function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\n}\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/interfaces/INonceManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\ninterface INonceManager {\n\n    /**\n     * Return the next nonce for this sender.\n     * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\n     * But UserOp with different keys can come with arbitrary order.\n     *\n     * @param sender the account address\n     * @param key the high 192 bit of the nonce\n     * @return nonce a full nonce to pass for next UserOp with this sender.\n     */\n    function getNonce(address sender, uint192 key)\n    external view returns (uint256 nonce);\n\n    /**\n     * Manually increment the nonce of the sender.\n     * This method is exposed just for completeness..\n     * Account does NOT need to call it, neither during validation, nor elsewhere,\n     * as the EntryPoint will update the nonce regardless.\n     * Possible use-case is call it with various keys to \"initialize\" their nonces to one, so that future\n     * UserOperations will not pay extra for the first transaction with a given key.\n     */\n    function incrementNonce(uint192 key) external;\n}\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/core/Helpers.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n *              address(1) - the account failed to validate the signature.\n *              otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\n    struct ValidationData {\n        address aggregator;\n        uint48 validAfter;\n        uint48 validUntil;\n    }\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\n    function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\n        address aggregator = address(uint160(validationData));\n        uint48 validUntil = uint48(validationData >> 160);\n        if (validUntil == 0) {\n            validUntil = type(uint48).max;\n        }\n        uint48 validAfter = uint48(validationData >> (48 + 160));\n        return ValidationData(aggregator, validAfter, validUntil);\n    }\n\n// intersect account and paymaster ranges.\n    function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\n        ValidationData memory accountValidationData = _parseValidationData(validationData);\n        ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n        address aggregator = accountValidationData.aggregator;\n        if (aggregator == address(0)) {\n            aggregator = pmValidationData.aggregator;\n        }\n        uint48 validAfter = accountValidationData.validAfter;\n        uint48 validUntil = accountValidationData.validUntil;\n        uint48 pmValidAfter = pmValidationData.validAfter;\n        uint48 pmValidUntil = pmValidationData.validUntil;\n\n        if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n        if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n        return ValidationData(aggregator, validAfter, validUntil);\n    }\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\n    function _packValidationData(ValidationData memory data) pure returns (uint256) {\n        return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n    }\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\n    function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n        return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n    }\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n    function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n        assembly {\n            let mem := mload(0x40)\n            let len := data.length\n            calldatacopy(mem, data.offset, len)\n            ret := keccak256(mem, len)\n        }\n    }\n\n"
      },
      "lib/tokenbound/lib/account-abstraction/contracts/interfaces/IAccount.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\ninterface IAccount {\n\n    /**\n     * Validate user's signature and nonce\n     * the entryPoint will make the call to the recipient only if this validation call returns successfully.\n     * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\n     * This allows making a \"simulation call\" without a valid signature\n     * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\n     *\n     * @dev Must validate caller is the entryPoint.\n     *      Must validate the signature and nonce\n     * @param userOp the operation that is about to be executed.\n     * @param userOpHash hash of the user's request data. can be used as the basis for signature.\n     * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\n     *      This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\n     *      The excess is left as a deposit in the entrypoint, for future calls.\n     *      can be withdrawn anytime using \"entryPoint.withdrawTo()\"\n     *      In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\n     * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\n     *      <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n     *         otherwise, an address of an \"authorizer\" contract.\n     *      <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n     *      <6-byte> validAfter - first timestamp this operation is valid\n     *      If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n     *      Note that the validation code cannot use block.timestamp (or block.number) directly.\n     */\n    function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n    external returns (uint256 validationData);\n}\n"
      },
      "lib/tokenbound/src/abstract/execution/SandboxExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/utils/Create2.sol\";\n\nimport \"../../interfaces/ISandboxExecutor.sol\";\nimport \"../../utils/Errors.sol\";\nimport \"../../lib/LibSandbox.sol\";\nimport \"../../lib/LibExecutor.sol\";\n\n/**\n * @title Sandbox Executor\n * @dev Allows the sandbox contract for an account to execute low-level operations\n */\nabstract contract SandboxExecutor is ISandboxExecutor {\n    /**\n     * @dev Ensures that a given caller is the sandbox for this account\n     */\n    function _requireFromSandbox() internal view {\n        if (msg.sender != LibSandbox.sandbox(address(this))) revert NotAuthorized();\n    }\n\n    /**\n     * @dev Allows the sandbox contract to execute low-level calls from this account\n     */\n    function extcall(address to, uint256 value, bytes calldata data)\n        external\n        returns (bytes memory result)\n    {\n        _requireFromSandbox();\n        return LibExecutor._call(to, value, data);\n    }\n\n    /**\n     * @dev Allows the sandbox contract to create contracts on behalf of this account\n     */\n    function extcreate(uint256 value, bytes calldata bytecode) external returns (address) {\n        _requireFromSandbox();\n\n        return LibExecutor._create(value, bytecode);\n    }\n\n    /**\n     * @dev Allows the sandbox contract to create deterministic contracts on behalf of this account\n     */\n    function extcreate2(uint256 value, bytes32 salt, bytes calldata bytecode)\n        external\n        returns (address)\n    {\n        _requireFromSandbox();\n        return LibExecutor._create2(value, salt, bytecode);\n    }\n\n    /**\n     * @dev Allows arbitrary storage reads on this account from external contracts\n     */\n    function extsload(bytes32 slot) external view returns (bytes32 value) {\n        assembly {\n            value := sload(slot)\n        }\n    }\n}\n"
      },
      "lib/tokenbound/src/abstract/execution/BaseExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\";\n\nimport \"./SandboxExecutor.sol\";\n\n/**\n * @title Base Executor\n * @dev Base configuration for all executors\n */\nabstract contract BaseExecutor is Context, SandboxExecutor {\n    function _beforeExecute() internal virtual {}\n\n    function _isValidExecutor(address executor) internal view virtual returns (bool);\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1, \"Math: mulDiv overflow\");\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "lib/tokenbound/lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"
      },
      "lib/tokenbound/src/interfaces/ISandboxExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ninterface ISandboxExecutor {\n    function extcall(address to, uint256 value, bytes calldata data)\n        external\n        returns (bytes memory result);\n\n    function extcreate(uint256 value, bytes calldata data) external returns (address);\n\n    function extcreate2(uint256 value, bytes32 salt, bytes calldata bytecode)\n        external\n        returns (address);\n\n    function extsload(bytes32 slot) external view returns (bytes32 value);\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@openzeppelin/=lib/tokenbound/lib/openzeppelin-contracts/",
        "account-abstraction/=lib/tokenbound/lib/account-abstraction/contracts/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/tokenbound/lib/openzeppelin-contracts/lib/erc4626-tests/",
        "erc6551/=lib/tokenbound/lib/erc6551/src/",
        "forge-std/=lib/forge-std/src/",
        "multicall-authenticated/=lib/tokenbound/lib/multicall-authenticated/",
        "tokenbound/=lib/tokenbound/",
        "openzeppelin-contracts/=lib/tokenbound/lib/openzeppelin-contracts/",
        "openzeppelin/=lib/tokenbound/lib/openzeppelin-contracts/contracts/",
        "pendlefinance/=lib/pendlefinance/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs"
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "london",
      "libraries": {}
    }
  }}