creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/EntryPointSimulations.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n\nimport \"./EntryPoint.sol\";\nimport \"./IEntryPointSimulations.sol\";\n\n/*\n * This contract inherits the EntryPoint and extends it with the view-only methods that are executed by\n * the bundler in order to check UserOperation validity and estimate its gas consumption.\n * This contract should never be deployed on-chain and is only used as a parameter for the \"eth_call\" request.\n */\ncontract EntryPointSimulations is EntryPoint, IEntryPointSimulations {\n    // solhint-disable-next-line var-name-mixedcase\n    AggregatorStakeInfo private NOT_AGGREGATED =\n        AggregatorStakeInfo(address(0), StakeInfo(0, 0));\n\n    SenderCreator private _senderCreator;\n\n    function initSenderCreator() internal virtual {\n        //this is the address of the first contract created with CREATE by this address.\n        address createdObj = address(\n            uint160(\n                uint256(\n                    keccak256(\n                        abi.encodePacked(hex\"d694\", address(this), hex\"01\")\n                    )\n                )\n            )\n        );\n        _senderCreator = SenderCreator(createdObj);\n    }\n\n    function senderCreator()\n        internal\n        view\n        virtual\n        override\n        returns (SenderCreator)\n    {\n        // return the same senderCreator as real EntryPoint.\n        // this call is slightly (100) more expensive than EntryPoint's access to immutable member\n        return _senderCreator;\n    }\n\n    /**\n     * simulation contract should not be deployed, and specifically, accounts should not trust\n     * it as entrypoint, since the simulation functions don't check the signatures\n     */\n    constructor() {\n        // require(block.number < 100, \"should not be deployed\");\n    }\n\n    /// @inheritdoc IEntryPointSimulations\n    function simulateValidation(\n        PackedUserOperation calldata userOp\n    ) external returns (ValidationResult memory) {\n        UserOpInfo memory outOpInfo;\n\n        _simulationOnlyValidations(userOp);\n        (\n            uint256 validationData,\n            uint256 paymasterValidationData,\n            uint256 paymasterVerificationGasLimit\n        ) = _validatePrepayment(0, userOp, outOpInfo);\n\n        _validateAccountAndPaymasterValidationData(\n            0,\n            validationData,\n            paymasterValidationData,\n            address(0)\n        );\n\n        StakeInfo memory paymasterInfo = _getStakeInfo(\n            outOpInfo.mUserOp.paymaster\n        );\n        StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\n        StakeInfo memory factoryInfo;\n        {\n            bytes calldata initCode = userOp.initCode;\n            address factory = initCode.length >= 20\n                ? address(bytes20(initCode[0:20]))\n                : address(0);\n            factoryInfo = _getStakeInfo(factory);\n        }\n\n        address aggregator = address(uint160(validationData));\n        ReturnInfo memory returnInfo = ReturnInfo(\n            outOpInfo.preOpGas,\n            outOpInfo.prefund,\n            validationData,\n            paymasterValidationData,\n            getMemoryBytesFromOffset(outOpInfo.contextOffset)\n        );\n\n        AggregatorStakeInfo memory aggregatorInfo = NOT_AGGREGATED;\n        if (\n            uint160(aggregator) != SIG_VALIDATION_SUCCESS &&\n            uint160(aggregator) != SIG_VALIDATION_FAILED\n        ) {\n            aggregatorInfo = AggregatorStakeInfo(\n                aggregator,\n                _getStakeInfo(aggregator)\n            );\n        }\n        return\n            ValidationResult(\n                returnInfo,\n                senderInfo,\n                factoryInfo,\n                paymasterInfo,\n                aggregatorInfo\n            );\n    }\n\n    function simulateCallData(\n        PackedUserOperation calldata op,\n        address target,\n        bytes calldata targetCallData\n    ) external returns (TargetCallResult memory) {\n        UserOpInfo memory opInfo;\n        _simulationOnlyValidations(op);\n        _validatePrepayment(0, op, opInfo);\n\n        bool targetSuccess;\n        bytes memory targetResult;\n        uint256 usedGas;\n        if (target != address(0)) {\n            uint256 remainingGas = gasleft();\n            (targetSuccess, targetResult) = target.call(targetCallData);\n            usedGas = remainingGas - gasleft();\n        }\n        return TargetCallResult(usedGas, targetSuccess, targetResult);\n    }\n\n    /// @inheritdoc IEntryPointSimulations\n    function simulateHandleOp(\n        PackedUserOperation calldata op\n    ) external nonReentrant returns (ExecutionResult memory) {\n        UserOpInfo memory opInfo;\n        _simulationOnlyValidations(op);\n        (\n            uint256 validationData,\n            uint256 paymasterValidationData,\n            uint256 paymasterVerificationGasLimit\n        ) = _validatePrepayment(0, op, opInfo);\n\n        (uint256 paid, uint256 paymasterPostOpGasLimit) = _executeUserOp(\n            op,\n            opInfo\n        );\n\n        return\n            ExecutionResult(\n                opInfo.preOpGas,\n                paid,\n                validationData,\n                paymasterValidationData,\n                paymasterVerificationGasLimit,\n                paymasterPostOpGasLimit,\n                false,\n                \"0x\"\n            );\n    }\n\n    function _simulationOnlyValidations(\n        PackedUserOperation calldata userOp\n    ) internal {\n        //initialize senderCreator(). we can't rely on constructor\n        initSenderCreator();\n\n        string memory revertReason = _validateSenderAndPaymaster(\n            userOp.initCode,\n            userOp.sender,\n            userOp.paymasterAndData\n        );\n        // solhint-disable-next-line no-empty-blocks\n        if (bytes(revertReason).length != 0) {\n            revert FailedOp(0, revertReason);\n        }\n    }\n\n    /**\n     * Called only during simulation.\n     * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\n     * @param initCode         - The smart account constructor code.\n     * @param sender           - The sender address.\n     * @param paymasterAndData - The paymaster address (followed by other params, ignored by this method)\n     */\n    function _validateSenderAndPaymaster(\n        bytes calldata initCode,\n        address sender,\n        bytes calldata paymasterAndData\n    ) internal view returns (string memory) {\n        if (initCode.length == 0 && sender.code.length == 0) {\n            // it would revert anyway. but give a meaningful message\n            return (\"AA20 account not deployed\");\n        }\n        if (paymasterAndData.length >= 20) {\n            address paymaster = address(bytes20(paymasterAndData[0:20]));\n            if (paymaster.code.length == 0) {\n                // It would revert anyway. but give a meaningful message.\n                return (\"AA30 paymaster not deployed\");\n            }\n        }\n        // always revert\n        return (\"\");\n    }\n\n    //make sure depositTo cost is more than normal EntryPoint's cost,\n    // to mitigate DoS vector on the bundler\n    // empiric test showed that without this wrapper, simulation depositTo costs less..\n    function depositTo(\n        address account\n    ) public payable override(IStakeManager, StakeManager) {\n        unchecked {\n            // silly code, to waste some gas to make sure depositTo is always little more\n            // expensive than on-chain call\n            uint256 x = 1;\n            while (x < 5) {\n                x++;\n            }\n            StakeManager.depositTo(account);\n        }\n    }\n}\n"
      },
      "src/EntryPoint.sol": {
        "content": "pragma solidity ^0.8.23;\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IAccountExecute.sol\";\nimport \"account-abstraction/interfaces/IPaymaster.sol\";\nimport \"./IEntryPoint.sol\";\n\nimport \"account-abstraction/utils/Exec.sol\";\nimport \"account-abstraction/core/StakeManager.sol\";\nimport \"account-abstraction/core/SenderCreator.sol\";\nimport \"account-abstraction/core/Helpers.sol\";\nimport \"account-abstraction/core/NonceManager.sol\";\nimport \"account-abstraction/core/UserOperationLib.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\n/*\n * Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n * Only one instance required on each chain.\n */\n\n/// @custom:security-contact https://bounty.ethereum.org\ncontract EntryPoint is\n    IEntryPoint,\n    StakeManager,\n    NonceManager,\n    ReentrancyGuard\n    // ERC165\n{\n    using UserOperationLib for PackedUserOperation;\n\n    SenderCreator private immutable _senderCreator = new SenderCreator();\n\n    function senderCreator() internal view virtual returns (SenderCreator) {\n        return _senderCreator;\n    }\n\n    //compensate for innerHandleOps' emit message and deposit refund.\n    // allow some slack for future gas price changes.\n    uint256 private constant INNER_GAS_OVERHEAD = 10000;\n\n    // Marker for inner call revert on out of gas\n    bytes32 private constant INNER_OUT_OF_GAS = hex\"deaddead\";\n    bytes32 private constant INNER_REVERT_LOW_PREFUND = hex\"deadaa51\";\n\n    uint256 private constant REVERT_REASON_MAX_LEN = 2048;\n    uint256 private constant PENALTY_PERCENT = 10;\n\n    /// @inheritdoc IERC165\n    // function supportsInterface(\n    //     bytes4 interfaceId\n    // ) public view virtual override returns (bool) {\n    //     // note: solidity \"type(IEntryPoint).interfaceId\" is without inherited methods but we want to check everything\n    //     return\n    //         interfaceId ==\n    //         (type(IEntryPoint).interfaceId ^\n    //             type(IStakeManager).interfaceId ^\n    //             type(INonceManager).interfaceId) ||\n    //         interfaceId == type(IEntryPoint).interfaceId ||\n    //         interfaceId == type(IStakeManager).interfaceId ||\n    //         interfaceId == type(INonceManager).interfaceId ||\n    //         super.supportsInterface(interfaceId);\n    // }\n\n    /**\n     * Compensate the caller's beneficiary address with the collected fees of all UserOperations.\n     * @param beneficiary - The address to receive the fees.\n     * @param amount      - Amount to transfer.\n     */\n    function _compensate(address payable beneficiary, uint256 amount) internal {\n        require(beneficiary != address(0), \"AA90 invalid beneficiary\");\n        (bool success, ) = beneficiary.call{value: amount}(\"\");\n        require(success, \"AA91 failed send to beneficiary\");\n    }\n\n    /**\n     * Execute a user operation.\n     * @param userOp     - The userOp to execute.\n     * @param opInfo     - The opInfo filled by validatePrepayment for this userOp.\n     * @return collected - The total amount this userOp paid.\n     */\n    function _executeUserOp(\n        PackedUserOperation calldata userOp,\n        UserOpInfo memory opInfo\n    ) internal returns (uint256 collected, uint256 paymasterPostOpGasLimit) {\n        uint256 preGas = gasleft();\n        bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\n        {\n            uint256 saveFreePtr;\n            assembly (\"memory-safe\") {\n                saveFreePtr := mload(0x40)\n            }\n            bytes calldata callData = userOp.callData;\n            bytes4 methodSig;\n            assembly {\n                let len := callData.length\n                if gt(len, 3) {\n                    methodSig := calldataload(callData.offset)\n                }\n            }\n            if (methodSig == IAccountExecute.executeUserOp.selector) {\n                bytes memory executeUserOp = abi.encodeCall(\n                    IAccountExecute.executeUserOp,\n                    (userOp, opInfo.userOpHash)\n                );\n                (collected, paymasterPostOpGasLimit) = innerHandleOp(\n                    executeUserOp,\n                    opInfo,\n                    context,\n                    preGas\n                );\n            } else {\n                (collected, paymasterPostOpGasLimit) = innerHandleOp(\n                    callData,\n                    opInfo,\n                    context,\n                    preGas\n                );\n            }\n        }\n    }\n\n    function emitUserOperationEvent(\n        UserOpInfo memory opInfo,\n        bool success,\n        uint256 actualGasCost,\n        uint256 actualGas\n    ) internal virtual {\n        emit UserOperationEvent(\n            opInfo.userOpHash,\n            opInfo.mUserOp.sender,\n            opInfo.mUserOp.paymaster,\n            opInfo.mUserOp.nonce,\n            success,\n            actualGasCost,\n            actualGas\n        );\n    }\n\n    function emitPrefundTooLow(UserOpInfo memory opInfo) internal virtual {\n        emit UserOperationPrefundTooLow(\n            opInfo.userOpHash,\n            opInfo.mUserOp.sender,\n            opInfo.mUserOp.nonce\n        );\n    }\n\n    /// @inheritdoc IEntryPoint\n    // function handleOps(\n    //     PackedUserOperation[] calldata ops,\n    //     address payable beneficiary\n    // ) public nonReentrant {\n    //     uint256 opslen = ops.length;\n    //     UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\n    //\n    //     unchecked {\n    //         for (uint256 i = 0; i < opslen; i++) {\n    //             UserOpInfo memory opInfo = opInfos[i];\n    //             (\n    //                 uint256 validationData,\n    //                 uint256 pmValidationData,\n    //                 uint256 paymasterVerificationGasLimit\n    //             ) = _validatePrepayment(i, ops[i], opInfo);\n    //             _validateAccountAndPaymasterValidationData(\n    //                 i,\n    //                 validationData,\n    //                 pmValidationData,\n    //                 address(0)\n    //             );\n    //         }\n    //\n    //         uint256 collected = 0;\n    //         emit BeforeExecution();\n    //\n    //         for (uint256 i = 0; i < opslen; i++) {\n    //             (\n    //                 uint256 collectedAmount,\n    //                 uint256 paymasterVerificationGasLimit\n    //             ) = _executeUserOp(i, ops[i], opInfos[i]);\n    //             collected += collectedAmount;\n    //         }\n    //\n    //         _compensate(beneficiary, collected);\n    //     }\n    // }\n\n    /// @inheritdoc IEntryPoint\n    // function handleAggregatedOps(\n    //     UserOpsPerAggregator[] calldata opsPerAggregator,\n    //     address payable beneficiary\n    // ) public nonReentrant {\n    //     uint256 opasLen = opsPerAggregator.length;\n    //     uint256 totalOps = 0;\n    //     for (uint256 i = 0; i < opasLen; i++) {\n    //         UserOpsPerAggregator calldata opa = opsPerAggregator[i];\n    //         PackedUserOperation[] calldata ops = opa.userOps;\n    //         IAggregator aggregator = opa.aggregator;\n    //\n    //         //address(1) is special marker of \"signature error\"\n    //         require(\n    //             address(aggregator) != address(1),\n    //             \"AA96 invalid aggregator\"\n    //         );\n    //\n    //         if (address(aggregator) != address(0)) {\n    //             // solhint-disable-next-line no-empty-blocks\n    //             try aggregator.validateSignatures(ops, opa.signature) {} catch {\n    //                 revert SignatureValidationFailed(address(aggregator));\n    //             }\n    //         }\n    //\n    //         totalOps += ops.length;\n    //     }\n    //\n    //     UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\n    //\n    //     uint256 opIndex = 0;\n    //     for (uint256 a = 0; a < opasLen; a++) {\n    //         UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n    //         PackedUserOperation[] calldata ops = opa.userOps;\n    //         IAggregator aggregator = opa.aggregator;\n    //\n    //         uint256 opslen = ops.length;\n    //         for (uint256 i = 0; i < opslen; i++) {\n    //             UserOpInfo memory opInfo = opInfos[opIndex];\n    //             (\n    //                 uint256 validationData,\n    //                 uint256 paymasterValidationData,\n    //                 uint256 paymasterVerificationGasLimit\n    //             ) = _validatePrepayment(opIndex, ops[i], opInfo);\n    //             _validateAccountAndPaymasterValidationData(\n    //                 i,\n    //                 validationData,\n    //                 paymasterValidationData,\n    //                 address(aggregator)\n    //             );\n    //             opIndex++;\n    //         }\n    //     }\n    //\n    //     emit BeforeExecution();\n    //\n    //     uint256 collected = 0;\n    //     opIndex = 0;\n    //     for (uint256 a = 0; a < opasLen; a++) {\n    //         UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n    //         emit SignatureAggregatorChanged(address(opa.aggregator));\n    //         PackedUserOperation[] calldata ops = opa.userOps;\n    //         uint256 opslen = ops.length;\n    //\n    //         for (uint256 i = 0; i < opslen; i++) {\n    //             (\n    //                 uint256 collectedAmount,\n    //                 uint256 paymasterVerificationGasLimit\n    //             ) = _executeUserOp(i, ops[i], opInfos[i]);\n    //             collected += collectedAmount;\n    //\n    //             opIndex++;\n    //         }\n    //     }\n    //     emit SignatureAggregatorChanged(address(0));\n    //\n    //     _compensate(beneficiary, collected);\n    // }\n\n    /**\n     * A memory copy of UserOp static fields only.\n     * Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\n     */\n    struct MemoryUserOp {\n        address sender;\n        uint256 nonce;\n        uint256 verificationGasLimit;\n        uint256 callGasLimit;\n        uint256 paymasterVerificationGasLimit;\n        uint256 paymasterPostOpGasLimit;\n        uint256 preVerificationGas;\n        address paymaster;\n        uint256 maxFeePerGas;\n        uint256 maxPriorityFeePerGas;\n    }\n\n    struct UserOpInfo {\n        MemoryUserOp mUserOp;\n        bytes32 userOpHash;\n        uint256 prefund;\n        uint256 contextOffset;\n        uint256 preOpGas;\n    }\n\n    /**\n     * Inner function to handle a UserOperation.\n     * Must be declared \"external\" to open a call context, but it can only be called by handleOps.\n     * @param callData - The callData to execute.\n     * @param opInfo   - The UserOpInfo struct.\n     * @param context  - The context bytes.\n     * @return actualGasCost - the actual cost in eth this UserOperation paid for gas\n     */\n    function innerHandleOp(\n        bytes memory callData,\n        UserOpInfo memory opInfo,\n        bytes memory context,\n        uint256 preGas\n    ) public returns (uint256 actualGasCost, uint256 paymasterPostOpGasLimit) {\n        MemoryUserOp memory mUserOp = opInfo.mUserOp;\n\n        uint256 callGasLimit = mUserOp.callGasLimit;\n        unchecked {\n            // handleOps was called with gas limit too low. abort entire bundle.\n            if (\n                (gasleft() * 63) / 64 <\n                callGasLimit +\n                    mUserOp.paymasterPostOpGasLimit +\n                    INNER_GAS_OVERHEAD\n            ) {\n                revert FailedOp(0, \"AA95 out of gas\");\n            }\n        }\n\n        IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\n        if (callData.length > 0) {\n            bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\n            if (!success) {\n                bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\n                if (result.length > 0) {\n                    emit UserOperationRevertReason(\n                        opInfo.userOpHash,\n                        mUserOp.sender,\n                        mUserOp.nonce,\n                        result\n                    );\n                }\n                mode = IPaymaster.PostOpMode.opReverted;\n            }\n        }\n\n        unchecked {\n            uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n            return _postExecution(mode, opInfo, context, actualGas);\n        }\n    }\n\n    /// @inheritdoc IEntryPoint\n    function getUserOpHash(\n        PackedUserOperation calldata userOp\n    ) public view returns (bytes32) {\n        return\n            keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\n    }\n\n    /**\n     * Copy general fields from userOp into the memory opInfo structure.\n     * @param userOp  - The user operation.\n     * @param mUserOp - The memory user operation.\n     */\n    function _copyUserOpToMemory(\n        PackedUserOperation calldata userOp,\n        MemoryUserOp memory mUserOp\n    ) internal pure {\n        mUserOp.sender = userOp.sender;\n        mUserOp.nonce = userOp.nonce;\n        (mUserOp.verificationGasLimit, mUserOp.callGasLimit) = UserOperationLib\n            .unpackUints(userOp.accountGasLimits);\n        mUserOp.preVerificationGas = userOp.preVerificationGas;\n        (mUserOp.maxPriorityFeePerGas, mUserOp.maxFeePerGas) = UserOperationLib\n            .unpackUints(userOp.gasFees);\n        bytes calldata paymasterAndData = userOp.paymasterAndData;\n        if (paymasterAndData.length > 0) {\n            require(\n                paymasterAndData.length >=\n                    UserOperationLib.PAYMASTER_DATA_OFFSET,\n                \"AA93 invalid paymasterAndData\"\n            );\n            (\n                mUserOp.paymaster,\n                mUserOp.paymasterVerificationGasLimit,\n                mUserOp.paymasterPostOpGasLimit\n            ) = UserOperationLib.unpackPaymasterStaticFields(paymasterAndData);\n        } else {\n            mUserOp.paymaster = address(0);\n            mUserOp.paymasterVerificationGasLimit = 0;\n            mUserOp.paymasterPostOpGasLimit = 0;\n        }\n    }\n\n    /**\n     * Get the required prefunded gas fee amount for an operation.\n     * @param mUserOp - The user operation in memory.\n     */\n    function _getRequiredPrefund(\n        MemoryUserOp memory mUserOp\n    ) internal pure returns (uint256 requiredPrefund) {\n        unchecked {\n            uint256 requiredGas = mUserOp.verificationGasLimit +\n                mUserOp.callGasLimit +\n                mUserOp.paymasterVerificationGasLimit +\n                mUserOp.paymasterPostOpGasLimit +\n                mUserOp.preVerificationGas;\n\n            requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\n        }\n    }\n\n    /**\n     * Create sender smart contract account if init code is provided.\n     * @param opIndex  - The operation index.\n     * @param opInfo   - The operation info.\n     * @param initCode - The init code for the smart contract account.\n     */\n    function _createSenderIfNeeded(\n        uint256 opIndex,\n        UserOpInfo memory opInfo,\n        bytes calldata initCode\n    ) internal {\n        if (initCode.length != 0) {\n            address sender = opInfo.mUserOp.sender;\n            if (sender.code.length != 0)\n                revert FailedOp(opIndex, \"AA10 sender already constructed\");\n            address sender1 = senderCreator().createSender{\n                gas: opInfo.mUserOp.verificationGasLimit\n            }(initCode);\n            if (sender1 == address(0))\n                revert FailedOp(opIndex, \"AA13 initCode failed or OOG\");\n            if (sender1 != sender)\n                revert FailedOp(opIndex, \"AA14 initCode must return sender\");\n            if (sender1.code.length == 0)\n                revert FailedOp(opIndex, \"AA15 initCode must create sender\");\n            address factory = address(bytes20(initCode[0:20]));\n            emit AccountDeployed(\n                opInfo.userOpHash,\n                sender,\n                factory,\n                opInfo.mUserOp.paymaster\n            );\n        }\n    }\n\n    /// @inheritdoc IEntryPoint\n    // function getSenderAddress(bytes calldata initCode) public {\n    //     address sender = senderCreator().createSender(initCode);\n    //     revert SenderAddressResult(sender);\n    // }\n\n    /**\n     * Call account.validateUserOp.\n     * Revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\n     * Decrement account's deposit if needed.\n     * @param opIndex         - The operation index.\n     * @param op              - The user operation.\n     * @param opInfo          - The operation info.\n     * @param requiredPrefund - The required prefund amount.\n     */\n    function _validateAccountPrepayment(\n        uint256 opIndex,\n        PackedUserOperation calldata op,\n        UserOpInfo memory opInfo,\n        uint256 requiredPrefund,\n        uint256 verificationGasLimit\n    ) internal returns (uint256 validationData) {\n        unchecked {\n            MemoryUserOp memory mUserOp = opInfo.mUserOp;\n            address sender = mUserOp.sender;\n            _createSenderIfNeeded(opIndex, opInfo, op.initCode);\n            address paymaster = mUserOp.paymaster;\n            uint256 missingAccountFunds = 0;\n            if (paymaster == address(0)) {\n                uint256 bal = balanceOf(sender);\n                missingAccountFunds = bal > requiredPrefund\n                    ? 0\n                    : requiredPrefund - bal;\n            }\n            try\n                IAccount(sender).validateUserOp{gas: verificationGasLimit}(\n                    op,\n                    opInfo.userOpHash,\n                    missingAccountFunds\n                )\n            returns (uint256 _validationData) {\n                validationData = _validationData;\n            } catch {\n                revert FailedOpWithRevert(\n                    opIndex,\n                    \"AA23 reverted\",\n                    Exec.getReturnData(REVERT_REASON_MAX_LEN)\n                );\n            }\n            if (paymaster == address(0)) {\n                DepositInfo storage senderInfo = deposits[sender];\n                uint256 deposit = senderInfo.deposit;\n                if (requiredPrefund > deposit) {\n                    revert FailedOp(opIndex, \"AA21 didn't pay prefund\");\n                }\n                senderInfo.deposit = deposit - requiredPrefund;\n            }\n        }\n    }\n\n    /**\n     * In case the request has a paymaster:\n     *  - Validate paymaster has enough deposit.\n     *  - Call paymaster.validatePaymasterUserOp.\n     *  - Revert with proper FailedOp in case paymaster reverts.\n     *  - Decrement paymaster's deposit.\n     * @param opIndex                            - The operation index.\n     * @param op                                 - The user operation.\n     * @param opInfo                             - The operation info.\n     * @param requiredPreFund                    - The required prefund amount.\n     */\n    function _validatePaymasterPrepayment(\n        uint256 opIndex,\n        PackedUserOperation calldata op,\n        UserOpInfo memory opInfo,\n        uint256 requiredPreFund\n    ) internal returns (bytes memory context, uint256 validationData) {\n        unchecked {\n            uint256 preGas = gasleft();\n            MemoryUserOp memory mUserOp = opInfo.mUserOp;\n            address paymaster = mUserOp.paymaster;\n            DepositInfo storage paymasterInfo = deposits[paymaster];\n            uint256 deposit = paymasterInfo.deposit;\n            if (deposit < requiredPreFund) {\n                revert FailedOp(opIndex, \"AA31 paymaster deposit too low\");\n            }\n            paymasterInfo.deposit = deposit - requiredPreFund;\n            uint256 pmVerificationGasLimit = mUserOp\n                .paymasterVerificationGasLimit;\n            try\n                IPaymaster(paymaster).validatePaymasterUserOp{\n                    gas: pmVerificationGasLimit\n                }(op, opInfo.userOpHash, requiredPreFund)\n            returns (bytes memory _context, uint256 _validationData) {\n                context = _context;\n                validationData = _validationData;\n            } catch {\n                revert FailedOpWithRevert(\n                    opIndex,\n                    \"AA33 reverted\",\n                    Exec.getReturnData(REVERT_REASON_MAX_LEN)\n                );\n            }\n            if (preGas - gasleft() > pmVerificationGasLimit) {\n                revert FailedOp(\n                    opIndex,\n                    \"AA36 over paymasterVerificationGasLimit\"\n                );\n            }\n        }\n    }\n\n    /**\n     * Revert if either account validationData or paymaster validationData is expired.\n     * @param opIndex                 - The operation index.\n     * @param validationData          - The account validationData.\n     * @param paymasterValidationData - The paymaster validationData.\n     * @param expectedAggregator      - The expected aggregator.\n     */\n    function _validateAccountAndPaymasterValidationData(\n        uint256 opIndex,\n        uint256 validationData,\n        uint256 paymasterValidationData,\n        address expectedAggregator\n    ) internal view {\n        (address aggregator, bool outOfTimeRange) = _getValidationData(\n            validationData\n        );\n        if (expectedAggregator != aggregator) {\n            revert FailedOp(opIndex, \"AA24 signature error\");\n        }\n        if (outOfTimeRange) {\n            revert FailedOp(opIndex, \"AA22 expired or not due\");\n        }\n        // pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\n        // Non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation).\n        address pmAggregator;\n        (pmAggregator, outOfTimeRange) = _getValidationData(\n            paymasterValidationData\n        );\n        if (pmAggregator != address(0)) {\n            revert FailedOp(opIndex, \"AA34 signature error\");\n        }\n        if (outOfTimeRange) {\n            revert FailedOp(opIndex, \"AA32 paymaster expired or not due\");\n        }\n    }\n\n    /**\n     * Parse validationData into its components.\n     * @param validationData - The packed validation data (sigFailed, validAfter, validUntil).\n     * @return aggregator the aggregator of the validationData\n     * @return outOfTimeRange true if current time is outside the time range of this validationData.\n     */\n    function _getValidationData(\n        uint256 validationData\n    ) internal view returns (address aggregator, bool outOfTimeRange) {\n        if (validationData == 0) {\n            return (address(0), false);\n        }\n        ValidationData memory data = _parseValidationData(validationData);\n        // solhint-disable-next-line not-rely-on-time\n        outOfTimeRange =\n            block.timestamp > data.validUntil ||\n            block.timestamp < data.validAfter;\n        aggregator = data.aggregator;\n    }\n\n    /**\n     * Validate account and paymaster (if defined) and\n     * also make sure total validation doesn't exceed verificationGasLimit.\n     * This method is called off-chain (simulateValidation()) and on-chain (from handleOps)\n     * @param opIndex - The index of this userOp into the \"opInfos\" array.\n     * @param userOp  - The userOp to validate.\n     */\n    function _validatePrepayment(\n        uint256 opIndex,\n        PackedUserOperation calldata userOp,\n        UserOpInfo memory outOpInfo\n    )\n        internal\n        returns (\n            uint256 validationData,\n            uint256 paymasterValidationData,\n            uint256 paymasterVerificationGasLimit\n        )\n    {\n        uint256 preGas = gasleft();\n        MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\n        _copyUserOpToMemory(userOp, mUserOp);\n        outOpInfo.userOpHash = getUserOpHash(userOp);\n\n        // Validate all numeric values in userOp are well below 128 bit, so they can safely be added\n        // and multiplied without causing overflow.\n        uint256 verificationGasLimit = mUserOp.verificationGasLimit;\n        uint256 maxGasValues = mUserOp.preVerificationGas |\n            verificationGasLimit |\n            mUserOp.callGasLimit |\n            mUserOp.paymasterVerificationGasLimit |\n            mUserOp.paymasterPostOpGasLimit |\n            mUserOp.maxFeePerGas |\n            mUserOp.maxPriorityFeePerGas;\n        require(maxGasValues <= type(uint120).max, \"AA94 gas values overflow\");\n\n        uint256 requiredPreFund = _getRequiredPrefund(mUserOp);\n        validationData = _validateAccountPrepayment(\n            opIndex,\n            userOp,\n            outOpInfo,\n            requiredPreFund,\n            verificationGasLimit\n        );\n\n        if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\n            revert FailedOp(opIndex, \"AA25 invalid account nonce\");\n        }\n\n        unchecked {\n            if (preGas - gasleft() > verificationGasLimit) {\n                revert FailedOp(opIndex, \"AA26 over verificationGasLimit\");\n            }\n        }\n\n        bytes memory context;\n        uint256 remainingGas = gasleft();\n        if (mUserOp.paymaster != address(0)) {\n            (context, paymasterValidationData) = _validatePaymasterPrepayment(\n                opIndex,\n                userOp,\n                outOpInfo,\n                requiredPreFund\n            );\n        }\n        unchecked {\n            outOpInfo.prefund = requiredPreFund;\n            outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\n            outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\n        }\n        paymasterVerificationGasLimit =\n            ((remainingGas - gasleft()) * 115) /\n            100;\n    }\n\n    /**\n     * Process post-operation, called just after the callData is executed.\n     * If a paymaster is defined and its validation returned a non-empty context, its postOp is called.\n     * The excess amount is refunded to the account (or paymaster - if it was used in the request).\n     * @param mode      - Whether is called from innerHandleOp, or outside (postOpReverted).\n     * @param opInfo    - UserOp fields and info collected during validation.\n     * @param context   - The context returned in validatePaymasterUserOp.\n     * @param actualGas - The gas used so far by this user operation.\n     */\n    function _postExecution(\n        IPaymaster.PostOpMode mode,\n        UserOpInfo memory opInfo,\n        bytes memory context,\n        uint256 actualGas\n    ) private returns (uint256 actualGasCost, uint256 paymasterPostOpGasLimit) {\n        uint256 preGas = gasleft();\n        unchecked {\n            address refundAddress;\n            MemoryUserOp memory mUserOp = opInfo.mUserOp;\n            uint256 gasPrice = getUserOpGasPrice(mUserOp);\n\n            address paymaster = mUserOp.paymaster;\n            if (paymaster == address(0)) {\n                refundAddress = mUserOp.sender;\n            } else {\n                refundAddress = paymaster;\n                if (context.length > 0) {\n                    actualGasCost = actualGas * gasPrice;\n                    if (mode != IPaymaster.PostOpMode.postOpReverted) {\n                        uint256 remainingGas = gasleft();\n                        try\n                            IPaymaster(paymaster).postOp{\n                                gas: mUserOp.paymasterPostOpGasLimit\n                            }(mode, context, actualGasCost, gasPrice)\n                        // solhint-disable-next-line no-empty-blocks\n                        {\n\n                        } catch {\n                            emit PostOpRevertReason(\n                                opInfo.userOpHash,\n                                opInfo.mUserOp.sender,\n                                opInfo.mUserOp.nonce,\n                                Exec.getReturnData(REVERT_REASON_MAX_LEN)\n                            );\n                            actualGas = preGas - gasleft() + opInfo.preOpGas;\n                            (\n                                actualGasCost,\n                                paymasterPostOpGasLimit\n                            ) = _postExecution(\n                                IPaymaster.PostOpMode.postOpReverted,\n                                opInfo,\n                                context,\n                                actualGas\n                            );\n                        }\n                        paymasterPostOpGasLimit = remainingGas - gasleft();\n                    }\n                }\n            }\n            actualGas += preGas - gasleft();\n\n            // Calculating a penalty for unused execution gas\n            {\n                uint256 executionGasLimit = mUserOp.callGasLimit +\n                    mUserOp.paymasterPostOpGasLimit;\n                uint256 executionGasUsed = actualGas - opInfo.preOpGas;\n                // this check is required for the gas used within EntryPoint and not covered by explicit gas limits\n                if (executionGasLimit > executionGasUsed) {\n                    uint256 unusedGas = executionGasLimit - executionGasUsed;\n                    uint256 unusedGasPenalty = (unusedGas * PENALTY_PERCENT) /\n                        100;\n                    actualGas += unusedGasPenalty;\n                }\n            }\n\n            actualGasCost = actualGas * gasPrice;\n            uint256 prefund = opInfo.prefund;\n            if (prefund < actualGasCost) {\n                if (mode == IPaymaster.PostOpMode.postOpReverted) {\n                    actualGasCost = prefund;\n                    emitPrefundTooLow(opInfo);\n                    emitUserOperationEvent(\n                        opInfo,\n                        false,\n                        actualGasCost,\n                        actualGas\n                    );\n                } else {\n                    actualGas = preGas - gasleft() + opInfo.preOpGas;\n                    actualGasCost = opInfo.prefund;\n                    emitPrefundTooLow(opInfo);\n                    emitUserOperationEvent(\n                        opInfo,\n                        false,\n                        actualGasCost,\n                        actualGas\n                    );\n                }\n            } else {\n                uint256 refund = prefund - actualGasCost;\n                _incrementDeposit(refundAddress, refund);\n                bool success = mode == IPaymaster.PostOpMode.opSucceeded;\n                emitUserOperationEvent(\n                    opInfo,\n                    success,\n                    actualGasCost,\n                    actualGas\n                );\n            }\n        } // unchecked\n    }\n\n    /**\n     * The gas price this UserOp agrees to pay.\n     * Relayer/block builder might submit the TX with higher priorityFee, but the user should not.\n     * @param mUserOp - The userOp to get the gas price from.\n     */\n    function getUserOpGasPrice(\n        MemoryUserOp memory mUserOp\n    ) internal view returns (uint256) {\n        unchecked {\n            uint256 maxFeePerGas = mUserOp.maxFeePerGas;\n            uint256 maxPriorityFeePerGas = mUserOp.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    /**\n     * The offset of the given bytes in memory.\n     * @param data - The bytes to get the offset of.\n     */\n    function getOffsetOfMemoryBytes(\n        bytes memory data\n    ) internal pure returns (uint256 offset) {\n        assembly {\n            offset := data\n        }\n    }\n\n    /**\n     * The bytes in memory at the given offset.\n     * @param offset - The offset to get the bytes from.\n     */\n    function getMemoryBytesFromOffset(\n        uint256 offset\n    ) internal pure returns (bytes memory data) {\n        assembly (\"memory-safe\") {\n            data := offset\n        }\n    }\n\n    /// @inheritdoc IEntryPoint\n    // function delegateAndRevert(address target, bytes calldata data) external {\n    //     (bool success, bytes memory ret) = target.delegatecall(data);\n    //     revert DelegateAndRevert(success, ret);\n    // }\n}\n"
      },
      "src/IEntryPointSimulations.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport \"account-abstraction/interfaces/PackedUserOperation.sol\";\nimport \"./IEntryPoint.sol\";\n\ninterface IEntryPointSimulations is IEntryPoint {\n    struct TargetCallResult {\n        uint256 gasUsed;\n        bool success;\n        bytes returnData;\n    }\n\n    struct PaymasterDataResult {\n        uint256 paymasterVerificationGasLimit;\n        uint256 paymasterPostOpGasLimit;\n    }\n\n    // Return value of simulateHandleOp.\n    struct ExecutionResult {\n        uint256 preOpGas;\n        uint256 paid;\n        uint256 accountValidationData;\n        uint256 paymasterValidationData;\n        uint256 paymasterVerificationGasLimit;\n        uint256 paymasterPostOpGasLimit;\n        bool targetSuccess;\n        bytes targetResult;\n    }\n\n    /**\n     * Successful result from simulateValidation.\n     * If the account returns a signature aggregator the \"aggregatorInfo\" struct is filled in as well.\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    struct ValidationResult {\n        ReturnInfo returnInfo;\n        StakeInfo senderInfo;\n        StakeInfo factoryInfo;\n        StakeInfo paymasterInfo;\n        AggregatorStakeInfo aggregatorInfo;\n    }\n\n    /**\n     * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n     * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage\n     *      outside the account's data.\n     * @param userOp - The user operation to validate.\n     * @return the validation result structure\n     */\n    function simulateValidation(\n        PackedUserOperation calldata userOp\n    ) external returns (ValidationResult memory);\n\n    /**\n     * Simulate full execution of a UserOperation (including both validation and target execution)\n     * It performs full validation of the UserOperation, but ignores signature error.\n     * An optional target address is called after the userop succeeds,\n     * and its value is returned (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     * @return the execution result structure\n     */\n    function simulateHandleOp(\n        PackedUserOperation calldata op\n    ) external returns (ExecutionResult memory);\n}\n"
      },
      "lib/account-abstraction/contracts/interfaces/IAccount.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport \"./PackedUserOperation.sol\";\n\ninterface IAccount {\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\n     *                              able to make the call. The excess is left as a deposit in the entrypoint\n     *                              for future calls. Can be withdrawn anytime using \"entryPoint.withdrawTo()\".\n     *                              In case there is a paymaster in the request (or the current deposit is high\n     *                              enough), this value will be zero.\n     * @return validationData       - Packaged ValidationData structure. use `_packValidationData` and\n     *                              `_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\n     *                                                    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(\n        PackedUserOperation calldata userOp,\n        bytes32 userOpHash,\n        uint256 missingAccountFunds\n    ) external returns (uint256 validationData);\n}\n"
      },
      "lib/account-abstraction/contracts/interfaces/IAccountExecute.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport \"./PackedUserOperation.sol\";\n\ninterface IAccountExecute {\n    /**\n     * Account may implement this execute method.\n     * passing this methodSig at the beginning of callData will cause the entryPoint to pass the full UserOp (and hash)\n     * to the account.\n     * The account should skip the methodSig, and use the callData (and optionally, other UserOp fields)\n     *\n     * @param userOp              - The operation that was just validated.\n     * @param userOpHash          - Hash of the user's request data.\n     */\n    function executeUserOp(\n        PackedUserOperation calldata userOp,\n        bytes32 userOpHash\n    ) external;\n}\n"
      },
      "lib/account-abstraction/contracts/interfaces/IPaymaster.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport \"./PackedUserOperation.sol\";\n\n/**\n * The interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\n * A paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\n */\ninterface IPaymaster {\n    enum PostOpMode {\n        // User op succeeded.\n        opSucceeded,\n        // User op reverted. Still has to pay for gas.\n        opReverted,\n        // Only used internally in the EntryPoint (cleanup after postOp reverts). Never calling paymaster with this value\n        postOpReverted\n    }\n\n    /**\n     * Payment validation: check if paymaster agrees to pay.\n     * Must verify sender is the entryPoint.\n     * Revert to reject this request.\n     * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted).\n     * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\n     * @param userOp          - The user operation.\n     * @param userOpHash      - Hash of the user's request data.\n     * @param maxCost         - The maximum cost of this transaction (based on maximum gas and gas price from userOp).\n     * @return context        - Value to send to a postOp. Zero length to signify postOp is not required.\n     * @return validationData - Signature and time-range of this operation, encoded the same as the return\n     *                          value of validateUserOperation.\n     *                          <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n     *                                                    other values are invalid for paymaster.\n     *                          <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n     *                          <6-byte> validAfter - first timestamp this operation is valid\n     *                          Note that the validation code cannot use block.timestamp (or block.number) directly.\n     */\n    function validatePaymasterUserOp(\n        PackedUserOperation calldata userOp,\n        bytes32 userOpHash,\n        uint256 maxCost\n    ) external returns (bytes memory context, uint256 validationData);\n\n    /**\n     * Post-operation handler.\n     * Must verify sender is the entryPoint.\n     * @param mode          - Enum with the following options:\n     *                        opSucceeded - User operation succeeded.\n     *                        opReverted  - User op reverted. The paymaster still has to pay for gas.\n     *                        postOpReverted - never passed in a call to postOp().\n     * @param context       - The context value returned by validatePaymasterUserOp\n     * @param actualGasCost - Actual gas used so far (without this postOp call).\n     * @param actualUserOpFeePerGas - the gas price this UserOp pays. This value is based on the UserOp's maxFeePerGas\n     *                        and maxPriorityFee (and basefee)\n     *                        It is not the same as tx.gasprice, which is what the bundler pays.\n     */\n    function postOp(\n        PostOpMode mode,\n        bytes calldata context,\n        uint256 actualGasCost,\n        uint256 actualUserOpFeePerGas\n    ) external;\n}\n"
      },
      "src/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.7.5;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"account-abstraction/interfaces/PackedUserOperation.sol\";\nimport \"account-abstraction/interfaces/IStakeManager.sol\";\nimport \"account-abstraction/interfaces/IAggregator.sol\";\nimport \"account-abstraction/interfaces/INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\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,\n     *                        validation and execution).\n     */\n    event UserOperationEvent(\n        bytes32 indexed userOpHash,\n        address indexed sender,\n        address indexed paymaster,\n        uint256 nonce,\n        bool success,\n        uint256 actualGasCost,\n        uint256 actualGasUsed\n    );\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(\n        bytes32 indexed userOpHash,\n        address indexed sender,\n        address factory,\n        address paymaster\n    );\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(\n        bytes32 indexed userOpHash,\n        address indexed sender,\n        uint256 nonce,\n        bytes revertReason\n    );\n\n    /**\n     * An event emitted if the UserOperation Paymaster's \"postOp\" call 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 PostOpRevertReason(\n        bytes32 indexed userOpHash,\n        address indexed sender,\n        uint256 nonce,\n        bytes revertReason\n    );\n\n    /**\n     * UserOp consumed more than prefund. The UserOperation is reverted, and no refund is made.\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     */\n    event UserOperationPrefundTooLow(\n        bytes32 indexed userOpHash,\n        address indexed sender,\n        uint256 nonce\n    );\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     * @param aggregator - The aggregator used for the following UserOperationEvents.\n     */\n    event SignatureAggregatorChanged(address indexed aggregator);\n\n    /**\n     * A custom revert error of handleOps, to identify the offending op.\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     * 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. The string starts with a unique code \"AAmn\",\n     *                  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     */\n    error FailedOp(uint256 opIndex, string reason);\n\n    /**\n     * A custom revert error of handleOps, to report a revert by account or paymaster.\n     * @param opIndex - Index into the array of ops to the failed one (in simulateValidation, this is always zero).\n     * @param reason  - Revert reason. see FailedOp(uint256,string), above\n     * @param inner   - data from inner cought revert reason\n     * @dev note that inner is truncated to 2048 bytes\n     */\n    error FailedOpWithRevert(uint256 opIndex, string reason, bytes inner);\n\n    error PostOpReverted(bytes returnData);\n\n    /**\n     * Error case when a signature aggregator fails to verify the aggregated signature it had created.\n     * @param aggregator The aggregator that failed to verify the signature\n     */\n    error SignatureValidationFailed(address aggregator);\n\n    // Return value of getSenderAddress.\n    error SenderAddressResult(address sender);\n\n    // UserOps handled, per aggregator.\n    struct UserOpsPerAggregator {\n        PackedUserOperation[] userOps;\n        // Aggregator address\n        IAggregator aggregator;\n        // Aggregated signature\n        bytes signature;\n    }\n\n    /**\n     * Execute a batch of UserOperations.\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(\n    //     PackedUserOperation[] calldata ops,\n    //     address payable beneficiary\n    // ) 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     * @param userOp - The user operation to generate the request ID for.\n     * @return hash the hash of this UserOperation\n     */\n    function getUserOpHash(\n        PackedUserOperation calldata userOp\n    ) external view returns (bytes32);\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 accountValidationData   - returned validationData from account.\n     * @param paymasterValidationData - return validationData from paymaster.\n     * @param paymasterContext - Returned by validatePaymasterUserOp (to be passed into postOp)\n     */\n    struct ReturnInfo {\n        uint256 preOpGas;\n        uint256 prefund;\n        uint256 accountValidationData;\n        uint256 paymasterValidationData;\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    // error DelegateAndRevert(bool success, bytes ret);\n\n    /**\n     * Helper method for dry-run testing.\n     * @dev calling this method, the EntryPoint will make a delegatecall to the given data, and report (via revert) the result.\n     *  The method always revert, so is only useful off-chain for dry run calls, in cases where state-override to replace\n     *  actual EntryPoint code is less convenient.\n     * @param target a target contract to make a delegatecall from entrypoint\n     * @param data data to pass to target in a delegatecall\n     */\n    // function delegateAndRevert(address target, bytes calldata data) external;\n}\n"
      },
      "lib/account-abstraction/contracts/utils/Exec.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.23;\n\n// solhint-disable no-inline-assembly\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n\n    function call(\n        address to,\n        uint256 value,\n        bytes memory data,\n        uint256 txGas\n    ) internal returns (bool success) {\n        assembly (\"memory-safe\") {\n            success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n        }\n    }\n\n    function staticcall(\n        address to,\n        bytes memory data,\n        uint256 txGas\n    ) internal view returns (bool success) {\n        assembly (\"memory-safe\") {\n            success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n        }\n    }\n\n    function delegateCall(\n        address to,\n        bytes memory data,\n        uint256 txGas\n    ) internal returns (bool success) {\n        assembly (\"memory-safe\") {\n            success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n        }\n    }\n\n    // get returned data from last call or calldelegate\n    function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n        assembly (\"memory-safe\") {\n            let len := returndatasize()\n            if gt(len, maxLen) {\n                len := maxLen\n            }\n            let ptr := mload(0x40)\n            mstore(0x40, add(ptr, add(len, 0x20)))\n            mstore(ptr, len)\n            returndatacopy(add(ptr, 0x20), 0, len)\n            returnData := ptr\n        }\n    }\n\n    // revert with explicit byte array (probably reverted info from call)\n    function revertWithData(bytes memory returnData) internal pure {\n        assembly (\"memory-safe\") {\n            revert(add(returnData, 32), mload(returnData))\n        }\n    }\n\n    function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\n        bool success = call(to,0,data,gasleft());\n        if (!success) {\n            revertWithData(getReturnData(maxLen));\n        }\n    }\n}\n"
      },
      "lib/account-abstraction/contracts/core/StakeManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.23;\n\nimport \"../interfaces/IStakeManager.sol\";\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable not-rely-on-time */\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 a paymaster.\n */\nabstract contract StakeManager is IStakeManager {\n    /// maps paymaster to their deposits and stakes\n    mapping(address => DepositInfo) public deposits;\n\n    /// @inheritdoc IStakeManager\n    function getDepositInfo(\n        address account\n    ) public view returns (DepositInfo memory info) {\n        return deposits[account];\n    }\n\n    /**\n     * Internal method to return just the stake info.\n     * @param addr - The account to query.\n     */\n    function _getStakeInfo(\n        address addr\n    ) internal view returns (StakeInfo memory info) {\n        DepositInfo storage depositInfo = deposits[addr];\n        info.stake = depositInfo.stake;\n        info.unstakeDelaySec = depositInfo.unstakeDelaySec;\n    }\n\n    /// @inheritdoc IStakeManager\n    function balanceOf(address account) public view returns (uint256) {\n        return deposits[account].deposit;\n    }\n\n    receive() external payable {\n        depositTo(msg.sender);\n    }\n\n    /**\n     * Increments an account's deposit.\n     * @param account - The account to increment.\n     * @param amount  - The amount to increment by.\n     * @return the updated deposit of this account\n     */\n    function _incrementDeposit(address account, uint256 amount) internal returns (uint256) {\n        DepositInfo storage info = deposits[account];\n        uint256 newAmount = info.deposit + amount;\n        info.deposit = newAmount;\n        return newAmount;\n    }\n\n    /**\n     * Add to the deposit of the given account.\n     * @param account - The account to add to.\n     */\n    function depositTo(address account) public virtual payable {\n        uint256 newDeposit = _incrementDeposit(account, msg.value);\n        emit Deposited(account, newDeposit);\n    }\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) public payable {\n        DepositInfo storage info = deposits[msg.sender];\n        require(unstakeDelaySec > 0, \"must specify unstake delay\");\n        require(\n            unstakeDelaySec >= info.unstakeDelaySec,\n            \"cannot decrease unstake time\"\n        );\n        uint256 stake = info.stake + msg.value;\n        require(stake > 0, \"no stake specified\");\n        require(stake <= type(uint112).max, \"stake overflow\");\n        deposits[msg.sender] = DepositInfo(\n            info.deposit,\n            true,\n            uint112(stake),\n            unstakeDelaySec,\n            0\n        );\n        emit StakeLocked(msg.sender, stake, unstakeDelaySec);\n    }\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        DepositInfo storage info = deposits[msg.sender];\n        require(info.unstakeDelaySec != 0, \"not staked\");\n        require(info.staked, \"already unstaking\");\n        uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\n        info.withdrawTime = withdrawTime;\n        info.staked = false;\n        emit StakeUnlocked(msg.sender, withdrawTime);\n    }\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        DepositInfo storage info = deposits[msg.sender];\n        uint256 stake = info.stake;\n        require(stake > 0, \"No stake to withdraw\");\n        require(info.withdrawTime > 0, \"must call unlockStake() first\");\n        require(\n            info.withdrawTime <= block.timestamp,\n            \"Stake withdrawal is not due\"\n        );\n        info.unstakeDelaySec = 0;\n        info.withdrawTime = 0;\n        info.stake = 0;\n        emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\n        (bool success,) = withdrawAddress.call{value: stake}(\"\");\n        require(success, \"failed to withdraw stake\");\n    }\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(\n        address payable withdrawAddress,\n        uint256 withdrawAmount\n    ) external {\n        DepositInfo storage info = deposits[msg.sender];\n        require(withdrawAmount <= info.deposit, \"Withdraw amount too large\");\n        info.deposit = info.deposit - withdrawAmount;\n        emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\n        (bool success,) = withdrawAddress.call{value: withdrawAmount}(\"\");\n        require(success, \"failed to withdraw\");\n    }\n}\n"
      },
      "lib/account-abstraction/contracts/core/SenderCreator.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\n/**\n * Helper contract for EntryPoint, to call userOp.initCode from a \"neutral\" address,\n * which is explicitly not the entryPoint itself.\n */\ncontract SenderCreator {\n    /**\n     * Call the \"initCode\" factory to create and return the sender account address.\n     * @param initCode - The initCode value from a UserOp. contains 20 bytes of factory address,\n     *                   followed by calldata.\n     * @return sender  - The returned address of the created account, or zero address on failure.\n     */\n    function createSender(\n        bytes calldata initCode\n    ) external returns (address sender) {\n        address factory = address(bytes20(initCode[0:20]));\n        bytes memory initCallData = initCode[20:];\n        bool success;\n        /* solhint-disable no-inline-assembly */\n        assembly (\"memory-safe\") {\n            success := call(\n                gas(),\n                factory,\n                0,\n                add(initCallData, 0x20),\n                mload(initCallData),\n                0,\n                32\n            )\n            sender := mload(0)\n        }\n        if (!success) {\n            sender = address(0);\n        }\n    }\n}\n"
      },
      "lib/account-abstraction/contracts/core/Helpers.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\n/* solhint-disable no-inline-assembly */\n\n\n /*\n  * For simulation purposes, validateUserOp (and validatePaymasterUserOp)\n  * must return this value in case of signature failure, instead of revert.\n  */\nuint256 constant SIG_VALIDATION_FAILED = 1;\n\n\n/*\n * For simulation purposes, validateUserOp (and validatePaymasterUserOp)\n * return this value on success.\n */\nuint256 constant SIG_VALIDATION_SUCCESS = 0;\n\n\n/**\n * Returned data from validateUserOp.\n * validateUserOp returns a uint256, which is created by `_packedValidationData` and\n * 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\n *                                  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 */\nstruct ValidationData {\n    address aggregator;\n    uint48 validAfter;\n    uint48 validUntil;\n}\n\n/**\n * Extract sigFailed, validAfter, validUntil.\n * Also convert zero validUntil to type(uint48).max.\n * @param validationData - The packed validation data.\n */\nfunction _parseValidationData(\n    uint256 validationData\n) 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/**\n * Helper to pack the return value for validateUserOp.\n * @param data - The ValidationData to pack.\n */\nfunction _packValidationData(\n    ValidationData memory data\n) pure returns (uint256) {\n    return\n        uint160(data.aggregator) |\n        (uint256(data.validUntil) << 160) |\n        (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 */\nfunction _packValidationData(\n    bool sigFailed,\n    uint48 validUntil,\n    uint48 validAfter\n) pure returns (uint256) {\n    return\n        (sigFailed ? 1 : 0) |\n        (uint256(validUntil) << 160) |\n        (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 (\"memory-safe\") {\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\n/**\n * The minimum of two numbers.\n * @param a - First number.\n * @param b - Second number.\n */\n    function min(uint256 a, uint256 b) pure returns (uint256) {\n        return a < b ? a : b;\n    }\n"
      },
      "lib/account-abstraction/contracts/core/NonceManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\nimport \"../interfaces/INonceManager.sol\";\n\n/**\n * nonce management functionality\n */\nabstract contract NonceManager is INonceManager {\n\n    /**\n     * The next valid sequence number for a given nonce key.\n     */\n    mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\n\n    /// @inheritdoc INonceManager\n    function getNonce(address sender, uint192 key)\n    public view override returns (uint256 nonce) {\n        return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\n    }\n\n    // allow an account to manually increment its own nonce.\n    // (mainly so that during construction nonce can be made non-zero,\n    // to \"absorb\" the gas cost of first nonce increment to 1st transaction (construction),\n    // not to 2nd transaction)\n    function incrementNonce(uint192 key) public override {\n        nonceSequenceNumber[msg.sender][key]++;\n    }\n\n    /**\n     * validate nonce uniqueness for this account.\n     * called just after validateUserOp()\n     * @return true if the nonce was incremented successfully.\n     *         false if the current nonce doesn't match the given one.\n     */\n    function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\n\n        uint192 key = uint192(nonce >> 64);\n        uint64 seq = uint64(nonce);\n        return nonceSequenceNumber[sender][key]++ == seq;\n    }\n\n}\n"
      },
      "lib/account-abstraction/contracts/core/UserOperationLib.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\n/* solhint-disable no-inline-assembly */\n\nimport \"../interfaces/PackedUserOperation.sol\";\nimport {calldataKeccak, min} from \"./Helpers.sol\";\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n    uint256 public constant PAYMASTER_VALIDATION_GAS_OFFSET = 20;\n    uint256 public constant PAYMASTER_POSTOP_GAS_OFFSET = 36;\n    uint256 public constant PAYMASTER_DATA_OFFSET = 52;\n    /**\n     * Get sender from user operation data.\n     * @param userOp - The user operation data.\n     */\n    function getSender(\n        PackedUserOperation calldata userOp\n    ) internal pure returns (address) {\n        address data;\n        //read sender from userOp, which is first userOp member (saves 800 gas...)\n        assembly {\n            data := calldataload(userOp)\n        }\n        return address(uint160(data));\n    }\n\n    /**\n     * Relayer/block builder might submit the TX with higher priorityFee,\n     * but the user should not pay above what he signed for.\n     * @param userOp - The user operation data.\n     */\n    function gasPrice(\n        PackedUserOperation calldata userOp\n    ) internal view returns (uint256) {\n        unchecked {\n            (uint256 maxPriorityFeePerGas, uint256 maxFeePerGas) = unpackUints(userOp.gasFees);\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    /**\n     * Pack the user operation data into bytes for hashing.\n     * @param userOp - The user operation data.\n     */\n    function encode(\n        PackedUserOperation calldata userOp\n    ) 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        bytes32 accountGasLimits = userOp.accountGasLimits;\n        uint256 preVerificationGas = userOp.preVerificationGas;\n        bytes32 gasFees = userOp.gasFees;\n        bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n        return abi.encode(\n            sender, nonce,\n            hashInitCode, hashCallData,\n            accountGasLimits, preVerificationGas, gasFees,\n            hashPaymasterAndData\n        );\n    }\n\n    function unpackUints(\n        bytes32 packed\n    ) internal pure returns (uint256 high128, uint256 low128) {\n        return (uint128(bytes16(packed)), uint128(uint256(packed)));\n    }\n\n    //unpack just the high 128-bits from a packed value\n    function unpackHigh128(bytes32 packed) internal pure returns (uint256) {\n        return uint256(packed) >> 128;\n    }\n\n    // unpack just the low 128-bits from a packed value\n    function unpackLow128(bytes32 packed) internal pure returns (uint256) {\n        return uint128(uint256(packed));\n    }\n\n    function unpackMaxPriorityFeePerGas(PackedUserOperation calldata userOp)\n    internal pure returns (uint256) {\n        return unpackHigh128(userOp.gasFees);\n    }\n\n    function unpackMaxFeePerGas(PackedUserOperation calldata userOp)\n    internal pure returns (uint256) {\n        return unpackLow128(userOp.gasFees);\n    }\n\n    function unpackVerificationGasLimit(PackedUserOperation calldata userOp)\n    internal pure returns (uint256) {\n        return unpackHigh128(userOp.accountGasLimits);\n    }\n\n    function unpackCallGasLimit(PackedUserOperation calldata userOp)\n    internal pure returns (uint256) {\n        return unpackLow128(userOp.accountGasLimits);\n    }\n\n    function unpackPaymasterVerificationGasLimit(PackedUserOperation calldata userOp)\n    internal pure returns (uint256) {\n        return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET]));\n    }\n\n    function unpackPostOpGasLimit(PackedUserOperation calldata userOp)\n    internal pure returns (uint256) {\n        return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET]));\n    }\n\n    function unpackPaymasterStaticFields(\n        bytes calldata paymasterAndData\n    ) internal pure returns (address paymaster, uint256 validationGasLimit, uint256 postOpGasLimit) {\n        return (\n            address(bytes20(paymasterAndData[: PAYMASTER_VALIDATION_GAS_OFFSET])),\n            uint128(bytes16(paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET])),\n            uint128(bytes16(paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET]))\n        );\n    }\n\n    /**\n     * Hash the user operation data.\n     * @param userOp - The user operation data.\n     */\n    function hash(\n        PackedUserOperation calldata userOp\n    ) internal pure returns (bytes32) {\n        return keccak256(encode(userOp));\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./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 */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"
      },
      "lib/account-abstraction/contracts/interfaces/PackedUserOperation.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\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 accountGasLimits      - Packed gas limits for validateUserOp and gas limit passed to the callData method call.\n * @param preVerificationGas    - Gas not calculated by the handleOps method, but added to the gas paid.\n *                                Covers batch overhead.\n * @param gasFees               - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters.\n * @param paymasterAndData      - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data\n *                                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 */\nstruct PackedUserOperation {\n    address sender;\n    uint256 nonce;\n    bytes initCode;\n    bytes callData;\n    bytes32 accountGasLimits;\n    uint256 preVerificationGas;\n    bytes32 gasFees;\n    bytes paymasterAndData;\n    bytes signature;\n}\n"
      },
      "lib/account-abstraction/contracts/interfaces/IStakeManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.7.5;\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    event Deposited(address indexed account, uint256 totalDeposit);\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(address indexed account, uint256 withdrawTime);\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 fits into one cell (used during handleOp)\n     *      and the rest fit into a 2nd cell (used during stake/unstake)\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        uint256 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    /**\n     * Get deposit info.\n     * @param account - The account to query.\n     * @return info   - Full deposit information of given account.\n     */\n    function getDepositInfo(\n        address account\n    ) external view returns (DepositInfo memory info);\n\n    /**\n     * Get account balance.\n     * @param account - The account to query.\n     * @return        - The deposit (for gas payment) of the account.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * Add to the deposit of the given account.\n     * @param account - The account to add to.\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(\n        address payable withdrawAddress,\n        uint256 withdrawAmount\n    ) external;\n}\n"
      },
      "lib/account-abstraction/contracts/interfaces/IAggregator.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport \"./PackedUserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n    /**\n     * Validate aggregated signature.\n     * Revert if the aggregated signature does not match the given list of operations.\n     * @param userOps   - Array of UserOperations to validate the signature for.\n     * @param signature - The aggregated signature.\n     */\n    function validateSignatures(\n        PackedUserOperation[] calldata userOps,\n        bytes calldata signature\n    ) external view;\n\n    /**\n     * Validate signature of a single userOp.\n     * This method should be called by bundler after EntryPointSimulation.simulateValidation() returns\n     * the aggregator this account uses.\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(\n        PackedUserOperation 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(\n        PackedUserOperation[] calldata userOps\n    ) external view returns (bytes memory aggregatedSignature);\n}\n"
      },
      "lib/account-abstraction/contracts/interfaces/INonceManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\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/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\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"
      }
    },
    "settings": {
      "remappings": [
        "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        "account-abstraction/=lib/account-abstraction/contracts/",
        "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}