{"file_path":"src/EIP7702/EIP7702StatelessDeleGator.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: MIT AND Apache-2.0\npragma solidity 0.8.23;\n\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport { IEntryPoint } from \"@account-abstraction/interfaces/IEntryPoint.sol\";\n\nimport { EIP7702DeleGatorCore } from \"./EIP7702DeleGatorCore.sol\";\nimport { IDelegationManager } from \"../interfaces/IDelegationManager.sol\";\nimport { ERC1271Lib } from \"../libraries/ERC1271Lib.sol\";\n\n/**\n * @title EIP7702 Stateless Delegator Contract\n * @dev This contract extends the EIP7702DeleGatorCore contract. It provides functionality for EIP7702 based access control\n * and delegation.\n * @dev The signer that controls the DeleGator MUST be the EIP7702 EOA\n */\ncontract EIP7702StatelessDeleGator is EIP7702DeleGatorCore {\n    ////////////////////////////// State //////////////////////////////\n\n    /// @dev The name of the contract\n    string public constant NAME = \"EIP7702StatelessDeleGator\";\n\n    /// @dev The version used in the domainSeparator for EIP712\n    string public constant DOMAIN_VERSION = \"1\";\n\n    /// @dev The version of the contract\n    string public constant VERSION = \"1.3.0\";\n\n    /// @dev The length of a signature\n    uint256 private constant SIGNATURE_LENGTH = 65;\n\n    ////////////////////////////// Constructor //////////////////////////////\n\n    /**\n     * @notice Constructor for the EIP7702Stateless DeleGator\n     * @param _delegationManager the address of the trusted DelegationManager contract that will have root access to this contract\n     * @param _entryPoint the address of the EntryPoint contract that will have root access to this contract\n     */\n    constructor(\n        IDelegationManager _delegationManager,\n        IEntryPoint _entryPoint\n    )\n        EIP7702DeleGatorCore(_delegationManager, _entryPoint, NAME, DOMAIN_VERSION)\n    { }\n\n    ////////////////////////////// Internal Methods //////////////////////////////\n\n    /**\n     * @notice This method is used to verify the signature of the signer\n     * @param _hash The data signed\n     * @param _signature A 65-byte signature produced by the EIP7702 EOA\n     * @return The EIP1271 magic value if the signature is valid, otherwise it reverts\n     */\n    function _isValidSignature(bytes32 _hash, bytes calldata _signature) internal view override returns (bytes4) {\n        if (ECDSA.recover(_hash, _signature) == address(this)) return ERC1271Lib.EIP1271_MAGIC_VALUE;\n\n        return ERC1271Lib.SIG_VALIDATION_FAILED;\n    }\n}\n","deployed_bytecode":"0x6080604052600436106101c65760003560e01c806384b0196e116100f7578063d03c791411610095578063ea4d3c9b11610064578063ea4d3c9b14610568578063ed8101b51461059c578063f23a6e61146105bc578063ffa1ad74146105dc57600080fd5b8063d03c791414610500578063d087d28814610520578063d691c96414610535578063e9ae5c531461055557600080fd5b8063b0d691fe116100d1578063b0d691fe1461045f578063bc197c81146104ab578063c399ec88146104cb578063cef6d209146104e057600080fd5b806384b0196e146103b4578063a3f4df7e146103dc578063acb8cc491461043257600080fd5b80633ed01015116101645780634a58db191161013e5780634a58db19146103645780635c1c6dcd1461036c5780637f07bfdc1461037f57806383ebb7711461039f57600080fd5b80633ed0101514610302578063445140b814610324578063499340471461034457600080fd5b80631626ba7e116101a05780631626ba7e1461026e57806319822f7c1461028e5780632b3afd99146102ae5780633e1b0812146102e257600080fd5b806301ffc9a7146101d257806306394d6714610207578063150b7a021461023557600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611fb2565b61060d565b60405190151581526020015b60405180910390f35b34801561021357600080fd5b50610227610222366004611ff5565b6106f9565b6040519081526020016101fe565b34801561024157600080fd5b506102556102503660046120fb565b61072e565b6040516001600160e01b031990911681526020016101fe565b34801561027a57600080fd5b506102556102893660046121ae565b61078a565b34801561029a57600080fd5b506102276102a93660046121f9565b6107ea565b3480156102ba57600080fd5b506102277fbc37962d8bd1d319c95199bdfda6d3f92baa8903a61b32d5f4ec1f4b36a3bc1881565b3480156102ee57600080fd5b506102276102fd366004612246565b61089b565b34801561030e57600080fd5b5061032261031d36600461226f565b610935565b005b34801561033057600080fd5b506101f261033f3660046122a9565b610a0d565b34801561035057600080fd5b5061032261035f36600461226f565b610a99565b610322610b3c565b61032261037a3660046122c2565b610be7565b34801561038b57600080fd5b5061032261039a3660046122fc565b610c69565b3480156103ab57600080fd5b50610227610d46565b3480156103c057600080fd5b506103c9610d55565b6040516101fe979695949392919061236e565b3480156103e857600080fd5b506104256040518060400160405280601981526020017f4549503737303253746174656c65737344656c654761746f720000000000000081525081565b6040516101fe9190612407565b34801561043e57600080fd5b50610425604051806040016040528060018152602001603160f81b81525081565b34801561046b57600080fd5b506104937f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da03281565b6040516001600160a01b0390911681526020016101fe565b3480156104b757600080fd5b506102556104c6366004612499565b610d9b565b3480156104d757600080fd5b50610227610df8565b3480156104ec57600080fd5b506103226104fb36600461258a565b610e84565b34801561050c57600080fd5b506101f261051b3660046122a9565b610f6b565b34801561052c57600080fd5b50610227610ff6565b6105486105433660046121ae565b61104c565b6040516101fe9190612623565b6103226105633660046121ae565b6112c2565b34801561057457600080fd5b506104937f000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db381565b3480156105a857600080fd5b506102276105b7366004611ff5565b6114d3565b3480156105c857600080fd5b506102556105d7366004612687565b611615565b3480156105e857600080fd5b50610425604051806040016040528060058152602001640312e332e360dc1b81525081565b60006001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b16300361065857604051634f81d01360e11b815260040160405180910390fd5b6001600160e01b031982166335a4725960e21b148061068757506001600160e01b03198216630a85bd0160e11b145b806106a257506001600160e01b03198216630271189760e51b145b806106bd57506001600160e01b031982166301ffc9a760e01b145b806106d857506001600160e01b03198216630b135d3f60e11b145b806106f357506001600160e01b03198216633992254760e01b145b92915050565b60006106f3610706611672565b61070f846114d3565b60405161190160f01b8152600281019290925260228201526042902090565b60006001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b16300361077957604051634f81d01360e11b815260040160405180910390fd5b50630a85bd0160e11b949350505050565b60006001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b1630036107d557604051634f81d01360e11b815260040160405180910390fd5b6107e084848461179d565b90505b9392505050565b6000336001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032161461083557604051636b31ba1560e11b815260040160405180910390fd5b6001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b16300361087e57604051634f81d01360e11b815260040160405180910390fd5b6108908461088b866106f9565b611816565b90506107e38261185e565b604051631aab3f0d60e11b81523060048201526001600160c01b03821660248201526000907f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b0316906335567e1a90604401602060405180830381865afa158015610911573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f391906126ef565b336001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032161480159061096e5750333014155b1561098c57604051630796d94560e01b815260040160405180910390fd5b604051633ed0101560e01b81526001600160a01b037f000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db31690633ed01015906109d8908490600401612837565b600060405180830381600087803b1580156109f257600080fd5b505af1158015610a06573d6000803e3d6000fd5b5050505050565b6040516316a0682960e11b8152600481018290526000907f000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db36001600160a01b031690632d40d05290602401602060405180830381865afa158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f39190612908565b336001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321614801590610ad25750333014155b15610af057604051630796d94560e01b815260040160405180910390fd5b604051634993404760e01b81526001600160a01b037f000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db316906349934047906109d8908490600401612837565b6001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b163003610b8557604051634f81d01360e11b815260040160405180910390fd5b60405163b760faf960e01b81523060048201527f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b03169063b760faf99034906024016000604051808303818588803b1580156109f257600080fd5b336001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321614801590610c205750333014155b15610c3e57604051630796d94560e01b815260040160405180910390fd5b610c65610c4e602083018361292a565b6020830135610c606040850185612947565b6118f6565b5050565b336001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321614801590610ca25750333014155b15610cc057604051630796d94560e01b815260040160405180910390fd5b60405163040b850f60e31b81526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032169063205c287890604401600060405180830381600087803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b505050505050565b6000610d50611672565b905090565b600060608060008060006060610d6961192c565b610d71611959565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60006001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b163003610de657604051634f81d01360e11b815260040160405180910390fd5b5063bc197c8160e01b95945050505050565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b0316906370a08231906024015b602060405180830381865afa158015610e60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5091906126ef565b336001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321614801590610ebd5750333014155b15610edb57604051630796d94560e01b815260040160405180910390fd5b60405163cef6d20960e01b81526001600160a01b037f000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db3169063cef6d20990610f31908990899089908990899089906004016129ee565b600060405180830381600087803b158015610f4b57600080fd5b505af1158015610f5f573d6000803e3d6000fd5b50505050505050505050565b600081600881901b603082901b605083901b610f878486611986565b80610f9b5750610f9b84600160f81b611986565b8015610fc15750610fad836000611986565b80610fc15750610fc183600160f81b611986565b8015610fd557506001600160e01b03198216155b8015610fec575069ffffffffffffffffffff198116155b9695505050505050565b604051631aab3f0d60e11b8152306004820152600060248201819052907f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b0316906335567e1a90604401610e43565b6060336001600160a01b037f000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db3161461109757604051630692ce8160e21b815260040160405180910390fd5b83600881901b6110ab82600160f81b611986565b15611131573660006110bd8787611998565b90925090506110cd836000611986565b156110e3576110dc8282611a31565b945061112a565b6110f183600160f81b611986565b15611100576110dc8282611af2565b6040516308c3ee0360e11b81526001600160f81b0319841660048201526024015b60405180910390fd5b50506112b9565b61113c826000611986565b15611294576000803660006111518989611c1f565b6040805160018082528183019092529498509296509094509250816020015b606081526020019060019003908161117057905050965060006111938682611986565b156111c7576111a4858585856118f6565b886000815181106111b7576111b7612a57565b602002602001018190525061128a565b6111d586600160f81b611986565b15611265576111e685858585611c70565b896000815181106111f9576111f9612a57565b6020908102919091010152905080611260577fe723f28f104e46b47fd3531f3608374ac226bcf3ddda334a23a266453e0efdb760008960008151811061124157611241612a57565b6020026020010151604051611257929190612a6d565b60405180910390a15b61128a565b6040516308c3ee0360e11b81526001600160f81b031987166004820152602401611121565b50505050506112b9565b604051632e5bf3f960e21b81526001600160f81b031983166004820152602401611121565b50509392505050565b336001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da03216148015906112fb5750333014155b1561131957604051630796d94560e01b815260040160405180910390fd5b82600881901b61132d82600160f81b611986565b156113885736600061133f8686611998565b909250905061134f836000611986565b156113645761135e8282611a31565b50611381565b61137283600160f81b611986565b156111005761135e8282611af2565b5050610a06565b611393826000611986565b15611294576000803660006113a88888611c1f565b93509350935093506113be85600060f81b611986565b156113d5576113cf848484846118f6565b506114ca565b6113e385600160f81b611986565b156114a557604080516001808252818301909252600091816020015b60608152602001906001900390816113ff579050509050600061142486868686611c70565b8360008151811061143757611437612a57565b602090810291909101015290508061149e577fe723f28f104e46b47fd3531f3608374ac226bcf3ddda334a23a266453e0efdb760008360008151811061147f5761147f612a57565b6020026020010151604051611495929190612a6d565b60405180910390a15b50506114ca565b6040516308c3ee0360e11b81526001600160f81b031986166004820152602401611121565b50505050610a06565b60007fbc37962d8bd1d319c95199bdfda6d3f92baa8903a61b32d5f4ec1f4b36a3bc18611503602084018461292a565b60208401356115156040860186612947565b604051611523929190612a86565b6040519081900390206115396060870187612947565b604051611547929190612a86565b604051908190039020608087013560a088013560c089013561156c60e08b018b612947565b60405161157a929190612a86565b60408051918290038220602083019a909a526001600160a01b03988916908201526060810196909652608086019490945260a085019290925260c084015260e08301526101008201526101208101929092527f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321661014082015261016001604051602081830303815290604052805190602001209050919050565b60006001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b16300361166057604051634f81d01360e11b815260040160405180910390fd5b5063f23a6e6160e01b95945050505050565b6000306001600160a01b037f00000000000000000000000063c0c19a282a1b52b07dd5a65b58948a07dae32b161480156116cb57507f000000000000000000000000000000000000000000000000000000000000000146145b156116f557507fa19b62214f2551ffb2d44413716fd580710b2992e6261b9e161e65847d90b77e90565b610d50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f87e2b3436f0f6d8494dfcb826d860322ea231814dba9eb086540f62b8561c57b918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000306001600160a01b03166117e98585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611ca192505050565b6001600160a01b0316036118055750630b135d3f60e11b6107e3565b506001600160e01b03199392505050565b6000806118308361182b610100870187612947565b61179d565b90506374eca2c160e11b6001600160e01b03198216016118545760009150506106f3565b5060019392505050565b80156118f357604051600090339060001990849084818181858888f193505050503d80600081146118ab576040519150601f19603f3d011682016040523d82523d6000602084013e6118b0565b606091505b505060408051848152821515602082015291925033917fa427c7d47f24d01b170779a7600b1d4c0d7cdbabaa0f19c4f0e6182053ffc931910160405180910390a2505b50565b60405181838237600038838387895af1611913573d6000823e3d81fd5b3d8152602081013d6000823e3d01604052949350505050565b6060610d507f4549503737303253746174656c65737344656c654761746f72000000000000196000611ccb565b6060610d507f31000000000000000000000000000000000000000000000000000000000000016001611ccb565b6001600160f81b031990811691161490565b366000833580850160208587010360208201945081359350808460051b8301118360401c17156119d05763ba597e7e6000526004601cfd5b8315611a27578392505b6001830392508260051b850135915081850160408101358082018381358201118460408501111782861782351760401c1715611a1e5763ba597e7e6000526004601cfd5b505050826119da575b5050509250929050565b606081806001600160401b03811115611a4c57611a4c612046565b604051908082528060200260200182016040528015611a7f57816020015b6060815260200190600190039081611a6a5790505b50915060005b81811015611aea5736858583818110611aa057611aa0612a57565b9050602002810190611ab29190612a96565b9050611ac4610c4e602083018361292a565b848381518110611ad657611ad6612a57565b602090810291909101015250600101611a85565b505092915050565b606081806001600160401b03811115611b0d57611b0d612046565b604051908082528060200260200182016040528015611b4057816020015b6060815260200190600190039081611b2b5790505b50915060005b81811015611aea5736858583818110611b6157611b61612a57565b9050602002810190611b739190612a96565b90506000611b9e611b87602084018461292a565b6020840135611b996040860186612947565b611c70565b868581518110611bb057611bb0612a57565b6020908102919091010152905080611c15577fe723f28f104e46b47fd3531f3608374ac226bcf3ddda334a23a266453e0efdb783868581518110611bf657611bf6612a57565b6020026020010151604051611c0c929190612a6d565b60405180910390a15b5050600101611b46565b6000803681611c316014828789612ab6565b611c3a91612ae0565b60601c9350611c4d603460148789612ab6565b611c5691612b13565b9250611c658560348189612ab6565b949793965094505050565b604051600090828482376000388483888a5af191503d8152602081013d6000823e3d81016040525094509492505050565b600080600080611cb18686611d76565b925092509250611cc18282611dc3565b5090949350505050565b606060ff8314611ce557611cde83611e7c565b90506106f3565b818054611cf190612b31565b80601f0160208091040260200160405190810160405280929190818152602001828054611d1d90612b31565b8015611d6a5780601f10611d3f57610100808354040283529160200191611d6a565b820191906000526020600020905b815481529060010190602001808311611d4d57829003601f168201915b505050505090506106f3565b60008060008351604103611db05760208401516040850151606086015160001a611da288828585611ebb565b955095509550505050611dbc565b50508151600091506002905b9250925092565b6000826003811115611dd757611dd7612b65565b03611de0575050565b6001826003811115611df457611df4612b65565b03611e125760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115611e2657611e26612b65565b03611e475760405163fce698f760e01b815260048101829052602401611121565b6003826003811115611e5b57611e5b612b65565b03610c65576040516335e2f38360e21b815260048101829052602401611121565b60606000611e8983611f8a565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115611ef65750600091506003905082611f80565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015611f4a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611f7657506000925060019150829050611f80565b9250600091508190505b9450945094915050565b600060ff8216601f8111156106f357604051632cd44ac360e21b815260040160405180910390fd5b600060208284031215611fc457600080fd5b81356001600160e01b0319811681146107e357600080fd5b60006101208284031215611fef57600080fd5b50919050565b60006020828403121561200757600080fd5b81356001600160401b0381111561201d57600080fd5b61202984828501611fdc565b949350505050565b6001600160a01b03811681146118f357600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561208457612084612046565b604052919050565b600082601f83011261209d57600080fd5b81356001600160401b038111156120b6576120b6612046565b6120c9601f8201601f191660200161205c565b8181528460208386010111156120de57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561211157600080fd5b843561211c81612031565b9350602085013561212c81612031565b92506040850135915060608501356001600160401b0381111561214e57600080fd5b61215a8782880161208c565b91505092959194509250565b60008083601f84011261217857600080fd5b5081356001600160401b0381111561218f57600080fd5b6020830191508360208285010111156121a757600080fd5b9250929050565b6000806000604084860312156121c357600080fd5b8335925060208401356001600160401b038111156121e057600080fd5b6121ec86828701612166565b9497909650939450505050565b60008060006060848603121561220e57600080fd5b83356001600160401b0381111561222457600080fd5b61223086828701611fdc565b9660208601359650604090950135949350505050565b60006020828403121561225857600080fd5b81356001600160c01b03811681146107e357600080fd5b60006020828403121561228157600080fd5b81356001600160401b0381111561229757600080fd5b820160c081850312156107e357600080fd5b6000602082840312156122bb57600080fd5b5035919050565b6000602082840312156122d457600080fd5b81356001600160401b038111156122ea57600080fd5b8201606081850312156107e357600080fd5b6000806040838503121561230f57600080fd5b823561231a81612031565b946020939093013593505050565b6000815180845260005b8181101561234e57602081850181015186830182015201612332565b506000602082860101526020601f19601f83011685010191505092915050565b60ff60f81b881681526000602060e0602084015261238f60e084018a612328565b83810360408501526123a1818a612328565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b818110156123f5578351835292840192918401916001016123d9565b50909c9b505050505050505050505050565b6020815260006107e36020830184612328565b600082601f83011261242b57600080fd5b813560206001600160401b0382111561244657612446612046565b8160051b61245582820161205c565b928352848101820192828101908785111561246f57600080fd5b83870192505b8483101561248e57823582529183019190830190612475565b979650505050505050565b600080600080600060a086880312156124b157600080fd5b85356124bc81612031565b945060208601356124cc81612031565b935060408601356001600160401b03808211156124e857600080fd5b6124f489838a0161241a565b9450606088013591508082111561250a57600080fd5b61251689838a0161241a565b9350608088013591508082111561252c57600080fd5b506125398882890161208c565b9150509295509295909350565b60008083601f84011261255857600080fd5b5081356001600160401b0381111561256f57600080fd5b6020830191508360208260051b85010111156121a757600080fd5b600080600080600080606087890312156125a357600080fd5b86356001600160401b03808211156125ba57600080fd5b6125c68a838b01612546565b909850965060208901359150808211156125df57600080fd5b6125eb8a838b01612546565b9096509450604089013591508082111561260457600080fd5b5061261189828a01612546565b979a9699509497509295939492505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b8281101561267a57603f19888603018452612668858351612328565b9450928501929085019060010161264c565b5092979650505050505050565b600080600080600060a0868803121561269f57600080fd5b85356126aa81612031565b945060208601356126ba81612031565b9350604086013592506060860135915060808601356001600160401b038111156126e357600080fd5b6125398882890161208c565b60006020828403121561270157600080fd5b5051919050565b6000808335601e1984360301811261271f57600080fd5b83016020810192503590506001600160401b0381111561273e57600080fd5b8036038213156121a757600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008383855260208086019550808560051b830101846000805b8881101561282957858403601f19018a52823536899003605e190181126127b5578283fd5b8801606081356127c481612031565b6001600160a01b031686526127db82880183612708565b82898901526127ed838901828461274d565b9250505060406127ff81840184612708565b93508783038289015261281383858361274d565b9d89019d97505050938601935050600101612790565b509198975050505050505050565b602081526000823561284881612031565b6001600160a01b039081166020848101919091528401359061286982612031565b80821660408501525050604083013560608301526060830135601e1984360301811261289457600080fd5b83016020810190356001600160401b038111156128b057600080fd5b8060051b36038213156128c257600080fd5b60c060808501526128d760e085018284612776565b915050608084013560a08401526128f160a0850185612708565b848303601f190160c0860152610fec83828461274d565b60006020828403121561291a57600080fd5b815180151581146107e357600080fd5b60006020828403121561293c57600080fd5b81356107e381612031565b6000808335601e1984360301811261295e57600080fd5b8301803591506001600160401b0382111561297857600080fd5b6020019150368190038213156121a757600080fd5b6000838385526020808601955060208560051b8301018460005b878110156129e157848303601f190189526129c28288612708565b6129cd85828461274d565b9a86019a94505050908301906001016129a7565b5090979650505050505050565b606081526000612a0260608301888a61298d565b8281036020848101919091528682528791810160005b88811015612a3457833582529282019290820190600101612a18565b508481036040860152612a4881878961298d565b9b9a5050505050505050505050565b634e487b7160e01b600052603260045260246000fd5b8281526040602082015260006107e06040830184612328565b8183823760009101908152919050565b60008235605e19833603018112612aac57600080fd5b9190910192915050565b60008085851115612ac657600080fd5b83861115612ad357600080fd5b5050820193919092039150565b6bffffffffffffffffffffffff198135818116916014851015611aea5760149490940360031b84901b1690921692915050565b803560208310156106f357600019602084900360031b1b1692915050565b600181811c90821680612b4557607f821691505b602082108103611fef57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220d057b8f9a4d5cb46c51c1004ce8cae8dcd3c06323da26ccdfd3dd38584a43adb64736f6c63430008170033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"outputSelection":{},"remappings":["@FCL/=lib/FCL/solidity/src/","@SCL/=lib/SCL/src/","@account-abstraction/=lib/account-abstraction/contracts/","@bytes-utils/=lib/solidity-bytes-utils/contracts/","@erc7579/=lib/erc7579-implementation/src/","@openzeppelin/contracts-upgradeable/=lib/openzeppelin-upgradable-contracts/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","@solidity-stringutils/=lib/solidity-stringutils/src/","@solidity/=lib/SCL/src/","FCL/=lib/FCL/solidity/src/","FreshCryptoLib/=lib/FreshCryptoLib/solidity/src/","SCL/=lib/SCL/","account-abstraction/=lib/account-abstraction/contracts/","ds-test/=lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","erc7579-implementation/=lib/erc7579-implementation/src/","forge-std/=lib/forge-std/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/","sentinellist/=lib/erc7579-implementation/node_modules/@rhinestone/sentinellist/src/","solady/=lib/erc7579-implementation/node_modules/solady/src/","solidity-bytes-utils/=lib/solidity-bytes-utils/contracts/","solidity-stringutils/=lib/solidity-stringutils/"]},"optimization_runs":200,"sourcify_repo_url":null,"decoded_constructor_args":[["0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3",{"internalType":"contract IDelegationManager","name":"_delegationManager","type":"address"}],["0x0000000071727De22E5E9d8BAf0edAc6f37da032",{"internalType":"contract IEntryPoint","name":"_entryPoint","type":"address"}]],"compiler_version":"v0.8.23+commit.f704f362","is_verified_via_verifier_alliance":false,"verified_at":"2025-05-07T09:31:29.034573Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x6101c060405230610160523480156200001757600080fd5b50604051620031b0380380620031b08339810160408190526200003a91620002b3565b81816040518060400160405280601981526020017f4549503737303253746174656c65737344656c654761746f7200000000000000815250604051806040016040528060018152602001603160f81b8152508181620000a46000836200021560201b90919060201c565b61012052620000b581600162000215565b61014052815160208084019190912060e052815190820120610100524660a0526200014360e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c0528151601f10156200017057604051631ad9af3960e21b815260040160405180910390fd5b601f8151111562000194576040516309203c9d60e41b815260040160405180910390fd5b6001600160a01b038085166101808190529084166101a0526040517fb2e8eb88b584ae71ef4e854c10847f4d39bd93e52599f147bfb4dcc8de52014d90600090a26040516001600160a01b038416907fee8699dc0e27105da2653bdba54be0edcaadc3e33890a3ad705517ffe9bf0a9990600090a2505050505050620004db565b600060208351101562000235576200022d836200024e565b905062000248565b8162000242848262000399565b5060ff90505b92915050565b600080829050601f8151111562000285578260405163305a27a960e01b81526004016200027c919062000465565b60405180910390fd5b80516200029282620004b6565b179392505050565b6001600160a01b0381168114620002b057600080fd5b50565b60008060408385031215620002c757600080fd5b8251620002d4816200029a565b6020840151909250620002e7816200029a565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200031d57607f821691505b6020821081036200033e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000394576000816000526020600020601f850160051c810160208610156200036f5750805b601f850160051c820191505b8181101562000390578281556001016200037b565b5050505b505050565b81516001600160401b03811115620003b557620003b5620002f2565b620003cd81620003c6845462000308565b8462000344565b602080601f831160018114620004055760008415620003ec5750858301515b600019600386901b1c1916600185901b17855562000390565b600085815260208120601f198616915b82811015620004365788860151825594840194600190910190840162000415565b5085821015620004555787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020808352835180602085015260005b81811015620004955785810183015185820160400152820162000477565b506000604082860101526040601f19601f8301168501019250505092915050565b805160208083015191908110156200033e5760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a051612bb1620005ff60003960008181610471015281816107f7015281816108c20152818161094001528181610aa401528181610b9a01528181610bf201528181610c7401528181610ce601528181610e1001528181610e8f01528181611015015281816112cd01526115ce01526000818161057a015281816109a301528181610a2601528181610b0701528181610ef201526110590152600081816106190152818161073a015281816107960152818161083f01528181610b4601528181610da7015261162101526000611960015260006119330152600061174c015260006117240152600061167f015260006116a9015260006116d30152612bb16000f3fe6080604052600436106101c65760003560e01c806384b0196e116100f7578063d03c791411610095578063ea4d3c9b11610064578063ea4d3c9b14610568578063ed8101b51461059c578063f23a6e61146105bc578063ffa1ad74146105dc57600080fd5b8063d03c791414610500578063d087d28814610520578063d691c96414610535578063e9ae5c531461055557600080fd5b8063b0d691fe116100d1578063b0d691fe1461045f578063bc197c81146104ab578063c399ec88146104cb578063cef6d209146104e057600080fd5b806384b0196e146103b4578063a3f4df7e146103dc578063acb8cc491461043257600080fd5b80633ed01015116101645780634a58db191161013e5780634a58db19146103645780635c1c6dcd1461036c5780637f07bfdc1461037f57806383ebb7711461039f57600080fd5b80633ed0101514610302578063445140b814610324578063499340471461034457600080fd5b80631626ba7e116101a05780631626ba7e1461026e57806319822f7c1461028e5780632b3afd99146102ae5780633e1b0812146102e257600080fd5b806301ffc9a7146101d257806306394d6714610207578063150b7a021461023557600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611fb2565b61060d565b60405190151581526020015b60405180910390f35b34801561021357600080fd5b50610227610222366004611ff5565b6106f9565b6040519081526020016101fe565b34801561024157600080fd5b506102556102503660046120fb565b61072e565b6040516001600160e01b031990911681526020016101fe565b34801561027a57600080fd5b506102556102893660046121ae565b61078a565b34801561029a57600080fd5b506102276102a93660046121f9565b6107ea565b3480156102ba57600080fd5b506102277fbc37962d8bd1d319c95199bdfda6d3f92baa8903a61b32d5f4ec1f4b36a3bc1881565b3480156102ee57600080fd5b506102276102fd366004612246565b61089b565b34801561030e57600080fd5b5061032261031d36600461226f565b610935565b005b34801561033057600080fd5b506101f261033f3660046122a9565b610a0d565b34801561035057600080fd5b5061032261035f36600461226f565b610a99565b610322610b3c565b61032261037a3660046122c2565b610be7565b34801561038b57600080fd5b5061032261039a3660046122fc565b610c69565b3480156103ab57600080fd5b50610227610d46565b3480156103c057600080fd5b506103c9610d55565b6040516101fe979695949392919061236e565b3480156103e857600080fd5b506104256040518060400160405280601981526020017f4549503737303253746174656c65737344656c654761746f720000000000000081525081565b6040516101fe9190612407565b34801561043e57600080fd5b50610425604051806040016040528060018152602001603160f81b81525081565b34801561046b57600080fd5b506104937f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101fe565b3480156104b757600080fd5b506102556104c6366004612499565b610d9b565b3480156104d757600080fd5b50610227610df8565b3480156104ec57600080fd5b506103226104fb36600461258a565b610e84565b34801561050c57600080fd5b506101f261051b3660046122a9565b610f6b565b34801561052c57600080fd5b50610227610ff6565b6105486105433660046121ae565b61104c565b6040516101fe9190612623565b6103226105633660046121ae565b6112c2565b34801561057457600080fd5b506104937f000000000000000000000000000000000000000000000000000000000000000081565b3480156105a857600080fd5b506102276105b7366004611ff5565b6114d3565b3480156105c857600080fd5b506102556105d7366004612687565b611615565b3480156105e857600080fd5b50610425604051806040016040528060058152602001640312e332e360dc1b81525081565b60006001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361065857604051634f81d01360e11b815260040160405180910390fd5b6001600160e01b031982166335a4725960e21b148061068757506001600160e01b03198216630a85bd0160e11b145b806106a257506001600160e01b03198216630271189760e51b145b806106bd57506001600160e01b031982166301ffc9a760e01b145b806106d857506001600160e01b03198216630b135d3f60e11b145b806106f357506001600160e01b03198216633992254760e01b145b92915050565b60006106f3610706611672565b61070f846114d3565b60405161190160f01b8152600281019290925260228201526042902090565b60006001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361077957604051634f81d01360e11b815260040160405180910390fd5b50630a85bd0160e11b949350505050565b60006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036107d557604051634f81d01360e11b815260040160405180910390fd5b6107e084848461179d565b90505b9392505050565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461083557604051636b31ba1560e11b815260040160405180910390fd5b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361087e57604051634f81d01360e11b815260040160405180910390fd5b6108908461088b866106f9565b611816565b90506107e38261185e565b604051631aab3f0d60e11b81523060048201526001600160c01b03821660248201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906335567e1a90604401602060405180830381865afa158015610911573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f391906126ef565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480159061096e5750333014155b1561098c57604051630796d94560e01b815260040160405180910390fd5b604051633ed0101560e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633ed01015906109d8908490600401612837565b600060405180830381600087803b1580156109f257600080fd5b505af1158015610a06573d6000803e3d6000fd5b5050505050565b6040516316a0682960e11b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632d40d05290602401602060405180830381865afa158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f39190612908565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801590610ad25750333014155b15610af057604051630796d94560e01b815260040160405180910390fd5b604051634993404760e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906349934047906109d8908490600401612837565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610b8557604051634f81d01360e11b815260040160405180910390fd5b60405163b760faf960e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063b760faf99034906024016000604051808303818588803b1580156109f257600080fd5b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801590610c205750333014155b15610c3e57604051630796d94560e01b815260040160405180910390fd5b610c65610c4e602083018361292a565b6020830135610c606040850185612947565b6118f6565b5050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801590610ca25750333014155b15610cc057604051630796d94560e01b815260040160405180910390fd5b60405163040b850f60e31b81526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063205c287890604401600060405180830381600087803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b505050505050565b6000610d50611672565b905090565b600060608060008060006060610d6961192c565b610d71611959565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60006001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610de657604051634f81d01360e11b815260040160405180910390fd5b5063bc197c8160e01b95945050505050565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a08231906024015b602060405180830381865afa158015610e60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5091906126ef565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801590610ebd5750333014155b15610edb57604051630796d94560e01b815260040160405180910390fd5b60405163cef6d20960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cef6d20990610f31908990899089908990899089906004016129ee565b600060405180830381600087803b158015610f4b57600080fd5b505af1158015610f5f573d6000803e3d6000fd5b50505050505050505050565b600081600881901b603082901b605083901b610f878486611986565b80610f9b5750610f9b84600160f81b611986565b8015610fc15750610fad836000611986565b80610fc15750610fc183600160f81b611986565b8015610fd557506001600160e01b03198216155b8015610fec575069ffffffffffffffffffff198116155b9695505050505050565b604051631aab3f0d60e11b8152306004820152600060248201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906335567e1a90604401610e43565b6060336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461109757604051630692ce8160e21b815260040160405180910390fd5b83600881901b6110ab82600160f81b611986565b15611131573660006110bd8787611998565b90925090506110cd836000611986565b156110e3576110dc8282611a31565b945061112a565b6110f183600160f81b611986565b15611100576110dc8282611af2565b6040516308c3ee0360e11b81526001600160f81b0319841660048201526024015b60405180910390fd5b50506112b9565b61113c826000611986565b15611294576000803660006111518989611c1f565b6040805160018082528183019092529498509296509094509250816020015b606081526020019060019003908161117057905050965060006111938682611986565b156111c7576111a4858585856118f6565b886000815181106111b7576111b7612a57565b602002602001018190525061128a565b6111d586600160f81b611986565b15611265576111e685858585611c70565b896000815181106111f9576111f9612a57565b6020908102919091010152905080611260577fe723f28f104e46b47fd3531f3608374ac226bcf3ddda334a23a266453e0efdb760008960008151811061124157611241612a57565b6020026020010151604051611257929190612a6d565b60405180910390a15b61128a565b6040516308c3ee0360e11b81526001600160f81b031987166004820152602401611121565b50505050506112b9565b604051632e5bf3f960e21b81526001600160f81b031983166004820152602401611121565b50509392505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015906112fb5750333014155b1561131957604051630796d94560e01b815260040160405180910390fd5b82600881901b61132d82600160f81b611986565b156113885736600061133f8686611998565b909250905061134f836000611986565b156113645761135e8282611a31565b50611381565b61137283600160f81b611986565b156111005761135e8282611af2565b5050610a06565b611393826000611986565b15611294576000803660006113a88888611c1f565b93509350935093506113be85600060f81b611986565b156113d5576113cf848484846118f6565b506114ca565b6113e385600160f81b611986565b156114a557604080516001808252818301909252600091816020015b60608152602001906001900390816113ff579050509050600061142486868686611c70565b8360008151811061143757611437612a57565b602090810291909101015290508061149e577fe723f28f104e46b47fd3531f3608374ac226bcf3ddda334a23a266453e0efdb760008360008151811061147f5761147f612a57565b6020026020010151604051611495929190612a6d565b60405180910390a15b50506114ca565b6040516308c3ee0360e11b81526001600160f81b031986166004820152602401611121565b50505050610a06565b60007fbc37962d8bd1d319c95199bdfda6d3f92baa8903a61b32d5f4ec1f4b36a3bc18611503602084018461292a565b60208401356115156040860186612947565b604051611523929190612a86565b6040519081900390206115396060870187612947565b604051611547929190612a86565b604051908190039020608087013560a088013560c089013561156c60e08b018b612947565b60405161157a929190612a86565b60408051918290038220602083019a909a526001600160a01b03988916908201526060810196909652608086019490945260a085019290925260c084015260e08301526101008201526101208101929092527f00000000000000000000000000000000000000000000000000000000000000001661014082015261016001604051602081830303815290604052805190602001209050919050565b60006001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361166057604051634f81d01360e11b815260040160405180910390fd5b5063f23a6e6160e01b95945050505050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156116cb57507f000000000000000000000000000000000000000000000000000000000000000046145b156116f557507f000000000000000000000000000000000000000000000000000000000000000090565b610d50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000306001600160a01b03166117e98585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611ca192505050565b6001600160a01b0316036118055750630b135d3f60e11b6107e3565b506001600160e01b03199392505050565b6000806118308361182b610100870187612947565b61179d565b90506374eca2c160e11b6001600160e01b03198216016118545760009150506106f3565b5060019392505050565b80156118f357604051600090339060001990849084818181858888f193505050503d80600081146118ab576040519150601f19603f3d011682016040523d82523d6000602084013e6118b0565b606091505b505060408051848152821515602082015291925033917fa427c7d47f24d01b170779a7600b1d4c0d7cdbabaa0f19c4f0e6182053ffc931910160405180910390a2505b50565b60405181838237600038838387895af1611913573d6000823e3d81fd5b3d8152602081013d6000823e3d01604052949350505050565b6060610d507f00000000000000000000000000000000000000000000000000000000000000006000611ccb565b6060610d507f00000000000000000000000000000000000000000000000000000000000000006001611ccb565b6001600160f81b031990811691161490565b366000833580850160208587010360208201945081359350808460051b8301118360401c17156119d05763ba597e7e6000526004601cfd5b8315611a27578392505b6001830392508260051b850135915081850160408101358082018381358201118460408501111782861782351760401c1715611a1e5763ba597e7e6000526004601cfd5b505050826119da575b5050509250929050565b606081806001600160401b03811115611a4c57611a4c612046565b604051908082528060200260200182016040528015611a7f57816020015b6060815260200190600190039081611a6a5790505b50915060005b81811015611aea5736858583818110611aa057611aa0612a57565b9050602002810190611ab29190612a96565b9050611ac4610c4e602083018361292a565b848381518110611ad657611ad6612a57565b602090810291909101015250600101611a85565b505092915050565b606081806001600160401b03811115611b0d57611b0d612046565b604051908082528060200260200182016040528015611b4057816020015b6060815260200190600190039081611b2b5790505b50915060005b81811015611aea5736858583818110611b6157611b61612a57565b9050602002810190611b739190612a96565b90506000611b9e611b87602084018461292a565b6020840135611b996040860186612947565b611c70565b868581518110611bb057611bb0612a57565b6020908102919091010152905080611c15577fe723f28f104e46b47fd3531f3608374ac226bcf3ddda334a23a266453e0efdb783868581518110611bf657611bf6612a57565b6020026020010151604051611c0c929190612a6d565b60405180910390a15b5050600101611b46565b6000803681611c316014828789612ab6565b611c3a91612ae0565b60601c9350611c4d603460148789612ab6565b611c5691612b13565b9250611c658560348189612ab6565b949793965094505050565b604051600090828482376000388483888a5af191503d8152602081013d6000823e3d81016040525094509492505050565b600080600080611cb18686611d76565b925092509250611cc18282611dc3565b5090949350505050565b606060ff8314611ce557611cde83611e7c565b90506106f3565b818054611cf190612b31565b80601f0160208091040260200160405190810160405280929190818152602001828054611d1d90612b31565b8015611d6a5780601f10611d3f57610100808354040283529160200191611d6a565b820191906000526020600020905b815481529060010190602001808311611d4d57829003601f168201915b505050505090506106f3565b60008060008351604103611db05760208401516040850151606086015160001a611da288828585611ebb565b955095509550505050611dbc565b50508151600091506002905b9250925092565b6000826003811115611dd757611dd7612b65565b03611de0575050565b6001826003811115611df457611df4612b65565b03611e125760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115611e2657611e26612b65565b03611e475760405163fce698f760e01b815260048101829052602401611121565b6003826003811115611e5b57611e5b612b65565b03610c65576040516335e2f38360e21b815260048101829052602401611121565b60606000611e8983611f8a565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115611ef65750600091506003905082611f80565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015611f4a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611f7657506000925060019150829050611f80565b9250600091508190505b9450945094915050565b600060ff8216601f8111156106f357604051632cd44ac360e21b815260040160405180910390fd5b600060208284031215611fc457600080fd5b81356001600160e01b0319811681146107e357600080fd5b60006101208284031215611fef57600080fd5b50919050565b60006020828403121561200757600080fd5b81356001600160401b0381111561201d57600080fd5b61202984828501611fdc565b949350505050565b6001600160a01b03811681146118f357600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561208457612084612046565b604052919050565b600082601f83011261209d57600080fd5b81356001600160401b038111156120b6576120b6612046565b6120c9601f8201601f191660200161205c565b8181528460208386010111156120de57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561211157600080fd5b843561211c81612031565b9350602085013561212c81612031565b92506040850135915060608501356001600160401b0381111561214e57600080fd5b61215a8782880161208c565b91505092959194509250565b60008083601f84011261217857600080fd5b5081356001600160401b0381111561218f57600080fd5b6020830191508360208285010111156121a757600080fd5b9250929050565b6000806000604084860312156121c357600080fd5b8335925060208401356001600160401b038111156121e057600080fd5b6121ec86828701612166565b9497909650939450505050565b60008060006060848603121561220e57600080fd5b83356001600160401b0381111561222457600080fd5b61223086828701611fdc565b9660208601359650604090950135949350505050565b60006020828403121561225857600080fd5b81356001600160c01b03811681146107e357600080fd5b60006020828403121561228157600080fd5b81356001600160401b0381111561229757600080fd5b820160c081850312156107e357600080fd5b6000602082840312156122bb57600080fd5b5035919050565b6000602082840312156122d457600080fd5b81356001600160401b038111156122ea57600080fd5b8201606081850312156107e357600080fd5b6000806040838503121561230f57600080fd5b823561231a81612031565b946020939093013593505050565b6000815180845260005b8181101561234e57602081850181015186830182015201612332565b506000602082860101526020601f19601f83011685010191505092915050565b60ff60f81b881681526000602060e0602084015261238f60e084018a612328565b83810360408501526123a1818a612328565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b818110156123f5578351835292840192918401916001016123d9565b50909c9b505050505050505050505050565b6020815260006107e36020830184612328565b600082601f83011261242b57600080fd5b813560206001600160401b0382111561244657612446612046565b8160051b61245582820161205c565b928352848101820192828101908785111561246f57600080fd5b83870192505b8483101561248e57823582529183019190830190612475565b979650505050505050565b600080600080600060a086880312156124b157600080fd5b85356124bc81612031565b945060208601356124cc81612031565b935060408601356001600160401b03808211156124e857600080fd5b6124f489838a0161241a565b9450606088013591508082111561250a57600080fd5b61251689838a0161241a565b9350608088013591508082111561252c57600080fd5b506125398882890161208c565b9150509295509295909350565b60008083601f84011261255857600080fd5b5081356001600160401b0381111561256f57600080fd5b6020830191508360208260051b85010111156121a757600080fd5b600080600080600080606087890312156125a357600080fd5b86356001600160401b03808211156125ba57600080fd5b6125c68a838b01612546565b909850965060208901359150808211156125df57600080fd5b6125eb8a838b01612546565b9096509450604089013591508082111561260457600080fd5b5061261189828a01612546565b979a9699509497509295939492505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b8281101561267a57603f19888603018452612668858351612328565b9450928501929085019060010161264c565b5092979650505050505050565b600080600080600060a0868803121561269f57600080fd5b85356126aa81612031565b945060208601356126ba81612031565b9350604086013592506060860135915060808601356001600160401b038111156126e357600080fd5b6125398882890161208c565b60006020828403121561270157600080fd5b5051919050565b6000808335601e1984360301811261271f57600080fd5b83016020810192503590506001600160401b0381111561273e57600080fd5b8036038213156121a757600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008383855260208086019550808560051b830101846000805b8881101561282957858403601f19018a52823536899003605e190181126127b5578283fd5b8801606081356127c481612031565b6001600160a01b031686526127db82880183612708565b82898901526127ed838901828461274d565b9250505060406127ff81840184612708565b93508783038289015261281383858361274d565b9d89019d97505050938601935050600101612790565b509198975050505050505050565b602081526000823561284881612031565b6001600160a01b039081166020848101919091528401359061286982612031565b80821660408501525050604083013560608301526060830135601e1984360301811261289457600080fd5b83016020810190356001600160401b038111156128b057600080fd5b8060051b36038213156128c257600080fd5b60c060808501526128d760e085018284612776565b915050608084013560a08401526128f160a0850185612708565b848303601f190160c0860152610fec83828461274d565b60006020828403121561291a57600080fd5b815180151581146107e357600080fd5b60006020828403121561293c57600080fd5b81356107e381612031565b6000808335601e1984360301811261295e57600080fd5b8301803591506001600160401b0382111561297857600080fd5b6020019150368190038213156121a757600080fd5b6000838385526020808601955060208560051b8301018460005b878110156129e157848303601f190189526129c28288612708565b6129cd85828461274d565b9a86019a94505050908301906001016129a7565b5090979650505050505050565b606081526000612a0260608301888a61298d565b8281036020848101919091528682528791810160005b88811015612a3457833582529282019290820190600101612a18565b508481036040860152612a4881878961298d565b9b9a5050505050505050505050565b634e487b7160e01b600052603260045260246000fd5b8281526040602082015260006107e06040830184612328565b8183823760009101908152919050565b60008235605e19833603018112612aac57600080fd5b9190910192915050565b60008085851115612ac657600080fd5b83861115612ad357600080fd5b5050820193919092039150565b6bffffffffffffffffffffffff198135818116916014851015611aea5760149490940360031b84901b1690921692915050565b803560208310156106f357600019602084900360031b1b1692915050565b600181811c90821680612b4557607f821691505b602082108103611fef57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220d057b8f9a4d5cb46c51c1004ce8cae8dcd3c06323da26ccdfd3dd38584a43adb64736f6c63430008170033000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db30000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032","name":"EIP7702StatelessDeleGator","is_blueprint":false,"license_type":"mit","is_fully_verified":true,"is_verified_via_eth_bytecode_db":false,"language":"solidity","evm_version":"london","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"lib/account-abstraction/contracts/interfaces/IAggregator.sol","source_code":"// 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"},{"file_path":"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol","source_code":"/**\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 \"./PackedUserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./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"},{"file_path":"lib/account-abstraction/contracts/interfaces/INonceManager.sol","source_code":"// 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"},{"file_path":"lib/account-abstraction/contracts/interfaces/IStakeManager.sol","source_code":"// 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"},{"file_path":"lib/account-abstraction/contracts/interfaces/PackedUserOperation.sol","source_code":"// 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"},{"file_path":"lib/erc7579-implementation/src/core/ExecutionHelper.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\nimport { Execution } from \"../interfaces/IERC7579Account.sol\";\n\n/**\n * @title Execution\n * @dev This contract executes calls in the context of this contract.\n * @author zeroknots.eth | rhinestone.wtf\n * shoutout to solady (vectorized, ross) for this code\n * https://github.com/Vectorized/solady/blob/main/src/accounts/ERC4337.sol\n */\ncontract ExecutionHelper {\n    error ExecutionFailed();\n\n    event TryExecuteUnsuccessful(uint256 batchExecutionindex, bytes result);\n\n    function _execute(Execution[] calldata executions) internal returns (bytes[] memory result) {\n        uint256 length = executions.length;\n        result = new bytes[](length);\n\n        for (uint256 i; i < length; i++) {\n            Execution calldata _exec = executions[i];\n            result[i] = _execute(_exec.target, _exec.value, _exec.callData);\n        }\n    }\n\n    function _tryExecute(Execution[] calldata executions)\n        internal\n        returns (bytes[] memory result)\n    {\n        uint256 length = executions.length;\n        result = new bytes[](length);\n\n        for (uint256 i; i < length; i++) {\n            Execution calldata _exec = executions[i];\n            bool success;\n            (success, result[i]) = _tryExecute(_exec.target, _exec.value, _exec.callData);\n            if (!success) emit TryExecuteUnsuccessful(i, result[i]);\n        }\n    }\n\n    function _execute(\n        address target,\n        uint256 value,\n        bytes calldata callData\n    )\n        internal\n        virtual\n        returns (bytes memory result)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := mload(0x40)\n            calldatacopy(result, callData.offset, callData.length)\n            if iszero(call(gas(), target, value, result, callData.length, codesize(), 0x00)) {\n                // Bubble up the revert if the call reverts.\n                returndatacopy(result, 0x00, returndatasize())\n                revert(result, returndatasize())\n            }\n            mstore(result, returndatasize()) // Store the length.\n            let o := add(result, 0x20)\n            returndatacopy(o, 0x00, returndatasize()) // Copy the returndata.\n            mstore(0x40, add(o, returndatasize())) // Allocate the memory.\n        }\n    }\n\n    function _tryExecute(\n        address target,\n        uint256 value,\n        bytes calldata callData\n    )\n        internal\n        virtual\n        returns (bool success, bytes memory result)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := mload(0x40)\n            calldatacopy(result, callData.offset, callData.length)\n            success := call(gas(), target, value, result, callData.length, codesize(), 0x00)\n            mstore(result, returndatasize()) // Store the length.\n            let o := add(result, 0x20)\n            returndatacopy(o, 0x00, returndatasize()) // Copy the returndata.\n            mstore(0x40, add(o, returndatasize())) // Allocate the memory.\n        }\n    }\n\n    /// @dev Execute a delegatecall with `delegate` on this account.\n    function _executeDelegatecall(\n        address delegate,\n        bytes calldata callData\n    )\n        internal\n        returns (bytes memory result)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := mload(0x40)\n            calldatacopy(result, callData.offset, callData.length)\n            // Forwards the `data` to `delegate` via delegatecall.\n            if iszero(delegatecall(gas(), delegate, result, callData.length, codesize(), 0x00)) {\n                // Bubble up the revert if the call reverts.\n                returndatacopy(result, 0x00, returndatasize())\n                revert(result, returndatasize())\n            }\n            mstore(result, returndatasize()) // Store the length.\n            let o := add(result, 0x20)\n            returndatacopy(o, 0x00, returndatasize()) // Copy the returndata.\n            mstore(0x40, add(o, returndatasize())) // Allocate the memory.\n        }\n    }\n\n    /// @dev Execute a delegatecall with `delegate` on this account and catch reverts.\n    function _tryExecuteDelegatecall(\n        address delegate,\n        bytes calldata callData\n    )\n        internal\n        returns (bool success, bytes memory result)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := mload(0x40)\n            calldatacopy(result, callData.offset, callData.length)\n            // Forwards the `data` to `delegate` via delegatecall.\n            success := delegatecall(gas(), delegate, result, callData.length, codesize(), 0x00)\n            mstore(result, returndatasize()) // Store the length.\n            let o := add(result, 0x20)\n            returndatacopy(o, 0x00, returndatasize()) // Copy the returndata.\n            mstore(0x40, add(o, returndatasize())) // Allocate the memory.\n        }\n    }\n}\n"},{"file_path":"lib/erc7579-implementation/src/interfaces/IERC7579Account.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { CallType, ExecType, ModeCode } from \"../lib/ModeLib.sol\";\n\nstruct Execution {\n    address target;\n    uint256 value;\n    bytes callData;\n}\n\ninterface IERC7579Account {\n    event ModuleInstalled(uint256 moduleTypeId, address module);\n    event ModuleUninstalled(uint256 moduleTypeId, address module);\n\n    /**\n     * @dev Executes a transaction on behalf of the account.\n     *         This function is intended to be called by ERC-4337 EntryPoint.sol\n     * @dev Ensure adequate authorization control: i.e. onlyEntryPointOrSelf\n     *\n     * @dev MSA MUST implement this function signature.\n     * If a mode is requested that is not supported by the Account, it MUST revert\n     * @param mode The encoded execution mode of the transaction. See ModeLib.sol for details\n     * @param executionCalldata The encoded execution call data\n     */\n    function execute(ModeCode mode, bytes calldata executionCalldata) external payable;\n\n    /**\n     * @dev Executes a transaction on behalf of the account.\n     *         This function is intended to be called by Executor Modules\n     * @dev Ensure adequate authorization control: i.e. onlyExecutorModule\n     *\n     * @dev MSA MUST implement this function signature.\n     * If a mode is requested that is not supported by the Account, it MUST revert\n     * @param mode The encoded execution mode of the transaction. See ModeLib.sol for details\n     * @param executionCalldata The encoded execution call data\n     */\n    function executeFromExecutor(\n        ModeCode mode,\n        bytes calldata executionCalldata\n    )\n        external\n        payable\n        returns (bytes[] memory returnData);\n\n    /**\n     * @dev ERC-1271 isValidSignature\n     *         This function is intended to be used to validate a smart account signature\n     * and may forward the call to a validator module\n     *\n     * @param hash The hash of the data that is signed\n     * @param data The data that is signed\n     */\n    function isValidSignature(bytes32 hash, bytes calldata data) external view returns (bytes4);\n\n    /**\n     * @dev installs a Module of a certain type on the smart account\n     * @dev Implement Authorization control of your chosing\n     * @param moduleTypeId the module type ID according the ERC-7579 spec\n     * @param module the module address\n     * @param initData arbitrary data that may be required on the module during `onInstall`\n     * initialization.\n     */\n    function installModule(\n        uint256 moduleTypeId,\n        address module,\n        bytes calldata initData\n    )\n        external\n        payable;\n\n    /**\n     * @dev uninstalls a Module of a certain type on the smart account\n     * @dev Implement Authorization control of your chosing\n     * @param moduleTypeId the module type ID according the ERC-7579 spec\n     * @param module the module address\n     * @param deInitData arbitrary data that may be required on the module during `onUninstall`\n     * de-initialization.\n     */\n    function uninstallModule(\n        uint256 moduleTypeId,\n        address module,\n        bytes calldata deInitData\n    )\n        external\n        payable;\n\n    /**\n     * Function to check if the account supports a certain CallType or ExecType (see ModeLib.sol)\n     * @param encodedMode the encoded mode\n     */\n    function supportsExecutionMode(ModeCode encodedMode) external view returns (bool);\n\n    /**\n     * Function to check if the account supports installation of a certain module type Id\n     * @param moduleTypeId the module type ID according the ERC-7579 spec\n     */\n    function supportsModule(uint256 moduleTypeId) external view returns (bool);\n\n    /**\n     * Function to check if the account has a certain module installed\n     * @param moduleTypeId the module type ID according the ERC-7579 spec\n     *      Note: keep in mind that some contracts can be multiple module types at the same time. It\n     *            thus may be necessary to query multiple module types\n     * @param module the module address\n     * @param additionalContext additional context data that the smart account may interpret to\n     *                          identifiy conditions under which the module is installed.\n     *                          usually this is not necessary, but for some special hooks that\n     *                          are stored in mappings, this param might be needed\n     */\n    function isModuleInstalled(\n        uint256 moduleTypeId,\n        address module,\n        bytes calldata additionalContext\n    )\n        external\n        view\n        returns (bool);\n\n    /**\n     * @dev Returns the account id of the smart account\n     * @return accountImplementationId the account id of the smart account\n     * the accountId should be structured like so:\n     *        \"vendorname.accountname.semver\"\n     */\n    function accountId() external view returns (string memory accountImplementationId);\n}\n"},{"file_path":"lib/erc7579-implementation/src/lib/ExecutionLib.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\nimport { Execution } from \"../interfaces/IERC7579Account.sol\";\n\n/**\n * Helper Library for decoding Execution calldata\n * malloc for memory allocation is bad for gas. use this assembly instead\n */\nlibrary ExecutionLib {\n    error ERC7579DecodingError();\n\n    /**\n     * @notice Decode a batch of `Execution` executionBatch from a `bytes` calldata.\n     * @dev code is copied from solady's LibERC7579.sol\n     * https://github.com/Vectorized/solady/blob/740812cedc9a1fc11e17cb3d4569744367dedf19/src/accounts/LibERC7579.sol#L146\n     *      Credits to Vectorized and the Solady Team\n     */\n    function decodeBatch(bytes calldata executionCalldata)\n        internal\n        pure\n        returns (Execution[] calldata executionBatch)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let u := calldataload(executionCalldata.offset)\n            let s := add(executionCalldata.offset, u)\n            let e := sub(add(executionCalldata.offset, executionCalldata.length), 0x20)\n            executionBatch.offset := add(s, 0x20)\n            executionBatch.length := calldataload(s)\n            if or(shr(64, u), gt(add(s, shl(5, executionBatch.length)), e)) {\n                mstore(0x00, 0xba597e7e) // `DecodingError()`.\n                revert(0x1c, 0x04)\n            }\n            if executionBatch.length {\n                // Perform bounds checks on the decoded `executionBatch`.\n                // Loop runs out-of-gas if `executionBatch.length` is big enough to cause overflows.\n                for { let i := executionBatch.length } 1 { } {\n                    i := sub(i, 1)\n                    let p := calldataload(add(executionBatch.offset, shl(5, i)))\n                    let c := add(executionBatch.offset, p)\n                    let q := calldataload(add(c, 0x40))\n                    let o := add(c, q)\n                    // forgefmt: disable-next-item\n                    if or(shr(64, or(calldataload(o), or(p, q))),\n                        or(gt(add(c, 0x40), e), gt(add(o, calldataload(o)), e))) {\n                        mstore(0x00, 0xba597e7e) // `DecodingError()`.\n                        revert(0x1c, 0x04)\n                    }\n                    if iszero(i) { break }\n                }\n            }\n        }\n    }\n\n    function encodeBatch(Execution[] memory executions)\n        internal\n        pure\n        returns (bytes memory callData)\n    {\n        callData = abi.encode(executions);\n    }\n\n    function decodeSingle(bytes calldata executionCalldata)\n        internal\n        pure\n        returns (address target, uint256 value, bytes calldata callData)\n    {\n        target = address(bytes20(executionCalldata[0:20]));\n        value = uint256(bytes32(executionCalldata[20:52]));\n        callData = executionCalldata[52:];\n    }\n\n    function encodeSingle(\n        address target,\n        uint256 value,\n        bytes memory callData\n    )\n        internal\n        pure\n        returns (bytes memory userOpCalldata)\n    {\n        userOpCalldata = abi.encodePacked(target, value, callData);\n    }\n}\n"},{"file_path":"lib/erc7579-implementation/src/lib/ModeLib.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\n/**\n * @title ModeLib\n * To allow smart accounts to be very simple, but allow for more complex execution, A custom mode\n * encoding is used.\n *    Function Signature of execute function:\n *           function execute(ModeCode mode, bytes calldata executionCalldata) external payable;\n * This allows for a single bytes32 to be used to encode the execution mode, calltype, execType and\n * context.\n * NOTE: Simple Account implementations only have to scope for the most significant byte. Account  that\n * implement\n * more complex execution modes may use the entire bytes32.\n *\n * |--------------------------------------------------------------------|\n * | CALLTYPE  | EXECTYPE  |   UNUSED   | ModeSelector  |  ModePayload  |\n * |--------------------------------------------------------------------|\n * | 1 byte    | 1 byte    |   4 bytes  | 4 bytes       |   22 bytes    |\n * |--------------------------------------------------------------------|\n *\n * CALLTYPE: 1 byte\n * CallType is used to determine how the executeCalldata paramter of the execute function has to be\n * decoded.\n * It can be either single, batch or delegatecall. In the future different calls could be added.\n * CALLTYPE can be used by a validation module to determine how to decode <userOp.callData[36:]>.\n *\n * EXECTYPE: 1 byte\n * ExecType is used to determine how the account should handle the execution.\n * It can indicate if the execution should revert on failure or continue execution.\n * In the future more execution modes may be added.\n * Default Behavior (EXECTYPE = 0x00) is to revert on a single failed execution. If one execution in\n * a batch fails, the entire batch is reverted\n *\n * UNUSED: 4 bytes\n * Unused bytes are reserved for future use.\n *\n * ModeSelector: bytes4\n * The \"optional\" mode selector can be used by account vendors, to implement custom behavior in\n * their accounts.\n * the way a ModeSelector is to be calculated is bytes4(keccak256(\"vendorname.featurename\"))\n * this is to prevent collisions between different vendors, while allowing innovation and the\n * development of new features without coordination between ERC-7579 implementing accounts\n *\n * ModePayload: 22 bytes\n * Mode payload is used to pass additional data to the smart account execution, this may be\n * interpreted depending on the ModeSelector\n *\n * ExecutionCallData: n bytes\n * single, delegatecall or batch exec abi.encoded as bytes\n */\nimport { Execution } from \"../interfaces/IERC7579Account.sol\";\n\n// Custom type for improved developer experience\ntype ModeCode is bytes32;\n\ntype CallType is bytes1;\n\ntype ExecType is bytes1;\n\ntype ModeSelector is bytes4;\n\ntype ModePayload is bytes22;\n\n// Default CallType\nCallType constant CALLTYPE_SINGLE = CallType.wrap(0x00);\n// Batched CallType\nCallType constant CALLTYPE_BATCH = CallType.wrap(0x01);\n// @dev Implementing delegatecall is OPTIONAL!\n// implement delegatecall with extreme care.\nCallType constant CALLTYPE_STATIC = CallType.wrap(0xFE);\nCallType constant CALLTYPE_DELEGATECALL = CallType.wrap(0xFF);\n\n// @dev default behavior is to revert on failure\n// To allow very simple accounts to use mode encoding, the default behavior is to revert on failure\n// Since this is value 0x00, no additional encoding is required for simple accounts\nExecType constant EXECTYPE_DEFAULT = ExecType.wrap(0x00);\n// @dev account may elect to change execution behavior. For example \"try exec\" / \"allow fail\"\nExecType constant EXECTYPE_TRY = ExecType.wrap(0x01);\n\nModeSelector constant MODE_DEFAULT = ModeSelector.wrap(bytes4(0x00000000));\n// Example declaration of a custom mode selector\nModeSelector constant MODE_OFFSET = ModeSelector.wrap(bytes4(keccak256(\"default.mode.offset\")));\n\n/**\n * @dev ModeLib is a helper library to encode/decode ModeCodes\n */\nlibrary ModeLib {\n    function decode(ModeCode mode)\n        internal\n        pure\n        returns (\n            CallType _calltype,\n            ExecType _execType,\n            ModeSelector _modeSelector,\n            ModePayload _modePayload\n        )\n    {\n        assembly {\n            _calltype := mode\n            _execType := shl(8, mode)\n            _modeSelector := shl(48, mode)\n            _modePayload := shl(80, mode)\n        }\n    }\n\n    function encode(\n        CallType callType,\n        ExecType execType,\n        ModeSelector mode,\n        ModePayload payload\n    )\n        internal\n        pure\n        returns (ModeCode)\n    {\n        return ModeCode.wrap(\n            bytes32(\n                abi.encodePacked(callType, execType, bytes4(0), ModeSelector.unwrap(mode), payload)\n            )\n        );\n    }\n\n    function encodeSimpleBatch() internal pure returns (ModeCode mode) {\n        mode = encode(CALLTYPE_BATCH, EXECTYPE_DEFAULT, MODE_DEFAULT, ModePayload.wrap(0x00));\n    }\n\n    function encodeSimpleSingle() internal pure returns (ModeCode mode) {\n        mode = encode(CALLTYPE_SINGLE, EXECTYPE_DEFAULT, MODE_DEFAULT, ModePayload.wrap(0x00));\n    }\n\n    function getCallType(ModeCode mode) internal pure returns (CallType calltype) {\n        assembly {\n            calltype := mode\n        }\n    }\n}\n\nusing { eqModeSelector as == } for ModeSelector global;\nusing { eqCallType as == } for CallType global;\nusing { eqExecType as == } for ExecType global;\n\nfunction eqCallType(CallType a, CallType b) pure returns (bool) {\n    return CallType.unwrap(a) == CallType.unwrap(b);\n}\n\nfunction eqExecType(ExecType a, ExecType b) pure returns (bool) {\n    return ExecType.unwrap(a) == ExecType.unwrap(b);\n}\n\nfunction eqModeSelector(ModeSelector a, ModeSelector b) pure returns (bool) {\n    return ModeSelector.unwrap(a) == ModeSelector.unwrap(b);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n */\ninterface IERC1271 {\n    /**\n     * @dev Should return whether the signature provided is valid for the provided data\n     * @param hash      Hash of the data to be signed\n     * @param signature Signature byte array associated with _data\n     */\n    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.20;\n\ninterface IERC5267 {\n    /**\n     * @dev MAY be emitted to signal that the domain could have changed.\n     */\n    event EIP712DomainChanged();\n\n    /**\n     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n     * signature.\n     */\n    function eip712Domain()\n        external\n        view\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        );\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface that must be implemented by smart contracts in order to receive\n * ERC-1155 token transfers.\n */\ninterface IERC1155Receiver is IERC165 {\n    /**\n     * @dev Handles the receipt of a single ERC-1155 token type. This function is\n     * called at the end of a `safeTransferFrom` after the balance has been updated.\n     *\n     * NOTE: To accept the transfer, this must return\n     * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n     * (i.e. 0xf23a6e61, or its own function selector).\n     *\n     * @param operator The address which initiated the transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param id The ID of the token being transferred\n     * @param value The amount of tokens being transferred\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n     */\n    function onERC1155Received(\n        address operator,\n        address from,\n        uint256 id,\n        uint256 value,\n        bytes calldata data\n    ) external returns (bytes4);\n\n    /**\n     * @dev Handles the receipt of a multiple ERC-1155 token types. This function\n     * is called at the end of a `safeBatchTransferFrom` after the balances have\n     * been updated.\n     *\n     * NOTE: To accept the transfer(s), this must return\n     * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n     * (i.e. 0xbc197c81, or its own function selector).\n     *\n     * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param ids An array containing ids of each token being transferred (order and length must match values array)\n     * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n     */\n    function onERC1155BatchReceived(\n        address operator,\n        address from,\n        uint256[] calldata ids,\n        uint256[] calldata values,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @title ERC-721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC-721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n     * reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/Panic.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n *      using Panic for uint256;\n *\n *      // Use any of the declared internal constants\n *      function foo() { Panic.GENERIC.panic(); }\n *\n *      // Alternatively\n *      function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n    /// @dev generic / unspecified error\n    uint256 internal constant GENERIC = 0x00;\n    /// @dev used by the assert() builtin\n    uint256 internal constant ASSERT = 0x01;\n    /// @dev arithmetic underflow or overflow\n    uint256 internal constant UNDER_OVERFLOW = 0x11;\n    /// @dev division or modulo by zero\n    uint256 internal constant DIVISION_BY_ZERO = 0x12;\n    /// @dev enum conversion error\n    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n    /// @dev invalid encoding in storage\n    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n    /// @dev empty array pop\n    uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n    /// @dev array out of bounds access\n    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n    /// @dev resource error (too large allocation or too large array)\n    uint256 internal constant RESOURCE_ERROR = 0x41;\n    /// @dev calling invalid internal function\n    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n    /// @dev Reverts with a panic code. Recommended to use with\n    /// the internal constants with predefined codes.\n    function panic(uint256 code) internal pure {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, 0x4e487b71)\n            mstore(0x20, code)\n            revert(0x1c, 0x24)\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/ShortStrings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |\n// | length  | 0x                                                              BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n *     using ShortStrings for *;\n *\n *     ShortString private immutable _name;\n *     string private _nameFallback;\n *\n *     constructor(string memory contractName) {\n *         _name = contractName.toShortStringWithFallback(_nameFallback);\n *     }\n *\n *     function name() external view returns (string memory) {\n *         return _name.toStringWithFallback(_nameFallback);\n *     }\n * }\n * ```\n */\nlibrary ShortStrings {\n    // Used as an identifier for strings longer than 31 bytes.\n    bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n    error StringTooLong(string str);\n    error InvalidShortString();\n\n    /**\n     * @dev Encode a string of at most 31 chars into a `ShortString`.\n     *\n     * This will trigger a `StringTooLong` error is the input string is too long.\n     */\n    function toShortString(string memory str) internal pure returns (ShortString) {\n        bytes memory bstr = bytes(str);\n        if (bstr.length > 31) {\n            revert StringTooLong(str);\n        }\n        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n    }\n\n    /**\n     * @dev Decode a `ShortString` back to a \"normal\" string.\n     */\n    function toString(ShortString sstr) internal pure returns (string memory) {\n        uint256 len = byteLength(sstr);\n        // using `new string(len)` would work locally but is not memory safe.\n        string memory str = new string(32);\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(str, len)\n            mstore(add(str, 0x20), sstr)\n        }\n        return str;\n    }\n\n    /**\n     * @dev Return the length of a `ShortString`.\n     */\n    function byteLength(ShortString sstr) internal pure returns (uint256) {\n        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n        if (result > 31) {\n            revert InvalidShortString();\n        }\n        return result;\n    }\n\n    /**\n     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n     */\n    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n        if (bytes(value).length < 32) {\n            return toShortString(value);\n        } else {\n            StorageSlot.getStringSlot(store).value = value;\n            return ShortString.wrap(FALLBACK_SENTINEL);\n        }\n    }\n\n    /**\n     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n     */\n    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n            return toString(value);\n        } else {\n            return store;\n        }\n    }\n\n    /**\n     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n     * {setWithFallback}.\n     *\n     * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n     */\n    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n            return byteLength(value);\n        } else {\n            return bytes(store).length;\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(newImplementation.code.length > 0);\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/Strings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n    uint8 private constant ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev The `value` string doesn't fit in the specified `length`.\n     */\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toStringSigned(int256 value) internal pure returns (string memory) {\n        return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        uint256 localValue = value;\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = HEX_DIGITS[localValue & 0xf];\n            localValue >>= 4;\n        }\n        if (localValue != 0) {\n            revert StringsInsufficientHexLength(value, length);\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n     * representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS\n    }\n\n    /**\n     * @dev The signature derives the `address(0)`.\n     */\n    error ECDSAInvalidSignature();\n\n    /**\n     * @dev The signature has an invalid length.\n     */\n    error ECDSAInvalidSignatureLength(uint256 length);\n\n    /**\n     * @dev The signature has an S value that is in the upper half order.\n     */\n    error ECDSAInvalidSignatureS(bytes32 s);\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n     * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n     * and a bytes32 providing additional information about the error.\n     *\n     * If no error is returned, then the address can be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n     */\n    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {\n        unchecked {\n            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n            // We do not check for an overflow here since the shift operation results in 0 or 1.\n            uint8 v = uint8((uint256(vs) >> 255) + 27);\n            return tryRecover(hash, v, r, s);\n        }\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address, RecoverError, bytes32) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS, s);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature, bytes32(0));\n        }\n\n        return (signer, RecoverError.NoError, bytes32(0));\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n     */\n    function _throwError(RecoverError error, bytes32 errorArg) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert ECDSAInvalidSignature();\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert ECDSAInvalidSignatureLength(uint256(errorArg));\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert ECDSAInvalidSignatureS(errorArg);\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.20;\n\nimport {MessageHashUtils} from \"./MessageHashUtils.sol\";\nimport {ShortStrings, ShortString} from \"../ShortStrings.sol\";\nimport {IERC5267} from \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable\n */\nabstract contract EIP712 is IERC5267 {\n    using ShortStrings for *;\n\n    bytes32 private constant TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n    // invalidate the cached domain separator if the chain id changes.\n    bytes32 private immutable _cachedDomainSeparator;\n    uint256 private immutable _cachedChainId;\n    address private immutable _cachedThis;\n\n    bytes32 private immutable _hashedName;\n    bytes32 private immutable _hashedVersion;\n\n    ShortString private immutable _name;\n    ShortString private immutable _version;\n    string private _nameFallback;\n    string private _versionFallback;\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    constructor(string memory name, string memory version) {\n        _name = name.toShortStringWithFallback(_nameFallback);\n        _version = version.toShortStringWithFallback(_versionFallback);\n        _hashedName = keccak256(bytes(name));\n        _hashedVersion = keccak256(bytes(version));\n\n        _cachedChainId = block.chainid;\n        _cachedDomainSeparator = _buildDomainSeparator();\n        _cachedThis = address(this);\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n            return _cachedDomainSeparator;\n        } else {\n            return _buildDomainSeparator();\n        }\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /**\n     * @dev See {IERC-5267}.\n     */\n    function eip712Domain()\n        public\n        view\n        virtual\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        return (\n            hex\"0f\", // 01111\n            _EIP712Name(),\n            _EIP712Version(),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n\n    /**\n     * @dev The name parameter for the EIP712 domain.\n     *\n     * NOTE: By default this function reads _name which is an immutable value.\n     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function _EIP712Name() internal view returns (string memory) {\n        return _name.toStringWithFallback(_nameFallback);\n    }\n\n    /**\n     * @dev The version parameter for the EIP712 domain.\n     *\n     * NOTE: By default this function reads _version which is an immutable value.\n     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function _EIP712Version() internal view returns (string memory) {\n        return _version.toStringWithFallback(_versionFallback);\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.20;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing a bytes32 `messageHash` with\n     * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n     * keccak256, although any bytes32 value can be safely used because the final digest will\n     * be re-hashed.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n        }\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing an arbitrary `message` with\n     * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n        return\n            keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x00` (data with intended validator).\n     *\n     * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n     * `validator` address. Then hashing the result.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n     *\n     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n     * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(ptr, hex\"19_01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            digest := keccak256(ptr, 0x42)\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol","source_code":"// 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 ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\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[ERC 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"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with an success flag (no overflow).\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n\n        // The following calculation ensures accurate ceiling division without overflow.\n        // Since a is non-zero, (a - 1) / b will not overflow.\n        // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n        // but the largest value we can obtain is type(uint256).max - 1, which happens\n        // when a = type(uint256).max and b = 1.\n        unchecked {\n            return a == 0 ? 0 : (a - 1) / b + 1;\n        }\n    }\n\n    /**\n     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     *\n     * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2²⁵⁶ + prod0.\n            uint256 prod0 = x * y; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n            if (denominator <= prod1) {\n                Panic.panic(denominator == 0 ? Panic.DIVISION_BY_ZERO : Panic.UNDER_OVERFLOW);\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n            inverse *= 2 - denominator * inverse; // inverse mod 2³²\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n    }\n\n    /**\n     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n     *\n     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, expect 0.\n     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n     *\n     * If the input value is not inversible, 0 is returned.\n     *\n     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Ferma's little theorem and get the\n     * inverse using `Math.modExp(a, n - 2, n)`.\n     */\n    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n        unchecked {\n            if (n == 0) return 0;\n\n            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n            // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n            // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n            // ax + ny = 1\n            // ax = 1 + (-y)n\n            // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n            // If the remainder is 0 the gcd is n right away.\n            uint256 remainder = a % n;\n            uint256 gcd = n;\n\n            // Therefore the initial coefficients are:\n            // ax + ny = gcd(a, n) = n\n            // 0a + 1n = n\n            int256 x = 0;\n            int256 y = 1;\n\n            while (remainder != 0) {\n                uint256 quotient = gcd / remainder;\n\n                (gcd, remainder) = (\n                    // The old remainder is the next gcd to try.\n                    remainder,\n                    // Compute the next remainder.\n                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n                    // where gcd is at most n (capped to type(uint256).max)\n                    gcd - remainder * quotient\n                );\n\n                (x, y) = (\n                    // Increment the coefficient of a.\n                    y,\n                    // Decrement the coefficient of n.\n                    // Can overflow, but the result is casted to uint256 so that the\n                    // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n                    x - y * int256(quotient)\n                );\n            }\n\n            if (gcd != 1) return 0; // No inverse exists.\n            return x < 0 ? (n - uint256(-x)) : uint256(x); // Wrap the result if it's negative.\n        }\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n     *\n     * Requirements:\n     * - modulus can't be zero\n     * - underlying staticcall to precompile must succeed\n     *\n     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n     * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n     * interpreted as 0.\n     */\n    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n        (bool success, uint256 result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n     * It includes a success flag indicating if the operation succeeded. Operation will be marked has failed if trying\n     * to operate modulo 0 or if the underlying precompile reverted.\n     *\n     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n     * of a revert, but the result may be incorrectly interpreted as 0.\n     */\n    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n        if (m == 0) return (false, 0);\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            // | Offset    | Content    | Content (Hex)                                                      |\n            // |-----------|------------|--------------------------------------------------------------------|\n            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n            // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n            mstore(ptr, 0x20)\n            mstore(add(ptr, 0x20), 0x20)\n            mstore(add(ptr, 0x40), 0x20)\n            mstore(add(ptr, 0x60), b)\n            mstore(add(ptr, 0x80), e)\n            mstore(add(ptr, 0xa0), m)\n\n            // Given the result < m, it's guaranteed to fit in 32 bytes,\n            // so we can use the memory scratch space located at offset 0.\n            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n            result := mload(0x00)\n        }\n    }\n\n    /**\n     * @dev Variant of {modExp} that supports inputs of arbitrary length.\n     */\n    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n        (bool success, bytes memory result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n     */\n    function tryModExp(\n        bytes memory b,\n        bytes memory e,\n        bytes memory m\n    ) internal view returns (bool success, bytes memory result) {\n        if (_zeroBytes(m)) return (false, new bytes(0));\n\n        uint256 mLen = m.length;\n\n        // Encode call args in result and move the free memory pointer\n        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            let dataPtr := add(result, 0x20)\n            // Write result on top of args to avoid allocating extra memory.\n            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n            // Overwrite the length.\n            // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n            mstore(result, mLen)\n            // Set the memory pointer after the returned data.\n            mstore(0x40, add(dataPtr, mLen))\n        }\n    }\n\n    /**\n     * @dev Returns whether the provided byte array is zero.\n     */\n    function _zeroBytes(bytes memory byteArray) private pure returns (bool) {\n        for (uint256 i = 0; i < byteArray.length; ++i) {\n            if (byteArray[i] != 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n     * using integer operations.\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        unchecked {\n            // Take care of easy edge cases when a == 0 or a == 1\n            if (a <= 1) {\n                return a;\n            }\n\n            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n            // the current value as `ε_n = | x_n - sqrt(a) |`.\n            //\n            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n            // bigger than any uint256.\n            //\n            // By noticing that\n            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n            // to the msb function.\n            uint256 aa = a;\n            uint256 xn = 1;\n\n            if (aa >= (1 << 128)) {\n                aa >>= 128;\n                xn <<= 64;\n            }\n            if (aa >= (1 << 64)) {\n                aa >>= 64;\n                xn <<= 32;\n            }\n            if (aa >= (1 << 32)) {\n                aa >>= 32;\n                xn <<= 16;\n            }\n            if (aa >= (1 << 16)) {\n                aa >>= 16;\n                xn <<= 8;\n            }\n            if (aa >= (1 << 8)) {\n                aa >>= 8;\n                xn <<= 4;\n            }\n            if (aa >= (1 << 4)) {\n                aa >>= 4;\n                xn <<= 2;\n            }\n            if (aa >= (1 << 2)) {\n                xn <<= 1;\n            }\n\n            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n            //\n            // We can refine our estimation by noticing that the the middle of that interval minimizes the error.\n            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n            // This is going to be our x_0 (and ε_0)\n            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n            // From here, Newton's method give us:\n            // x_{n+1} = (x_n + a / x_n) / 2\n            //\n            // One should note that:\n            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n            //              = ((x_n² + a) / (2 * x_n))² - a\n            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n            //              = (x_n² - a)² / (2 * x_n)²\n            //              = ((x_n² - a) / (2 * x_n))²\n            //              ≥ 0\n            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n            //\n            // This gives us the proof of quadratic convergence of the sequence:\n            // ε_{n+1} = | x_{n+1} - sqrt(a) |\n            //         = | (x_n + a / x_n) / 2 - sqrt(a) |\n            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n            //         = | (x_n - sqrt(a))² / (2 * x_n) |\n            //         = | ε_n² / (2 * x_n) |\n            //         = ε_n² / | (2 * x_n) |\n            //\n            // For the first iteration, we have a special case where x_0 is known:\n            // ε_1 = ε_0² / | (2 * x_0) |\n            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))\n            //     ≤ 2**(e-3) / 3\n            //     ≤ 2**(e-3-log2(3))\n            //     ≤ 2**(e-4.5)\n            //\n            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n            // ε_{n+1} = ε_n² / | (2 * x_n) |\n            //         ≤ (2**(e-k))² / (2 * 2**(e-1))\n            //         ≤ 2**(2*e-2*k) / 2**e\n            //         ≤ 2**(e-2*k)\n            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above\n            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5\n            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9\n            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18\n            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36\n            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72\n\n            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n            // sqrt(a) or sqrt(a) + 1.\n            return xn - SafeCast.toUint(xn > a / xn);\n        }\n    }\n\n    /**\n     * @dev Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        uint256 exp;\n        unchecked {\n            exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);\n            value >>= exp;\n            result += exp;\n\n            exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);\n            value >>= exp;\n            result += exp;\n\n            exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);\n            value >>= exp;\n            result += exp;\n\n            exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);\n            value >>= exp;\n            result += exp;\n\n            exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);\n            value >>= exp;\n            result += exp;\n\n            exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);\n            value >>= exp;\n            result += exp;\n\n            exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);\n            value >>= exp;\n            result += exp;\n\n            result += SafeCast.toUint(value > 1);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        uint256 isGt;\n        unchecked {\n            isGt = SafeCast.toUint(value > (1 << 128) - 1);\n            value >>= isGt * 128;\n            result += isGt * 16;\n\n            isGt = SafeCast.toUint(value > (1 << 64) - 1);\n            value >>= isGt * 64;\n            result += isGt * 8;\n\n            isGt = SafeCast.toUint(value > (1 << 32) - 1);\n            value >>= isGt * 32;\n            result += isGt * 4;\n\n            isGt = SafeCast.toUint(value > (1 << 16) - 1);\n            value >>= isGt * 16;\n            result += isGt * 2;\n\n            result += SafeCast.toUint(value > (1 << 8) - 1);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n    /**\n     * @dev Value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n    /**\n     * @dev An int value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedIntToUint(int256 value);\n\n    /**\n     * @dev Value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n    /**\n     * @dev An uint value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedUintToInt(uint256 value);\n\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        if (value > type(uint248).max) {\n            revert SafeCastOverflowedUintDowncast(248, value);\n        }\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        if (value > type(uint240).max) {\n            revert SafeCastOverflowedUintDowncast(240, value);\n        }\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        if (value > type(uint232).max) {\n            revert SafeCastOverflowedUintDowncast(232, value);\n        }\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        if (value > type(uint224).max) {\n            revert SafeCastOverflowedUintDowncast(224, value);\n        }\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        if (value > type(uint216).max) {\n            revert SafeCastOverflowedUintDowncast(216, value);\n        }\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        if (value > type(uint208).max) {\n            revert SafeCastOverflowedUintDowncast(208, value);\n        }\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        if (value > type(uint200).max) {\n            revert SafeCastOverflowedUintDowncast(200, value);\n        }\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        if (value > type(uint192).max) {\n            revert SafeCastOverflowedUintDowncast(192, value);\n        }\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        if (value > type(uint184).max) {\n            revert SafeCastOverflowedUintDowncast(184, value);\n        }\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        if (value > type(uint176).max) {\n            revert SafeCastOverflowedUintDowncast(176, value);\n        }\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        if (value > type(uint168).max) {\n            revert SafeCastOverflowedUintDowncast(168, value);\n        }\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        if (value > type(uint160).max) {\n            revert SafeCastOverflowedUintDowncast(160, value);\n        }\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        if (value > type(uint152).max) {\n            revert SafeCastOverflowedUintDowncast(152, value);\n        }\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        if (value > type(uint144).max) {\n            revert SafeCastOverflowedUintDowncast(144, value);\n        }\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        if (value > type(uint136).max) {\n            revert SafeCastOverflowedUintDowncast(136, value);\n        }\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        if (value > type(uint128).max) {\n            revert SafeCastOverflowedUintDowncast(128, value);\n        }\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        if (value > type(uint120).max) {\n            revert SafeCastOverflowedUintDowncast(120, value);\n        }\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        if (value > type(uint112).max) {\n            revert SafeCastOverflowedUintDowncast(112, value);\n        }\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        if (value > type(uint104).max) {\n            revert SafeCastOverflowedUintDowncast(104, value);\n        }\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        if (value > type(uint96).max) {\n            revert SafeCastOverflowedUintDowncast(96, value);\n        }\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        if (value > type(uint88).max) {\n            revert SafeCastOverflowedUintDowncast(88, value);\n        }\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        if (value > type(uint80).max) {\n            revert SafeCastOverflowedUintDowncast(80, value);\n        }\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        if (value > type(uint72).max) {\n            revert SafeCastOverflowedUintDowncast(72, value);\n        }\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SafeCastOverflowedUintDowncast(64, value);\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        if (value > type(uint56).max) {\n            revert SafeCastOverflowedUintDowncast(56, value);\n        }\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert SafeCastOverflowedUintDowncast(48, value);\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert SafeCastOverflowedUintDowncast(40, value);\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert SafeCastOverflowedUintDowncast(32, value);\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        if (value > type(uint24).max) {\n            revert SafeCastOverflowedUintDowncast(24, value);\n        }\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        if (value > type(uint16).max) {\n            revert SafeCastOverflowedUintDowncast(16, value);\n        }\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        if (value > type(uint8).max) {\n            revert SafeCastOverflowedUintDowncast(8, value);\n        }\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        if (value < 0) {\n            revert SafeCastOverflowedIntToUint(value);\n        }\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(248, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(240, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(232, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(224, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(216, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(208, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(200, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(192, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(184, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(176, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(168, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(160, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(152, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(144, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(136, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(128, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(120, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(112, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(104, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(96, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(88, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(80, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(72, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(64, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(56, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(48, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(40, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(32, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(24, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(16, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(8, value);\n        }\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        if (value > uint256(type(int256).max)) {\n            revert SafeCastOverflowedUintToInt(value);\n        }\n        return int256(value);\n    }\n\n    /**\n     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n     */\n    function toUint(bool b) internal pure returns (uint256 u) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            u := iszero(iszero(b))\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // Formula from the \"Bit Twiddling Hacks\" by Sean Eron Anderson.\n            // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,\n            // taking advantage of the most significant (or \"sign\" bit) in two's complement representation.\n            // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,\n            // the mask will either be `bytes(0)` (if n is positive) or `~bytes32(0)` (if n is negative).\n            int256 mask = n >> 255;\n\n            // A `bytes(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.\n            return uint256((n + mask) ^ mask);\n        }\n    }\n}\n"},{"file_path":"src/EIP7702/EIP7702DeleGatorCore.sol","source_code":"// SPDX-License-Identifier: MIT AND Apache-2.0\npragma solidity 0.8.23;\n\nimport { IEntryPoint } from \"@account-abstraction/interfaces/IEntryPoint.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport { IERC1271 } from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\nimport { IERC1155Receiver } from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport { IERC721Receiver } from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport { ModeLib } from \"@erc7579/lib/ModeLib.sol\";\nimport { ExecutionLib } from \"@erc7579/lib/ExecutionLib.sol\";\nimport { ExecutionHelper } from \"@erc7579/core/ExecutionHelper.sol\";\nimport { EIP712 } from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\nimport { MessageHashUtils } from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\n\nimport { ERC1271Lib } from \"../libraries/ERC1271Lib.sol\";\nimport { IDeleGatorCore } from \"../interfaces/IDeleGatorCore.sol\";\nimport { IDelegationManager } from \"../interfaces/IDelegationManager.sol\";\nimport { IERC7821 } from \"../interfaces/IERC7821.sol\";\nimport {\n    CallType, ExecType, ModeSelector, ModePayload, Execution, Delegation, PackedUserOperation, ModeCode\n} from \"../utils/Types.sol\";\nimport { CALLTYPE_SINGLE, CALLTYPE_BATCH, EXECTYPE_DEFAULT, EXECTYPE_TRY, MODE_DEFAULT } from \"../utils/Constants.sol\";\n\n/**\n * @title EIP7702DeleGatorCore\n * @notice This contract contains the shared logic for a DeleGator SCA implementation.\n * @dev Implements the interface needed for a DelegationManager to interact with a DeleGator implementation.\n * @dev DeleGator implementations can inherit this to enable Delegation and ERC4337 structure.\n * @dev Any child contract adding state variables must use namespaced storage for safe upgrades.\n */\nabstract contract EIP7702DeleGatorCore is\n    ExecutionHelper,\n    IERC165,\n    IERC7821,\n    IDeleGatorCore,\n    IERC721Receiver,\n    IERC1155Receiver,\n    EIP712\n{\n    using ModeLib for ModeCode;\n    using ModeLib for ModeSelector;\n    using ExecutionLib for bytes;\n\n    ////////////////////////////// State //////////////////////////////\n\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    address private immutable __self = address(this);\n\n    /// @dev The DelegationManager contract that has root access to this contract\n    IDelegationManager public immutable delegationManager;\n\n    /// @dev The EntryPoint contract that has root access to this contract\n    IEntryPoint public immutable entryPoint;\n\n    /// @dev The typehash for the PackedUserOperation struct\n    bytes32 public constant PACKED_USER_OP_TYPEHASH = keccak256(\n        \"PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData,address entryPoint)\"\n    );\n\n    ////////////////////////////// Events //////////////////////////////\n\n    /// @dev Emitted once in the constructor when the DelegationManager is assigned\n    event SetDelegationManager(IDelegationManager indexed newDelegationManager);\n\n    /// @dev Emitted once in the constructor when the EntryPoint is assigned\n    event SetEntryPoint(IEntryPoint indexed entryPoint);\n\n    /// @dev Event emitted when prefunding is sent.\n    event SentPrefund(address indexed sender, uint256 amount, bool success);\n\n    ////////////////////////////// Errors //////////////////////////////\n\n    /// @dev Error thrown when the caller is not this contract.\n    error NotSelf();\n\n    /// @dev Error thrown when the caller is not the entry point.\n    error NotEntryPoint();\n\n    /// @dev Error thrown when the caller is not the EntryPoint or this contract.\n    error NotEntryPointOrSelf();\n\n    /// @dev Error thrown when the caller is not the delegation manager.\n    error NotDelegationManager();\n\n    /// @dev The call is from an unauthorized context.\n    error UnauthorizedCallContext();\n\n    /// @dev Error thrown when an execution with an unsupported CallType was made.\n    error UnsupportedCallType(CallType callType);\n\n    /// @dev Error thrown when an execution with an unsupported ExecType was made.\n    error UnsupportedExecType(ExecType execType);\n\n    /// @dev The EIP712 name can not be longer than 31 bytes.\n    error InvalidEIP712NameLength();\n\n    /// @dev The EIP712 version can not be longer than 31 bytes.\n    error InvalidEIP712VersionLength();\n\n    ////////////////////////////// Modifiers //////////////////////////////\n\n    /**\n     * @dev Prevents direct calls to the implementation.\n     * @dev Check that the execution is being performed through a delegatecall call.\n     */\n    modifier onlyProxy() {\n        if (address(this) == __self) revert UnauthorizedCallContext();\n        _;\n    }\n\n    /**\n     * @notice Require the function call to come from the EntryPoint.\n     * @dev Check that the caller is the entry point\n     */\n    modifier onlyEntryPoint() {\n        if (msg.sender != address(entryPoint)) revert NotEntryPoint();\n        _;\n    }\n\n    /**\n     * @notice Require the function call to come from the EntryPoint or this contract.\n     * @dev Check that the caller is either the delegator contract itself or the entry point\n     */\n    modifier onlyEntryPointOrSelf() {\n        if (msg.sender != address(entryPoint) && msg.sender != address(this)) revert NotEntryPointOrSelf();\n        _;\n    }\n\n    /**\n     * @notice Require the function call to come from the DelegationManager.\n     * @dev Check that the caller is the stored delegation manager.\n     */\n    modifier onlyDelegationManager() {\n        if (msg.sender != address(delegationManager)) revert NotDelegationManager();\n        _;\n    }\n\n    ////////////////////////////// Constructor //////////////////////////////\n\n    /**\n     * @notice Initializes the DeleGatorCore contract\n     * @param _delegationManager the address of the trusted DelegationManager contract that will have root access to this contract\n     * @param _entryPoint the address of entry point\n     * @param _name Name of the contract\n     * @param _domainVersion Domain version of the contract\n     */\n    constructor(\n        IDelegationManager _delegationManager,\n        IEntryPoint _entryPoint,\n        string memory _name,\n        string memory _domainVersion\n    )\n        EIP712(_name, _domainVersion)\n    {\n        // Short name and version do not use storage in EIP712\n        if (bytes(_name).length > 31) revert InvalidEIP712NameLength();\n        if (bytes(_domainVersion).length > 31) revert InvalidEIP712VersionLength();\n\n        delegationManager = _delegationManager;\n        entryPoint = _entryPoint;\n        emit SetDelegationManager(_delegationManager);\n        emit SetEntryPoint(_entryPoint);\n    }\n\n    ////////////////////////////// External Methods //////////////////////////////\n\n    /**\n     * @notice Allows this contract to receive the chains native token\n     */\n    receive() external payable { }\n\n    /**\n     * @notice Redeems a delegation on the DelegationManager and executes the specified executions on behalf of the root delegator.\n     * @param _permissionContexts An array of bytes where each element is made up of an array\n     * of `Delegation` structs that are used to validate the authority given to execute the corresponding execution on the\n     * root delegator, ordered from leaf to root.\n     * @param _modes An array of `ModeCode` structs representing the mode of execution for each execution callData.\n     * @param _executionCallDatas An array of `Execution` structs representing the executions to be executed.\n     */\n    function redeemDelegations(\n        bytes[] calldata _permissionContexts,\n        ModeCode[] calldata _modes,\n        bytes[] calldata _executionCallDatas\n    )\n        external\n        onlyEntryPointOrSelf\n    {\n        delegationManager.redeemDelegations(_permissionContexts, _modes, _executionCallDatas);\n    }\n\n    /**\n     * @notice Executes an Execution from this contract\n     * @dev This method is intended to be called through a UserOp which ensures the invoker has sufficient permissions\n     * @dev This convenience method defaults to reverting on failure and a single execution.\n     * @param _execution The Execution to be executed\n     */\n    function execute(Execution calldata _execution) external payable onlyEntryPointOrSelf {\n        _execute(_execution.target, _execution.value, _execution.callData);\n    }\n\n    /**\n     * @notice Executes an Execution from this contract\n     * @dev Related: @erc7579/MSAAdvanced.sol and ERC-7821\n     * @dev This method must be called from the entry point or self\n     * @param _mode The ModeCode for the execution\n     * @param _executionCalldata The calldata for the execution\n     */\n    function execute(ModeCode _mode, bytes calldata _executionCalldata) external payable onlyEntryPointOrSelf {\n        (CallType callType_, ExecType execType_,,) = _mode.decode();\n\n        // Check if calltype is batch or single\n        if (callType_ == CALLTYPE_BATCH) {\n            // destructure executionCallData according to batched exec\n            Execution[] calldata executions_ = _executionCalldata.decodeBatch();\n            // Check if execType is revert or try\n            if (execType_ == EXECTYPE_DEFAULT) _execute(executions_);\n            else if (execType_ == EXECTYPE_TRY) _tryExecute(executions_);\n            else revert UnsupportedExecType(execType_);\n        } else if (callType_ == CALLTYPE_SINGLE) {\n            // Destructure executionCallData according to single exec\n            (address target_, uint256 value_, bytes calldata callData_) = _executionCalldata.decodeSingle();\n            // Check if execType is revert or try\n            if (execType_ == EXECTYPE_DEFAULT) {\n                _execute(target_, value_, callData_);\n            } else if (execType_ == EXECTYPE_TRY) {\n                bytes[] memory returnData_ = new bytes[](1);\n                bool success_;\n                (success_, returnData_[0]) = _tryExecute(target_, value_, callData_);\n                if (!success_) emit TryExecuteUnsuccessful(0, returnData_[0]);\n            } else {\n                revert UnsupportedExecType(execType_);\n            }\n        } else {\n            revert UnsupportedCallType(callType_);\n        }\n    }\n\n    /**\n     * @inheritdoc IDeleGatorCore\n     * @dev Related: @erc7579/MSAAdvanced.sol\n     */\n    function executeFromExecutor(\n        ModeCode _mode,\n        bytes calldata _executionCalldata\n    )\n        external\n        payable\n        onlyDelegationManager\n        returns (bytes[] memory returnData_)\n    {\n        (CallType callType_, ExecType execType_,,) = _mode.decode();\n\n        // Check if calltype is batch or single\n        if (callType_ == CALLTYPE_BATCH) {\n            // Destructure executionCallData according to batched exec\n            Execution[] calldata executions_ = _executionCalldata.decodeBatch();\n            // check if execType is revert or try\n            if (execType_ == EXECTYPE_DEFAULT) returnData_ = _execute(executions_);\n            else if (execType_ == EXECTYPE_TRY) returnData_ = _tryExecute(executions_);\n            else revert UnsupportedExecType(execType_);\n        } else if (callType_ == CALLTYPE_SINGLE) {\n            // Destructure executionCallData according to single exec\n            (address target_, uint256 value_, bytes calldata callData_) = _executionCalldata.decodeSingle();\n            returnData_ = new bytes[](1);\n            bool success_;\n            // check if execType is revert or try\n            if (execType_ == EXECTYPE_DEFAULT) {\n                returnData_[0] = _execute(target_, value_, callData_);\n            } else if (execType_ == EXECTYPE_TRY) {\n                (success_, returnData_[0]) = _tryExecute(target_, value_, callData_);\n                if (!success_) emit TryExecuteUnsuccessful(0, returnData_[0]);\n            } else {\n                revert UnsupportedExecType(execType_);\n            }\n        } else {\n            revert UnsupportedCallType(callType_);\n        }\n    }\n\n    /**\n     * @notice Validates a UserOp signature and sends any necessary funds to the EntryPoint\n     * @dev Related: ERC4337\n     * @param _userOp The UserOp struct to validate\n     * @param _missingAccountFunds The missing funds from the account\n     * @return validationData_ The validation data\n     */\n    function validateUserOp(\n        PackedUserOperation calldata _userOp,\n        bytes32, // Ignore UserOpHash from the Entry Point\n        uint256 _missingAccountFunds\n    )\n        external\n        onlyEntryPoint\n        onlyProxy\n        returns (uint256 validationData_)\n    {\n        validationData_ = _validateUserOpSignature(_userOp, getPackedUserOperationTypedDataHash(_userOp));\n        _payPrefund(_missingAccountFunds);\n    }\n\n    /**\n     * @inheritdoc IERC1271\n     * @notice Verifies the signatures of the signers.\n     * @dev Related: ERC4337, Delegation\n     * @param _hash The hash of the data signed.\n     * @param _signature The signatures of the signers.\n     * @return magicValue_ A bytes4 magic value which is EIP1271_MAGIC_VALUE(0x1626ba7e) if the signature is valid, returns\n     * SIG_VALIDATION_FAILED(0xffffffff) if there is a signature mismatch and reverts (for all other errors).\n     */\n    function isValidSignature(\n        bytes32 _hash,\n        bytes calldata _signature\n    )\n        external\n        view\n        override\n        onlyProxy\n        returns (bytes4 magicValue_)\n    {\n        return _isValidSignature(_hash, _signature);\n    }\n\n    /// @inheritdoc IERC721Receiver\n    function onERC721Received(address, address, uint256, bytes memory) external view override onlyProxy returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n\n    /// @inheritdoc IERC1155Receiver\n    function onERC1155Received(\n        address,\n        address,\n        uint256,\n        uint256,\n        bytes memory\n    )\n        external\n        view\n        override\n        onlyProxy\n        returns (bytes4)\n    {\n        return this.onERC1155Received.selector;\n    }\n\n    /// @inheritdoc IERC1155Receiver\n    function onERC1155BatchReceived(\n        address,\n        address,\n        uint256[] memory,\n        uint256[] memory,\n        bytes memory\n    )\n        external\n        view\n        override\n        onlyProxy\n        returns (bytes4)\n    {\n        return this.onERC1155BatchReceived.selector;\n    }\n\n    /**\n     * @notice Deposits more funds for this account in the entry point\n     * @dev Related: ERC4337\n     */\n    function addDeposit() external payable onlyProxy {\n        entryPoint.depositTo{ value: msg.value }(address(this));\n    }\n\n    /**\n     * @notice This method withdraws funds of this account from the entry point\n     * @dev Related: ERC4337\n     * @param _withdrawAddress Address to withdraw the amount to\n     * @param _withdrawAmount Amount to be withdraw from the entry point\n     */\n    function withdrawDeposit(address payable _withdrawAddress, uint256 _withdrawAmount) external onlyEntryPointOrSelf {\n        entryPoint.withdrawTo(_withdrawAddress, _withdrawAmount);\n    }\n\n    /**\n     * @notice Disables a delegation from being used\n     * @param _delegation The delegation to be disabled\n     */\n    function disableDelegation(Delegation calldata _delegation) external onlyEntryPointOrSelf {\n        delegationManager.disableDelegation(_delegation);\n    }\n\n    /**\n     * @notice Enables a delegation to be used\n     * @dev Delegations only need to be enabled if they have been disabled\n     * @param _delegation The delegation to be enabled\n     */\n    function enableDelegation(Delegation calldata _delegation) external onlyEntryPointOrSelf {\n        delegationManager.enableDelegation(_delegation);\n    }\n\n    /**\n     * @notice Checks if the delegation is disabled\n     * @param _delegationHash the hash of the delegation to check for disabled status.\n     * @return bool is the delegation disabled\n     */\n    function isDelegationDisabled(bytes32 _delegationHash) external view returns (bool) {\n        return delegationManager.disabledDelegations(_delegationHash);\n    }\n\n    /**\n     * @notice Gets the current account's deposit in the entry point\n     * @dev Related: ERC4337\n     * @return uint256 The current account's deposit in the entry point\n     */\n    function getDeposit() external view returns (uint256) {\n        return entryPoint.balanceOf(address(this));\n    }\n\n    /**\n     * @notice Returns the next sequential nonce using a static key\n     * @dev Related: ERC4337\n     * @return uint256 The next sequential nonce\n     */\n    function getNonce() external view returns (uint256) {\n        return entryPoint.getNonce(address(this), 0);\n    }\n\n    /**\n     * @notice Returns the next sequential nonce using a custom key\n     * @dev Related: ERC4337\n     * @return uint256 The next sequential nonce for the key provided\n     * @param _key The key to use for the nonce\n     */\n    function getNonce(uint192 _key) external view returns (uint256) {\n        return entryPoint.getNonce(address(this), _key);\n    }\n\n    /**\n     * @notice This method returns the domain hash used for signing typed data\n     * @return bytes32 The domain hash\n     */\n    function getDomainHash() external view returns (bytes32) {\n        return _domainSeparatorV4();\n    }\n\n    /**\n     * @notice Returns a boolean indicating if a mode is supported\n     * @param _mode The mode to validate\n     * @notice Returns true if the mode is supported, and false otherwise\n     */\n    function supportsExecutionMode(ModeCode _mode) external view virtual override returns (bool) {\n        (CallType callType_, ExecType execType_, ModeSelector modeSelector_, ModePayload modePayload_) = _mode.decode();\n\n        return (\n            (callType_ == CALLTYPE_SINGLE || callType_ == CALLTYPE_BATCH)\n                && (execType_ == EXECTYPE_DEFAULT || execType_ == EXECTYPE_TRY) && (modeSelector_ == MODE_DEFAULT)\n                && (ModePayload.unwrap(modePayload_) == bytes22(0x00))\n        );\n    }\n\n    /**\n     * @notice Returns the formatted hash to sign for an EIP712 typed data signature\n     * @param _userOp the UserOp to hash\n     * @notice Returns an EIP712 typed data hash for a given UserOp\n     */\n    function getPackedUserOperationTypedDataHash(PackedUserOperation calldata _userOp) public view returns (bytes32) {\n        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), getPackedUserOperationHash(_userOp));\n    }\n\n    /**\n     * @inheritdoc IERC165\n     * @dev Supports the following interfaces: IDeleGatorCore, IERC721Receiver, IERC1155Receiver, IERC165, IERC1271\n     */\n    function supportsInterface(bytes4 _interfaceId) public view virtual override(IERC165) onlyProxy returns (bool) {\n        return _interfaceId == type(IDeleGatorCore).interfaceId || _interfaceId == type(IERC721Receiver).interfaceId\n            || _interfaceId == type(IERC1155Receiver).interfaceId || _interfaceId == type(IERC165).interfaceId\n            || _interfaceId == type(IERC1271).interfaceId || _interfaceId == type(IERC7821).interfaceId;\n    }\n\n    /**\n     * Provides the typed data hash for a PackedUserOperation\n     * @param _userOp the PackedUserOperation to hash\n     */\n    function getPackedUserOperationHash(PackedUserOperation calldata _userOp) public view returns (bytes32) {\n        return keccak256(\n            abi.encode(\n                PACKED_USER_OP_TYPEHASH,\n                _userOp.sender,\n                _userOp.nonce,\n                keccak256(_userOp.initCode),\n                keccak256(_userOp.callData),\n                _userOp.accountGasLimits,\n                _userOp.preVerificationGas,\n                _userOp.gasFees,\n                keccak256(_userOp.paymasterAndData),\n                entryPoint\n            )\n        );\n    }\n\n    ////////////////////////////// Internal Methods //////////////////////////////\n\n    /**\n     * @notice Sends the entrypoint (msg.sender) any needed funds for the transaction.\n     * @param _missingAccountFunds the minimum value this method should send the entrypoint.\n     *         this value MAY be zero, in case there is enough deposit, or the userOp has a paymaster.\n     */\n    function _payPrefund(uint256 _missingAccountFunds) internal {\n        if (_missingAccountFunds != 0) {\n            (bool success_,) = payable(msg.sender).call{ value: _missingAccountFunds, gas: type(uint256).max }(\"\");\n            (success_);\n            // Ignore failure (it's EntryPoint's job to verify, not account.)\n            emit SentPrefund(msg.sender, _missingAccountFunds, success_);\n        }\n    }\n\n    /**\n     * @notice The logic to verify if the signature is valid for this contract\n     * @dev This is an internal function that should be overridden by the implementing contract based on the signature scheme used.\n     * @dev Related: ERC4337\n     * @param _hash The hash of the data signed.\n     * @param _signature The signatures of the signers.\n     * @return A bytes4 magic value which is EIP1271_MAGIC_VALUE(0x1626ba7e) if the signature is valid, returns\n     * SIG_VALIDATION_FAILED(0xffffffff) if there is a signature mismatch and reverts (for all other errors).\n     */\n    function _isValidSignature(bytes32 _hash, bytes calldata _signature) internal view virtual returns (bytes4);\n\n    /**\n     * @notice Validates a UserOp signature and returns a code indicating if the signature is valid or not\n     * @dev This method calls the DeleGator implementations `_isValidSignature` to validate the signature according to the\n     * implementations auth scheme.\n     * @dev Returns 0 if the signature is valid, 1 if the signature is invalid.\n     * @dev Related: ERC4337\n     * @param _userOp The UserOp\n     * @param _userOpHash UserOp hash produced with typed data\n     * @return validationData_ A code indicating if the signature is valid or not\n     */\n    function _validateUserOpSignature(\n        PackedUserOperation calldata _userOp,\n        bytes32 _userOpHash\n    )\n        internal\n        view\n        returns (uint256 validationData_)\n    {\n        bytes4 result_ = _isValidSignature(_userOpHash, _userOp.signature);\n        if (result_ == ERC1271Lib.EIP1271_MAGIC_VALUE) {\n            return 0;\n        } else {\n            return 1;\n        }\n    }\n}\n"},{"file_path":"src/interfaces/IDeleGatorCore.sol","source_code":"// SPDX-License-Identifier: MIT AND Apache-2.0\npragma solidity 0.8.23;\n\nimport { IERC1271 } from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\n\nimport { ModeCode } from \"../utils/Types.sol\";\n\n/**\n * @title IDeleGatorCore\n * @notice Interface for a DeleGator that exposes the minimal functionality required.\n */\ninterface IDeleGatorCore is IERC1271 {\n    /**\n     * @dev Executes a transaction on behalf of the account.\n     *         This function is intended to be called by Executor Modules\n     * @dev Ensure adequate authorization control: i.e. onlyExecutorModule\n     * @dev If a mode is requested that is not supported by the Account, it MUST revert\n     * @dev Related: @erc7579/MSAAdvanced.sol\n     * @param _mode The encoded execution mode of the transaction. See @erc7579/ModeLib.sol for details.\n     * @param _executionCalldata The encoded execution call data\n     */\n    function executeFromExecutor(\n        ModeCode _mode,\n        bytes calldata _executionCalldata\n    )\n        external\n        payable\n        returns (bytes[] memory returnData);\n}\n"},{"file_path":"src/interfaces/IDelegationManager.sol","source_code":"// SPDX-License-Identifier: MIT AND Apache-2.0\npragma solidity 0.8.23;\n\nimport { Delegation, Execution, ModeCode } from \"../utils/Types.sol\";\n\n/**\n * @title IDelegationManager\n * @notice Interface that exposes methods of a custom DelegationManager implementation.\n */\ninterface IDelegationManager {\n    ////////////////////////////// Events //////////////////////////////\n\n    /// @dev Emitted when a delegation is redeemed\n    event RedeemedDelegation(address indexed rootDelegator, address indexed redeemer, Delegation delegation);\n\n    /// @dev Emitted when a delegation is enabled after being disabled\n    event EnabledDelegation(\n        bytes32 indexed delegationHash, address indexed delegator, address indexed delegate, Delegation delegation\n    );\n\n    /// @dev Emitted when a delegation is disabled\n    event DisabledDelegation(\n        bytes32 indexed delegationHash, address indexed delegator, address indexed delegate, Delegation delegation\n    );\n\n    /// @dev Emitted when the domain hash is set\n    event SetDomain(\n        bytes32 indexed domainHash, string name, string domainVersion, uint256 chainId, address indexed contractAddress\n    );\n\n    ////////////////////////////// Errors //////////////////////////////\n\n    /// @dev Error thrown when a user attempts to use a disabled delegation\n    error CannotUseADisabledDelegation();\n\n    /// @dev Error thrown when the authority in a chain of delegations doesn't match the expected authority\n    error InvalidAuthority();\n\n    /// @dev Error thrown when the redeemer doesn't match the approved delegate\n    error InvalidDelegate();\n\n    /// @dev Error thrown when the delegator of a delegation doesn't match the caller\n    error InvalidDelegator();\n\n    /// @dev Error thrown when the EOA signature provided is invalid\n    error InvalidEOASignature();\n\n    /// @dev Error thrown when the ERC1271 signature provided is invalid\n    error InvalidERC1271Signature();\n\n    /// @dev Error thrown when the signature is empty\n    error EmptySignature();\n\n    /// @dev Error thrown when the delegation provided is already disabled\n    error AlreadyDisabled();\n\n    /// @dev Error thrown when the delegation provided is already enabled\n    error AlreadyEnabled();\n\n    /// @dev Error thrown when the batch size doesn't match the execution array size\n    error BatchDataLengthMismatch();\n\n    ////////////////////////////// MM Implementation Methods //////////////////////////////\n\n    function pause() external;\n\n    function unpause() external;\n\n    function enableDelegation(Delegation calldata _delegation) external;\n\n    function disableDelegation(Delegation calldata _delegation) external;\n\n    function disabledDelegations(bytes32 _delegationHash) external view returns (bool);\n\n    function getDelegationHash(Delegation calldata _delegation) external pure returns (bytes32);\n\n    function redeemDelegations(\n        bytes[] calldata _permissionContexts,\n        ModeCode[] calldata _modes,\n        bytes[] calldata _executionCallDatas\n    )\n        external;\n\n    function getDomainHash() external view returns (bytes32);\n}\n"},{"file_path":"src/interfaces/IERC7821.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\nimport { ModeCode } from \"../utils/Types.sol\";\n\n/**\n * @dev Interface for minimal batch executor.\n */\ninterface IERC7821 {\n    /**\n     * @notice Executes the function calls specified in `executionData` according to the provided `mode`.\n     *\n     * @dev The `executionData` must be encoded according to EIP-7579 standards.\n     * @param mode Execution mode as defined above.\n     * @param executionData Encoded function calls and associated data to execute.\n     * Supported modes:\n     * - `bytes32(0x0000...)`: Single execution, revert on failure.\n     * - `bytes32(0x0001...)`: Single execution, skip on failure.\n     * - `bytes32(0x0100...)`: Batch execution, revert on failure.\n     * - `bytes32(0x0101...)`: Batch execution, skip on failure.\n     *\n     */\n    function execute(ModeCode mode, bytes calldata executionData) external payable;\n\n    /**\n     * @notice Indicates whether the contract supports a given execution mode.\n     *\n     * @param mode The execution mode to check.\n     * @return bool True if the specified execution mode is supported, false otherwise.\n     *\n     * Supported modes:\n     * - `bytes32(0x0000...)`: Single execution, revert on failure.\n     * - `bytes32(0x0001...)`: Single execution, skip on failure.\n     * - `bytes32(0x0100...)`: Batch execution, revert on failure.\n     * - `bytes32(0x0101...)`: Batch execution, skip on failure.\n     */\n    function supportsExecutionMode(ModeCode mode) external view returns (bool);\n}\n"},{"file_path":"src/libraries/ERC1271Lib.sol","source_code":"// SPDX-License-Identifier: MIT AND Apache-2.0\npragma solidity 0.8.23;\n\n/**\n * @title ERC1271 Library\n */\nlibrary ERC1271Lib {\n    /// @dev Magic value to be returned upon successful validation.\n    bytes4 internal constant EIP1271_MAGIC_VALUE = 0x1626ba7e;\n\n    /// @dev Magic value to be returned upon failed validation.\n    bytes4 internal constant SIG_VALIDATION_FAILED = 0xffffffff;\n}\n"},{"file_path":"src/utils/Constants.sol","source_code":"// SPDX-License-Identifier: MIT AND Apache-2.0\npragma solidity 0.8.23;\n\nimport {\n    CALLTYPE_SINGLE, CALLTYPE_BATCH, EXECTYPE_DEFAULT, EXECTYPE_TRY, MODE_DEFAULT, MODE_OFFSET\n} from \"@erc7579/lib/ModeLib.sol\";\n\nbytes32 constant EIP712_DOMAIN_TYPEHASH =\n    keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n// NOTE: signature is omitted from the Delegation typehash\nbytes32 constant DELEGATION_TYPEHASH = keccak256(\n    \"Delegation(address delegate,address delegator,bytes32 authority,Caveat[] caveats,uint256 salt)Caveat(address enforcer,bytes terms)\"\n);\n\nbytes32 constant CAVEAT_TYPEHASH = keccak256(\"Caveat(address enforcer,bytes terms)\");\n"},{"file_path":"src/utils/Types.sol","source_code":"// SPDX-License-Identifier: MIT AND Apache-2.0\npragma solidity 0.8.23;\n\nimport { PackedUserOperation } from \"@account-abstraction/interfaces/PackedUserOperation.sol\";\nimport { Execution } from \"@erc7579/interfaces/IERC7579Account.sol\";\nimport { ModeCode, CallType, ExecType, ModeSelector, ModePayload } from \"@erc7579/lib/ModeLib.sol\";\n\n/**\n * @title EIP712Domain\n * @notice Struct representing the EIP712 domain for signature validation.\n */\nstruct EIP712Domain {\n    string name;\n    string version;\n    uint256 chainId;\n    address verifyingContract;\n}\n\n/**\n * @title Delegation\n * @notice Struct representing a delegation to give a delegate authority to act on behalf of a delegator.\n * @dev `signature` is ignored during delegation hashing so it can be manipulated post signing.\n */\nstruct Delegation {\n    address delegate;\n    address delegator;\n    bytes32 authority;\n    Caveat[] caveats;\n    uint256 salt;\n    bytes signature;\n}\n\n/**\n * @title Caveat\n * @notice Struct representing a caveat to enforce on a delegation.\n * @dev `args` is ignored during caveat hashing so it can be manipulated post signing.\n */\nstruct Caveat {\n    address enforcer;\n    bytes terms;\n    bytes args;\n}\n\n/**\n * @title P256 Public Key\n * @notice Struct containing the X and Y coordinates of a P256 public key.\n */\nstruct P256PublicKey {\n    uint256 x;\n    uint256 y;\n}\n\nstruct DecodedWebAuthnSignature {\n    uint256 r;\n    uint256 s;\n    bytes authenticatorData;\n    bool requireUserVerification;\n    string clientDataJSONPrefix;\n    string clientDataJSONSuffix;\n    uint256 responseTypeLocation;\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"contract IDelegationManager","name":"_delegationManager","type":"address"},{"internalType":"contract IEntryPoint","name":"_entryPoint","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"ExecutionFailed","type":"error"},{"inputs":[],"name":"InvalidEIP712NameLength","type":"error"},{"inputs":[],"name":"InvalidEIP712VersionLength","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"NotDelegationManager","type":"error"},{"inputs":[],"name":"NotEntryPoint","type":"error"},{"inputs":[],"name":"NotEntryPointOrSelf","type":"error"},{"inputs":[],"name":"NotSelf","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"UnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"CallType","name":"callType","type":"bytes1"}],"name":"UnsupportedCallType","type":"error"},{"inputs":[{"internalType":"ExecType","name":"execType","type":"bytes1"}],"name":"UnsupportedExecType","type":"error"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"SentPrefund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDelegationManager","name":"newDelegationManager","type":"address"}],"name":"SetDelegationManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IEntryPoint","name":"entryPoint","type":"address"}],"name":"SetEntryPoint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"batchExecutionindex","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"result","type":"bytes"}],"name":"TryExecuteUnsuccessful","type":"event"},{"inputs":[],"name":"DOMAIN_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PACKED_USER_OP_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"delegationManager","outputs":[{"internalType":"contract IDelegationManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"delegate","type":"address"},{"internalType":"address","name":"delegator","type":"address"},{"internalType":"bytes32","name":"authority","type":"bytes32"},{"components":[{"internalType":"address","name":"enforcer","type":"address"},{"internalType":"bytes","name":"terms","type":"bytes"},{"internalType":"bytes","name":"args","type":"bytes"}],"internalType":"struct Caveat[]","name":"caveats","type":"tuple[]"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Delegation","name":"_delegation","type":"tuple"}],"name":"disableDelegation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"delegate","type":"address"},{"internalType":"address","name":"delegator","type":"address"},{"internalType":"bytes32","name":"authority","type":"bytes32"},{"components":[{"internalType":"address","name":"enforcer","type":"address"},{"internalType":"bytes","name":"terms","type":"bytes"},{"internalType":"bytes","name":"args","type":"bytes"}],"internalType":"struct Caveat[]","name":"caveats","type":"tuple[]"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Delegation","name":"_delegation","type":"tuple"}],"name":"enableDelegation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"entryPoint","outputs":[{"internalType":"contract IEntryPoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Execution","name":"_execution","type":"tuple"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"ModeCode","name":"_mode","type":"bytes32"},{"internalType":"bytes","name":"_executionCalldata","type":"bytes"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"ModeCode","name":"_mode","type":"bytes32"},{"internalType":"bytes","name":"_executionCalldata","type":"bytes"}],"name":"executeFromExecutor","outputs":[{"internalType":"bytes[]","name":"returnData_","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint192","name":"_key","type":"uint192"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"initCode","type":"bytes"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes32","name":"accountGasLimits","type":"bytes32"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"bytes32","name":"gasFees","type":"bytes32"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct PackedUserOperation","name":"_userOp","type":"tuple"}],"name":"getPackedUserOperationHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"initCode","type":"bytes"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes32","name":"accountGasLimits","type":"bytes32"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"bytes32","name":"gasFees","type":"bytes32"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct PackedUserOperation","name":"_userOp","type":"tuple"}],"name":"getPackedUserOperationTypedDataHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_delegationHash","type":"bytes32"}],"name":"isDelegationDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_hash","type":"bytes32"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"magicValue_","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"_permissionContexts","type":"bytes[]"},{"internalType":"ModeCode[]","name":"_modes","type":"bytes32[]"},{"internalType":"bytes[]","name":"_executionCallDatas","type":"bytes[]"}],"name":"redeemDelegations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"ModeCode","name":"_mode","type":"bytes32"}],"name":"supportsExecutionMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"initCode","type":"bytes"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes32","name":"accountGasLimits","type":"bytes32"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"bytes32","name":"gasFees","type":"bytes32"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct PackedUserOperation","name":"_userOp","type":"tuple"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"_missingAccountFunds","type":"uint256"}],"name":"validateUserOp","outputs":[{"internalType":"uint256","name":"validationData_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_withdrawAddress","type":"address"},{"internalType":"uint256","name":"_withdrawAmount","type":"uint256"}],"name":"withdrawDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x000000000000000000000000db9b1e94b5b69df7e401ddbede43491141047db30000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032"}