creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/SudoPolicy.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"kernel/sdk/moduleBase/PolicyBase.sol\";\n\ncontract SudoPolicy is PolicyBase {\n    mapping(address => uint256) public usedIds;\n\n    function isInitialized(address wallet) external view override returns (bool) {\n        return usedIds[wallet] > 0;\n    }\n\n    function checkUserOpPolicy(bytes32 id, PackedUserOperation calldata userOp)\n        external\n        payable\n        override\n        returns (uint256)\n    {\n        return 0;\n    }\n\n    function checkSignaturePolicy(bytes32 id, address sender, bytes32 hash, bytes calldata sig)\n        external\n        view\n        override\n        returns (uint256)\n    {\n        return 0;\n    }\n\n    function _policyOninstall(bytes32 id, bytes calldata _data) internal override {\n        usedIds[msg.sender]++;\n    }\n\n    function _policyOnUninstall(bytes32 id, bytes calldata _data) internal override {\n        usedIds[msg.sender]--;\n    }\n}\n"
      },
      "lib/kernel_v3/src/sdk/moduleBase/PolicyBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IPolicy} from \"../../interfaces/IERC7579Modules.sol\";\nimport {PackedUserOperation} from \"../../interfaces/PackedUserOperation.sol\";\n\nabstract contract PolicyBase is IPolicy {\n    function onInstall(bytes calldata data) external payable {\n        bytes32 id = bytes32(data[0:32]);\n        bytes calldata _data = data[32:];\n        _policyOninstall(id, _data);\n    }\n\n    function onUninstall(bytes calldata data) external payable {\n        bytes32 id = bytes32(data[0:32]);\n        bytes calldata _data = data[32:];\n        _policyOnUninstall(id, _data);\n    }\n\n    function isModuleType(uint256 id) external pure returns (bool) {\n        return id == 5;\n    }\n\n    function isInitialized(address) external view virtual returns (bool); // TODO : not sure if this is the right way to do it\n    function checkUserOpPolicy(bytes32 id, PackedUserOperation calldata userOp)\n        external\n        payable\n        virtual\n        returns (uint256);\n    function checkSignaturePolicy(bytes32 id, address sender, bytes32 hash, bytes calldata sig)\n        external\n        view\n        virtual\n        returns (uint256);\n\n    function _policyOninstall(bytes32 id, bytes calldata _data) internal virtual;\n    function _policyOnUninstall(bytes32 id, bytes calldata _data) internal virtual;\n}\n"
      },
      "lib/kernel_v3/src/interfaces/IERC7579Modules.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport {PackedUserOperation} from \"./PackedUserOperation.sol\";\n\nuint256 constant VALIDATION_SUCCESS = 0;\nuint256 constant VALIDATION_FAILED = 1;\n\nuint256 constant MODULE_TYPE_VALIDATOR = 1;\nuint256 constant MODULE_TYPE_EXECUTOR = 2;\nuint256 constant MODULE_TYPE_FALLBACK = 3;\nuint256 constant MODULE_TYPE_HOOK = 4;\nuint256 constant MODULE_TYPE_POLICY = 5;\nuint256 constant MODULE_TYPE_SIGNER = 6;\nuint256 constant MODULE_TYPE_ACTION = 7;\n\ninterface IModule {\n    error AlreadyInitialized(address smartAccount);\n    error NotInitialized(address smartAccount);\n\n    /**\n     * @dev This function is called by the smart account during installation of the module\n     * @param data arbitrary data that may be required on the module during `onInstall`\n     * initialization\n     *\n     * MUST revert on error (i.e. if module is already enabled)\n     */\n    function onInstall(bytes calldata data) external payable;\n\n    /**\n     * @dev This function is called by the smart account during uninstallation of the module\n     * @param data arbitrary data that may be required on the module during `onUninstall`\n     * de-initialization\n     *\n     * MUST revert on error\n     */\n    function onUninstall(bytes calldata data) external payable;\n\n    /**\n     * @dev Returns boolean value if module is a certain type\n     * @param moduleTypeId the module type ID according the ERC-7579 spec\n     *\n     * MUST return true if the module is of the given type and false otherwise\n     */\n    function isModuleType(uint256 moduleTypeId) external view returns (bool);\n\n    /**\n     * @dev Returns if the module was already initialized for a provided smartaccount\n     */\n    function isInitialized(address smartAccount) external view returns (bool);\n}\n\ninterface IValidator is IModule {\n    error InvalidTargetAddress(address target);\n\n    /**\n     * @dev Validates a transaction on behalf of the account.\n     *         This function is intended to be called by the MSA during the ERC-4337 validaton phase\n     *         Note: solely relying on bytes32 hash and signature is not suffcient for some\n     * validation implementations (i.e. SessionKeys often need access to userOp.calldata)\n     * @param userOp The user operation to be validated. The userOp MUST NOT contain any metadata.\n     * The MSA MUST clean up the userOp before sending it to the validator.\n     * @param userOpHash The hash of the user operation to be validated\n     * @return return value according to ERC-4337\n     */\n    function validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)\n        external\n        payable\n        returns (uint256);\n\n    /**\n     * Validator can be used for ERC-1271 validation\n     */\n    function isValidSignatureWithSender(address sender, bytes32 hash, bytes calldata data)\n        external\n        view\n        returns (bytes4);\n}\n\ninterface IExecutor is IModule {}\n\ninterface IHook is IModule {\n    function preCheck(address msgSender, bytes calldata msgData) external payable returns (bytes memory hookData);\n    function postCheck(bytes calldata hookData) external payable returns (bool success);\n}\n\ninterface IFallback is IModule {}\n\ninterface IPolicy is IModule {\n    function checkUserOpPolicy(bytes32 id, PackedUserOperation calldata userOp) external payable returns (uint256);\n    function checkSignaturePolicy(bytes32 id, address sender, bytes32 hash, bytes calldata sig)\n        external\n        view\n        returns (uint256);\n}\n\ninterface ISigner is IModule {\n    function checkUserOpSignature(bytes32 id, PackedUserOperation calldata userOp, bytes32 userOpHash)\n        external\n        payable\n        returns (uint256);\n    function checkSignature(bytes32 id, address sender, bytes32 hash, bytes calldata sig)\n        external\n        view\n        returns (bytes4);\n}\n\ninterface IAction is IModule {}\n"
      },
      "lib/kernel_v3/src/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 maxFeePerGas and maxPriorityFeePerGas - Same as EIP-1559 gas parameter.\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; //maxPriorityFee and maxFeePerGas;\n    bytes paymasterAndData;\n    bytes signature;\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "ds-test/=lib/kernel_v3/lib/forge-std/lib/ds-test/src/",
        "forge-std/=lib/forge-std/src/",
        "kernel/=lib/kernel_v3/src/",
        "ExcessivelySafeCall/=lib/kernel_v3/lib/ExcessivelySafeCall/src/",
        "kernel_v3/=lib/kernel_v3/src/",
        "solady/=lib/kernel_v3/lib/solady/src/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "libraries": {}
    }
  }}