diff --git a/deploy/deploy-all.ts b/deploy/deploy-all.ts index ecf7c146..11fbac13 100644 --- a/deploy/deploy-all.ts +++ b/deploy/deploy-all.ts @@ -31,13 +31,13 @@ const deployKernel: DeployFunction = async function (hre: HardhatRuntimeEnvironm from: deployerAddress, args: [entrypoint], log: true, - deterministicDeployment: true + deterministicDeployment: true, }); await deploy('ZeroDevSessionKeyPlugin', { from: deployerAddress, log: true, - deterministicDeployment: true + deterministicDeployment: true, }); } diff --git a/deployments/arbitrumGoerli/.chainId b/deployments/arbitrumGoerli/.chainId new file mode 100644 index 00000000..16be23a3 --- /dev/null +++ b/deployments/arbitrumGoerli/.chainId @@ -0,0 +1 @@ +421613 \ No newline at end of file diff --git a/deployments/arbitrumGoerli/KernelFactory.json b/deployments/arbitrumGoerli/KernelFactory.json new file mode 100644 index 00000000..b51b35cf --- /dev/null +++ b/deployments/arbitrumGoerli/KernelFactory.json @@ -0,0 +1,124 @@ +{ + "address": "0x4E4946298614FC299B50c947289F4aD0572CB9ce", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "AccountCreated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "createAccount", + "outputs": [ + { + "internalType": "contract EIP1967Proxy", + "name": "proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getAccountAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kernelTemplate", + "outputs": [ + { + "internalType": "contract Kernel", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "args": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" + ], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IEntryPoint\",\"name\":\"_entryPoint\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"AccountCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"createAccount\",\"outputs\":[{\"internalType\":\"contract EIP1967Proxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getAccountAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kernelTemplate\",\"outputs\":[{\"internalType\":\"contract Kernel\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/KernelFactory.sol\":\"KernelFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/EntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n\\nimport \\\"../interfaces/IAccount.sol\\\";\\nimport \\\"../interfaces/IPaymaster.sol\\\";\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\nimport \\\"../utils/Exec.sol\\\";\\nimport \\\"./StakeManager.sol\\\";\\nimport \\\"./SenderCreator.sol\\\";\\nimport \\\"./Helpers.sol\\\";\\nimport \\\"./NonceManager.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\n\\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\\n\\n using UserOperationLib for UserOperation;\\n\\n SenderCreator private immutable senderCreator = new SenderCreator();\\n\\n // internal value used during simulation: need to query aggregator.\\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\\n\\n // marker for inner call revert on out of gas\\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\\n\\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\\n\\n /**\\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\\n * in case of signature failure, instead of revert.\\n */\\n uint256 public constant SIG_VALIDATION_FAILED = 1;\\n\\n /**\\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\\n * @param beneficiary the address to receive the fees\\n * @param amount amount to transfer.\\n */\\n function _compensate(address payable beneficiary, uint256 amount) internal {\\n require(beneficiary != address(0), \\\"AA90 invalid beneficiary\\\");\\n (bool success,) = beneficiary.call{value : amount}(\\\"\\\");\\n require(success, \\\"AA91 failed send to beneficiary\\\");\\n }\\n\\n /**\\n * execute a user op\\n * @param opIndex index into the opInfo array\\n * @param userOp the userOp to execute\\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\\n * @return collected the total amount this userOp paid.\\n */\\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\\n uint256 preGas = gasleft();\\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\\n\\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\\n collected = _actualGasCost;\\n } catch {\\n bytes32 innerRevertCode;\\n assembly {\\n returndatacopy(0, 0, 32)\\n innerRevertCode := mload(0)\\n }\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (innerRevertCode == INNER_OUT_OF_GAS) {\\n //report paymaster, since if it is not deliberately caused by the bundler,\\n // it must be a revert caused by paymaster.\\n revert FailedOp(opIndex, \\\"AA95 out of gas\\\");\\n }\\n\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\\n }\\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\\n\\n uint256 opslen = ops.length;\\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\\n\\n unchecked {\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[i];\\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\\n }\\n\\n uint256 collected = 0;\\n emit BeforeExecution();\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(i, ops[i], opInfos[i]);\\n }\\n\\n _compensate(beneficiary, collected);\\n } //unchecked\\n }\\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 ) public nonReentrant {\\n\\n uint256 opasLen = opsPerAggregator.length;\\n uint256 totalOps = 0;\\n for (uint256 i = 0; i < opasLen; i++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n //address(1) is special marker of \\\"signature error\\\"\\n require(address(aggregator) != address(1), \\\"AA96 invalid aggregator\\\");\\n\\n if (address(aggregator) != address(0)) {\\n // solhint-disable-next-line no-empty-blocks\\n try aggregator.validateSignatures(ops, opa.signature) {}\\n catch {\\n revert SignatureValidationFailed(address(aggregator));\\n }\\n }\\n\\n totalOps += ops.length;\\n }\\n\\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\\n\\n emit BeforeExecution();\\n\\n uint256 opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n uint256 opslen = ops.length;\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[opIndex];\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\\n opIndex++;\\n }\\n }\\n\\n uint256 collected = 0;\\n opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n emit SignatureAggregatorChanged(address(opa.aggregator));\\n UserOperation[] calldata ops = opa.userOps;\\n uint256 opslen = ops.length;\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\\n opIndex++;\\n }\\n }\\n emit SignatureAggregatorChanged(address(0));\\n\\n _compensate(beneficiary, collected);\\n }\\n\\n /// @inheritdoc IEntryPoint\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\\n\\n UserOpInfo memory opInfo;\\n _simulationOnlyValidations(op);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n\\n numberMarker();\\n uint256 paid = _executeUserOp(0, op, opInfo);\\n numberMarker();\\n bool targetSuccess;\\n bytes memory targetResult;\\n if (target != address(0)) {\\n (targetSuccess, targetResult) = target.call(targetCallData);\\n }\\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\\n }\\n\\n\\n // A memory copy of UserOp static fields only.\\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\\n struct MemoryUserOp {\\n address sender;\\n uint256 nonce;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n address paymaster;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n }\\n\\n struct UserOpInfo {\\n MemoryUserOp mUserOp;\\n bytes32 userOpHash;\\n uint256 prefund;\\n uint256 contextOffset;\\n uint256 preOpGas;\\n }\\n\\n /**\\n * inner function to handle a UserOperation.\\n * Must be declared \\\"external\\\" to open a call context, but it can only be called by handleOps.\\n */\\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n require(msg.sender == address(this), \\\"AA92 internal call only\\\");\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n\\n uint callGasLimit = mUserOp.callGasLimit;\\n unchecked {\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\\n assembly {\\n mstore(0, INNER_OUT_OF_GAS)\\n revert(0, 32)\\n }\\n }\\n }\\n\\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\\n if (callData.length > 0) {\\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\\n if (!success) {\\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\\n if (result.length > 0) {\\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\\n }\\n mode = IPaymaster.PostOpMode.opReverted;\\n }\\n }\\n\\n unchecked {\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\\n return _handlePostOp(0, mode, opInfo, context, actualGas);\\n }\\n }\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\\n }\\n\\n /**\\n * copy general fields from userOp into the memory opInfo structure.\\n */\\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\\n mUserOp.sender = userOp.sender;\\n mUserOp.nonce = userOp.nonce;\\n mUserOp.callGasLimit = userOp.callGasLimit;\\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\\n mUserOp.preVerificationGas = userOp.preVerificationGas;\\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes calldata paymasterAndData = userOp.paymasterAndData;\\n if (paymasterAndData.length > 0) {\\n require(paymasterAndData.length >= 20, \\\"AA93 invalid paymasterAndData\\\");\\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\\n } else {\\n mUserOp.paymaster = address(0);\\n }\\n }\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external {\\n UserOpInfo memory outOpInfo;\\n\\n _simulationOnlyValidations(userOp);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\\n StakeInfo memory factoryInfo;\\n {\\n bytes calldata initCode = userOp.initCode;\\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\\n factoryInfo = _getStakeInfo(factory);\\n }\\n\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n address aggregator = data.aggregator;\\n bool sigFailed = aggregator == address(1);\\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\\n\\n if (aggregator != address(0) && aggregator != address(1)) {\\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\\n }\\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\\n\\n }\\n\\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\\n unchecked {\\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\\n // our security model might call postOp eventually twice\\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\\n\\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\\n }\\n }\\n\\n // create the sender's contract if needed.\\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\\n if (initCode.length != 0) {\\n address sender = opInfo.mUserOp.sender;\\n if (sender.code.length != 0) revert FailedOp(opIndex, \\\"AA10 sender already constructed\\\");\\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\\n if (sender1 == address(0)) revert FailedOp(opIndex, \\\"AA13 initCode failed or OOG\\\");\\n if (sender1 != sender) revert FailedOp(opIndex, \\\"AA14 initCode must return sender\\\");\\n if (sender1.code.length == 0) revert FailedOp(opIndex, \\\"AA15 initCode must create sender\\\");\\n address factory = address(bytes20(initCode[0 : 20]));\\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\\n }\\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 calldata initCode) public {\\n address sender = senderCreator.createSender(initCode);\\n revert SenderAddressResult(sender);\\n }\\n\\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\\n // solhint-disable-next-line no-empty-blocks\\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\\n catch Error(string memory revertReason) {\\n if (bytes(revertReason).length != 0) {\\n revert FailedOp(0, revertReason);\\n }\\n }\\n }\\n\\n /**\\n * Called only during simulation.\\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\\n */\\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\\n if (initCode.length == 0 && sender.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA20 account not deployed\\\");\\n }\\n if (paymasterAndData.length >= 20) {\\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\\n if (paymaster.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA30 paymaster not deployed\\\");\\n }\\n }\\n // always revert\\n revert(\\\"\\\");\\n }\\n\\n /**\\n * call account.validateUserOp.\\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\\n * decrement account's deposit if needed\\n */\\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\\n unchecked {\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n address sender = mUserOp.sender;\\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\\n address paymaster = mUserOp.paymaster;\\n numberMarker();\\n uint256 missingAccountFunds = 0;\\n if (paymaster == address(0)) {\\n uint256 bal = balanceOf(sender);\\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\\n }\\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\\n returns (uint256 _validationData) {\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA23 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA23 reverted (or OOG)\\\");\\n }\\n if (paymaster == address(0)) {\\n DepositInfo storage senderInfo = deposits[sender];\\n uint256 deposit = senderInfo.deposit;\\n if (requiredPrefund > deposit) {\\n revert FailedOp(opIndex, \\\"AA21 didn't pay prefund\\\");\\n }\\n senderInfo.deposit = uint112(deposit - requiredPrefund);\\n }\\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\\n }\\n }\\n\\n /**\\n * In case the request has a paymaster:\\n * Validate paymaster has enough deposit.\\n * Call paymaster.validatePaymasterUserOp.\\n * Revert with proper FailedOp in case paymaster reverts.\\n * Decrement paymaster's deposit\\n */\\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\\n internal returns (bytes memory context, uint256 validationData) {\\n unchecked {\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \\\"AA41 too little verificationGas\\\");\\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\\n\\n address paymaster = mUserOp.paymaster;\\n DepositInfo storage paymasterInfo = deposits[paymaster];\\n uint256 deposit = paymasterInfo.deposit;\\n if (deposit < requiredPreFund) {\\n revert FailedOp(opIndex, \\\"AA31 paymaster deposit too low\\\");\\n }\\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\\n context = _context;\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA33 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA33 reverted (or OOG)\\\");\\n }\\n }\\n }\\n\\n /**\\n * revert if either account validationData or paymaster validationData is expired\\n */\\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\\n if (expectedAggregator != aggregator) {\\n revert FailedOp(opIndex, \\\"AA24 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA22 expired or not due\\\");\\n }\\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\\n address pmAggregator;\\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\\n if (pmAggregator != address(0)) {\\n revert FailedOp(opIndex, \\\"AA34 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA32 paymaster expired or not due\\\");\\n }\\n }\\n\\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\\n if (validationData == 0) {\\n return (address(0), false);\\n }\\n ValidationData memory data = _parseValidationData(validationData);\\n // solhint-disable-next-line not-rely-on-time\\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\\n aggregator = data.aggregator;\\n }\\n\\n /**\\n * validate account and paymaster (if defined).\\n * also make sure total validation doesn't exceed verificationGasLimit\\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\\n * @param opIndex the index of this userOp into the \\\"opInfos\\\" array\\n * @param userOp the userOp to validate\\n */\\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\\n private returns (uint256 validationData, uint256 paymasterValidationData) {\\n\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\\n _copyUserOpToMemory(userOp, mUserOp);\\n outOpInfo.userOpHash = getUserOpHash(userOp);\\n\\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\\n // and multiplied without causing overflow\\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\\n require(maxGasValues <= type(uint120).max, \\\"AA94 gas values overflow\\\");\\n\\n uint256 gasUsedByValidateAccountPrepayment;\\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\\n\\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\\n revert FailedOp(opIndex, \\\"AA25 invalid account nonce\\\");\\n }\\n\\n //a \\\"marker\\\" where account opcode validation is done and paymaster opcode validation is about to start\\n // (used only by off-chain simulateValidation)\\n numberMarker();\\n\\n bytes memory context;\\n if (mUserOp.paymaster != address(0)) {\\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\\n }\\n unchecked {\\n uint256 gasUsed = preGas - gasleft();\\n\\n if (userOp.verificationGasLimit < gasUsed) {\\n revert FailedOp(opIndex, \\\"AA40 over verificationGasLimit\\\");\\n }\\n outOpInfo.prefund = requiredPreFund;\\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\\n }\\n }\\n\\n /**\\n * process post-operation.\\n * called just after the callData is executed.\\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\\n * @param opIndex index in the batch\\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\\n * @param opInfo userOp fields and info collected during validation\\n * @param context the context returned in validatePaymasterUserOp\\n * @param actualGas the gas used so far by this user operation\\n */\\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n unchecked {\\n address refundAddress;\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\\n\\n address paymaster = mUserOp.paymaster;\\n if (paymaster == address(0)) {\\n refundAddress = mUserOp.sender;\\n } else {\\n refundAddress = paymaster;\\n if (context.length > 0) {\\n actualGasCost = actualGas * gasPrice;\\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\\n } else {\\n // solhint-disable-next-line no-empty-blocks\\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\\n catch Error(string memory reason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA50 postOp reverted: \\\", reason));\\n }\\n catch {\\n revert FailedOp(opIndex, \\\"AA50 postOp revert\\\");\\n }\\n }\\n }\\n }\\n actualGas += preGas - gasleft();\\n actualGasCost = actualGas * gasPrice;\\n if (opInfo.prefund < actualGasCost) {\\n revert FailedOp(opIndex, \\\"AA51 prefund below actualGasCost\\\");\\n }\\n uint256 refund = opInfo.prefund - actualGasCost;\\n _incrementDeposit(refundAddress, refund);\\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\\n } // unchecked\\n }\\n\\n /**\\n * the gas price this UserOp agrees to pay.\\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n */\\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\\n assembly {offset := data}\\n }\\n\\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\\n assembly {data := offset}\\n }\\n\\n //place the NUMBER opcode in the code.\\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\\n // account and paymaster.\\n function numberMarker() internal view {\\n assembly {mstore(0, number())}\\n }\\n}\\n\\n\",\"keccak256\":\"0x04f86318b47f052d7308795ffae6ecec0d023d2458b4e17751b89a0e4acfcdc6\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/NonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\n/**\\n * nonce management functionality\\n */\\ncontract NonceManager is INonceManager {\\n\\n /**\\n * The next valid sequence number for a given nonce key.\\n */\\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\\n\\n function getNonce(address sender, uint192 key)\\n public view override returns (uint256 nonce) {\\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\\n }\\n\\n // allow an account to manually increment its own nonce.\\n // (mainly so that during construction nonce can be made non-zero,\\n // to \\\"absorb\\\" the gas cost of first nonce increment to 1st transaction (construction),\\n // not to 2nd transaction)\\n function incrementNonce(uint192 key) public override {\\n nonceSequenceNumber[msg.sender][key]++;\\n }\\n\\n /**\\n * validate nonce uniqueness for this account.\\n * called just after validateUserOp()\\n */\\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\\n\\n uint192 key = uint192(nonce >> 64);\\n uint64 seq = uint64(nonce);\\n return nonceSequenceNumber[sender][key]++ == seq;\\n }\\n\\n}\\n\",\"keccak256\":\"0xa17a4a6fde70088ab18ffe6df830f3efa31f1cd0e1a7160336c96e3c94984d25\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/SenderCreator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/**\\n * helper contract for EntryPoint, to call userOp.initCode from a \\\"neutral\\\" address,\\n * which is explicitly not the entryPoint itself.\\n */\\ncontract SenderCreator {\\n\\n /**\\n * call the \\\"initCode\\\" factory to create and return the sender account address\\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\\n * @return sender the returned address of the created account, or zero address on failure.\\n */\\n function createSender(bytes calldata initCode) external returns (address sender) {\\n address factory = address(bytes20(initCode[0 : 20]));\\n bytes memory initCallData = initCode[20 :];\\n bool success;\\n /* solhint-disable no-inline-assembly */\\n assembly {\\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\\n sender := mload(0)\\n }\\n if (!success) {\\n sender = address(0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x44b9449fec82d6cdfb01d52fdd5a72f90099c651316123810cf9633f00b018c2\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/StakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IStakeManager.sol\\\";\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable not-rely-on-time */\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by a paymaster.\\n */\\nabstract contract StakeManager is IStakeManager {\\n\\n /// maps paymaster to their deposits and stakes\\n mapping(address => DepositInfo) public deposits;\\n\\n /// @inheritdoc IStakeManager\\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\\n return deposits[account];\\n }\\n\\n // internal method to return just the stake info\\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\\n DepositInfo storage depositInfo = deposits[addr];\\n info.stake = depositInfo.stake;\\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\\n }\\n\\n /// return the deposit (for gas payment) of the account\\n function balanceOf(address account) public view returns (uint256) {\\n return deposits[account].deposit;\\n }\\n\\n receive() external payable {\\n depositTo(msg.sender);\\n }\\n\\n function _incrementDeposit(address account, uint256 amount) internal {\\n DepositInfo storage info = deposits[account];\\n uint256 newAmount = info.deposit + amount;\\n require(newAmount <= type(uint112).max, \\\"deposit overflow\\\");\\n info.deposit = uint112(newAmount);\\n }\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) public payable {\\n _incrementDeposit(account, msg.value);\\n DepositInfo storage info = deposits[account];\\n emit Deposited(account, info.deposit);\\n }\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 unstakeDelaySec) public payable {\\n DepositInfo storage info = deposits[msg.sender];\\n require(unstakeDelaySec > 0, \\\"must specify unstake delay\\\");\\n require(unstakeDelaySec >= info.unstakeDelaySec, \\\"cannot decrease unstake time\\\");\\n uint256 stake = info.stake + msg.value;\\n require(stake > 0, \\\"no stake specified\\\");\\n require(stake <= type(uint112).max, \\\"stake overflow\\\");\\n deposits[msg.sender] = DepositInfo(\\n info.deposit,\\n true,\\n uint112(stake),\\n unstakeDelaySec,\\n 0\\n );\\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\\n }\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(info.unstakeDelaySec != 0, \\\"not staked\\\");\\n require(info.staked, \\\"already unstaking\\\");\\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\\n info.withdrawTime = withdrawTime;\\n info.staked = false;\\n emit StakeUnlocked(msg.sender, withdrawTime);\\n }\\n\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external {\\n DepositInfo storage info = deposits[msg.sender];\\n uint256 stake = info.stake;\\n require(stake > 0, \\\"No stake to withdraw\\\");\\n require(info.withdrawTime > 0, \\\"must call unlockStake() first\\\");\\n require(info.withdrawTime <= block.timestamp, \\\"Stake withdrawal is not due\\\");\\n info.unstakeDelaySec = 0;\\n info.withdrawTime = 0;\\n info.stake = 0;\\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\\n (bool success,) = withdrawAddress.call{value : stake}(\\\"\\\");\\n require(success, \\\"failed to withdraw stake\\\");\\n }\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(withdrawAmount <= info.deposit, \\\"Withdraw amount too large\\\");\\n info.deposit = uint112(info.deposit - withdrawAmount);\\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\\\"\\\");\\n require(success, \\\"failed to withdraw\\\");\\n }\\n}\\n\",\"keccak256\":\"0x21aa0956382bd000b1b8c3b1d19ca6ebcd6c9029eebb19c612fb38ee5dd2430a\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IPaymaster.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\\n */\\ninterface IPaymaster {\\n\\n enum PostOpMode {\\n opSucceeded, // user op succeeded\\n opReverted, // user op reverted. still has to pay for gas.\\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\\n }\\n\\n /**\\n * payment validation: check if paymaster agrees to pay.\\n * Must verify sender is the entryPoint.\\n * Revert to reject this request.\\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\\n * @param userOp the user operation\\n * @param userOpHash hash of the user's request data.\\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\\n * @return context value to send to a postOp\\n * zero length to signify postOp is not required.\\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\\n external returns (bytes memory context, uint256 validationData);\\n\\n /**\\n * post-operation handler.\\n * Must verify sender is the entryPoint\\n * @param mode enum with the following options:\\n * opSucceeded - user operation succeeded.\\n * opReverted - user op reverted. still has to pay for gas.\\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\\n * Now this is the 2nd call, after user's op was deliberately reverted.\\n * @param context - the context value returned by validatePaymasterUserOp\\n * @param actualGasCost - actual gas used so far (without this postOp call).\\n */\\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\\n}\\n\",\"keccak256\":\"0x36858ba8685024974f533530420688da3454d29996ebc42e410673a1ed2ec456\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n\\n function call(\\n address to,\\n uint256 value,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function staticcall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal view returns (bool success) {\\n assembly {\\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function delegateCall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n // get returned data from last call or calldelegate\\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\\n assembly {\\n let len := returndatasize()\\n if gt(len, maxLen) {\\n len := maxLen\\n }\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n // revert with explicit byte array (probably reverted info from call)\\n function revertWithData(bytes memory returnData) internal pure {\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n\\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\\n bool success = call(to,0,data,gasleft());\\n if (!success) {\\n revertWithData(getReturnData(maxLen));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b232117afbc2939f3ffc92745614867e9e1d475a3e1e5443adae13c200174f1\",\"license\":\"LGPL-3.0-only\"},\"lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x190dd6f8d592b7e4e930feb7f4313aeb8e1c4ad3154c27ce1cf6a512fc30d8cc\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(\\n uint256 amount,\\n bytes32 salt,\\n bytes memory bytecode\\n ) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(\\n bytes32 salt,\\n bytes32 bytecodeHash,\\n address deployer\\n ) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xafc07f37809f74d9c66d6461cc0f85fb5147ab855acd0acc30af4b2272130c61\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/Kernel.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"./plugin/IPlugin.sol\\\";\\nimport \\\"account-abstraction/core/Helpers.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport {EntryPoint} from \\\"account-abstraction/core/EntryPoint.sol\\\";\\nimport \\\"./utils/Exec.sol\\\";\\nimport \\\"./abstract/Compatibility.sol\\\";\\nimport \\\"./abstract/KernelStorage.sol\\\";\\n\\n/// @title Kernel\\n/// @author taek\\n/// @notice wallet kernel for minimal wallet functionality\\n/// @dev supports only 1 owner, multiple plugins\\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\\n error InvalidNonce();\\n error InvalidSignatureLength();\\n error QueryResult(bytes result);\\n\\n string public constant name = \\\"Kernel\\\";\\n\\n string public constant version = \\\"0.0.1\\\";\\n\\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\\n\\n /// @notice initialize wallet kernel\\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\\n /// @param _owner owner address\\n function initialize(address _owner) external {\\n WalletKernelStorage storage ws = getKernelStorage();\\n require(ws.owner == address(0), \\\"account: already initialized\\\");\\n ws.owner = _owner;\\n }\\n\\n /// @notice Query plugin for data\\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\\n /// @param _plugin Plugin address\\n /// @param _data Data to query\\n function queryPlugin(address _plugin, bytes calldata _data) external {\\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\\n if (success) {\\n revert QueryResult(_ret);\\n } else {\\n assembly {\\n revert(add(_ret, 32), mload(_ret))\\n }\\n }\\n }\\n\\n /// @notice execute function call to external contract\\n /// @dev this function will execute function call to external contract\\n /// @param to target contract address\\n /// @param value value to be sent\\n /// @param data data to be sent\\n /// @param operation operation type (call or delegatecall)\\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\\n \\\"account: not from entrypoint or owner\\\"\\n );\\n bool success;\\n bytes memory ret;\\n if (operation == Operation.DelegateCall) {\\n (success, ret) = Exec.delegateCall(to, data);\\n } else {\\n (success, ret) = Exec.call(to, value, data);\\n }\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n }\\n\\n /// @notice validate user operation\\n /// @dev this function will validate user operation and be called by EntryPoint\\n /// @param userOp user operation\\n /// @param userOpHash user operation hash\\n /// @param missingAccountFunds funds needed to be reimbursed\\n /// @return validationData validation data\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (uint256 validationData)\\n {\\n require(msg.sender == address(entryPoint), \\\"account: not from entryPoint\\\");\\n if (userOp.signature.length == 65) {\\n validationData = _validateUserOp(userOp, userOpHash);\\n } else if (userOp.signature.length > 97) {\\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\\n address plugin = address(bytes20(userOp.signature[0:20]));\\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\\n bytes memory signature = userOp.signature[32:97];\\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\\\"\\n ), // we are going to trust plugin for verification\\n plugin,\\n validUntil,\\n validAfter,\\n keccak256(data)\\n )\\n )\\n );\\n\\n address signer = ECDSA.recover(digest, signature);\\n if (getKernelStorage().owner != signer) {\\n return SIG_VALIDATION_FAILED;\\n }\\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\\n bool res = abi.decode(ret, (bool));\\n if (!res) {\\n return SIG_VALIDATION_FAILED;\\n }\\n validationData = _packValidationData(!res, validUntil, validAfter);\\n } else {\\n revert InvalidSignatureLength();\\n }\\n if (missingAccountFunds > 0) {\\n // we are going to assume signature is valid at this point\\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\\\"\\\");\\n (success);\\n return validationData;\\n }\\n }\\n\\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\\n internal\\n view\\n returns (uint256 validationData)\\n {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\\n return validationData;\\n }\\n\\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\\n address recovered = ECDSA.recover(hash, userOp.signature);\\n if (ws.owner != recovered) {\\n return SIG_VALIDATION_FAILED;\\n }\\n }\\n\\n /**\\n * delegate the contract call to the plugin\\n */\\n function _delegateToPlugin(\\n address plugin,\\n UserOperation calldata userOp,\\n bytes32 opHash,\\n uint256 missingAccountFunds\\n ) internal returns (bytes memory) {\\n bytes memory data =\\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n return ret;\\n }\\n\\n /// @notice validate signature using eip1271\\n /// @dev this function will validate signature using eip1271\\n /// @param _hash hash to be signed\\n /// @param _signature signature\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\\n return 0x1626ba7e;\\n }\\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\\n address recovered = ECDSA.recover(hash, _signature);\\n // Validate signatures\\n if (ws.owner == recovered) {\\n return 0x1626ba7e;\\n } else {\\n return 0xffffffff;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xee1651f7212298696da5a773709d0a33ee272ae8c06e31824655e71a2228ae25\",\"license\":\"MIT\"},\"src/KernelFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/Create2.sol\\\";\\nimport \\\"./factory/EIP1967Proxy.sol\\\";\\nimport \\\"./Kernel.sol\\\";\\n\\ncontract KernelFactory {\\n Kernel public immutable kernelTemplate;\\n\\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\\n\\n constructor(IEntryPoint _entryPoint) {\\n kernelTemplate = new Kernel(_entryPoint);\\n }\\n\\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n address addr = Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n if (addr.code.length > 0) {\\n return EIP1967Proxy(payable(addr));\\n }\\n proxy =\\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\\n emit AccountCreated(address(proxy), _owner, _index);\\n }\\n\\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n return Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x53a5dbafaf7d000de850be785d4c2d883980acf1772d231b510c122640ccf789\",\"license\":\"MIT\"},\"src/abstract/Compatibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract Compatibility {\\n receive() external payable {}\\n\\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n\\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\\n external\\n pure\\n returns (bytes4)\\n {\\n return this.onERC1155BatchReceived.selector;\\n }\\n\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\\n}\\n\",\"keccak256\":\"0x0d4634886db9ce6c2321db3a9bbbe0883cffe654cbce75dcfc9df1ec7eedb0b8\",\"license\":\"MIT\"},\"src/abstract/KernelStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\n\\nstruct WalletKernelStorage {\\n address owner;\\n}\\n\\ncontract KernelStorage {\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n IEntryPoint public immutable entryPoint;\\n\\n event Upgraded(address indexed newImplementation);\\n\\n // modifier for checking if the sender is the entrypoint or\\n // the account itself\\n modifier onlyFromEntryPointOrOwnerOrSelf() {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\\n \\\"account: not from entrypoint or owner or self\\\"\\n );\\n _;\\n }\\n\\n constructor(IEntryPoint _entryPoint) {\\n entryPoint = _entryPoint;\\n getKernelStorage().owner = address(1);\\n }\\n /// @notice get wallet kernel storage\\n /// @dev used to get wallet kernel storage\\n /// @return ws wallet kernel storage, consists of owner and nonces\\n\\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\\n bytes32 storagePosition = bytes32(uint256(keccak256(\\\"zerodev.kernel\\\")) - 1);\\n assembly {\\n ws.slot := storagePosition\\n }\\n }\\n\\n function getOwner() external view returns (address) {\\n return getKernelStorage().owner;\\n }\\n\\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n assembly {\\n sstore(slot, _newImplementation)\\n }\\n emit Upgraded(_newImplementation);\\n }\\n\\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\\n getKernelStorage().owner = _newOwner;\\n }\\n\\n function getNonce() public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), 0);\\n }\\n\\n function getNonce(uint192 key) public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), key);\\n }\\n}\\n \",\"keccak256\":\"0xe4512794b67794cf90eba665aee57b75efa60f2aacd1cc45eb17d3f3b255008c\",\"license\":\"MIT\"},\"src/factory/EIP1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ncontract EIP1967Proxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n constructor(address _logic, bytes memory _data) payable {\\n require(_logic != address(0), \\\"EIP1967Proxy: implementation is the zero address\\\");\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n sstore(slot, _logic)\\n }\\n if (_data.length > 0) {\\n (bool success,) = _logic.delegatecall(_data);\\n require(success, \\\"EIP1967Proxy: constructor call failed\\\");\\n }\\n }\\n\\n fallback() external payable {\\n address implementation = _implementation();\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n function _implementation() internal view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xbec8942c8258db6379a08dcb3b0a4aa0ee585972f26eba258c35ece87972d78b\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\nenum Operation {\\n Call,\\n DelegateCall\\n}\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n function call(address to, uint256 value, bytes memory data)\\n internal\\n returns (bool success, bytes memory returnData)\\n {\\n assembly {\\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\\n assembly {\\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\\n assembly {\\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1eef311d5073ff7f02b44311ae4d5c53f619ea19f1a059b8d17c028d141c2893\",\"license\":\"LGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b506040516200466d3803806200466d833981810160405281019062000037919062000136565b806040516200004690620000aa565b620000529190620001d3565b604051809103906000f0801580156200006f573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505050620001f0565b613527806200114683390190565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000ea82620000bd565b9050919050565b6000620000fe82620000dd565b9050919050565b6200011081620000f1565b81146200011c57600080fd5b50565b600081519050620001308162000105565b92915050565b6000602082840312156200014f576200014e620000b8565b5b60006200015f848285016200011f565b91505092915050565b6000819050919050565b6000620001936200018d6200018784620000bd565b62000168565b620000bd565b9050919050565b6000620001a78262000172565b9050919050565b6000620001bb826200019a565b9050919050565b620001cd81620001ae565b82525050565b6000602082019050620001ea6000830184620001c2565b92915050565b608051610f26620002206000396000818160db0152818161015a0152818161028a01526103830152610f266000f3fe60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c634300081200336101606040523480156200001257600080fd5b5060405162003527380380620035278339818101604052810190620000389190620002e2565b806040518060400160405280600681526020017f4b65726e656c00000000000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a081815250506200010e818484620001e760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050508073ffffffffffffffffffffffffffffffffffffffff166101408173ffffffffffffffffffffffffffffffffffffffff168152505060016200019e6200022360201b60201c565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505062000422565b60008383834630604051602001620002049594939291906200035b565b6040516020818303038152906040528051906020012090509392505050565b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c620002589190620003e7565b60001b90508091505090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002968262000269565b9050919050565b6000620002aa8262000289565b9050919050565b620002bc816200029d565b8114620002c857600080fd5b50565b600081519050620002dc81620002b1565b92915050565b600060208284031215620002fb57620002fa62000264565b5b60006200030b84828501620002cb565b91505092915050565b6000819050919050565b620003298162000314565b82525050565b6000819050919050565b62000344816200032f565b82525050565b620003558162000289565b82525050565b600060a0820190506200037260008301886200031e565b6200038160208301876200031e565b6200039060408301866200031e565b6200039f606083018562000339565b620003ae60808301846200034a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000620003f4826200032f565b915062000401836200032f565b92508282039050818111156200041c576200041b620003b8565b5b92915050565b60805160a05160c05160e051610100516101205161014051613080620004a76000396000818161057a0152818161071301528181610b1501528181610c2401528181610e0b01528181610f2f0152610fe701526000611800015260006118420152600061182101526000611756015260006117ac015260006117d501526130806000f3fe6080604052600436106100f75760003560e01c8063940d3c601161008a578063d087d28811610059578063d087d2881461035b578063f23a6e6114610386578063f2fde38b146103c3578063f333df55146103ec576100fe565b8063940d3c60146102a1578063b0d691fe146102ca578063bc197c81146102f5578063c4d66de814610332576100fe565b80633a871cdd116100c65780633a871cdd146101d15780633e1b08121461020e57806354fd4d501461024b578063893d20e814610276576100fe565b806306fdde0314610103578063150b7a021461012e5780631626ba7e1461016b5780633659cfe6146101a8576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b50610118610415565b6040516101259190611a4b565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611b7a565b61044e565b6040516101629190611c3d565b60405180910390f35b34801561017757600080fd5b50610192600480360381019061018d9190611dbe565b610463565b60405161019f9190611c3d565b60405180910390f35b3480156101b457600080fd5b506101cf60048036038101906101ca9190611e1a565b610578565b005b3480156101dd57600080fd5b506101f860048036038101906101f39190611e6c565b61070f565b6040516102059190611eea565b60405180910390f35b34801561021a57600080fd5b5061023560048036038101906102309190611f55565b610b11565b6040516102429190611eea565b60405180910390f35b34801561025757600080fd5b50610260610bb6565b60405161026d9190611a4b565b60405180910390f35b34801561028257600080fd5b5061028b610bef565b6040516102989190611f91565b60405180910390f35b3480156102ad57600080fd5b506102c860048036038101906102c39190611fd1565b610c22565b005b3480156102d657600080fd5b506102df610e09565b6040516102ec91906120b8565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612129565b610e2d565b6040516103299190611c3d565b60405180910390f35b34801561033e57600080fd5b5061035960048036038101906103549190611e1a565b610e45565b005b34801561036757600080fd5b50610370610f2b565b60405161037d9190611eea565b60405180910390f35b34801561039257600080fd5b506103ad60048036038101906103a89190612205565b610fcf565b6040516103ba9190611c3d565b60405180910390f35b3480156103cf57600080fd5b506103ea60048036038101906103e59190611e1a565b610fe5565b005b3480156103f857600080fd5b50610413600480360381019061040e919061229f565b611157565b005b6040518060400160405280600681526020017f4b65726e656c000000000000000000000000000000000000000000000000000081525081565b600063150b7a0260e01b905095945050505050565b60008061046e6111f7565b905061047a8484611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036104e057631626ba7e60e01b915050610572565b60006104eb8561125d565b905060006104f98286611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361056457631626ba7e60e01b9350505050610572565b63ffffffff60e01b93505050505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061062857506105d56111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061065e57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61069d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069490612371565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508181558173ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a25050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461079f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610796906123dd565b60405180910390fd5b6041848061014001906107b2919061240c565b9050036107ca576107c3848461128d565b9050610a8e565b6061848061014001906107dd919061240c565b90501115610a5b576000848061014001906107f8919061240c565b60009060149261080a93929190612479565b9061081591906124f8565b60601c905060008580610140019061082d919061240c565b601490601a9261083f93929190612479565b9061084a9190612583565b60d01c9050600086806101400190610862919061240c565b601a9060209261087493929190612479565b9061087f9190612583565b60d01c9050600087806101400190610897919061240c565b6020906061926108a993929190612479565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050600088806101400190610901919061240c565b606190809261091293929190612479565b81019061091f91906125e2565b50905060006109827f4584533bad8bbd8aa77024a548a56acb8d2807847381ce1b3364745ca396b2e3878787868051906020012060405160200161096795949392919061268a565b6040516020818303038152906040528051906020012061142e565b905060006109908285611236565b90508073ffffffffffffffffffffffffffffffffffffffff166109b16111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a00576001975050505050505050610b0a565b6000610a0e888d8d8d611448565b9050600081806020019051810190610a269190612715565b905080610a3f5760019950505050505050505050610b0a565b610a4b811589896114f4565b9950505050505050505050610a8d565b6040517f4be6321b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b6000821115610b095760003373ffffffffffffffffffffffffffffffffffffffff1683604051610abd90612773565b60006040518083038185875af1925050503d8060008114610afa576040519150601f19603f3d011682016040523d82523d6000602084013e610aff565b606091505b5050905050610b0a565b5b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a30846040518363ffffffff1660e01b8152600401610b6e929190612797565b602060405180830381865afa158015610b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baf91906127d5565b9050919050565b6040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b6000610bf96111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610cd25750610c7f6111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610d11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0890612874565b60405180910390fd5b60006060600180811115610d2857610d27612894565b5b836001811115610d3b57610d3a612894565b5b03610d9b57610d8e8786868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b8092508193505050610df3565b610dea878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611563565b80925081935050505b81610e0057805160208201fd5b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063bc197c8160e01b905098975050505050505050565b6000610e4f6111f7565b9050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610edb9061290f565b60405180910390fd5b818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a3060006040518363ffffffff1660e01b8152600401610f8992919061296a565b602060405180830381865afa158015610fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fca91906127d5565b905090565b600063f23a6e6160e01b90509695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061109557506110426111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806110cb57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61110a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110190612371565b60405180910390fd5b806111136111f7565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806111a88585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b9150915081156111ef57806040517fa52b21690000000000000000000000000000000000000000000000000000000081526004016111e691906129e8565b60405180910390fd5b805160208201fd5b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c61122a9190612a39565b60001b90508091505090565b6000806000611245858561159b565b91509150611252816115ec565b819250505092915050565b6000816040516020016112709190612ae5565b604051602081830303815290604052805190602001209050919050565b6000806112986111f7565b90506112f783858061014001906112af919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036113535750611428565b600061135e8461125d565b905060006113bf8287806101400190611377919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114245760019350505050611428565b5050505b92915050565b600061144161143b611752565b8361186c565b9050919050565b60606000639e2045ce60e01b85858560405160240161146993929190612d6b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000806114d5888461152d565b91509150816114e657805160208201fd5b809350505050949350505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b8561151c57600061151f565b60015b60ff16171790509392505050565b60006060600080845160208601875af491503d604051602082018101604052818152816000602083013e80925050509250929050565b6000606060008084516020860187895af191503d604051602082018101604052818152816000602083013e8092505050935093915050565b60008060418351036115dc5760008060006020860151925060408601519150606086015160001a90506115d08782858561189f565b945094505050506115e5565b60006002915091505b9250929050565b60006004811115611600576115ff612894565b5b81600481111561161357611612612894565b5b031561174f576001600481111561162d5761162c612894565b5b8160048111156116405761163f612894565b5b03611680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167790612df5565b60405180910390fd5b6002600481111561169457611693612894565b5b8160048111156116a7576116a6612894565b5b036116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116de90612e61565b60405180910390fd5b600360048111156116fb576116fa612894565b5b81600481111561170e5761170d612894565b5b0361174e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174590612ef3565b60405180910390fd5b5b50565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161480156117ce57507f000000000000000000000000000000000000000000000000000000000000000046145b156117fb577f00000000000000000000000000000000000000000000000000000000000000009050611869565b6118667f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611981565b90505b90565b60008282604051602001611881929190612f5f565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c11156118da576000600391509150611978565b6000600187878787604051600081526020016040526040516118ff9493929190612fb2565b6020604051602081039080840390855afa158015611921573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361196f57600060019250925050611978565b80600092509250505b94509492505050565b6000838383463060405160200161199c959493929190612ff7565b6040516020818303038152906040528051906020012090509392505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156119f55780820151818401526020810190506119da565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a1d826119bb565b611a2781856119c6565b9350611a378185602086016119d7565b611a4081611a01565b840191505092915050565b60006020820190508181036000830152611a658184611a12565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611aac82611a81565b9050919050565b611abc81611aa1565b8114611ac757600080fd5b50565b600081359050611ad981611ab3565b92915050565b6000819050919050565b611af281611adf565b8114611afd57600080fd5b50565b600081359050611b0f81611ae9565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611b3a57611b39611b15565b5b8235905067ffffffffffffffff811115611b5757611b56611b1a565b5b602083019150836001820283011115611b7357611b72611b1f565b5b9250929050565b600080600080600060808688031215611b9657611b95611a77565b5b6000611ba488828901611aca565b9550506020611bb588828901611aca565b9450506040611bc688828901611b00565b935050606086013567ffffffffffffffff811115611be757611be6611a7c565b5b611bf388828901611b24565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611c3781611c02565b82525050565b6000602082019050611c526000830184611c2e565b92915050565b6000819050919050565b611c6b81611c58565b8114611c7657600080fd5b50565b600081359050611c8881611c62565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611ccb82611a01565b810181811067ffffffffffffffff82111715611cea57611ce9611c93565b5b80604052505050565b6000611cfd611a6d565b9050611d098282611cc2565b919050565b600067ffffffffffffffff821115611d2957611d28611c93565b5b611d3282611a01565b9050602081019050919050565b82818337600083830152505050565b6000611d61611d5c84611d0e565b611cf3565b905082815260208101848484011115611d7d57611d7c611c8e565b5b611d88848285611d3f565b509392505050565b600082601f830112611da557611da4611b15565b5b8135611db5848260208601611d4e565b91505092915050565b60008060408385031215611dd557611dd4611a77565b5b6000611de385828601611c79565b925050602083013567ffffffffffffffff811115611e0457611e03611a7c565b5b611e1085828601611d90565b9150509250929050565b600060208284031215611e3057611e2f611a77565b5b6000611e3e84828501611aca565b91505092915050565b600080fd5b60006101608284031215611e6357611e62611e47565b5b81905092915050565b600080600060608486031215611e8557611e84611a77565b5b600084013567ffffffffffffffff811115611ea357611ea2611a7c565b5b611eaf86828701611e4c565b9350506020611ec086828701611c79565b9250506040611ed186828701611b00565b9150509250925092565b611ee481611adf565b82525050565b6000602082019050611eff6000830184611edb565b92915050565b600077ffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b611f3281611f05565b8114611f3d57600080fd5b50565b600081359050611f4f81611f29565b92915050565b600060208284031215611f6b57611f6a611a77565b5b6000611f7984828501611f40565b91505092915050565b611f8b81611aa1565b82525050565b6000602082019050611fa66000830184611f82565b92915050565b60028110611fb957600080fd5b50565b600081359050611fcb81611fac565b92915050565b600080600080600060808688031215611fed57611fec611a77565b5b6000611ffb88828901611aca565b955050602061200c88828901611b00565b945050604086013567ffffffffffffffff81111561202d5761202c611a7c565b5b61203988828901611b24565b9350935050606061204c88828901611fbc565b9150509295509295909350565b6000819050919050565b600061207e61207961207484611a81565b612059565b611a81565b9050919050565b600061209082612063565b9050919050565b60006120a282612085565b9050919050565b6120b281612097565b82525050565b60006020820190506120cd60008301846120a9565b92915050565b60008083601f8401126120e9576120e8611b15565b5b8235905067ffffffffffffffff81111561210657612105611b1a565b5b60208301915083602082028301111561212257612121611b1f565b5b9250929050565b60008060008060008060008060a0898b03121561214957612148611a77565b5b60006121578b828c01611aca565b98505060206121688b828c01611aca565b975050604089013567ffffffffffffffff81111561218957612188611a7c565b5b6121958b828c016120d3565b9650965050606089013567ffffffffffffffff8111156121b8576121b7611a7c565b5b6121c48b828c016120d3565b9450945050608089013567ffffffffffffffff8111156121e7576121e6611a7c565b5b6121f38b828c01611b24565b92509250509295985092959890939650565b60008060008060008060a0878903121561222257612221611a77565b5b600061223089828a01611aca565b965050602061224189828a01611aca565b955050604061225289828a01611b00565b945050606061226389828a01611b00565b935050608087013567ffffffffffffffff81111561228457612283611a7c565b5b61229089828a01611b24565b92509250509295509295509295565b6000806000604084860312156122b8576122b7611a77565b5b60006122c686828701611aca565b935050602084013567ffffffffffffffff8111156122e7576122e6611a7c565b5b6122f386828701611b24565b92509250509250925092565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572206f722073656c6600000000000000000000000000000000000000602082015250565b600061235b602d836119c6565b9150612366826122ff565b604082019050919050565b6000602082019050818103600083015261238a8161234e565b9050919050565b7f6163636f756e743a206e6f742066726f6d20656e747279506f696e7400000000600082015250565b60006123c7601c836119c6565b91506123d282612391565b602082019050919050565b600060208201905081810360008301526123f6816123ba565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612429576124286123fd565b5b80840192508235915067ffffffffffffffff82111561244b5761244a612402565b5b60208301925060018202360383131561246757612466612407565b5b509250929050565b600080fd5b600080fd5b6000808585111561248d5761248c61246f565b5b8386111561249e5761249d612474565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b600061250483836124b4565b8261250f81356124bf565b9250601482101561254f5761254a7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026124eb565b831692505b505092915050565b60007fffffffffffff000000000000000000000000000000000000000000000000000082169050919050565b600061258f83836124b4565b8261259a8135612557565b925060068210156125da576125d57fffffffffffff0000000000000000000000000000000000000000000000000000836006036008026124eb565b831692505b505092915050565b600080604083850312156125f9576125f8611a77565b5b600083013567ffffffffffffffff81111561261757612616611a7c565b5b61262385828601611d90565b925050602083013567ffffffffffffffff81111561264457612643611a7c565b5b61265085828601611d90565b9150509250929050565b61266381611c58565b82525050565b600065ffffffffffff82169050919050565b61268481612669565b82525050565b600060a08201905061269f600083018861265a565b6126ac6020830187611f82565b6126b9604083018661267b565b6126c6606083018561267b565b6126d3608083018461265a565b9695505050505050565b60008115159050919050565b6126f2816126dd565b81146126fd57600080fd5b50565b60008151905061270f816126e9565b92915050565b60006020828403121561272b5761272a611a77565b5b600061273984828501612700565b91505092915050565b600081905092915050565b50565b600061275d600083612742565b91506127688261274d565b600082019050919050565b600061277e82612750565b9150819050919050565b61279181611f05565b82525050565b60006040820190506127ac6000830185611f82565b6127b96020830184612788565b9392505050565b6000815190506127cf81611ae9565b92915050565b6000602082840312156127eb576127ea611a77565b5b60006127f9848285016127c0565b91505092915050565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b600061285e6025836119c6565b915061286982612802565b604082019050919050565b6000602082019050818103600083015261288d81612851565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6163636f756e743a20616c726561647920696e697469616c697a656400000000600082015250565b60006128f9601c836119c6565b9150612904826128c3565b602082019050919050565b60006020820190508181036000830152612928816128ec565b9050919050565b6000819050919050565b600061295461294f61294a8461292f565b612059565b611f05565b9050919050565b61296481612939565b82525050565b600060408201905061297f6000830185611f82565b61298c602083018461295b565b9392505050565b600081519050919050565b600082825260208201905092915050565b60006129ba82612993565b6129c4818561299e565b93506129d48185602086016119d7565b6129dd81611a01565b840191505092915050565b60006020820190508181036000830152612a0281846129af565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a4482611adf565b9150612a4f83611adf565b9250828203905081811115612a6757612a66612a0a565b5b92915050565b600081905092915050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000612aae601c83612a6d565b9150612ab982612a78565b601c82019050919050565b6000819050919050565b612adf612ada82611c58565b612ac4565b82525050565b6000612af082612aa1565b9150612afc8284612ace565b60208201915081905092915050565b6000612b1a6020840184611aca565b905092915050565b612b2b81611aa1565b82525050565b6000612b406020840184611b00565b905092915050565b612b5181611adf565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612b8357612b82612b61565b5b83810192508235915060208301925067ffffffffffffffff821115612bab57612baa612b57565b5b600182023603831315612bc157612bc0612b5c565b5b509250929050565b600082825260208201905092915050565b6000612be68385612bc9565b9350612bf3838584611d3f565b612bfc83611a01565b840190509392505050565b60006101608301612c1b6000840184612b0b565b612c286000860182612b22565b50612c366020840184612b31565b612c436020860182612b48565b50612c516040840184612b66565b8583036040870152612c64838284612bda565b92505050612c756060840184612b66565b8583036060870152612c88838284612bda565b92505050612c996080840184612b31565b612ca66080860182612b48565b50612cb460a0840184612b31565b612cc160a0860182612b48565b50612ccf60c0840184612b31565b612cdc60c0860182612b48565b50612cea60e0840184612b31565b612cf760e0860182612b48565b50612d06610100840184612b31565b612d14610100860182612b48565b50612d23610120840184612b66565b858303610120870152612d37838284612bda565b92505050612d49610140840184612b66565b858303610140870152612d5d838284612bda565b925050508091505092915050565b60006060820190508181036000830152612d858186612c07565b9050612d94602083018561265a565b612da16040830184611edb565b949350505050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000612ddf6018836119c6565b9150612dea82612da9565b602082019050919050565b60006020820190508181036000830152612e0e81612dd2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000612e4b601f836119c6565b9150612e5682612e15565b602082019050919050565b60006020820190508181036000830152612e7a81612e3e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000612edd6022836119c6565b9150612ee882612e81565b604082019050919050565b60006020820190508181036000830152612f0c81612ed0565b9050919050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000612f49600283612a6d565b9150612f5482612f13565b600282019050919050565b6000612f6a82612f3c565b9150612f768285612ace565b602082019150612f868284612ace565b6020820191508190509392505050565b600060ff82169050919050565b612fac81612f96565b82525050565b6000608082019050612fc7600083018761265a565b612fd46020830186612fa3565b612fe1604083018561265a565b612fee606083018461265a565b95945050505050565b600060a08201905061300c600083018861265a565b613019602083018761265a565b613026604083018661265a565b6130336060830185611edb565b6130406080830184611f82565b969550505050505056fea264697066735822122032ca1cf88a7b31318141bd230c1cabd5f99c4503ed694966da441ea9decb738c64736f6c63430008120033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrumGoerli/ZeroDevSessionKeyPlugin.json b/deployments/arbitrumGoerli/ZeroDevSessionKeyPlugin.json new file mode 100644 index 00000000..ed4e31bf --- /dev/null +++ b/deployments/arbitrumGoerli/ZeroDevSessionKeyPlugin.json @@ -0,0 +1,201 @@ +{ + "address": "0x6E2631aF80bF7a9cEE83F590eE496bCc2E40626D", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "key", + "type": "address" + } + ], + "name": "SessionKeyRevoked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_packed", + "type": "bytes" + } + ], + "name": "parseDataAndSignature", + "outputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revokeSessionKey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revoked", + "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": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "missingAccountFunds", + "type": "uint256" + } + ], + "name": "validatePluginData", + "outputs": [ + { + "internalType": "bool", + "name": "validated", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9a7b87919aff70c4cdc91ec0708265a63355bdbf540a7e6766bdbbb78146654b", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x8d8a9Cf53b7D95C148cB159384D249F8FB68db3f", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "39811357", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd4aa92397d61ce20898ef1878581f6e2fc2edce824b6a4fec65bd824b9b0872e", + "transactionHash": "0x9a7b87919aff70c4cdc91ec0708265a63355bdbf540a7e6766bdbbb78146654b", + "logs": [], + "blockNumber": 18851208, + "cumulativeGasUsed": "39811357", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"key\",\"type\":\"address\"}],\"name\":\"SessionKeyRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_packed\",\"type\":\"bytes\"}],\"name\":\"parseDataAndSignature\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revokeSessionKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revoked\",\"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\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"missingAccountFunds\",\"type\":\"uint256\"}],\"name\":\"validatePluginData\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"validated\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/plugin/ZeroDevSessionKeyPlugin.sol\":\"ZeroDevSessionKeyPlugin\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Tree proofs.\\n *\\n * The tree and the proofs can be generated using our\\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\\n * You will find a quickstart guide in the readme.\\n *\\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\\n * hashing, or use a hash function other than keccak256 for hashing leaves.\\n * This is because the concatenation of a sorted pair of internal nodes in\\n * the merkle tree could be reinterpreted as a leaf value.\\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\\n * against this attack out of the box.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {verify}\\n *\\n * _Available since v4.7._\\n */\\n function verifyCalldata(\\n bytes32[] calldata proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProofCalldata(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Calldata version of {processProof}\\n *\\n * _Available since v4.7._\\n */\\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerify(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProof(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {multiProofVerify}\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerifyCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\\n * respectively.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProof(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n /**\\n * @dev Calldata version of {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProofCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd466e8b07f4c6220eac16da5127f3ff142e65f0c15c03c7d38f257b02c8585e1\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/plugin/ZeroDevBasePlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport \\\"./IPlugin.sol\\\";\\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n override\\n returns (bool validated)\\n {\\n // data offset starts at 97\\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\\n validated = _validatePluginData(userOp, userOpHash, data, signature);\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal virtual returns (bool success);\\n\\n function parseDataAndSignature(bytes calldata _packed)\\n public\\n pure\\n returns (bytes calldata data, bytes calldata signature)\\n {\\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\\n\\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \\\"invalid data\\\");\\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \\\"invalid signature\\\");\\n }\\n}\\n\",\"keccak256\":\"0x600b768ba7d0766b2968c0d9bd6cd21154f14694eeb1e1a745d110d0fcb854e8\",\"license\":\"MIT\"},\"src/plugin/ZeroDevSessionKeyPlugin.sol\":{\"content\":\"//SPDX-License-Identifier: GPL\\npragma solidity ^0.8.7;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./ZeroDevBasePlugin.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\\\";\\nusing ECDSA for bytes32;\\n/**\\n * Main EIP4337 module.\\n * Called (through the fallback module) using \\\"delegate\\\" from the GnosisSafe as an \\\"IAccount\\\",\\n * so must implement validateUserOp\\n * holds an immutable reference to the EntryPoint\\n */\\n\\nstruct ZeroDevSessionKeyStorageStruct {\\n mapping(address => bool) revoked;\\n}\\n\\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\\n // return value in case of signature failure, with no time-range.\\n // equivalent to packSigTimeRange(true,0,0);\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n event SessionKeyRevoked(address indexed key);\\n\\n constructor() EIP712(\\\"ZeroDevSessionKeyPlugin\\\", \\\"0.0.1\\\") {}\\n\\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\\n bytes32 position = bytes32(uint256(keccak256(\\\"zero-dev.account.eip4337.sessionkey\\\")) - 1);\\n assembly {\\n s.slot := position\\n }\\n }\\n\\n // revoke session key\\n function revokeSessionKey(address _key) external {\\n getPolicyStorage().revoked[_key] = true;\\n emit SessionKeyRevoked(_key);\\n }\\n\\n function revoked(address _key) external view returns (bool) {\\n return getPolicyStorage().revoked[_key];\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal view override returns (bool) {\\n address sessionKey = address(bytes20(data[0:20]));\\n require(!getPolicyStorage().revoked[sessionKey], \\\"session key revoked\\\");\\n bytes32 merkleRoot = bytes32(data[20:52]);\\n if(merkleRoot == bytes32(0)) {\\n // means this session key has sudo permission\\n signature = signature[33:98];\\n } else {\\n uint8 leafLength = uint8(signature[0]);\\n bytes32[] memory proof;\\n bytes32 leaf;\\n if(leafLength == 20) {\\n leaf = keccak256(signature[1:21]);\\n proof = abi.decode(signature[86:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n signature = signature[21:86];\\n } else if(leafLength == 24) {\\n leaf = keccak256(signature[1:25]);\\n proof = abi.decode(signature[90:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\\n require(keccak256(sig) == keccak256(signature[21:25]));\\n signature = signature[25:90];\\n }\\n require(MerkleProof.verify(proof, merkleRoot, leaf), \\\"invalide merkle root\\\");\\n }\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\\"Session(bytes32 userOpHash,uint256 nonce)\\\"), // we are going to trust plugin for verification\\n userOpHash,\\n userOp.nonce\\n )\\n )\\n );\\n address recovered = digest.recover(signature);\\n require(recovered == sessionKey, \\\"account: invalid signature\\\");\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x7463f6b16e3dacf9d618a25e7cb6e12e210ff96682051c62d5a5d6e9243adb30\",\"license\":\"GPL\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b506040518060400160405280601781526020017f5a65726f44657653657373696f6e4b6579506c7567696e0000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a08181525050620000e88184846200013760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050506200024b565b6000838383463060405160200162000154959493929190620001ee565b6040516020818303038152906040528051906020012090509392505050565b6000819050919050565b620001888162000173565b82525050565b6000819050919050565b620001a3816200018e565b82525050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001d682620001a9565b9050919050565b620001e881620001c9565b82525050565b600060a0820190506200020560008301886200017d565b6200021460208301876200017d565b6200022360408301866200017d565b62000232606083018562000198565b620002416080830184620001dd565b9695505050505050565b60805160a05160c05160e0516101005161012051611e016200029b6000396000610bac01526000610bee01526000610bcd01526000610b0201526000610b5801526000610b810152611e016000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/arbitrumGoerli/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json b/deployments/arbitrumGoerli/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json new file mode 100644 index 00000000..d5d6537f --- /dev/null +++ b/deployments/arbitrumGoerli/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json @@ -0,0 +1,129 @@ +{ + "language": "Solidity", + "sources": { + "lib/account-abstraction/contracts/core/EntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n\nimport \"../interfaces/IAccount.sol\";\nimport \"../interfaces/IPaymaster.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\n\nimport \"../utils/Exec.sol\";\nimport \"./StakeManager.sol\";\nimport \"./SenderCreator.sol\";\nimport \"./Helpers.sol\";\nimport \"./NonceManager.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\n\n using UserOperationLib for UserOperation;\n\n SenderCreator private immutable senderCreator = new SenderCreator();\n\n // internal value used during simulation: need to query aggregator.\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\n\n // marker for inner call revert on out of gas\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\n\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\n\n /**\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\n * in case of signature failure, instead of revert.\n */\n uint256 public constant SIG_VALIDATION_FAILED = 1;\n\n /**\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\n * @param beneficiary the address to receive the fees\n * @param amount amount to transfer.\n */\n function _compensate(address payable beneficiary, uint256 amount) internal {\n require(beneficiary != address(0), \"AA90 invalid beneficiary\");\n (bool success,) = beneficiary.call{value : amount}(\"\");\n require(success, \"AA91 failed send to beneficiary\");\n }\n\n /**\n * execute a user op\n * @param opIndex index into the opInfo array\n * @param userOp the userOp to execute\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\n * @return collected the total amount this userOp paid.\n */\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\n uint256 preGas = gasleft();\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\n\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\n collected = _actualGasCost;\n } catch {\n bytes32 innerRevertCode;\n assembly {\n returndatacopy(0, 0, 32)\n innerRevertCode := mload(0)\n }\n // handleOps was called with gas limit too low. abort entire bundle.\n if (innerRevertCode == INNER_OUT_OF_GAS) {\n //report paymaster, since if it is not deliberately caused by the bundler,\n // it must be a revert caused by paymaster.\n revert FailedOp(opIndex, \"AA95 out of gas\");\n }\n\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\n }\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\n\n uint256 opslen = ops.length;\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\n\n unchecked {\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[i];\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\n }\n\n uint256 collected = 0;\n emit BeforeExecution();\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(i, ops[i], opInfos[i]);\n }\n\n _compensate(beneficiary, collected);\n } //unchecked\n }\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 ) public nonReentrant {\n\n uint256 opasLen = opsPerAggregator.length;\n uint256 totalOps = 0;\n for (uint256 i = 0; i < opasLen; i++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n //address(1) is special marker of \"signature error\"\n require(address(aggregator) != address(1), \"AA96 invalid aggregator\");\n\n if (address(aggregator) != address(0)) {\n // solhint-disable-next-line no-empty-blocks\n try aggregator.validateSignatures(ops, opa.signature) {}\n catch {\n revert SignatureValidationFailed(address(aggregator));\n }\n }\n\n totalOps += ops.length;\n }\n\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\n\n emit BeforeExecution();\n\n uint256 opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n uint256 opslen = ops.length;\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[opIndex];\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\n opIndex++;\n }\n }\n\n uint256 collected = 0;\n opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n emit SignatureAggregatorChanged(address(opa.aggregator));\n UserOperation[] calldata ops = opa.userOps;\n uint256 opslen = ops.length;\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\n opIndex++;\n }\n }\n emit SignatureAggregatorChanged(address(0));\n\n _compensate(beneficiary, collected);\n }\n\n /// @inheritdoc IEntryPoint\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\n\n UserOpInfo memory opInfo;\n _simulationOnlyValidations(op);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n\n numberMarker();\n uint256 paid = _executeUserOp(0, op, opInfo);\n numberMarker();\n bool targetSuccess;\n bytes memory targetResult;\n if (target != address(0)) {\n (targetSuccess, targetResult) = target.call(targetCallData);\n }\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\n }\n\n\n // A memory copy of UserOp static fields only.\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\n struct MemoryUserOp {\n address sender;\n uint256 nonce;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n address paymaster;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n }\n\n struct UserOpInfo {\n MemoryUserOp mUserOp;\n bytes32 userOpHash;\n uint256 prefund;\n uint256 contextOffset;\n uint256 preOpGas;\n }\n\n /**\n * inner function to handle a UserOperation.\n * Must be declared \"external\" to open a call context, but it can only be called by handleOps.\n */\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n require(msg.sender == address(this), \"AA92 internal call only\");\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n\n uint callGasLimit = mUserOp.callGasLimit;\n unchecked {\n // handleOps was called with gas limit too low. abort entire bundle.\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\n assembly {\n mstore(0, INNER_OUT_OF_GAS)\n revert(0, 32)\n }\n }\n }\n\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\n if (callData.length > 0) {\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\n if (!success) {\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\n if (result.length > 0) {\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\n }\n mode = IPaymaster.PostOpMode.opReverted;\n }\n }\n\n unchecked {\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\n return _handlePostOp(0, mode, opInfo, context, actualGas);\n }\n }\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\n }\n\n /**\n * copy general fields from userOp into the memory opInfo structure.\n */\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\n mUserOp.sender = userOp.sender;\n mUserOp.nonce = userOp.nonce;\n mUserOp.callGasLimit = userOp.callGasLimit;\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\n mUserOp.preVerificationGas = userOp.preVerificationGas;\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes calldata paymasterAndData = userOp.paymasterAndData;\n if (paymasterAndData.length > 0) {\n require(paymasterAndData.length >= 20, \"AA93 invalid paymasterAndData\");\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\n } else {\n mUserOp.paymaster = address(0);\n }\n }\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external {\n UserOpInfo memory outOpInfo;\n\n _simulationOnlyValidations(userOp);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\n StakeInfo memory factoryInfo;\n {\n bytes calldata initCode = userOp.initCode;\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\n factoryInfo = _getStakeInfo(factory);\n }\n\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n address aggregator = data.aggregator;\n bool sigFailed = aggregator == address(1);\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\n\n if (aggregator != address(0) && aggregator != address(1)) {\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\n }\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\n\n }\n\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\n unchecked {\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\n // our security model might call postOp eventually twice\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\n\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\n }\n }\n\n // create the sender's contract if needed.\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\n if (initCode.length != 0) {\n address sender = opInfo.mUserOp.sender;\n if (sender.code.length != 0) revert FailedOp(opIndex, \"AA10 sender already constructed\");\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\n if (sender1 == address(0)) revert FailedOp(opIndex, \"AA13 initCode failed or OOG\");\n if (sender1 != sender) revert FailedOp(opIndex, \"AA14 initCode must return sender\");\n if (sender1.code.length == 0) revert FailedOp(opIndex, \"AA15 initCode must create sender\");\n address factory = address(bytes20(initCode[0 : 20]));\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\n }\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 calldata initCode) public {\n address sender = senderCreator.createSender(initCode);\n revert SenderAddressResult(sender);\n }\n\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\n // solhint-disable-next-line no-empty-blocks\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\n catch Error(string memory revertReason) {\n if (bytes(revertReason).length != 0) {\n revert FailedOp(0, revertReason);\n }\n }\n }\n\n /**\n * Called only during simulation.\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\n */\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\n if (initCode.length == 0 && sender.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA20 account not deployed\");\n }\n if (paymasterAndData.length >= 20) {\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\n if (paymaster.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA30 paymaster not deployed\");\n }\n }\n // always revert\n revert(\"\");\n }\n\n /**\n * call account.validateUserOp.\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\n * decrement account's deposit if needed\n */\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\n unchecked {\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n address sender = mUserOp.sender;\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\n address paymaster = mUserOp.paymaster;\n numberMarker();\n uint256 missingAccountFunds = 0;\n if (paymaster == address(0)) {\n uint256 bal = balanceOf(sender);\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\n }\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\n returns (uint256 _validationData) {\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA23 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA23 reverted (or OOG)\");\n }\n if (paymaster == address(0)) {\n DepositInfo storage senderInfo = deposits[sender];\n uint256 deposit = senderInfo.deposit;\n if (requiredPrefund > deposit) {\n revert FailedOp(opIndex, \"AA21 didn't pay prefund\");\n }\n senderInfo.deposit = uint112(deposit - requiredPrefund);\n }\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\n }\n }\n\n /**\n * In case the request has a paymaster:\n * Validate paymaster has enough deposit.\n * Call paymaster.validatePaymasterUserOp.\n * Revert with proper FailedOp in case paymaster reverts.\n * Decrement paymaster's deposit\n */\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\n internal returns (bytes memory context, uint256 validationData) {\n unchecked {\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \"AA41 too little verificationGas\");\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\n\n address paymaster = mUserOp.paymaster;\n DepositInfo storage paymasterInfo = deposits[paymaster];\n uint256 deposit = paymasterInfo.deposit;\n if (deposit < requiredPreFund) {\n revert FailedOp(opIndex, \"AA31 paymaster deposit too low\");\n }\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\n context = _context;\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA33 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA33 reverted (or OOG)\");\n }\n }\n }\n\n /**\n * revert if either account validationData or paymaster validationData is expired\n */\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\n if (expectedAggregator != aggregator) {\n revert FailedOp(opIndex, \"AA24 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA22 expired or not due\");\n }\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\n address pmAggregator;\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\n if (pmAggregator != address(0)) {\n revert FailedOp(opIndex, \"AA34 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA32 paymaster expired or not due\");\n }\n }\n\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\n if (validationData == 0) {\n return (address(0), false);\n }\n ValidationData memory data = _parseValidationData(validationData);\n // solhint-disable-next-line not-rely-on-time\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\n aggregator = data.aggregator;\n }\n\n /**\n * validate account and paymaster (if defined).\n * also make sure total validation doesn't exceed verificationGasLimit\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\n * @param opIndex the index of this userOp into the \"opInfos\" array\n * @param userOp the userOp to validate\n */\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\n private returns (uint256 validationData, uint256 paymasterValidationData) {\n\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\n _copyUserOpToMemory(userOp, mUserOp);\n outOpInfo.userOpHash = getUserOpHash(userOp);\n\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\n // and multiplied without causing overflow\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\n require(maxGasValues <= type(uint120).max, \"AA94 gas values overflow\");\n\n uint256 gasUsedByValidateAccountPrepayment;\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\n\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\n revert FailedOp(opIndex, \"AA25 invalid account nonce\");\n }\n\n //a \"marker\" where account opcode validation is done and paymaster opcode validation is about to start\n // (used only by off-chain simulateValidation)\n numberMarker();\n\n bytes memory context;\n if (mUserOp.paymaster != address(0)) {\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\n }\n unchecked {\n uint256 gasUsed = preGas - gasleft();\n\n if (userOp.verificationGasLimit < gasUsed) {\n revert FailedOp(opIndex, \"AA40 over verificationGasLimit\");\n }\n outOpInfo.prefund = requiredPreFund;\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\n }\n }\n\n /**\n * process post-operation.\n * called just after the callData is executed.\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\n * @param opIndex index in the batch\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\n * @param opInfo userOp fields and info collected during validation\n * @param context the context returned in validatePaymasterUserOp\n * @param actualGas the gas used so far by this user operation\n */\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n unchecked {\n address refundAddress;\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\n\n address paymaster = mUserOp.paymaster;\n if (paymaster == address(0)) {\n refundAddress = mUserOp.sender;\n } else {\n refundAddress = paymaster;\n if (context.length > 0) {\n actualGasCost = actualGas * gasPrice;\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\n } else {\n // solhint-disable-next-line no-empty-blocks\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\n catch Error(string memory reason) {\n revert FailedOp(opIndex, string.concat(\"AA50 postOp reverted: \", reason));\n }\n catch {\n revert FailedOp(opIndex, \"AA50 postOp revert\");\n }\n }\n }\n }\n actualGas += preGas - gasleft();\n actualGasCost = actualGas * gasPrice;\n if (opInfo.prefund < actualGasCost) {\n revert FailedOp(opIndex, \"AA51 prefund below actualGasCost\");\n }\n uint256 refund = opInfo.prefund - actualGasCost;\n _incrementDeposit(refundAddress, refund);\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\n } // unchecked\n }\n\n /**\n * the gas price this UserOp agrees to pay.\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\n */\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\n assembly {offset := data}\n }\n\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\n assembly {data := offset}\n }\n\n //place the NUMBER opcode in the code.\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\n // account and paymaster.\n function numberMarker() internal view {\n assembly {mstore(0, number())}\n }\n}\n\n" + }, + "lib/account-abstraction/contracts/core/Helpers.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n * address(1) - the account failed to validate the signature.\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\n struct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n }\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n// intersect account and paymaster ranges.\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\n ValidationData memory accountValidationData = _parseValidationData(validationData);\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n address aggregator = accountValidationData.aggregator;\n if (aggregator == address(0)) {\n aggregator = pmValidationData.aggregator;\n }\n uint48 validAfter = accountValidationData.validAfter;\n uint48 validUntil = accountValidationData.validUntil;\n uint48 pmValidAfter = pmValidationData.validAfter;\n uint48 pmValidUntil = pmValidationData.validUntil;\n\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n }\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n }\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n\n" + }, + "lib/account-abstraction/contracts/core/NonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IEntryPoint.sol\";\n\n/**\n * nonce management functionality\n */\ncontract NonceManager is INonceManager {\n\n /**\n * The next valid sequence number for a given nonce key.\n */\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\n\n function getNonce(address sender, uint192 key)\n public view override returns (uint256 nonce) {\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\n }\n\n // allow an account to manually increment its own nonce.\n // (mainly so that during construction nonce can be made non-zero,\n // to \"absorb\" the gas cost of first nonce increment to 1st transaction (construction),\n // not to 2nd transaction)\n function incrementNonce(uint192 key) public override {\n nonceSequenceNumber[msg.sender][key]++;\n }\n\n /**\n * validate nonce uniqueness for this account.\n * called just after validateUserOp()\n */\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\n\n uint192 key = uint192(nonce >> 64);\n uint64 seq = uint64(nonce);\n return nonceSequenceNumber[sender][key]++ == seq;\n }\n\n}\n" + }, + "lib/account-abstraction/contracts/core/SenderCreator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/**\n * helper contract for EntryPoint, to call userOp.initCode from a \"neutral\" address,\n * which is explicitly not the entryPoint itself.\n */\ncontract SenderCreator {\n\n /**\n * call the \"initCode\" factory to create and return the sender account address\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\n * @return sender the returned address of the created account, or zero address on failure.\n */\n function createSender(bytes calldata initCode) external returns (address sender) {\n address factory = address(bytes20(initCode[0 : 20]));\n bytes memory initCallData = initCode[20 :];\n bool success;\n /* solhint-disable no-inline-assembly */\n assembly {\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\n sender := mload(0)\n }\n if (!success) {\n sender = address(0);\n }\n }\n}\n" + }, + "lib/account-abstraction/contracts/core/StakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IStakeManager.sol\";\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable not-rely-on-time */\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by a paymaster.\n */\nabstract contract StakeManager is IStakeManager {\n\n /// maps paymaster to their deposits and stakes\n mapping(address => DepositInfo) public deposits;\n\n /// @inheritdoc IStakeManager\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\n return deposits[account];\n }\n\n // internal method to return just the stake info\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\n DepositInfo storage depositInfo = deposits[addr];\n info.stake = depositInfo.stake;\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\n }\n\n /// return the deposit (for gas payment) of the account\n function balanceOf(address account) public view returns (uint256) {\n return deposits[account].deposit;\n }\n\n receive() external payable {\n depositTo(msg.sender);\n }\n\n function _incrementDeposit(address account, uint256 amount) internal {\n DepositInfo storage info = deposits[account];\n uint256 newAmount = info.deposit + amount;\n require(newAmount <= type(uint112).max, \"deposit overflow\");\n info.deposit = uint112(newAmount);\n }\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) public payable {\n _incrementDeposit(account, msg.value);\n DepositInfo storage info = deposits[account];\n emit Deposited(account, info.deposit);\n }\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 unstakeDelaySec) public payable {\n DepositInfo storage info = deposits[msg.sender];\n require(unstakeDelaySec > 0, \"must specify unstake delay\");\n require(unstakeDelaySec >= info.unstakeDelaySec, \"cannot decrease unstake time\");\n uint256 stake = info.stake + msg.value;\n require(stake > 0, \"no stake specified\");\n require(stake <= type(uint112).max, \"stake overflow\");\n deposits[msg.sender] = DepositInfo(\n info.deposit,\n true,\n uint112(stake),\n unstakeDelaySec,\n 0\n );\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\n }\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external {\n DepositInfo storage info = deposits[msg.sender];\n require(info.unstakeDelaySec != 0, \"not staked\");\n require(info.staked, \"already unstaking\");\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\n info.withdrawTime = withdrawTime;\n info.staked = false;\n emit StakeUnlocked(msg.sender, withdrawTime);\n }\n\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external {\n DepositInfo storage info = deposits[msg.sender];\n uint256 stake = info.stake;\n require(stake > 0, \"No stake to withdraw\");\n require(info.withdrawTime > 0, \"must call unlockStake() first\");\n require(info.withdrawTime <= block.timestamp, \"Stake withdrawal is not due\");\n info.unstakeDelaySec = 0;\n info.withdrawTime = 0;\n info.stake = 0;\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\n (bool success,) = withdrawAddress.call{value : stake}(\"\");\n require(success, \"failed to withdraw stake\");\n }\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\n DepositInfo storage info = deposits[msg.sender];\n require(withdrawAmount <= info.deposit, \"Withdraw amount too large\");\n info.deposit = uint112(info.deposit - withdrawAmount);\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\"\");\n require(success, \"failed to withdraw\");\n }\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAccount.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\ninterface IAccount {\n\n /**\n * Validate user's signature and nonce\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\n * This allows making a \"simulation call\" without a valid signature\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\n *\n * @dev Must validate caller is the entryPoint.\n * Must validate the signature and nonce\n * @param userOp the operation that is about to be executed.\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\n * The excess is left as a deposit in the entrypoint, for future calls.\n * can be withdrawn anytime using \"entryPoint.withdrawTo()\"\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external returns (uint256 validationData);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAggregator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n\n /**\n * validate aggregated signature.\n * revert if the aggregated signature does not match the given list of operations.\n */\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\n\n /**\n * validate signature of a single userOp\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n * @param userOp the userOperation received from the user.\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\n * (usually empty, unless account and aggregator support some kind of \"multisig\"\n */\n function validateUserOpSignature(UserOperation calldata userOp)\n external view returns (bytes memory sigForUserOp);\n\n /**\n * aggregate multiple signatures into a single value.\n * This method is called off-chain to calculate the signature to pass with handleOps()\n * bundler MAY use optimized custom code perform this aggregation\n * @param userOps array of UserOperations to collect the signatures from.\n * @return aggregatedSignature the aggregated signature\n */\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IEntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./UserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\n\n /***\n * An event emitted after each successful request\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\n * @param sender - the account that generates this request.\n * @param paymaster - if non-null, the paymaster that pays for this request.\n * @param nonce - the nonce value from the request.\n * @param success - true if the sender transaction succeeded, false if reverted.\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\n */\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\n\n /**\n * account \"sender\" was deployed.\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\n * @param sender the account that is deployed\n * @param factory the factory used to deploy this account (in the initCode)\n * @param paymaster the paymaster used by this UserOp\n */\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\n\n /**\n * An event emitted if the UserOperation \"callData\" reverted with non-zero length\n * @param userOpHash the request unique identifier.\n * @param sender the sender of this request\n * @param nonce the nonce used in the request\n * @param revertReason - the return bytes from the (reverted) call to \"callData\".\n */\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\n\n /**\n * an event emitted by handleOps(), before starting the execution loop.\n * any event emitted before this event, is part of the validation.\n */\n event BeforeExecution();\n\n /**\n * signature aggregator used by the following UserOperationEvents within this bundle.\n */\n event SignatureAggregatorChanged(address indexed aggregator);\n\n /**\n * a custom revert error of handleOps, to identify the offending op.\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\n * @param reason - revert reason\n * The string starts with a unique code \"AAmn\", where \"m\" is \"1\" for factory, \"2\" for account and \"3\" for paymaster issues,\n * so a failure can be attributed to the correct entity.\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\n */\n error FailedOp(uint256 opIndex, string reason);\n\n /**\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\n */\n error SignatureValidationFailed(address aggregator);\n\n /**\n * Successful result from simulateValidation.\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n */\n error ValidationResult(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\n\n /**\n * Successful result from simulateValidation, if the account returns a signature aggregator\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\n * bundler MUST use it to verify the signature, or reject the UserOperation\n */\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\n AggregatorStakeInfo aggregatorInfo);\n\n /**\n * return value of getSenderAddress\n */\n error SenderAddressResult(address sender);\n\n /**\n * return value of simulateHandleOp\n */\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\n\n //UserOps handled, per aggregator\n struct UserOpsPerAggregator {\n UserOperation[] userOps;\n\n // aggregator address\n IAggregator aggregator;\n // aggregated signature\n bytes signature;\n }\n\n /**\n * Execute a batch of UserOperation.\n * no signature aggregator is used.\n * if any account requires an aggregator (that is, it returned an aggregator when\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\n * @param ops the operations to execute\n * @param beneficiary the address to receive the fees\n */\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\n\n /**\n * Execute a batch of UserOperation with Aggregators\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\n * @param beneficiary the address to receive the fees\n */\n function handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n ) external;\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external;\n\n /**\n * gas and return values during simulation\n * @param preOpGas the gas used for validation (including preValidationGas)\n * @param prefund the required prefund for this operation\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\n */\n struct ReturnInfo {\n uint256 preOpGas;\n uint256 prefund;\n bool sigFailed;\n uint48 validAfter;\n uint48 validUntil;\n bytes paymasterContext;\n }\n\n /**\n * returned aggregated signature info.\n * the aggregator returned by the account, and its current stake.\n */\n struct AggregatorStakeInfo {\n address aggregator;\n StakeInfo stakeInfo;\n }\n\n /**\n * Get counterfactual sender address.\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n * this method always revert, and returns the address in SenderAddressResult error\n * @param initCode the constructor code to be passed into the UserOperation.\n */\n function getSenderAddress(bytes memory initCode) external;\n\n\n /**\n * simulate full execution of a UserOperation (including both validation and target execution)\n * this method will always revert with \"ExecutionResult\".\n * it performs full validation of the UserOperation, but ignores signature error.\n * an optional target address is called after the userop succeeds, and its value is returned\n * (before the entire call is reverted)\n * Note that in order to collect the the success/failure of the target call, it must be executed\n * with trace enabled to track the emitted events.\n * @param op the UserOperation to simulate\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\n * are set to the return from that call.\n * @param targetCallData callData to pass to target address\n */\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\n}\n\n" + }, + "lib/account-abstraction/contracts/interfaces/INonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\ninterface INonceManager {\n\n /**\n * Return the next nonce for this sender.\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\n * But UserOp with different keys can come with arbitrary order.\n *\n * @param sender the account address\n * @param key the high 192 bit of the nonce\n * @return nonce a full nonce to pass for next UserOp with this sender.\n */\n function getNonce(address sender, uint192 key)\n external view returns (uint256 nonce);\n\n /**\n * Manually increment the nonce of the sender.\n * This method is exposed just for completeness..\n * Account does NOT need to call it, neither during validation, nor elsewhere,\n * as the EntryPoint will update the nonce regardless.\n * Possible use-case is call it with various keys to \"initialize\" their nonces to one, so that future\n * UserOperations will not pay extra for the first transaction with a given key.\n */\n function incrementNonce(uint192 key) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IPaymaster.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\n */\ninterface IPaymaster {\n\n enum PostOpMode {\n opSucceeded, // user op succeeded\n opReverted, // user op reverted. still has to pay for gas.\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\n }\n\n /**\n * payment validation: check if paymaster agrees to pay.\n * Must verify sender is the entryPoint.\n * Revert to reject this request.\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\n * @param userOp the user operation\n * @param userOpHash hash of the user's request data.\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\n * @return context value to send to a postOp\n * zero length to signify postOp is not required.\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n external returns (bytes memory context, uint256 validationData);\n\n /**\n * post-operation handler.\n * Must verify sender is the entryPoint\n * @param mode enum with the following options:\n * opSucceeded - user operation succeeded.\n * opReverted - user op reverted. still has to pay for gas.\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\n * Now this is the 2nd call, after user's op was deliberately reverted.\n * @param context - the context value returned by validatePaymasterUserOp\n * @param actualGasCost - actual gas used so far (without this postOp call).\n */\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IStakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n\n event Deposited(\n address indexed account,\n uint256 totalDeposit\n );\n\n event Withdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /// Emitted when stake or unstake delay are modified\n event StakeLocked(\n address indexed account,\n uint256 totalStaked,\n uint256 unstakeDelaySec\n );\n\n /// Emitted once a stake is scheduled for withdrawal\n event StakeUnlocked(\n address indexed account,\n uint256 withdrawTime\n );\n\n event StakeWithdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /**\n * @param deposit the entity's deposit\n * @param staked true if this entity is staked.\n * @param stake actual amount of ether staked for this entity.\n * @param unstakeDelaySec minimum delay to withdraw the stake.\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\n * and the rest fit into a 2nd cell.\n * 112 bit allows for 10^15 eth\n * 48 bit for full timestamp\n * 32 bit allows 150 years for unstake delay\n */\n struct DepositInfo {\n uint112 deposit;\n bool staked;\n uint112 stake;\n uint32 unstakeDelaySec;\n uint48 withdrawTime;\n }\n\n //API struct used by getStakeInfo and simulateValidation\n struct StakeInfo {\n uint256 stake;\n uint256 unstakeDelaySec;\n }\n\n /// @return info - full deposit information of given account\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\n\n /// @return the deposit (for gas payment) of the account\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) external payable;\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 _unstakeDelaySec) external payable;\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external;\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external;\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/UserOperation.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\nimport {calldataKeccak} from \"../core/Helpers.sol\";\n\n/**\n * User Operation struct\n * @param sender the sender account of this request.\n * @param nonce unique value the sender uses to verify it is not a replay.\n * @param initCode if set, the account contract will be created by this constructor/\n * @param callData the method call to execute on this account.\n * @param callGasLimit the gas limit passed to the callData method call.\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\n * @param maxFeePerGas same as EIP-1559 gas parameter.\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n */\n struct UserOperation {\n\n address sender;\n uint256 nonce;\n bytes initCode;\n bytes callData;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n bytes paymasterAndData;\n bytes signature;\n }\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\n address data;\n //read sender from userOp, which is first userOp member (saves 800 gas...)\n assembly {data := calldataload(userOp)}\n return address(uint160(data));\n }\n\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\n // pay above what he signed for.\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\n address sender = getSender(userOp);\n uint256 nonce = userOp.nonce;\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n bytes32 hashCallData = calldataKeccak(userOp.callData);\n uint256 callGasLimit = userOp.callGasLimit;\n uint256 verificationGasLimit = userOp.verificationGasLimit;\n uint256 preVerificationGas = userOp.preVerificationGas;\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n return abi.encode(\n sender, nonce,\n hashInitCode, hashCallData,\n callGasLimit, verificationGasLimit, preVerificationGas,\n maxFeePerGas, maxPriorityFeePerGas,\n hashPaymasterAndData\n );\n }\n\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\n return keccak256(pack(userOp));\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n}\n" + }, + "lib/account-abstraction/contracts/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n\n function call(\n address to,\n uint256 value,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function staticcall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal view returns (bool success) {\n assembly {\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function delegateCall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n // get returned data from last call or calldelegate\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n assembly {\n let len := returndatasize()\n if gt(len, maxLen) {\n len := maxLen\n }\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n // revert with explicit byte array (probably reverted info from call)\n function revertWithData(bytes memory returnData) internal pure {\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\n bool success = call(to,0,data,gasleft());\n if (!success) {\n revertWithData(getReturnData(maxLen));\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Create2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts 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 * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\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 _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\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 bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n * respectively.\n *\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "src/abstract/Compatibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Compatibility {\n receive() external payable {}\n\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\n external\n pure\n returns (bytes4)\n {\n return this.onERC1155BatchReceived.selector;\n }\n\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "src/abstract/KernelStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\n\nstruct WalletKernelStorage {\n address owner;\n}\n\ncontract KernelStorage {\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n IEntryPoint public immutable entryPoint;\n\n event Upgraded(address indexed newImplementation);\n\n // modifier for checking if the sender is the entrypoint or\n // the account itself\n modifier onlyFromEntryPointOrOwnerOrSelf() {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\n \"account: not from entrypoint or owner or self\"\n );\n _;\n }\n\n constructor(IEntryPoint _entryPoint) {\n entryPoint = _entryPoint;\n getKernelStorage().owner = address(1);\n }\n /// @notice get wallet kernel storage\n /// @dev used to get wallet kernel storage\n /// @return ws wallet kernel storage, consists of owner and nonces\n\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\n bytes32 storagePosition = bytes32(uint256(keccak256(\"zerodev.kernel\")) - 1);\n assembly {\n ws.slot := storagePosition\n }\n }\n\n function getOwner() external view returns (address) {\n return getKernelStorage().owner;\n }\n\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n assembly {\n sstore(slot, _newImplementation)\n }\n emit Upgraded(_newImplementation);\n }\n\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\n getKernelStorage().owner = _newOwner;\n }\n\n function getNonce() public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), 0);\n }\n\n function getNonce(uint192 key) public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), key);\n }\n}\n " + }, + "src/factory/EIP1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract EIP1967Proxy {\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n constructor(address _logic, bytes memory _data) payable {\n require(_logic != address(0), \"EIP1967Proxy: implementation is the zero address\");\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n sstore(slot, _logic)\n }\n if (_data.length > 0) {\n (bool success,) = _logic.delegatecall(_data);\n require(success, \"EIP1967Proxy: constructor call failed\");\n }\n }\n\n fallback() external payable {\n address implementation = _implementation();\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 { revert(0, returndatasize()) }\n default { return(0, returndatasize()) }\n }\n }\n\n function _implementation() internal view returns (address impl) {\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n impl := sload(slot)\n }\n }\n}\n" + }, + "src/Kernel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"./plugin/IPlugin.sol\";\nimport \"account-abstraction/core/Helpers.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport {EntryPoint} from \"account-abstraction/core/EntryPoint.sol\";\nimport \"./utils/Exec.sol\";\nimport \"./abstract/Compatibility.sol\";\nimport \"./abstract/KernelStorage.sol\";\n\n/// @title Kernel\n/// @author taek\n/// @notice wallet kernel for minimal wallet functionality\n/// @dev supports only 1 owner, multiple plugins\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\n error InvalidNonce();\n error InvalidSignatureLength();\n error QueryResult(bytes result);\n\n string public constant name = \"Kernel\";\n\n string public constant version = \"0.0.1\";\n\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\n\n /// @notice initialize wallet kernel\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\n /// @param _owner owner address\n function initialize(address _owner) external {\n WalletKernelStorage storage ws = getKernelStorage();\n require(ws.owner == address(0), \"account: already initialized\");\n ws.owner = _owner;\n }\n\n /// @notice Query plugin for data\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\n /// @param _plugin Plugin address\n /// @param _data Data to query\n function queryPlugin(address _plugin, bytes calldata _data) external {\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\n if (success) {\n revert QueryResult(_ret);\n } else {\n assembly {\n revert(add(_ret, 32), mload(_ret))\n }\n }\n }\n\n /// @notice execute function call to external contract\n /// @dev this function will execute function call to external contract\n /// @param to target contract address\n /// @param value value to be sent\n /// @param data data to be sent\n /// @param operation operation type (call or delegatecall)\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\n \"account: not from entrypoint or owner\"\n );\n bool success;\n bytes memory ret;\n if (operation == Operation.DelegateCall) {\n (success, ret) = Exec.delegateCall(to, data);\n } else {\n (success, ret) = Exec.call(to, value, data);\n }\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n }\n\n /// @notice validate user operation\n /// @dev this function will validate user operation and be called by EntryPoint\n /// @param userOp user operation\n /// @param userOpHash user operation hash\n /// @param missingAccountFunds funds needed to be reimbursed\n /// @return validationData validation data\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (uint256 validationData)\n {\n require(msg.sender == address(entryPoint), \"account: not from entryPoint\");\n if (userOp.signature.length == 65) {\n validationData = _validateUserOp(userOp, userOpHash);\n } else if (userOp.signature.length > 97) {\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\n address plugin = address(bytes20(userOp.signature[0:20]));\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\n bytes memory signature = userOp.signature[32:97];\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\n \"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\"\n ), // we are going to trust plugin for verification\n plugin,\n validUntil,\n validAfter,\n keccak256(data)\n )\n )\n );\n\n address signer = ECDSA.recover(digest, signature);\n if (getKernelStorage().owner != signer) {\n return SIG_VALIDATION_FAILED;\n }\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\n bool res = abi.decode(ret, (bool));\n if (!res) {\n return SIG_VALIDATION_FAILED;\n }\n validationData = _packValidationData(!res, validUntil, validAfter);\n } else {\n revert InvalidSignatureLength();\n }\n if (missingAccountFunds > 0) {\n // we are going to assume signature is valid at this point\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\"\");\n (success);\n return validationData;\n }\n }\n\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\n internal\n view\n returns (uint256 validationData)\n {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\n return validationData;\n }\n\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\n address recovered = ECDSA.recover(hash, userOp.signature);\n if (ws.owner != recovered) {\n return SIG_VALIDATION_FAILED;\n }\n }\n\n /**\n * delegate the contract call to the plugin\n */\n function _delegateToPlugin(\n address plugin,\n UserOperation calldata userOp,\n bytes32 opHash,\n uint256 missingAccountFunds\n ) internal returns (bytes memory) {\n bytes memory data =\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n return ret;\n }\n\n /// @notice validate signature using eip1271\n /// @dev this function will validate signature using eip1271\n /// @param _hash hash to be signed\n /// @param _signature signature\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\n return 0x1626ba7e;\n }\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\n address recovered = ECDSA.recover(hash, _signature);\n // Validate signatures\n if (ws.owner == recovered) {\n return 0x1626ba7e;\n } else {\n return 0xffffffff;\n }\n }\n}\n" + }, + "src/KernelFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/Create2.sol\";\nimport \"./factory/EIP1967Proxy.sol\";\nimport \"./Kernel.sol\";\n\ncontract KernelFactory {\n Kernel public immutable kernelTemplate;\n\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\n\n constructor(IEntryPoint _entryPoint) {\n kernelTemplate = new Kernel(_entryPoint);\n }\n\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n address addr = Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n if (addr.code.length > 0) {\n return EIP1967Proxy(payable(addr));\n }\n proxy =\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\n emit AccountCreated(address(proxy), _owner, _index);\n }\n\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n return Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n }\n}\n" + }, + "src/plugin/IPlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/UserOperation.sol\";\n\ninterface IPlugin {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (bool);\n}\n" + }, + "src/plugin/ZeroDevBasePlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport \"./IPlugin.sol\";\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n override\n returns (bool validated)\n {\n // data offset starts at 97\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\n validated = _validatePluginData(userOp, userOpHash, data, signature);\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal virtual returns (bool success);\n\n function parseDataAndSignature(bytes calldata _packed)\n public\n pure\n returns (bytes calldata data, bytes calldata signature)\n {\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\n\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \"invalid data\");\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \"invalid signature\");\n }\n}\n" + }, + "src/plugin/ZeroDevSessionKeyPlugin.sol": { + "content": "//SPDX-License-Identifier: GPL\npragma solidity ^0.8.7;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./ZeroDevBasePlugin.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\";\nusing ECDSA for bytes32;\n/**\n * Main EIP4337 module.\n * Called (through the fallback module) using \"delegate\" from the GnosisSafe as an \"IAccount\",\n * so must implement validateUserOp\n * holds an immutable reference to the EntryPoint\n */\n\nstruct ZeroDevSessionKeyStorageStruct {\n mapping(address => bool) revoked;\n}\n\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\n // return value in case of signature failure, with no time-range.\n // equivalent to packSigTimeRange(true,0,0);\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n event SessionKeyRevoked(address indexed key);\n\n constructor() EIP712(\"ZeroDevSessionKeyPlugin\", \"0.0.1\") {}\n\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\n bytes32 position = bytes32(uint256(keccak256(\"zero-dev.account.eip4337.sessionkey\")) - 1);\n assembly {\n s.slot := position\n }\n }\n\n // revoke session key\n function revokeSessionKey(address _key) external {\n getPolicyStorage().revoked[_key] = true;\n emit SessionKeyRevoked(_key);\n }\n\n function revoked(address _key) external view returns (bool) {\n return getPolicyStorage().revoked[_key];\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal view override returns (bool) {\n address sessionKey = address(bytes20(data[0:20]));\n require(!getPolicyStorage().revoked[sessionKey], \"session key revoked\");\n bytes32 merkleRoot = bytes32(data[20:52]);\n if(merkleRoot == bytes32(0)) {\n // means this session key has sudo permission\n signature = signature[33:98];\n } else {\n uint8 leafLength = uint8(signature[0]);\n bytes32[] memory proof;\n bytes32 leaf;\n if(leafLength == 20) {\n leaf = keccak256(signature[1:21]);\n proof = abi.decode(signature[86:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n signature = signature[21:86];\n } else if(leafLength == 24) {\n leaf = keccak256(signature[1:25]);\n proof = abi.decode(signature[90:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\n require(keccak256(sig) == keccak256(signature[21:25]));\n signature = signature[25:90];\n }\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"invalide merkle root\");\n }\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\"Session(bytes32 userOpHash,uint256 nonce)\"), // we are going to trust plugin for verification\n userOpHash,\n userOp.nonce\n )\n )\n );\n address recovered = digest.recover(signature);\n require(recovered == sessionKey, \"account: invalid signature\");\n return true;\n }\n}\n" + }, + "src/test/TestCounter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\ncontract TestCounter {\n uint256 public counter;\n function increment() public {\n counter += 1;\n }\n}" + }, + "src/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\nenum Operation {\n Call,\n DelegateCall\n}\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n function call(address to, uint256 value, bytes memory data)\n internal\n returns (bool success, bytes memory returnData)\n {\n assembly {\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\n assembly {\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\n assembly {\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "@openzeppelin/=lib/openzeppelin-contracts/", + "account-abstraction/=lib/account-abstraction/contracts/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "openzeppelin-contracts/=lib/openzeppelin-contracts/" + ] + } +} \ No newline at end of file diff --git a/deployments/baseGoerli/.chainId b/deployments/baseGoerli/.chainId new file mode 100644 index 00000000..9b24bf02 --- /dev/null +++ b/deployments/baseGoerli/.chainId @@ -0,0 +1 @@ +84531 \ No newline at end of file diff --git a/deployments/baseGoerli/KernelFactory.json b/deployments/baseGoerli/KernelFactory.json new file mode 100644 index 00000000..23570846 --- /dev/null +++ b/deployments/baseGoerli/KernelFactory.json @@ -0,0 +1,140 @@ +{ + "address": "0x4E4946298614FC299B50c947289F4aD0572CB9ce", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "AccountCreated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "createAccount", + "outputs": [ + { + "internalType": "contract EIP1967Proxy", + "name": "proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getAccountAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kernelTemplate", + "outputs": [ + { + "internalType": "contract Kernel", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x2ac80db42e6ee74d6cac152f55aa787d79908e5332d195abe991233916edba05", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x8d8a9Cf53b7D95C148cB159384D249F8FB68db3f", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "3645194", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7500b674e126c4c2d8945a378d89fe28c70ec9c617ee663b2cc2eb75c2e6b112", + "transactionHash": "0x2ac80db42e6ee74d6cac152f55aa787d79908e5332d195abe991233916edba05", + "logs": [], + "blockNumber": 4035724, + "cumulativeGasUsed": "3853626", + "status": 1, + "byzantium": true + }, + "args": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" + ], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IEntryPoint\",\"name\":\"_entryPoint\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"AccountCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"createAccount\",\"outputs\":[{\"internalType\":\"contract EIP1967Proxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getAccountAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kernelTemplate\",\"outputs\":[{\"internalType\":\"contract Kernel\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/KernelFactory.sol\":\"KernelFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/EntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n\\nimport \\\"../interfaces/IAccount.sol\\\";\\nimport \\\"../interfaces/IPaymaster.sol\\\";\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\nimport \\\"../utils/Exec.sol\\\";\\nimport \\\"./StakeManager.sol\\\";\\nimport \\\"./SenderCreator.sol\\\";\\nimport \\\"./Helpers.sol\\\";\\nimport \\\"./NonceManager.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\n\\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\\n\\n using UserOperationLib for UserOperation;\\n\\n SenderCreator private immutable senderCreator = new SenderCreator();\\n\\n // internal value used during simulation: need to query aggregator.\\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\\n\\n // marker for inner call revert on out of gas\\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\\n\\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\\n\\n /**\\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\\n * in case of signature failure, instead of revert.\\n */\\n uint256 public constant SIG_VALIDATION_FAILED = 1;\\n\\n /**\\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\\n * @param beneficiary the address to receive the fees\\n * @param amount amount to transfer.\\n */\\n function _compensate(address payable beneficiary, uint256 amount) internal {\\n require(beneficiary != address(0), \\\"AA90 invalid beneficiary\\\");\\n (bool success,) = beneficiary.call{value : amount}(\\\"\\\");\\n require(success, \\\"AA91 failed send to beneficiary\\\");\\n }\\n\\n /**\\n * execute a user op\\n * @param opIndex index into the opInfo array\\n * @param userOp the userOp to execute\\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\\n * @return collected the total amount this userOp paid.\\n */\\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\\n uint256 preGas = gasleft();\\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\\n\\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\\n collected = _actualGasCost;\\n } catch {\\n bytes32 innerRevertCode;\\n assembly {\\n returndatacopy(0, 0, 32)\\n innerRevertCode := mload(0)\\n }\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (innerRevertCode == INNER_OUT_OF_GAS) {\\n //report paymaster, since if it is not deliberately caused by the bundler,\\n // it must be a revert caused by paymaster.\\n revert FailedOp(opIndex, \\\"AA95 out of gas\\\");\\n }\\n\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\\n }\\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\\n\\n uint256 opslen = ops.length;\\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\\n\\n unchecked {\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[i];\\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\\n }\\n\\n uint256 collected = 0;\\n emit BeforeExecution();\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(i, ops[i], opInfos[i]);\\n }\\n\\n _compensate(beneficiary, collected);\\n } //unchecked\\n }\\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 ) public nonReentrant {\\n\\n uint256 opasLen = opsPerAggregator.length;\\n uint256 totalOps = 0;\\n for (uint256 i = 0; i < opasLen; i++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n //address(1) is special marker of \\\"signature error\\\"\\n require(address(aggregator) != address(1), \\\"AA96 invalid aggregator\\\");\\n\\n if (address(aggregator) != address(0)) {\\n // solhint-disable-next-line no-empty-blocks\\n try aggregator.validateSignatures(ops, opa.signature) {}\\n catch {\\n revert SignatureValidationFailed(address(aggregator));\\n }\\n }\\n\\n totalOps += ops.length;\\n }\\n\\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\\n\\n emit BeforeExecution();\\n\\n uint256 opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n uint256 opslen = ops.length;\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[opIndex];\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\\n opIndex++;\\n }\\n }\\n\\n uint256 collected = 0;\\n opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n emit SignatureAggregatorChanged(address(opa.aggregator));\\n UserOperation[] calldata ops = opa.userOps;\\n uint256 opslen = ops.length;\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\\n opIndex++;\\n }\\n }\\n emit SignatureAggregatorChanged(address(0));\\n\\n _compensate(beneficiary, collected);\\n }\\n\\n /// @inheritdoc IEntryPoint\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\\n\\n UserOpInfo memory opInfo;\\n _simulationOnlyValidations(op);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n\\n numberMarker();\\n uint256 paid = _executeUserOp(0, op, opInfo);\\n numberMarker();\\n bool targetSuccess;\\n bytes memory targetResult;\\n if (target != address(0)) {\\n (targetSuccess, targetResult) = target.call(targetCallData);\\n }\\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\\n }\\n\\n\\n // A memory copy of UserOp static fields only.\\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\\n struct MemoryUserOp {\\n address sender;\\n uint256 nonce;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n address paymaster;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n }\\n\\n struct UserOpInfo {\\n MemoryUserOp mUserOp;\\n bytes32 userOpHash;\\n uint256 prefund;\\n uint256 contextOffset;\\n uint256 preOpGas;\\n }\\n\\n /**\\n * inner function to handle a UserOperation.\\n * Must be declared \\\"external\\\" to open a call context, but it can only be called by handleOps.\\n */\\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n require(msg.sender == address(this), \\\"AA92 internal call only\\\");\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n\\n uint callGasLimit = mUserOp.callGasLimit;\\n unchecked {\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\\n assembly {\\n mstore(0, INNER_OUT_OF_GAS)\\n revert(0, 32)\\n }\\n }\\n }\\n\\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\\n if (callData.length > 0) {\\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\\n if (!success) {\\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\\n if (result.length > 0) {\\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\\n }\\n mode = IPaymaster.PostOpMode.opReverted;\\n }\\n }\\n\\n unchecked {\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\\n return _handlePostOp(0, mode, opInfo, context, actualGas);\\n }\\n }\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\\n }\\n\\n /**\\n * copy general fields from userOp into the memory opInfo structure.\\n */\\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\\n mUserOp.sender = userOp.sender;\\n mUserOp.nonce = userOp.nonce;\\n mUserOp.callGasLimit = userOp.callGasLimit;\\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\\n mUserOp.preVerificationGas = userOp.preVerificationGas;\\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes calldata paymasterAndData = userOp.paymasterAndData;\\n if (paymasterAndData.length > 0) {\\n require(paymasterAndData.length >= 20, \\\"AA93 invalid paymasterAndData\\\");\\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\\n } else {\\n mUserOp.paymaster = address(0);\\n }\\n }\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external {\\n UserOpInfo memory outOpInfo;\\n\\n _simulationOnlyValidations(userOp);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\\n StakeInfo memory factoryInfo;\\n {\\n bytes calldata initCode = userOp.initCode;\\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\\n factoryInfo = _getStakeInfo(factory);\\n }\\n\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n address aggregator = data.aggregator;\\n bool sigFailed = aggregator == address(1);\\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\\n\\n if (aggregator != address(0) && aggregator != address(1)) {\\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\\n }\\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\\n\\n }\\n\\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\\n unchecked {\\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\\n // our security model might call postOp eventually twice\\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\\n\\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\\n }\\n }\\n\\n // create the sender's contract if needed.\\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\\n if (initCode.length != 0) {\\n address sender = opInfo.mUserOp.sender;\\n if (sender.code.length != 0) revert FailedOp(opIndex, \\\"AA10 sender already constructed\\\");\\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\\n if (sender1 == address(0)) revert FailedOp(opIndex, \\\"AA13 initCode failed or OOG\\\");\\n if (sender1 != sender) revert FailedOp(opIndex, \\\"AA14 initCode must return sender\\\");\\n if (sender1.code.length == 0) revert FailedOp(opIndex, \\\"AA15 initCode must create sender\\\");\\n address factory = address(bytes20(initCode[0 : 20]));\\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\\n }\\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 calldata initCode) public {\\n address sender = senderCreator.createSender(initCode);\\n revert SenderAddressResult(sender);\\n }\\n\\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\\n // solhint-disable-next-line no-empty-blocks\\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\\n catch Error(string memory revertReason) {\\n if (bytes(revertReason).length != 0) {\\n revert FailedOp(0, revertReason);\\n }\\n }\\n }\\n\\n /**\\n * Called only during simulation.\\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\\n */\\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\\n if (initCode.length == 0 && sender.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA20 account not deployed\\\");\\n }\\n if (paymasterAndData.length >= 20) {\\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\\n if (paymaster.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA30 paymaster not deployed\\\");\\n }\\n }\\n // always revert\\n revert(\\\"\\\");\\n }\\n\\n /**\\n * call account.validateUserOp.\\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\\n * decrement account's deposit if needed\\n */\\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\\n unchecked {\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n address sender = mUserOp.sender;\\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\\n address paymaster = mUserOp.paymaster;\\n numberMarker();\\n uint256 missingAccountFunds = 0;\\n if (paymaster == address(0)) {\\n uint256 bal = balanceOf(sender);\\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\\n }\\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\\n returns (uint256 _validationData) {\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA23 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA23 reverted (or OOG)\\\");\\n }\\n if (paymaster == address(0)) {\\n DepositInfo storage senderInfo = deposits[sender];\\n uint256 deposit = senderInfo.deposit;\\n if (requiredPrefund > deposit) {\\n revert FailedOp(opIndex, \\\"AA21 didn't pay prefund\\\");\\n }\\n senderInfo.deposit = uint112(deposit - requiredPrefund);\\n }\\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\\n }\\n }\\n\\n /**\\n * In case the request has a paymaster:\\n * Validate paymaster has enough deposit.\\n * Call paymaster.validatePaymasterUserOp.\\n * Revert with proper FailedOp in case paymaster reverts.\\n * Decrement paymaster's deposit\\n */\\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\\n internal returns (bytes memory context, uint256 validationData) {\\n unchecked {\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \\\"AA41 too little verificationGas\\\");\\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\\n\\n address paymaster = mUserOp.paymaster;\\n DepositInfo storage paymasterInfo = deposits[paymaster];\\n uint256 deposit = paymasterInfo.deposit;\\n if (deposit < requiredPreFund) {\\n revert FailedOp(opIndex, \\\"AA31 paymaster deposit too low\\\");\\n }\\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\\n context = _context;\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA33 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA33 reverted (or OOG)\\\");\\n }\\n }\\n }\\n\\n /**\\n * revert if either account validationData or paymaster validationData is expired\\n */\\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\\n if (expectedAggregator != aggregator) {\\n revert FailedOp(opIndex, \\\"AA24 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA22 expired or not due\\\");\\n }\\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\\n address pmAggregator;\\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\\n if (pmAggregator != address(0)) {\\n revert FailedOp(opIndex, \\\"AA34 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA32 paymaster expired or not due\\\");\\n }\\n }\\n\\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\\n if (validationData == 0) {\\n return (address(0), false);\\n }\\n ValidationData memory data = _parseValidationData(validationData);\\n // solhint-disable-next-line not-rely-on-time\\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\\n aggregator = data.aggregator;\\n }\\n\\n /**\\n * validate account and paymaster (if defined).\\n * also make sure total validation doesn't exceed verificationGasLimit\\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\\n * @param opIndex the index of this userOp into the \\\"opInfos\\\" array\\n * @param userOp the userOp to validate\\n */\\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\\n private returns (uint256 validationData, uint256 paymasterValidationData) {\\n\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\\n _copyUserOpToMemory(userOp, mUserOp);\\n outOpInfo.userOpHash = getUserOpHash(userOp);\\n\\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\\n // and multiplied without causing overflow\\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\\n require(maxGasValues <= type(uint120).max, \\\"AA94 gas values overflow\\\");\\n\\n uint256 gasUsedByValidateAccountPrepayment;\\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\\n\\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\\n revert FailedOp(opIndex, \\\"AA25 invalid account nonce\\\");\\n }\\n\\n //a \\\"marker\\\" where account opcode validation is done and paymaster opcode validation is about to start\\n // (used only by off-chain simulateValidation)\\n numberMarker();\\n\\n bytes memory context;\\n if (mUserOp.paymaster != address(0)) {\\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\\n }\\n unchecked {\\n uint256 gasUsed = preGas - gasleft();\\n\\n if (userOp.verificationGasLimit < gasUsed) {\\n revert FailedOp(opIndex, \\\"AA40 over verificationGasLimit\\\");\\n }\\n outOpInfo.prefund = requiredPreFund;\\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\\n }\\n }\\n\\n /**\\n * process post-operation.\\n * called just after the callData is executed.\\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\\n * @param opIndex index in the batch\\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\\n * @param opInfo userOp fields and info collected during validation\\n * @param context the context returned in validatePaymasterUserOp\\n * @param actualGas the gas used so far by this user operation\\n */\\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n unchecked {\\n address refundAddress;\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\\n\\n address paymaster = mUserOp.paymaster;\\n if (paymaster == address(0)) {\\n refundAddress = mUserOp.sender;\\n } else {\\n refundAddress = paymaster;\\n if (context.length > 0) {\\n actualGasCost = actualGas * gasPrice;\\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\\n } else {\\n // solhint-disable-next-line no-empty-blocks\\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\\n catch Error(string memory reason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA50 postOp reverted: \\\", reason));\\n }\\n catch {\\n revert FailedOp(opIndex, \\\"AA50 postOp revert\\\");\\n }\\n }\\n }\\n }\\n actualGas += preGas - gasleft();\\n actualGasCost = actualGas * gasPrice;\\n if (opInfo.prefund < actualGasCost) {\\n revert FailedOp(opIndex, \\\"AA51 prefund below actualGasCost\\\");\\n }\\n uint256 refund = opInfo.prefund - actualGasCost;\\n _incrementDeposit(refundAddress, refund);\\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\\n } // unchecked\\n }\\n\\n /**\\n * the gas price this UserOp agrees to pay.\\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n */\\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\\n assembly {offset := data}\\n }\\n\\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\\n assembly {data := offset}\\n }\\n\\n //place the NUMBER opcode in the code.\\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\\n // account and paymaster.\\n function numberMarker() internal view {\\n assembly {mstore(0, number())}\\n }\\n}\\n\\n\",\"keccak256\":\"0x04f86318b47f052d7308795ffae6ecec0d023d2458b4e17751b89a0e4acfcdc6\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/NonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\n/**\\n * nonce management functionality\\n */\\ncontract NonceManager is INonceManager {\\n\\n /**\\n * The next valid sequence number for a given nonce key.\\n */\\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\\n\\n function getNonce(address sender, uint192 key)\\n public view override returns (uint256 nonce) {\\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\\n }\\n\\n // allow an account to manually increment its own nonce.\\n // (mainly so that during construction nonce can be made non-zero,\\n // to \\\"absorb\\\" the gas cost of first nonce increment to 1st transaction (construction),\\n // not to 2nd transaction)\\n function incrementNonce(uint192 key) public override {\\n nonceSequenceNumber[msg.sender][key]++;\\n }\\n\\n /**\\n * validate nonce uniqueness for this account.\\n * called just after validateUserOp()\\n */\\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\\n\\n uint192 key = uint192(nonce >> 64);\\n uint64 seq = uint64(nonce);\\n return nonceSequenceNumber[sender][key]++ == seq;\\n }\\n\\n}\\n\",\"keccak256\":\"0xa17a4a6fde70088ab18ffe6df830f3efa31f1cd0e1a7160336c96e3c94984d25\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/SenderCreator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/**\\n * helper contract for EntryPoint, to call userOp.initCode from a \\\"neutral\\\" address,\\n * which is explicitly not the entryPoint itself.\\n */\\ncontract SenderCreator {\\n\\n /**\\n * call the \\\"initCode\\\" factory to create and return the sender account address\\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\\n * @return sender the returned address of the created account, or zero address on failure.\\n */\\n function createSender(bytes calldata initCode) external returns (address sender) {\\n address factory = address(bytes20(initCode[0 : 20]));\\n bytes memory initCallData = initCode[20 :];\\n bool success;\\n /* solhint-disable no-inline-assembly */\\n assembly {\\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\\n sender := mload(0)\\n }\\n if (!success) {\\n sender = address(0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x44b9449fec82d6cdfb01d52fdd5a72f90099c651316123810cf9633f00b018c2\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/StakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IStakeManager.sol\\\";\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable not-rely-on-time */\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by a paymaster.\\n */\\nabstract contract StakeManager is IStakeManager {\\n\\n /// maps paymaster to their deposits and stakes\\n mapping(address => DepositInfo) public deposits;\\n\\n /// @inheritdoc IStakeManager\\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\\n return deposits[account];\\n }\\n\\n // internal method to return just the stake info\\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\\n DepositInfo storage depositInfo = deposits[addr];\\n info.stake = depositInfo.stake;\\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\\n }\\n\\n /// return the deposit (for gas payment) of the account\\n function balanceOf(address account) public view returns (uint256) {\\n return deposits[account].deposit;\\n }\\n\\n receive() external payable {\\n depositTo(msg.sender);\\n }\\n\\n function _incrementDeposit(address account, uint256 amount) internal {\\n DepositInfo storage info = deposits[account];\\n uint256 newAmount = info.deposit + amount;\\n require(newAmount <= type(uint112).max, \\\"deposit overflow\\\");\\n info.deposit = uint112(newAmount);\\n }\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) public payable {\\n _incrementDeposit(account, msg.value);\\n DepositInfo storage info = deposits[account];\\n emit Deposited(account, info.deposit);\\n }\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 unstakeDelaySec) public payable {\\n DepositInfo storage info = deposits[msg.sender];\\n require(unstakeDelaySec > 0, \\\"must specify unstake delay\\\");\\n require(unstakeDelaySec >= info.unstakeDelaySec, \\\"cannot decrease unstake time\\\");\\n uint256 stake = info.stake + msg.value;\\n require(stake > 0, \\\"no stake specified\\\");\\n require(stake <= type(uint112).max, \\\"stake overflow\\\");\\n deposits[msg.sender] = DepositInfo(\\n info.deposit,\\n true,\\n uint112(stake),\\n unstakeDelaySec,\\n 0\\n );\\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\\n }\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(info.unstakeDelaySec != 0, \\\"not staked\\\");\\n require(info.staked, \\\"already unstaking\\\");\\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\\n info.withdrawTime = withdrawTime;\\n info.staked = false;\\n emit StakeUnlocked(msg.sender, withdrawTime);\\n }\\n\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external {\\n DepositInfo storage info = deposits[msg.sender];\\n uint256 stake = info.stake;\\n require(stake > 0, \\\"No stake to withdraw\\\");\\n require(info.withdrawTime > 0, \\\"must call unlockStake() first\\\");\\n require(info.withdrawTime <= block.timestamp, \\\"Stake withdrawal is not due\\\");\\n info.unstakeDelaySec = 0;\\n info.withdrawTime = 0;\\n info.stake = 0;\\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\\n (bool success,) = withdrawAddress.call{value : stake}(\\\"\\\");\\n require(success, \\\"failed to withdraw stake\\\");\\n }\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(withdrawAmount <= info.deposit, \\\"Withdraw amount too large\\\");\\n info.deposit = uint112(info.deposit - withdrawAmount);\\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\\\"\\\");\\n require(success, \\\"failed to withdraw\\\");\\n }\\n}\\n\",\"keccak256\":\"0x21aa0956382bd000b1b8c3b1d19ca6ebcd6c9029eebb19c612fb38ee5dd2430a\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IPaymaster.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\\n */\\ninterface IPaymaster {\\n\\n enum PostOpMode {\\n opSucceeded, // user op succeeded\\n opReverted, // user op reverted. still has to pay for gas.\\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\\n }\\n\\n /**\\n * payment validation: check if paymaster agrees to pay.\\n * Must verify sender is the entryPoint.\\n * Revert to reject this request.\\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\\n * @param userOp the user operation\\n * @param userOpHash hash of the user's request data.\\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\\n * @return context value to send to a postOp\\n * zero length to signify postOp is not required.\\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\\n external returns (bytes memory context, uint256 validationData);\\n\\n /**\\n * post-operation handler.\\n * Must verify sender is the entryPoint\\n * @param mode enum with the following options:\\n * opSucceeded - user operation succeeded.\\n * opReverted - user op reverted. still has to pay for gas.\\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\\n * Now this is the 2nd call, after user's op was deliberately reverted.\\n * @param context - the context value returned by validatePaymasterUserOp\\n * @param actualGasCost - actual gas used so far (without this postOp call).\\n */\\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\\n}\\n\",\"keccak256\":\"0x36858ba8685024974f533530420688da3454d29996ebc42e410673a1ed2ec456\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n\\n function call(\\n address to,\\n uint256 value,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function staticcall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal view returns (bool success) {\\n assembly {\\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function delegateCall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n // get returned data from last call or calldelegate\\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\\n assembly {\\n let len := returndatasize()\\n if gt(len, maxLen) {\\n len := maxLen\\n }\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n // revert with explicit byte array (probably reverted info from call)\\n function revertWithData(bytes memory returnData) internal pure {\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n\\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\\n bool success = call(to,0,data,gasleft());\\n if (!success) {\\n revertWithData(getReturnData(maxLen));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b232117afbc2939f3ffc92745614867e9e1d475a3e1e5443adae13c200174f1\",\"license\":\"LGPL-3.0-only\"},\"lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x190dd6f8d592b7e4e930feb7f4313aeb8e1c4ad3154c27ce1cf6a512fc30d8cc\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(\\n uint256 amount,\\n bytes32 salt,\\n bytes memory bytecode\\n ) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(\\n bytes32 salt,\\n bytes32 bytecodeHash,\\n address deployer\\n ) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xafc07f37809f74d9c66d6461cc0f85fb5147ab855acd0acc30af4b2272130c61\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/Kernel.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"./plugin/IPlugin.sol\\\";\\nimport \\\"account-abstraction/core/Helpers.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport {EntryPoint} from \\\"account-abstraction/core/EntryPoint.sol\\\";\\nimport \\\"./utils/Exec.sol\\\";\\nimport \\\"./abstract/Compatibility.sol\\\";\\nimport \\\"./abstract/KernelStorage.sol\\\";\\n\\n/// @title Kernel\\n/// @author taek\\n/// @notice wallet kernel for minimal wallet functionality\\n/// @dev supports only 1 owner, multiple plugins\\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\\n error InvalidNonce();\\n error InvalidSignatureLength();\\n error QueryResult(bytes result);\\n\\n string public constant name = \\\"Kernel\\\";\\n\\n string public constant version = \\\"0.0.1\\\";\\n\\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\\n\\n /// @notice initialize wallet kernel\\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\\n /// @param _owner owner address\\n function initialize(address _owner) external {\\n WalletKernelStorage storage ws = getKernelStorage();\\n require(ws.owner == address(0), \\\"account: already initialized\\\");\\n ws.owner = _owner;\\n }\\n\\n /// @notice Query plugin for data\\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\\n /// @param _plugin Plugin address\\n /// @param _data Data to query\\n function queryPlugin(address _plugin, bytes calldata _data) external {\\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\\n if (success) {\\n revert QueryResult(_ret);\\n } else {\\n assembly {\\n revert(add(_ret, 32), mload(_ret))\\n }\\n }\\n }\\n\\n /// @notice execute function call to external contract\\n /// @dev this function will execute function call to external contract\\n /// @param to target contract address\\n /// @param value value to be sent\\n /// @param data data to be sent\\n /// @param operation operation type (call or delegatecall)\\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\\n \\\"account: not from entrypoint or owner\\\"\\n );\\n bool success;\\n bytes memory ret;\\n if (operation == Operation.DelegateCall) {\\n (success, ret) = Exec.delegateCall(to, data);\\n } else {\\n (success, ret) = Exec.call(to, value, data);\\n }\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n }\\n\\n /// @notice validate user operation\\n /// @dev this function will validate user operation and be called by EntryPoint\\n /// @param userOp user operation\\n /// @param userOpHash user operation hash\\n /// @param missingAccountFunds funds needed to be reimbursed\\n /// @return validationData validation data\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (uint256 validationData)\\n {\\n require(msg.sender == address(entryPoint), \\\"account: not from entryPoint\\\");\\n if (userOp.signature.length == 65) {\\n validationData = _validateUserOp(userOp, userOpHash);\\n } else if (userOp.signature.length > 97) {\\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\\n address plugin = address(bytes20(userOp.signature[0:20]));\\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\\n bytes memory signature = userOp.signature[32:97];\\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\\\"\\n ), // we are going to trust plugin for verification\\n plugin,\\n validUntil,\\n validAfter,\\n keccak256(data)\\n )\\n )\\n );\\n\\n address signer = ECDSA.recover(digest, signature);\\n if (getKernelStorage().owner != signer) {\\n return SIG_VALIDATION_FAILED;\\n }\\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\\n bool res = abi.decode(ret, (bool));\\n if (!res) {\\n return SIG_VALIDATION_FAILED;\\n }\\n validationData = _packValidationData(!res, validUntil, validAfter);\\n } else {\\n revert InvalidSignatureLength();\\n }\\n if (missingAccountFunds > 0) {\\n // we are going to assume signature is valid at this point\\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\\\"\\\");\\n (success);\\n return validationData;\\n }\\n }\\n\\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\\n internal\\n view\\n returns (uint256 validationData)\\n {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\\n return validationData;\\n }\\n\\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\\n address recovered = ECDSA.recover(hash, userOp.signature);\\n if (ws.owner != recovered) {\\n return SIG_VALIDATION_FAILED;\\n }\\n }\\n\\n /**\\n * delegate the contract call to the plugin\\n */\\n function _delegateToPlugin(\\n address plugin,\\n UserOperation calldata userOp,\\n bytes32 opHash,\\n uint256 missingAccountFunds\\n ) internal returns (bytes memory) {\\n bytes memory data =\\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n return ret;\\n }\\n\\n /// @notice validate signature using eip1271\\n /// @dev this function will validate signature using eip1271\\n /// @param _hash hash to be signed\\n /// @param _signature signature\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\\n return 0x1626ba7e;\\n }\\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\\n address recovered = ECDSA.recover(hash, _signature);\\n // Validate signatures\\n if (ws.owner == recovered) {\\n return 0x1626ba7e;\\n } else {\\n return 0xffffffff;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xee1651f7212298696da5a773709d0a33ee272ae8c06e31824655e71a2228ae25\",\"license\":\"MIT\"},\"src/KernelFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/Create2.sol\\\";\\nimport \\\"./factory/EIP1967Proxy.sol\\\";\\nimport \\\"./Kernel.sol\\\";\\n\\ncontract KernelFactory {\\n Kernel public immutable kernelTemplate;\\n\\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\\n\\n constructor(IEntryPoint _entryPoint) {\\n kernelTemplate = new Kernel(_entryPoint);\\n }\\n\\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n address addr = Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n if (addr.code.length > 0) {\\n return EIP1967Proxy(payable(addr));\\n }\\n proxy =\\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\\n emit AccountCreated(address(proxy), _owner, _index);\\n }\\n\\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n return Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x53a5dbafaf7d000de850be785d4c2d883980acf1772d231b510c122640ccf789\",\"license\":\"MIT\"},\"src/abstract/Compatibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract Compatibility {\\n receive() external payable {}\\n\\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n\\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\\n external\\n pure\\n returns (bytes4)\\n {\\n return this.onERC1155BatchReceived.selector;\\n }\\n\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\\n}\\n\",\"keccak256\":\"0x0d4634886db9ce6c2321db3a9bbbe0883cffe654cbce75dcfc9df1ec7eedb0b8\",\"license\":\"MIT\"},\"src/abstract/KernelStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\n\\nstruct WalletKernelStorage {\\n address owner;\\n}\\n\\ncontract KernelStorage {\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n IEntryPoint public immutable entryPoint;\\n\\n event Upgraded(address indexed newImplementation);\\n\\n // modifier for checking if the sender is the entrypoint or\\n // the account itself\\n modifier onlyFromEntryPointOrOwnerOrSelf() {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\\n \\\"account: not from entrypoint or owner or self\\\"\\n );\\n _;\\n }\\n\\n constructor(IEntryPoint _entryPoint) {\\n entryPoint = _entryPoint;\\n getKernelStorage().owner = address(1);\\n }\\n /// @notice get wallet kernel storage\\n /// @dev used to get wallet kernel storage\\n /// @return ws wallet kernel storage, consists of owner and nonces\\n\\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\\n bytes32 storagePosition = bytes32(uint256(keccak256(\\\"zerodev.kernel\\\")) - 1);\\n assembly {\\n ws.slot := storagePosition\\n }\\n }\\n\\n function getOwner() external view returns (address) {\\n return getKernelStorage().owner;\\n }\\n\\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n assembly {\\n sstore(slot, _newImplementation)\\n }\\n emit Upgraded(_newImplementation);\\n }\\n\\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\\n getKernelStorage().owner = _newOwner;\\n }\\n\\n function getNonce() public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), 0);\\n }\\n\\n function getNonce(uint192 key) public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), key);\\n }\\n}\\n \",\"keccak256\":\"0xe4512794b67794cf90eba665aee57b75efa60f2aacd1cc45eb17d3f3b255008c\",\"license\":\"MIT\"},\"src/factory/EIP1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ncontract EIP1967Proxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n constructor(address _logic, bytes memory _data) payable {\\n require(_logic != address(0), \\\"EIP1967Proxy: implementation is the zero address\\\");\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n sstore(slot, _logic)\\n }\\n if (_data.length > 0) {\\n (bool success,) = _logic.delegatecall(_data);\\n require(success, \\\"EIP1967Proxy: constructor call failed\\\");\\n }\\n }\\n\\n fallback() external payable {\\n address implementation = _implementation();\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n function _implementation() internal view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xbec8942c8258db6379a08dcb3b0a4aa0ee585972f26eba258c35ece87972d78b\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\nenum Operation {\\n Call,\\n DelegateCall\\n}\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n function call(address to, uint256 value, bytes memory data)\\n internal\\n returns (bool success, bytes memory returnData)\\n {\\n assembly {\\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\\n assembly {\\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\\n assembly {\\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1eef311d5073ff7f02b44311ae4d5c53f619ea19f1a059b8d17c028d141c2893\",\"license\":\"LGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b506040516200466d3803806200466d833981810160405281019062000037919062000136565b806040516200004690620000aa565b620000529190620001d3565b604051809103906000f0801580156200006f573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505050620001f0565b613527806200114683390190565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000ea82620000bd565b9050919050565b6000620000fe82620000dd565b9050919050565b6200011081620000f1565b81146200011c57600080fd5b50565b600081519050620001308162000105565b92915050565b6000602082840312156200014f576200014e620000b8565b5b60006200015f848285016200011f565b91505092915050565b6000819050919050565b6000620001936200018d6200018784620000bd565b62000168565b620000bd565b9050919050565b6000620001a78262000172565b9050919050565b6000620001bb826200019a565b9050919050565b620001cd81620001ae565b82525050565b6000602082019050620001ea6000830184620001c2565b92915050565b608051610f26620002206000396000818160db0152818161015a0152818161028a01526103830152610f266000f3fe60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c634300081200336101606040523480156200001257600080fd5b5060405162003527380380620035278339818101604052810190620000389190620002e2565b806040518060400160405280600681526020017f4b65726e656c00000000000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a081815250506200010e818484620001e760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050508073ffffffffffffffffffffffffffffffffffffffff166101408173ffffffffffffffffffffffffffffffffffffffff168152505060016200019e6200022360201b60201c565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505062000422565b60008383834630604051602001620002049594939291906200035b565b6040516020818303038152906040528051906020012090509392505050565b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c620002589190620003e7565b60001b90508091505090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002968262000269565b9050919050565b6000620002aa8262000289565b9050919050565b620002bc816200029d565b8114620002c857600080fd5b50565b600081519050620002dc81620002b1565b92915050565b600060208284031215620002fb57620002fa62000264565b5b60006200030b84828501620002cb565b91505092915050565b6000819050919050565b620003298162000314565b82525050565b6000819050919050565b62000344816200032f565b82525050565b620003558162000289565b82525050565b600060a0820190506200037260008301886200031e565b6200038160208301876200031e565b6200039060408301866200031e565b6200039f606083018562000339565b620003ae60808301846200034a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000620003f4826200032f565b915062000401836200032f565b92508282039050818111156200041c576200041b620003b8565b5b92915050565b60805160a05160c05160e051610100516101205161014051613080620004a76000396000818161057a0152818161071301528181610b1501528181610c2401528181610e0b01528181610f2f0152610fe701526000611800015260006118420152600061182101526000611756015260006117ac015260006117d501526130806000f3fe6080604052600436106100f75760003560e01c8063940d3c601161008a578063d087d28811610059578063d087d2881461035b578063f23a6e6114610386578063f2fde38b146103c3578063f333df55146103ec576100fe565b8063940d3c60146102a1578063b0d691fe146102ca578063bc197c81146102f5578063c4d66de814610332576100fe565b80633a871cdd116100c65780633a871cdd146101d15780633e1b08121461020e57806354fd4d501461024b578063893d20e814610276576100fe565b806306fdde0314610103578063150b7a021461012e5780631626ba7e1461016b5780633659cfe6146101a8576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b50610118610415565b6040516101259190611a4b565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611b7a565b61044e565b6040516101629190611c3d565b60405180910390f35b34801561017757600080fd5b50610192600480360381019061018d9190611dbe565b610463565b60405161019f9190611c3d565b60405180910390f35b3480156101b457600080fd5b506101cf60048036038101906101ca9190611e1a565b610578565b005b3480156101dd57600080fd5b506101f860048036038101906101f39190611e6c565b61070f565b6040516102059190611eea565b60405180910390f35b34801561021a57600080fd5b5061023560048036038101906102309190611f55565b610b11565b6040516102429190611eea565b60405180910390f35b34801561025757600080fd5b50610260610bb6565b60405161026d9190611a4b565b60405180910390f35b34801561028257600080fd5b5061028b610bef565b6040516102989190611f91565b60405180910390f35b3480156102ad57600080fd5b506102c860048036038101906102c39190611fd1565b610c22565b005b3480156102d657600080fd5b506102df610e09565b6040516102ec91906120b8565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612129565b610e2d565b6040516103299190611c3d565b60405180910390f35b34801561033e57600080fd5b5061035960048036038101906103549190611e1a565b610e45565b005b34801561036757600080fd5b50610370610f2b565b60405161037d9190611eea565b60405180910390f35b34801561039257600080fd5b506103ad60048036038101906103a89190612205565b610fcf565b6040516103ba9190611c3d565b60405180910390f35b3480156103cf57600080fd5b506103ea60048036038101906103e59190611e1a565b610fe5565b005b3480156103f857600080fd5b50610413600480360381019061040e919061229f565b611157565b005b6040518060400160405280600681526020017f4b65726e656c000000000000000000000000000000000000000000000000000081525081565b600063150b7a0260e01b905095945050505050565b60008061046e6111f7565b905061047a8484611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036104e057631626ba7e60e01b915050610572565b60006104eb8561125d565b905060006104f98286611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361056457631626ba7e60e01b9350505050610572565b63ffffffff60e01b93505050505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061062857506105d56111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061065e57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61069d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069490612371565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508181558173ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a25050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461079f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610796906123dd565b60405180910390fd5b6041848061014001906107b2919061240c565b9050036107ca576107c3848461128d565b9050610a8e565b6061848061014001906107dd919061240c565b90501115610a5b576000848061014001906107f8919061240c565b60009060149261080a93929190612479565b9061081591906124f8565b60601c905060008580610140019061082d919061240c565b601490601a9261083f93929190612479565b9061084a9190612583565b60d01c9050600086806101400190610862919061240c565b601a9060209261087493929190612479565b9061087f9190612583565b60d01c9050600087806101400190610897919061240c565b6020906061926108a993929190612479565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050600088806101400190610901919061240c565b606190809261091293929190612479565b81019061091f91906125e2565b50905060006109827f4584533bad8bbd8aa77024a548a56acb8d2807847381ce1b3364745ca396b2e3878787868051906020012060405160200161096795949392919061268a565b6040516020818303038152906040528051906020012061142e565b905060006109908285611236565b90508073ffffffffffffffffffffffffffffffffffffffff166109b16111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a00576001975050505050505050610b0a565b6000610a0e888d8d8d611448565b9050600081806020019051810190610a269190612715565b905080610a3f5760019950505050505050505050610b0a565b610a4b811589896114f4565b9950505050505050505050610a8d565b6040517f4be6321b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b6000821115610b095760003373ffffffffffffffffffffffffffffffffffffffff1683604051610abd90612773565b60006040518083038185875af1925050503d8060008114610afa576040519150601f19603f3d011682016040523d82523d6000602084013e610aff565b606091505b5050905050610b0a565b5b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a30846040518363ffffffff1660e01b8152600401610b6e929190612797565b602060405180830381865afa158015610b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baf91906127d5565b9050919050565b6040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b6000610bf96111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610cd25750610c7f6111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610d11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0890612874565b60405180910390fd5b60006060600180811115610d2857610d27612894565b5b836001811115610d3b57610d3a612894565b5b03610d9b57610d8e8786868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b8092508193505050610df3565b610dea878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611563565b80925081935050505b81610e0057805160208201fd5b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063bc197c8160e01b905098975050505050505050565b6000610e4f6111f7565b9050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610edb9061290f565b60405180910390fd5b818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a3060006040518363ffffffff1660e01b8152600401610f8992919061296a565b602060405180830381865afa158015610fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fca91906127d5565b905090565b600063f23a6e6160e01b90509695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061109557506110426111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806110cb57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61110a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110190612371565b60405180910390fd5b806111136111f7565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806111a88585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b9150915081156111ef57806040517fa52b21690000000000000000000000000000000000000000000000000000000081526004016111e691906129e8565b60405180910390fd5b805160208201fd5b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c61122a9190612a39565b60001b90508091505090565b6000806000611245858561159b565b91509150611252816115ec565b819250505092915050565b6000816040516020016112709190612ae5565b604051602081830303815290604052805190602001209050919050565b6000806112986111f7565b90506112f783858061014001906112af919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036113535750611428565b600061135e8461125d565b905060006113bf8287806101400190611377919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114245760019350505050611428565b5050505b92915050565b600061144161143b611752565b8361186c565b9050919050565b60606000639e2045ce60e01b85858560405160240161146993929190612d6b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000806114d5888461152d565b91509150816114e657805160208201fd5b809350505050949350505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b8561151c57600061151f565b60015b60ff16171790509392505050565b60006060600080845160208601875af491503d604051602082018101604052818152816000602083013e80925050509250929050565b6000606060008084516020860187895af191503d604051602082018101604052818152816000602083013e8092505050935093915050565b60008060418351036115dc5760008060006020860151925060408601519150606086015160001a90506115d08782858561189f565b945094505050506115e5565b60006002915091505b9250929050565b60006004811115611600576115ff612894565b5b81600481111561161357611612612894565b5b031561174f576001600481111561162d5761162c612894565b5b8160048111156116405761163f612894565b5b03611680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167790612df5565b60405180910390fd5b6002600481111561169457611693612894565b5b8160048111156116a7576116a6612894565b5b036116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116de90612e61565b60405180910390fd5b600360048111156116fb576116fa612894565b5b81600481111561170e5761170d612894565b5b0361174e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174590612ef3565b60405180910390fd5b5b50565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161480156117ce57507f000000000000000000000000000000000000000000000000000000000000000046145b156117fb577f00000000000000000000000000000000000000000000000000000000000000009050611869565b6118667f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611981565b90505b90565b60008282604051602001611881929190612f5f565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c11156118da576000600391509150611978565b6000600187878787604051600081526020016040526040516118ff9493929190612fb2565b6020604051602081039080840390855afa158015611921573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361196f57600060019250925050611978565b80600092509250505b94509492505050565b6000838383463060405160200161199c959493929190612ff7565b6040516020818303038152906040528051906020012090509392505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156119f55780820151818401526020810190506119da565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a1d826119bb565b611a2781856119c6565b9350611a378185602086016119d7565b611a4081611a01565b840191505092915050565b60006020820190508181036000830152611a658184611a12565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611aac82611a81565b9050919050565b611abc81611aa1565b8114611ac757600080fd5b50565b600081359050611ad981611ab3565b92915050565b6000819050919050565b611af281611adf565b8114611afd57600080fd5b50565b600081359050611b0f81611ae9565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611b3a57611b39611b15565b5b8235905067ffffffffffffffff811115611b5757611b56611b1a565b5b602083019150836001820283011115611b7357611b72611b1f565b5b9250929050565b600080600080600060808688031215611b9657611b95611a77565b5b6000611ba488828901611aca565b9550506020611bb588828901611aca565b9450506040611bc688828901611b00565b935050606086013567ffffffffffffffff811115611be757611be6611a7c565b5b611bf388828901611b24565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611c3781611c02565b82525050565b6000602082019050611c526000830184611c2e565b92915050565b6000819050919050565b611c6b81611c58565b8114611c7657600080fd5b50565b600081359050611c8881611c62565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611ccb82611a01565b810181811067ffffffffffffffff82111715611cea57611ce9611c93565b5b80604052505050565b6000611cfd611a6d565b9050611d098282611cc2565b919050565b600067ffffffffffffffff821115611d2957611d28611c93565b5b611d3282611a01565b9050602081019050919050565b82818337600083830152505050565b6000611d61611d5c84611d0e565b611cf3565b905082815260208101848484011115611d7d57611d7c611c8e565b5b611d88848285611d3f565b509392505050565b600082601f830112611da557611da4611b15565b5b8135611db5848260208601611d4e565b91505092915050565b60008060408385031215611dd557611dd4611a77565b5b6000611de385828601611c79565b925050602083013567ffffffffffffffff811115611e0457611e03611a7c565b5b611e1085828601611d90565b9150509250929050565b600060208284031215611e3057611e2f611a77565b5b6000611e3e84828501611aca565b91505092915050565b600080fd5b60006101608284031215611e6357611e62611e47565b5b81905092915050565b600080600060608486031215611e8557611e84611a77565b5b600084013567ffffffffffffffff811115611ea357611ea2611a7c565b5b611eaf86828701611e4c565b9350506020611ec086828701611c79565b9250506040611ed186828701611b00565b9150509250925092565b611ee481611adf565b82525050565b6000602082019050611eff6000830184611edb565b92915050565b600077ffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b611f3281611f05565b8114611f3d57600080fd5b50565b600081359050611f4f81611f29565b92915050565b600060208284031215611f6b57611f6a611a77565b5b6000611f7984828501611f40565b91505092915050565b611f8b81611aa1565b82525050565b6000602082019050611fa66000830184611f82565b92915050565b60028110611fb957600080fd5b50565b600081359050611fcb81611fac565b92915050565b600080600080600060808688031215611fed57611fec611a77565b5b6000611ffb88828901611aca565b955050602061200c88828901611b00565b945050604086013567ffffffffffffffff81111561202d5761202c611a7c565b5b61203988828901611b24565b9350935050606061204c88828901611fbc565b9150509295509295909350565b6000819050919050565b600061207e61207961207484611a81565b612059565b611a81565b9050919050565b600061209082612063565b9050919050565b60006120a282612085565b9050919050565b6120b281612097565b82525050565b60006020820190506120cd60008301846120a9565b92915050565b60008083601f8401126120e9576120e8611b15565b5b8235905067ffffffffffffffff81111561210657612105611b1a565b5b60208301915083602082028301111561212257612121611b1f565b5b9250929050565b60008060008060008060008060a0898b03121561214957612148611a77565b5b60006121578b828c01611aca565b98505060206121688b828c01611aca565b975050604089013567ffffffffffffffff81111561218957612188611a7c565b5b6121958b828c016120d3565b9650965050606089013567ffffffffffffffff8111156121b8576121b7611a7c565b5b6121c48b828c016120d3565b9450945050608089013567ffffffffffffffff8111156121e7576121e6611a7c565b5b6121f38b828c01611b24565b92509250509295985092959890939650565b60008060008060008060a0878903121561222257612221611a77565b5b600061223089828a01611aca565b965050602061224189828a01611aca565b955050604061225289828a01611b00565b945050606061226389828a01611b00565b935050608087013567ffffffffffffffff81111561228457612283611a7c565b5b61229089828a01611b24565b92509250509295509295509295565b6000806000604084860312156122b8576122b7611a77565b5b60006122c686828701611aca565b935050602084013567ffffffffffffffff8111156122e7576122e6611a7c565b5b6122f386828701611b24565b92509250509250925092565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572206f722073656c6600000000000000000000000000000000000000602082015250565b600061235b602d836119c6565b9150612366826122ff565b604082019050919050565b6000602082019050818103600083015261238a8161234e565b9050919050565b7f6163636f756e743a206e6f742066726f6d20656e747279506f696e7400000000600082015250565b60006123c7601c836119c6565b91506123d282612391565b602082019050919050565b600060208201905081810360008301526123f6816123ba565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612429576124286123fd565b5b80840192508235915067ffffffffffffffff82111561244b5761244a612402565b5b60208301925060018202360383131561246757612466612407565b5b509250929050565b600080fd5b600080fd5b6000808585111561248d5761248c61246f565b5b8386111561249e5761249d612474565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b600061250483836124b4565b8261250f81356124bf565b9250601482101561254f5761254a7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026124eb565b831692505b505092915050565b60007fffffffffffff000000000000000000000000000000000000000000000000000082169050919050565b600061258f83836124b4565b8261259a8135612557565b925060068210156125da576125d57fffffffffffff0000000000000000000000000000000000000000000000000000836006036008026124eb565b831692505b505092915050565b600080604083850312156125f9576125f8611a77565b5b600083013567ffffffffffffffff81111561261757612616611a7c565b5b61262385828601611d90565b925050602083013567ffffffffffffffff81111561264457612643611a7c565b5b61265085828601611d90565b9150509250929050565b61266381611c58565b82525050565b600065ffffffffffff82169050919050565b61268481612669565b82525050565b600060a08201905061269f600083018861265a565b6126ac6020830187611f82565b6126b9604083018661267b565b6126c6606083018561267b565b6126d3608083018461265a565b9695505050505050565b60008115159050919050565b6126f2816126dd565b81146126fd57600080fd5b50565b60008151905061270f816126e9565b92915050565b60006020828403121561272b5761272a611a77565b5b600061273984828501612700565b91505092915050565b600081905092915050565b50565b600061275d600083612742565b91506127688261274d565b600082019050919050565b600061277e82612750565b9150819050919050565b61279181611f05565b82525050565b60006040820190506127ac6000830185611f82565b6127b96020830184612788565b9392505050565b6000815190506127cf81611ae9565b92915050565b6000602082840312156127eb576127ea611a77565b5b60006127f9848285016127c0565b91505092915050565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b600061285e6025836119c6565b915061286982612802565b604082019050919050565b6000602082019050818103600083015261288d81612851565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6163636f756e743a20616c726561647920696e697469616c697a656400000000600082015250565b60006128f9601c836119c6565b9150612904826128c3565b602082019050919050565b60006020820190508181036000830152612928816128ec565b9050919050565b6000819050919050565b600061295461294f61294a8461292f565b612059565b611f05565b9050919050565b61296481612939565b82525050565b600060408201905061297f6000830185611f82565b61298c602083018461295b565b9392505050565b600081519050919050565b600082825260208201905092915050565b60006129ba82612993565b6129c4818561299e565b93506129d48185602086016119d7565b6129dd81611a01565b840191505092915050565b60006020820190508181036000830152612a0281846129af565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a4482611adf565b9150612a4f83611adf565b9250828203905081811115612a6757612a66612a0a565b5b92915050565b600081905092915050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000612aae601c83612a6d565b9150612ab982612a78565b601c82019050919050565b6000819050919050565b612adf612ada82611c58565b612ac4565b82525050565b6000612af082612aa1565b9150612afc8284612ace565b60208201915081905092915050565b6000612b1a6020840184611aca565b905092915050565b612b2b81611aa1565b82525050565b6000612b406020840184611b00565b905092915050565b612b5181611adf565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612b8357612b82612b61565b5b83810192508235915060208301925067ffffffffffffffff821115612bab57612baa612b57565b5b600182023603831315612bc157612bc0612b5c565b5b509250929050565b600082825260208201905092915050565b6000612be68385612bc9565b9350612bf3838584611d3f565b612bfc83611a01565b840190509392505050565b60006101608301612c1b6000840184612b0b565b612c286000860182612b22565b50612c366020840184612b31565b612c436020860182612b48565b50612c516040840184612b66565b8583036040870152612c64838284612bda565b92505050612c756060840184612b66565b8583036060870152612c88838284612bda565b92505050612c996080840184612b31565b612ca66080860182612b48565b50612cb460a0840184612b31565b612cc160a0860182612b48565b50612ccf60c0840184612b31565b612cdc60c0860182612b48565b50612cea60e0840184612b31565b612cf760e0860182612b48565b50612d06610100840184612b31565b612d14610100860182612b48565b50612d23610120840184612b66565b858303610120870152612d37838284612bda565b92505050612d49610140840184612b66565b858303610140870152612d5d838284612bda565b925050508091505092915050565b60006060820190508181036000830152612d858186612c07565b9050612d94602083018561265a565b612da16040830184611edb565b949350505050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000612ddf6018836119c6565b9150612dea82612da9565b602082019050919050565b60006020820190508181036000830152612e0e81612dd2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000612e4b601f836119c6565b9150612e5682612e15565b602082019050919050565b60006020820190508181036000830152612e7a81612e3e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000612edd6022836119c6565b9150612ee882612e81565b604082019050919050565b60006020820190508181036000830152612f0c81612ed0565b9050919050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000612f49600283612a6d565b9150612f5482612f13565b600282019050919050565b6000612f6a82612f3c565b9150612f768285612ace565b602082019150612f868284612ace565b6020820191508190509392505050565b600060ff82169050919050565b612fac81612f96565b82525050565b6000608082019050612fc7600083018761265a565b612fd46020830186612fa3565b612fe1604083018561265a565b612fee606083018461265a565b95945050505050565b600060a08201905061300c600083018861265a565b613019602083018761265a565b613026604083018661265a565b6130336060830185611edb565b6130406080830184611f82565b969550505050505056fea264697066735822122032ca1cf88a7b31318141bd230c1cabd5f99c4503ed694966da441ea9decb738c64736f6c63430008120033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/baseGoerli/ZeroDevSessionKeyPlugin.json b/deployments/baseGoerli/ZeroDevSessionKeyPlugin.json new file mode 100644 index 00000000..371bf702 --- /dev/null +++ b/deployments/baseGoerli/ZeroDevSessionKeyPlugin.json @@ -0,0 +1,201 @@ +{ + "address": "0x6E2631aF80bF7a9cEE83F590eE496bCc2E40626D", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "key", + "type": "address" + } + ], + "name": "SessionKeyRevoked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_packed", + "type": "bytes" + } + ], + "name": "parseDataAndSignature", + "outputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revokeSessionKey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revoked", + "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": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "missingAccountFunds", + "type": "uint256" + } + ], + "name": "validatePluginData", + "outputs": [ + { + "internalType": "bool", + "name": "validated", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x8441c15195a2c6c7704d8b37291d8a3cd5ef0ce67554a975dd3388c3c163aa66", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x8d8a9Cf53b7D95C148cB159384D249F8FB68db3f", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1716069", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2710210105efdd7632b954d758a43cd9ea112b1333b24a3080e4c86c0ac1f6f7", + "transactionHash": "0x8441c15195a2c6c7704d8b37291d8a3cd5ef0ce67554a975dd3388c3c163aa66", + "logs": [], + "blockNumber": 4035727, + "cumulativeGasUsed": "1762982", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"key\",\"type\":\"address\"}],\"name\":\"SessionKeyRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_packed\",\"type\":\"bytes\"}],\"name\":\"parseDataAndSignature\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revokeSessionKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revoked\",\"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\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"missingAccountFunds\",\"type\":\"uint256\"}],\"name\":\"validatePluginData\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"validated\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/plugin/ZeroDevSessionKeyPlugin.sol\":\"ZeroDevSessionKeyPlugin\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Tree proofs.\\n *\\n * The tree and the proofs can be generated using our\\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\\n * You will find a quickstart guide in the readme.\\n *\\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\\n * hashing, or use a hash function other than keccak256 for hashing leaves.\\n * This is because the concatenation of a sorted pair of internal nodes in\\n * the merkle tree could be reinterpreted as a leaf value.\\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\\n * against this attack out of the box.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {verify}\\n *\\n * _Available since v4.7._\\n */\\n function verifyCalldata(\\n bytes32[] calldata proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProofCalldata(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Calldata version of {processProof}\\n *\\n * _Available since v4.7._\\n */\\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerify(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProof(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {multiProofVerify}\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerifyCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\\n * respectively.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProof(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n /**\\n * @dev Calldata version of {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProofCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd466e8b07f4c6220eac16da5127f3ff142e65f0c15c03c7d38f257b02c8585e1\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/plugin/ZeroDevBasePlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport \\\"./IPlugin.sol\\\";\\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n override\\n returns (bool validated)\\n {\\n // data offset starts at 97\\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\\n validated = _validatePluginData(userOp, userOpHash, data, signature);\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal virtual returns (bool success);\\n\\n function parseDataAndSignature(bytes calldata _packed)\\n public\\n pure\\n returns (bytes calldata data, bytes calldata signature)\\n {\\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\\n\\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \\\"invalid data\\\");\\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \\\"invalid signature\\\");\\n }\\n}\\n\",\"keccak256\":\"0x600b768ba7d0766b2968c0d9bd6cd21154f14694eeb1e1a745d110d0fcb854e8\",\"license\":\"MIT\"},\"src/plugin/ZeroDevSessionKeyPlugin.sol\":{\"content\":\"//SPDX-License-Identifier: GPL\\npragma solidity ^0.8.7;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./ZeroDevBasePlugin.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\\\";\\nusing ECDSA for bytes32;\\n/**\\n * Main EIP4337 module.\\n * Called (through the fallback module) using \\\"delegate\\\" from the GnosisSafe as an \\\"IAccount\\\",\\n * so must implement validateUserOp\\n * holds an immutable reference to the EntryPoint\\n */\\n\\nstruct ZeroDevSessionKeyStorageStruct {\\n mapping(address => bool) revoked;\\n}\\n\\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\\n // return value in case of signature failure, with no time-range.\\n // equivalent to packSigTimeRange(true,0,0);\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n event SessionKeyRevoked(address indexed key);\\n\\n constructor() EIP712(\\\"ZeroDevSessionKeyPlugin\\\", \\\"0.0.1\\\") {}\\n\\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\\n bytes32 position = bytes32(uint256(keccak256(\\\"zero-dev.account.eip4337.sessionkey\\\")) - 1);\\n assembly {\\n s.slot := position\\n }\\n }\\n\\n // revoke session key\\n function revokeSessionKey(address _key) external {\\n getPolicyStorage().revoked[_key] = true;\\n emit SessionKeyRevoked(_key);\\n }\\n\\n function revoked(address _key) external view returns (bool) {\\n return getPolicyStorage().revoked[_key];\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal view override returns (bool) {\\n address sessionKey = address(bytes20(data[0:20]));\\n require(!getPolicyStorage().revoked[sessionKey], \\\"session key revoked\\\");\\n bytes32 merkleRoot = bytes32(data[20:52]);\\n if(merkleRoot == bytes32(0)) {\\n // means this session key has sudo permission\\n signature = signature[33:98];\\n } else {\\n uint8 leafLength = uint8(signature[0]);\\n bytes32[] memory proof;\\n bytes32 leaf;\\n if(leafLength == 20) {\\n leaf = keccak256(signature[1:21]);\\n proof = abi.decode(signature[86:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n signature = signature[21:86];\\n } else if(leafLength == 24) {\\n leaf = keccak256(signature[1:25]);\\n proof = abi.decode(signature[90:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\\n require(keccak256(sig) == keccak256(signature[21:25]));\\n signature = signature[25:90];\\n }\\n require(MerkleProof.verify(proof, merkleRoot, leaf), \\\"invalide merkle root\\\");\\n }\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\\"Session(bytes32 userOpHash,uint256 nonce)\\\"), // we are going to trust plugin for verification\\n userOpHash,\\n userOp.nonce\\n )\\n )\\n );\\n address recovered = digest.recover(signature);\\n require(recovered == sessionKey, \\\"account: invalid signature\\\");\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x7463f6b16e3dacf9d618a25e7cb6e12e210ff96682051c62d5a5d6e9243adb30\",\"license\":\"GPL\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b506040518060400160405280601781526020017f5a65726f44657653657373696f6e4b6579506c7567696e0000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a08181525050620000e88184846200013760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050506200024b565b6000838383463060405160200162000154959493929190620001ee565b6040516020818303038152906040528051906020012090509392505050565b6000819050919050565b620001888162000173565b82525050565b6000819050919050565b620001a3816200018e565b82525050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001d682620001a9565b9050919050565b620001e881620001c9565b82525050565b600060a0820190506200020560008301886200017d565b6200021460208301876200017d565b6200022360408301866200017d565b62000232606083018562000198565b620002416080830184620001dd565b9695505050505050565b60805160a05160c05160e0516101005161012051611e016200029b6000396000610bac01526000610bee01526000610bcd01526000610b0201526000610b5801526000610b810152611e016000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/baseGoerli/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json b/deployments/baseGoerli/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json new file mode 100644 index 00000000..d5d6537f --- /dev/null +++ b/deployments/baseGoerli/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json @@ -0,0 +1,129 @@ +{ + "language": "Solidity", + "sources": { + "lib/account-abstraction/contracts/core/EntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n\nimport \"../interfaces/IAccount.sol\";\nimport \"../interfaces/IPaymaster.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\n\nimport \"../utils/Exec.sol\";\nimport \"./StakeManager.sol\";\nimport \"./SenderCreator.sol\";\nimport \"./Helpers.sol\";\nimport \"./NonceManager.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\n\n using UserOperationLib for UserOperation;\n\n SenderCreator private immutable senderCreator = new SenderCreator();\n\n // internal value used during simulation: need to query aggregator.\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\n\n // marker for inner call revert on out of gas\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\n\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\n\n /**\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\n * in case of signature failure, instead of revert.\n */\n uint256 public constant SIG_VALIDATION_FAILED = 1;\n\n /**\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\n * @param beneficiary the address to receive the fees\n * @param amount amount to transfer.\n */\n function _compensate(address payable beneficiary, uint256 amount) internal {\n require(beneficiary != address(0), \"AA90 invalid beneficiary\");\n (bool success,) = beneficiary.call{value : amount}(\"\");\n require(success, \"AA91 failed send to beneficiary\");\n }\n\n /**\n * execute a user op\n * @param opIndex index into the opInfo array\n * @param userOp the userOp to execute\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\n * @return collected the total amount this userOp paid.\n */\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\n uint256 preGas = gasleft();\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\n\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\n collected = _actualGasCost;\n } catch {\n bytes32 innerRevertCode;\n assembly {\n returndatacopy(0, 0, 32)\n innerRevertCode := mload(0)\n }\n // handleOps was called with gas limit too low. abort entire bundle.\n if (innerRevertCode == INNER_OUT_OF_GAS) {\n //report paymaster, since if it is not deliberately caused by the bundler,\n // it must be a revert caused by paymaster.\n revert FailedOp(opIndex, \"AA95 out of gas\");\n }\n\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\n }\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\n\n uint256 opslen = ops.length;\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\n\n unchecked {\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[i];\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\n }\n\n uint256 collected = 0;\n emit BeforeExecution();\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(i, ops[i], opInfos[i]);\n }\n\n _compensate(beneficiary, collected);\n } //unchecked\n }\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 ) public nonReentrant {\n\n uint256 opasLen = opsPerAggregator.length;\n uint256 totalOps = 0;\n for (uint256 i = 0; i < opasLen; i++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n //address(1) is special marker of \"signature error\"\n require(address(aggregator) != address(1), \"AA96 invalid aggregator\");\n\n if (address(aggregator) != address(0)) {\n // solhint-disable-next-line no-empty-blocks\n try aggregator.validateSignatures(ops, opa.signature) {}\n catch {\n revert SignatureValidationFailed(address(aggregator));\n }\n }\n\n totalOps += ops.length;\n }\n\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\n\n emit BeforeExecution();\n\n uint256 opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n uint256 opslen = ops.length;\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[opIndex];\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\n opIndex++;\n }\n }\n\n uint256 collected = 0;\n opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n emit SignatureAggregatorChanged(address(opa.aggregator));\n UserOperation[] calldata ops = opa.userOps;\n uint256 opslen = ops.length;\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\n opIndex++;\n }\n }\n emit SignatureAggregatorChanged(address(0));\n\n _compensate(beneficiary, collected);\n }\n\n /// @inheritdoc IEntryPoint\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\n\n UserOpInfo memory opInfo;\n _simulationOnlyValidations(op);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n\n numberMarker();\n uint256 paid = _executeUserOp(0, op, opInfo);\n numberMarker();\n bool targetSuccess;\n bytes memory targetResult;\n if (target != address(0)) {\n (targetSuccess, targetResult) = target.call(targetCallData);\n }\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\n }\n\n\n // A memory copy of UserOp static fields only.\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\n struct MemoryUserOp {\n address sender;\n uint256 nonce;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n address paymaster;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n }\n\n struct UserOpInfo {\n MemoryUserOp mUserOp;\n bytes32 userOpHash;\n uint256 prefund;\n uint256 contextOffset;\n uint256 preOpGas;\n }\n\n /**\n * inner function to handle a UserOperation.\n * Must be declared \"external\" to open a call context, but it can only be called by handleOps.\n */\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n require(msg.sender == address(this), \"AA92 internal call only\");\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n\n uint callGasLimit = mUserOp.callGasLimit;\n unchecked {\n // handleOps was called with gas limit too low. abort entire bundle.\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\n assembly {\n mstore(0, INNER_OUT_OF_GAS)\n revert(0, 32)\n }\n }\n }\n\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\n if (callData.length > 0) {\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\n if (!success) {\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\n if (result.length > 0) {\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\n }\n mode = IPaymaster.PostOpMode.opReverted;\n }\n }\n\n unchecked {\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\n return _handlePostOp(0, mode, opInfo, context, actualGas);\n }\n }\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\n }\n\n /**\n * copy general fields from userOp into the memory opInfo structure.\n */\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\n mUserOp.sender = userOp.sender;\n mUserOp.nonce = userOp.nonce;\n mUserOp.callGasLimit = userOp.callGasLimit;\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\n mUserOp.preVerificationGas = userOp.preVerificationGas;\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes calldata paymasterAndData = userOp.paymasterAndData;\n if (paymasterAndData.length > 0) {\n require(paymasterAndData.length >= 20, \"AA93 invalid paymasterAndData\");\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\n } else {\n mUserOp.paymaster = address(0);\n }\n }\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external {\n UserOpInfo memory outOpInfo;\n\n _simulationOnlyValidations(userOp);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\n StakeInfo memory factoryInfo;\n {\n bytes calldata initCode = userOp.initCode;\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\n factoryInfo = _getStakeInfo(factory);\n }\n\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n address aggregator = data.aggregator;\n bool sigFailed = aggregator == address(1);\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\n\n if (aggregator != address(0) && aggregator != address(1)) {\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\n }\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\n\n }\n\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\n unchecked {\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\n // our security model might call postOp eventually twice\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\n\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\n }\n }\n\n // create the sender's contract if needed.\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\n if (initCode.length != 0) {\n address sender = opInfo.mUserOp.sender;\n if (sender.code.length != 0) revert FailedOp(opIndex, \"AA10 sender already constructed\");\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\n if (sender1 == address(0)) revert FailedOp(opIndex, \"AA13 initCode failed or OOG\");\n if (sender1 != sender) revert FailedOp(opIndex, \"AA14 initCode must return sender\");\n if (sender1.code.length == 0) revert FailedOp(opIndex, \"AA15 initCode must create sender\");\n address factory = address(bytes20(initCode[0 : 20]));\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\n }\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 calldata initCode) public {\n address sender = senderCreator.createSender(initCode);\n revert SenderAddressResult(sender);\n }\n\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\n // solhint-disable-next-line no-empty-blocks\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\n catch Error(string memory revertReason) {\n if (bytes(revertReason).length != 0) {\n revert FailedOp(0, revertReason);\n }\n }\n }\n\n /**\n * Called only during simulation.\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\n */\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\n if (initCode.length == 0 && sender.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA20 account not deployed\");\n }\n if (paymasterAndData.length >= 20) {\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\n if (paymaster.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA30 paymaster not deployed\");\n }\n }\n // always revert\n revert(\"\");\n }\n\n /**\n * call account.validateUserOp.\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\n * decrement account's deposit if needed\n */\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\n unchecked {\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n address sender = mUserOp.sender;\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\n address paymaster = mUserOp.paymaster;\n numberMarker();\n uint256 missingAccountFunds = 0;\n if (paymaster == address(0)) {\n uint256 bal = balanceOf(sender);\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\n }\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\n returns (uint256 _validationData) {\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA23 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA23 reverted (or OOG)\");\n }\n if (paymaster == address(0)) {\n DepositInfo storage senderInfo = deposits[sender];\n uint256 deposit = senderInfo.deposit;\n if (requiredPrefund > deposit) {\n revert FailedOp(opIndex, \"AA21 didn't pay prefund\");\n }\n senderInfo.deposit = uint112(deposit - requiredPrefund);\n }\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\n }\n }\n\n /**\n * In case the request has a paymaster:\n * Validate paymaster has enough deposit.\n * Call paymaster.validatePaymasterUserOp.\n * Revert with proper FailedOp in case paymaster reverts.\n * Decrement paymaster's deposit\n */\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\n internal returns (bytes memory context, uint256 validationData) {\n unchecked {\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \"AA41 too little verificationGas\");\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\n\n address paymaster = mUserOp.paymaster;\n DepositInfo storage paymasterInfo = deposits[paymaster];\n uint256 deposit = paymasterInfo.deposit;\n if (deposit < requiredPreFund) {\n revert FailedOp(opIndex, \"AA31 paymaster deposit too low\");\n }\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\n context = _context;\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA33 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA33 reverted (or OOG)\");\n }\n }\n }\n\n /**\n * revert if either account validationData or paymaster validationData is expired\n */\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\n if (expectedAggregator != aggregator) {\n revert FailedOp(opIndex, \"AA24 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA22 expired or not due\");\n }\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\n address pmAggregator;\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\n if (pmAggregator != address(0)) {\n revert FailedOp(opIndex, \"AA34 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA32 paymaster expired or not due\");\n }\n }\n\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\n if (validationData == 0) {\n return (address(0), false);\n }\n ValidationData memory data = _parseValidationData(validationData);\n // solhint-disable-next-line not-rely-on-time\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\n aggregator = data.aggregator;\n }\n\n /**\n * validate account and paymaster (if defined).\n * also make sure total validation doesn't exceed verificationGasLimit\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\n * @param opIndex the index of this userOp into the \"opInfos\" array\n * @param userOp the userOp to validate\n */\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\n private returns (uint256 validationData, uint256 paymasterValidationData) {\n\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\n _copyUserOpToMemory(userOp, mUserOp);\n outOpInfo.userOpHash = getUserOpHash(userOp);\n\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\n // and multiplied without causing overflow\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\n require(maxGasValues <= type(uint120).max, \"AA94 gas values overflow\");\n\n uint256 gasUsedByValidateAccountPrepayment;\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\n\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\n revert FailedOp(opIndex, \"AA25 invalid account nonce\");\n }\n\n //a \"marker\" where account opcode validation is done and paymaster opcode validation is about to start\n // (used only by off-chain simulateValidation)\n numberMarker();\n\n bytes memory context;\n if (mUserOp.paymaster != address(0)) {\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\n }\n unchecked {\n uint256 gasUsed = preGas - gasleft();\n\n if (userOp.verificationGasLimit < gasUsed) {\n revert FailedOp(opIndex, \"AA40 over verificationGasLimit\");\n }\n outOpInfo.prefund = requiredPreFund;\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\n }\n }\n\n /**\n * process post-operation.\n * called just after the callData is executed.\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\n * @param opIndex index in the batch\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\n * @param opInfo userOp fields and info collected during validation\n * @param context the context returned in validatePaymasterUserOp\n * @param actualGas the gas used so far by this user operation\n */\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n unchecked {\n address refundAddress;\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\n\n address paymaster = mUserOp.paymaster;\n if (paymaster == address(0)) {\n refundAddress = mUserOp.sender;\n } else {\n refundAddress = paymaster;\n if (context.length > 0) {\n actualGasCost = actualGas * gasPrice;\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\n } else {\n // solhint-disable-next-line no-empty-blocks\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\n catch Error(string memory reason) {\n revert FailedOp(opIndex, string.concat(\"AA50 postOp reverted: \", reason));\n }\n catch {\n revert FailedOp(opIndex, \"AA50 postOp revert\");\n }\n }\n }\n }\n actualGas += preGas - gasleft();\n actualGasCost = actualGas * gasPrice;\n if (opInfo.prefund < actualGasCost) {\n revert FailedOp(opIndex, \"AA51 prefund below actualGasCost\");\n }\n uint256 refund = opInfo.prefund - actualGasCost;\n _incrementDeposit(refundAddress, refund);\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\n } // unchecked\n }\n\n /**\n * the gas price this UserOp agrees to pay.\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\n */\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\n assembly {offset := data}\n }\n\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\n assembly {data := offset}\n }\n\n //place the NUMBER opcode in the code.\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\n // account and paymaster.\n function numberMarker() internal view {\n assembly {mstore(0, number())}\n }\n}\n\n" + }, + "lib/account-abstraction/contracts/core/Helpers.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n * address(1) - the account failed to validate the signature.\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\n struct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n }\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n// intersect account and paymaster ranges.\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\n ValidationData memory accountValidationData = _parseValidationData(validationData);\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n address aggregator = accountValidationData.aggregator;\n if (aggregator == address(0)) {\n aggregator = pmValidationData.aggregator;\n }\n uint48 validAfter = accountValidationData.validAfter;\n uint48 validUntil = accountValidationData.validUntil;\n uint48 pmValidAfter = pmValidationData.validAfter;\n uint48 pmValidUntil = pmValidationData.validUntil;\n\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n }\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n }\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n\n" + }, + "lib/account-abstraction/contracts/core/NonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IEntryPoint.sol\";\n\n/**\n * nonce management functionality\n */\ncontract NonceManager is INonceManager {\n\n /**\n * The next valid sequence number for a given nonce key.\n */\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\n\n function getNonce(address sender, uint192 key)\n public view override returns (uint256 nonce) {\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\n }\n\n // allow an account to manually increment its own nonce.\n // (mainly so that during construction nonce can be made non-zero,\n // to \"absorb\" the gas cost of first nonce increment to 1st transaction (construction),\n // not to 2nd transaction)\n function incrementNonce(uint192 key) public override {\n nonceSequenceNumber[msg.sender][key]++;\n }\n\n /**\n * validate nonce uniqueness for this account.\n * called just after validateUserOp()\n */\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\n\n uint192 key = uint192(nonce >> 64);\n uint64 seq = uint64(nonce);\n return nonceSequenceNumber[sender][key]++ == seq;\n }\n\n}\n" + }, + "lib/account-abstraction/contracts/core/SenderCreator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/**\n * helper contract for EntryPoint, to call userOp.initCode from a \"neutral\" address,\n * which is explicitly not the entryPoint itself.\n */\ncontract SenderCreator {\n\n /**\n * call the \"initCode\" factory to create and return the sender account address\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\n * @return sender the returned address of the created account, or zero address on failure.\n */\n function createSender(bytes calldata initCode) external returns (address sender) {\n address factory = address(bytes20(initCode[0 : 20]));\n bytes memory initCallData = initCode[20 :];\n bool success;\n /* solhint-disable no-inline-assembly */\n assembly {\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\n sender := mload(0)\n }\n if (!success) {\n sender = address(0);\n }\n }\n}\n" + }, + "lib/account-abstraction/contracts/core/StakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IStakeManager.sol\";\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable not-rely-on-time */\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by a paymaster.\n */\nabstract contract StakeManager is IStakeManager {\n\n /// maps paymaster to their deposits and stakes\n mapping(address => DepositInfo) public deposits;\n\n /// @inheritdoc IStakeManager\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\n return deposits[account];\n }\n\n // internal method to return just the stake info\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\n DepositInfo storage depositInfo = deposits[addr];\n info.stake = depositInfo.stake;\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\n }\n\n /// return the deposit (for gas payment) of the account\n function balanceOf(address account) public view returns (uint256) {\n return deposits[account].deposit;\n }\n\n receive() external payable {\n depositTo(msg.sender);\n }\n\n function _incrementDeposit(address account, uint256 amount) internal {\n DepositInfo storage info = deposits[account];\n uint256 newAmount = info.deposit + amount;\n require(newAmount <= type(uint112).max, \"deposit overflow\");\n info.deposit = uint112(newAmount);\n }\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) public payable {\n _incrementDeposit(account, msg.value);\n DepositInfo storage info = deposits[account];\n emit Deposited(account, info.deposit);\n }\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 unstakeDelaySec) public payable {\n DepositInfo storage info = deposits[msg.sender];\n require(unstakeDelaySec > 0, \"must specify unstake delay\");\n require(unstakeDelaySec >= info.unstakeDelaySec, \"cannot decrease unstake time\");\n uint256 stake = info.stake + msg.value;\n require(stake > 0, \"no stake specified\");\n require(stake <= type(uint112).max, \"stake overflow\");\n deposits[msg.sender] = DepositInfo(\n info.deposit,\n true,\n uint112(stake),\n unstakeDelaySec,\n 0\n );\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\n }\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external {\n DepositInfo storage info = deposits[msg.sender];\n require(info.unstakeDelaySec != 0, \"not staked\");\n require(info.staked, \"already unstaking\");\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\n info.withdrawTime = withdrawTime;\n info.staked = false;\n emit StakeUnlocked(msg.sender, withdrawTime);\n }\n\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external {\n DepositInfo storage info = deposits[msg.sender];\n uint256 stake = info.stake;\n require(stake > 0, \"No stake to withdraw\");\n require(info.withdrawTime > 0, \"must call unlockStake() first\");\n require(info.withdrawTime <= block.timestamp, \"Stake withdrawal is not due\");\n info.unstakeDelaySec = 0;\n info.withdrawTime = 0;\n info.stake = 0;\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\n (bool success,) = withdrawAddress.call{value : stake}(\"\");\n require(success, \"failed to withdraw stake\");\n }\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\n DepositInfo storage info = deposits[msg.sender];\n require(withdrawAmount <= info.deposit, \"Withdraw amount too large\");\n info.deposit = uint112(info.deposit - withdrawAmount);\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\"\");\n require(success, \"failed to withdraw\");\n }\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAccount.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\ninterface IAccount {\n\n /**\n * Validate user's signature and nonce\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\n * This allows making a \"simulation call\" without a valid signature\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\n *\n * @dev Must validate caller is the entryPoint.\n * Must validate the signature and nonce\n * @param userOp the operation that is about to be executed.\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\n * The excess is left as a deposit in the entrypoint, for future calls.\n * can be withdrawn anytime using \"entryPoint.withdrawTo()\"\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external returns (uint256 validationData);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAggregator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n\n /**\n * validate aggregated signature.\n * revert if the aggregated signature does not match the given list of operations.\n */\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\n\n /**\n * validate signature of a single userOp\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n * @param userOp the userOperation received from the user.\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\n * (usually empty, unless account and aggregator support some kind of \"multisig\"\n */\n function validateUserOpSignature(UserOperation calldata userOp)\n external view returns (bytes memory sigForUserOp);\n\n /**\n * aggregate multiple signatures into a single value.\n * This method is called off-chain to calculate the signature to pass with handleOps()\n * bundler MAY use optimized custom code perform this aggregation\n * @param userOps array of UserOperations to collect the signatures from.\n * @return aggregatedSignature the aggregated signature\n */\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IEntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./UserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\n\n /***\n * An event emitted after each successful request\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\n * @param sender - the account that generates this request.\n * @param paymaster - if non-null, the paymaster that pays for this request.\n * @param nonce - the nonce value from the request.\n * @param success - true if the sender transaction succeeded, false if reverted.\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\n */\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\n\n /**\n * account \"sender\" was deployed.\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\n * @param sender the account that is deployed\n * @param factory the factory used to deploy this account (in the initCode)\n * @param paymaster the paymaster used by this UserOp\n */\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\n\n /**\n * An event emitted if the UserOperation \"callData\" reverted with non-zero length\n * @param userOpHash the request unique identifier.\n * @param sender the sender of this request\n * @param nonce the nonce used in the request\n * @param revertReason - the return bytes from the (reverted) call to \"callData\".\n */\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\n\n /**\n * an event emitted by handleOps(), before starting the execution loop.\n * any event emitted before this event, is part of the validation.\n */\n event BeforeExecution();\n\n /**\n * signature aggregator used by the following UserOperationEvents within this bundle.\n */\n event SignatureAggregatorChanged(address indexed aggregator);\n\n /**\n * a custom revert error of handleOps, to identify the offending op.\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\n * @param reason - revert reason\n * The string starts with a unique code \"AAmn\", where \"m\" is \"1\" for factory, \"2\" for account and \"3\" for paymaster issues,\n * so a failure can be attributed to the correct entity.\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\n */\n error FailedOp(uint256 opIndex, string reason);\n\n /**\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\n */\n error SignatureValidationFailed(address aggregator);\n\n /**\n * Successful result from simulateValidation.\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n */\n error ValidationResult(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\n\n /**\n * Successful result from simulateValidation, if the account returns a signature aggregator\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\n * bundler MUST use it to verify the signature, or reject the UserOperation\n */\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\n AggregatorStakeInfo aggregatorInfo);\n\n /**\n * return value of getSenderAddress\n */\n error SenderAddressResult(address sender);\n\n /**\n * return value of simulateHandleOp\n */\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\n\n //UserOps handled, per aggregator\n struct UserOpsPerAggregator {\n UserOperation[] userOps;\n\n // aggregator address\n IAggregator aggregator;\n // aggregated signature\n bytes signature;\n }\n\n /**\n * Execute a batch of UserOperation.\n * no signature aggregator is used.\n * if any account requires an aggregator (that is, it returned an aggregator when\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\n * @param ops the operations to execute\n * @param beneficiary the address to receive the fees\n */\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\n\n /**\n * Execute a batch of UserOperation with Aggregators\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\n * @param beneficiary the address to receive the fees\n */\n function handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n ) external;\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external;\n\n /**\n * gas and return values during simulation\n * @param preOpGas the gas used for validation (including preValidationGas)\n * @param prefund the required prefund for this operation\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\n */\n struct ReturnInfo {\n uint256 preOpGas;\n uint256 prefund;\n bool sigFailed;\n uint48 validAfter;\n uint48 validUntil;\n bytes paymasterContext;\n }\n\n /**\n * returned aggregated signature info.\n * the aggregator returned by the account, and its current stake.\n */\n struct AggregatorStakeInfo {\n address aggregator;\n StakeInfo stakeInfo;\n }\n\n /**\n * Get counterfactual sender address.\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n * this method always revert, and returns the address in SenderAddressResult error\n * @param initCode the constructor code to be passed into the UserOperation.\n */\n function getSenderAddress(bytes memory initCode) external;\n\n\n /**\n * simulate full execution of a UserOperation (including both validation and target execution)\n * this method will always revert with \"ExecutionResult\".\n * it performs full validation of the UserOperation, but ignores signature error.\n * an optional target address is called after the userop succeeds, and its value is returned\n * (before the entire call is reverted)\n * Note that in order to collect the the success/failure of the target call, it must be executed\n * with trace enabled to track the emitted events.\n * @param op the UserOperation to simulate\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\n * are set to the return from that call.\n * @param targetCallData callData to pass to target address\n */\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\n}\n\n" + }, + "lib/account-abstraction/contracts/interfaces/INonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\ninterface INonceManager {\n\n /**\n * Return the next nonce for this sender.\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\n * But UserOp with different keys can come with arbitrary order.\n *\n * @param sender the account address\n * @param key the high 192 bit of the nonce\n * @return nonce a full nonce to pass for next UserOp with this sender.\n */\n function getNonce(address sender, uint192 key)\n external view returns (uint256 nonce);\n\n /**\n * Manually increment the nonce of the sender.\n * This method is exposed just for completeness..\n * Account does NOT need to call it, neither during validation, nor elsewhere,\n * as the EntryPoint will update the nonce regardless.\n * Possible use-case is call it with various keys to \"initialize\" their nonces to one, so that future\n * UserOperations will not pay extra for the first transaction with a given key.\n */\n function incrementNonce(uint192 key) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IPaymaster.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\n */\ninterface IPaymaster {\n\n enum PostOpMode {\n opSucceeded, // user op succeeded\n opReverted, // user op reverted. still has to pay for gas.\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\n }\n\n /**\n * payment validation: check if paymaster agrees to pay.\n * Must verify sender is the entryPoint.\n * Revert to reject this request.\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\n * @param userOp the user operation\n * @param userOpHash hash of the user's request data.\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\n * @return context value to send to a postOp\n * zero length to signify postOp is not required.\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n external returns (bytes memory context, uint256 validationData);\n\n /**\n * post-operation handler.\n * Must verify sender is the entryPoint\n * @param mode enum with the following options:\n * opSucceeded - user operation succeeded.\n * opReverted - user op reverted. still has to pay for gas.\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\n * Now this is the 2nd call, after user's op was deliberately reverted.\n * @param context - the context value returned by validatePaymasterUserOp\n * @param actualGasCost - actual gas used so far (without this postOp call).\n */\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IStakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n\n event Deposited(\n address indexed account,\n uint256 totalDeposit\n );\n\n event Withdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /// Emitted when stake or unstake delay are modified\n event StakeLocked(\n address indexed account,\n uint256 totalStaked,\n uint256 unstakeDelaySec\n );\n\n /// Emitted once a stake is scheduled for withdrawal\n event StakeUnlocked(\n address indexed account,\n uint256 withdrawTime\n );\n\n event StakeWithdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /**\n * @param deposit the entity's deposit\n * @param staked true if this entity is staked.\n * @param stake actual amount of ether staked for this entity.\n * @param unstakeDelaySec minimum delay to withdraw the stake.\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\n * and the rest fit into a 2nd cell.\n * 112 bit allows for 10^15 eth\n * 48 bit for full timestamp\n * 32 bit allows 150 years for unstake delay\n */\n struct DepositInfo {\n uint112 deposit;\n bool staked;\n uint112 stake;\n uint32 unstakeDelaySec;\n uint48 withdrawTime;\n }\n\n //API struct used by getStakeInfo and simulateValidation\n struct StakeInfo {\n uint256 stake;\n uint256 unstakeDelaySec;\n }\n\n /// @return info - full deposit information of given account\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\n\n /// @return the deposit (for gas payment) of the account\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) external payable;\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 _unstakeDelaySec) external payable;\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external;\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external;\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/UserOperation.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\nimport {calldataKeccak} from \"../core/Helpers.sol\";\n\n/**\n * User Operation struct\n * @param sender the sender account of this request.\n * @param nonce unique value the sender uses to verify it is not a replay.\n * @param initCode if set, the account contract will be created by this constructor/\n * @param callData the method call to execute on this account.\n * @param callGasLimit the gas limit passed to the callData method call.\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\n * @param maxFeePerGas same as EIP-1559 gas parameter.\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n */\n struct UserOperation {\n\n address sender;\n uint256 nonce;\n bytes initCode;\n bytes callData;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n bytes paymasterAndData;\n bytes signature;\n }\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\n address data;\n //read sender from userOp, which is first userOp member (saves 800 gas...)\n assembly {data := calldataload(userOp)}\n return address(uint160(data));\n }\n\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\n // pay above what he signed for.\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\n address sender = getSender(userOp);\n uint256 nonce = userOp.nonce;\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n bytes32 hashCallData = calldataKeccak(userOp.callData);\n uint256 callGasLimit = userOp.callGasLimit;\n uint256 verificationGasLimit = userOp.verificationGasLimit;\n uint256 preVerificationGas = userOp.preVerificationGas;\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n return abi.encode(\n sender, nonce,\n hashInitCode, hashCallData,\n callGasLimit, verificationGasLimit, preVerificationGas,\n maxFeePerGas, maxPriorityFeePerGas,\n hashPaymasterAndData\n );\n }\n\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\n return keccak256(pack(userOp));\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n}\n" + }, + "lib/account-abstraction/contracts/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n\n function call(\n address to,\n uint256 value,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function staticcall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal view returns (bool success) {\n assembly {\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function delegateCall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n // get returned data from last call or calldelegate\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n assembly {\n let len := returndatasize()\n if gt(len, maxLen) {\n len := maxLen\n }\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n // revert with explicit byte array (probably reverted info from call)\n function revertWithData(bytes memory returnData) internal pure {\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\n bool success = call(to,0,data,gasleft());\n if (!success) {\n revertWithData(getReturnData(maxLen));\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Create2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts 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 * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\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 _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\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 bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n * respectively.\n *\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "src/abstract/Compatibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Compatibility {\n receive() external payable {}\n\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\n external\n pure\n returns (bytes4)\n {\n return this.onERC1155BatchReceived.selector;\n }\n\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "src/abstract/KernelStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\n\nstruct WalletKernelStorage {\n address owner;\n}\n\ncontract KernelStorage {\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n IEntryPoint public immutable entryPoint;\n\n event Upgraded(address indexed newImplementation);\n\n // modifier for checking if the sender is the entrypoint or\n // the account itself\n modifier onlyFromEntryPointOrOwnerOrSelf() {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\n \"account: not from entrypoint or owner or self\"\n );\n _;\n }\n\n constructor(IEntryPoint _entryPoint) {\n entryPoint = _entryPoint;\n getKernelStorage().owner = address(1);\n }\n /// @notice get wallet kernel storage\n /// @dev used to get wallet kernel storage\n /// @return ws wallet kernel storage, consists of owner and nonces\n\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\n bytes32 storagePosition = bytes32(uint256(keccak256(\"zerodev.kernel\")) - 1);\n assembly {\n ws.slot := storagePosition\n }\n }\n\n function getOwner() external view returns (address) {\n return getKernelStorage().owner;\n }\n\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n assembly {\n sstore(slot, _newImplementation)\n }\n emit Upgraded(_newImplementation);\n }\n\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\n getKernelStorage().owner = _newOwner;\n }\n\n function getNonce() public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), 0);\n }\n\n function getNonce(uint192 key) public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), key);\n }\n}\n " + }, + "src/factory/EIP1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract EIP1967Proxy {\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n constructor(address _logic, bytes memory _data) payable {\n require(_logic != address(0), \"EIP1967Proxy: implementation is the zero address\");\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n sstore(slot, _logic)\n }\n if (_data.length > 0) {\n (bool success,) = _logic.delegatecall(_data);\n require(success, \"EIP1967Proxy: constructor call failed\");\n }\n }\n\n fallback() external payable {\n address implementation = _implementation();\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 { revert(0, returndatasize()) }\n default { return(0, returndatasize()) }\n }\n }\n\n function _implementation() internal view returns (address impl) {\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n impl := sload(slot)\n }\n }\n}\n" + }, + "src/Kernel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"./plugin/IPlugin.sol\";\nimport \"account-abstraction/core/Helpers.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport {EntryPoint} from \"account-abstraction/core/EntryPoint.sol\";\nimport \"./utils/Exec.sol\";\nimport \"./abstract/Compatibility.sol\";\nimport \"./abstract/KernelStorage.sol\";\n\n/// @title Kernel\n/// @author taek\n/// @notice wallet kernel for minimal wallet functionality\n/// @dev supports only 1 owner, multiple plugins\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\n error InvalidNonce();\n error InvalidSignatureLength();\n error QueryResult(bytes result);\n\n string public constant name = \"Kernel\";\n\n string public constant version = \"0.0.1\";\n\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\n\n /// @notice initialize wallet kernel\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\n /// @param _owner owner address\n function initialize(address _owner) external {\n WalletKernelStorage storage ws = getKernelStorage();\n require(ws.owner == address(0), \"account: already initialized\");\n ws.owner = _owner;\n }\n\n /// @notice Query plugin for data\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\n /// @param _plugin Plugin address\n /// @param _data Data to query\n function queryPlugin(address _plugin, bytes calldata _data) external {\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\n if (success) {\n revert QueryResult(_ret);\n } else {\n assembly {\n revert(add(_ret, 32), mload(_ret))\n }\n }\n }\n\n /// @notice execute function call to external contract\n /// @dev this function will execute function call to external contract\n /// @param to target contract address\n /// @param value value to be sent\n /// @param data data to be sent\n /// @param operation operation type (call or delegatecall)\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\n \"account: not from entrypoint or owner\"\n );\n bool success;\n bytes memory ret;\n if (operation == Operation.DelegateCall) {\n (success, ret) = Exec.delegateCall(to, data);\n } else {\n (success, ret) = Exec.call(to, value, data);\n }\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n }\n\n /// @notice validate user operation\n /// @dev this function will validate user operation and be called by EntryPoint\n /// @param userOp user operation\n /// @param userOpHash user operation hash\n /// @param missingAccountFunds funds needed to be reimbursed\n /// @return validationData validation data\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (uint256 validationData)\n {\n require(msg.sender == address(entryPoint), \"account: not from entryPoint\");\n if (userOp.signature.length == 65) {\n validationData = _validateUserOp(userOp, userOpHash);\n } else if (userOp.signature.length > 97) {\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\n address plugin = address(bytes20(userOp.signature[0:20]));\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\n bytes memory signature = userOp.signature[32:97];\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\n \"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\"\n ), // we are going to trust plugin for verification\n plugin,\n validUntil,\n validAfter,\n keccak256(data)\n )\n )\n );\n\n address signer = ECDSA.recover(digest, signature);\n if (getKernelStorage().owner != signer) {\n return SIG_VALIDATION_FAILED;\n }\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\n bool res = abi.decode(ret, (bool));\n if (!res) {\n return SIG_VALIDATION_FAILED;\n }\n validationData = _packValidationData(!res, validUntil, validAfter);\n } else {\n revert InvalidSignatureLength();\n }\n if (missingAccountFunds > 0) {\n // we are going to assume signature is valid at this point\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\"\");\n (success);\n return validationData;\n }\n }\n\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\n internal\n view\n returns (uint256 validationData)\n {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\n return validationData;\n }\n\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\n address recovered = ECDSA.recover(hash, userOp.signature);\n if (ws.owner != recovered) {\n return SIG_VALIDATION_FAILED;\n }\n }\n\n /**\n * delegate the contract call to the plugin\n */\n function _delegateToPlugin(\n address plugin,\n UserOperation calldata userOp,\n bytes32 opHash,\n uint256 missingAccountFunds\n ) internal returns (bytes memory) {\n bytes memory data =\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n return ret;\n }\n\n /// @notice validate signature using eip1271\n /// @dev this function will validate signature using eip1271\n /// @param _hash hash to be signed\n /// @param _signature signature\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\n return 0x1626ba7e;\n }\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\n address recovered = ECDSA.recover(hash, _signature);\n // Validate signatures\n if (ws.owner == recovered) {\n return 0x1626ba7e;\n } else {\n return 0xffffffff;\n }\n }\n}\n" + }, + "src/KernelFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/Create2.sol\";\nimport \"./factory/EIP1967Proxy.sol\";\nimport \"./Kernel.sol\";\n\ncontract KernelFactory {\n Kernel public immutable kernelTemplate;\n\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\n\n constructor(IEntryPoint _entryPoint) {\n kernelTemplate = new Kernel(_entryPoint);\n }\n\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n address addr = Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n if (addr.code.length > 0) {\n return EIP1967Proxy(payable(addr));\n }\n proxy =\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\n emit AccountCreated(address(proxy), _owner, _index);\n }\n\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n return Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n }\n}\n" + }, + "src/plugin/IPlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/UserOperation.sol\";\n\ninterface IPlugin {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (bool);\n}\n" + }, + "src/plugin/ZeroDevBasePlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport \"./IPlugin.sol\";\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n override\n returns (bool validated)\n {\n // data offset starts at 97\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\n validated = _validatePluginData(userOp, userOpHash, data, signature);\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal virtual returns (bool success);\n\n function parseDataAndSignature(bytes calldata _packed)\n public\n pure\n returns (bytes calldata data, bytes calldata signature)\n {\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\n\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \"invalid data\");\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \"invalid signature\");\n }\n}\n" + }, + "src/plugin/ZeroDevSessionKeyPlugin.sol": { + "content": "//SPDX-License-Identifier: GPL\npragma solidity ^0.8.7;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./ZeroDevBasePlugin.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\";\nusing ECDSA for bytes32;\n/**\n * Main EIP4337 module.\n * Called (through the fallback module) using \"delegate\" from the GnosisSafe as an \"IAccount\",\n * so must implement validateUserOp\n * holds an immutable reference to the EntryPoint\n */\n\nstruct ZeroDevSessionKeyStorageStruct {\n mapping(address => bool) revoked;\n}\n\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\n // return value in case of signature failure, with no time-range.\n // equivalent to packSigTimeRange(true,0,0);\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n event SessionKeyRevoked(address indexed key);\n\n constructor() EIP712(\"ZeroDevSessionKeyPlugin\", \"0.0.1\") {}\n\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\n bytes32 position = bytes32(uint256(keccak256(\"zero-dev.account.eip4337.sessionkey\")) - 1);\n assembly {\n s.slot := position\n }\n }\n\n // revoke session key\n function revokeSessionKey(address _key) external {\n getPolicyStorage().revoked[_key] = true;\n emit SessionKeyRevoked(_key);\n }\n\n function revoked(address _key) external view returns (bool) {\n return getPolicyStorage().revoked[_key];\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal view override returns (bool) {\n address sessionKey = address(bytes20(data[0:20]));\n require(!getPolicyStorage().revoked[sessionKey], \"session key revoked\");\n bytes32 merkleRoot = bytes32(data[20:52]);\n if(merkleRoot == bytes32(0)) {\n // means this session key has sudo permission\n signature = signature[33:98];\n } else {\n uint8 leafLength = uint8(signature[0]);\n bytes32[] memory proof;\n bytes32 leaf;\n if(leafLength == 20) {\n leaf = keccak256(signature[1:21]);\n proof = abi.decode(signature[86:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n signature = signature[21:86];\n } else if(leafLength == 24) {\n leaf = keccak256(signature[1:25]);\n proof = abi.decode(signature[90:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\n require(keccak256(sig) == keccak256(signature[21:25]));\n signature = signature[25:90];\n }\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"invalide merkle root\");\n }\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\"Session(bytes32 userOpHash,uint256 nonce)\"), // we are going to trust plugin for verification\n userOpHash,\n userOp.nonce\n )\n )\n );\n address recovered = digest.recover(signature);\n require(recovered == sessionKey, \"account: invalid signature\");\n return true;\n }\n}\n" + }, + "src/test/TestCounter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\ncontract TestCounter {\n uint256 public counter;\n function increment() public {\n counter += 1;\n }\n}" + }, + "src/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\nenum Operation {\n Call,\n DelegateCall\n}\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n function call(address to, uint256 value, bytes memory data)\n internal\n returns (bool success, bytes memory returnData)\n {\n assembly {\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\n assembly {\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\n assembly {\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "@openzeppelin/=lib/openzeppelin-contracts/", + "account-abstraction/=lib/account-abstraction/contracts/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "openzeppelin-contracts/=lib/openzeppelin-contracts/" + ] + } +} \ No newline at end of file diff --git a/deployments/bsc/.chainId b/deployments/bsc/.chainId new file mode 100644 index 00000000..2ebc6516 --- /dev/null +++ b/deployments/bsc/.chainId @@ -0,0 +1 @@ +56 \ No newline at end of file diff --git a/deployments/bsc/KernelFactory.json b/deployments/bsc/KernelFactory.json new file mode 100644 index 00000000..94a032a2 --- /dev/null +++ b/deployments/bsc/KernelFactory.json @@ -0,0 +1,140 @@ +{ + "address": "0x4E4946298614FC299B50c947289F4aD0572CB9ce", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "AccountCreated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "createAccount", + "outputs": [ + { + "internalType": "contract EIP1967Proxy", + "name": "proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getAccountAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kernelTemplate", + "outputs": [ + { + "internalType": "contract Kernel", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x1996d155cecf7ce4fef4cae9dbbc69ad6a11ccf807d17d7bb9fe3b23b4563442", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x8d8a9Cf53b7D95C148cB159384D249F8FB68db3f", + "contractAddress": null, + "transactionIndex": 60, + "gasUsed": "3643894", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7848f7cbc5c9bf4a0c6c4560593600bbe9e672c1dd493726ec70674e9ff9e5af", + "transactionHash": "0x1996d155cecf7ce4fef4cae9dbbc69ad6a11ccf807d17d7bb9fe3b23b4563442", + "logs": [], + "blockNumber": 27931519, + "cumulativeGasUsed": "9373259", + "status": 1, + "byzantium": true + }, + "args": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" + ], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IEntryPoint\",\"name\":\"_entryPoint\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"AccountCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"createAccount\",\"outputs\":[{\"internalType\":\"contract EIP1967Proxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getAccountAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kernelTemplate\",\"outputs\":[{\"internalType\":\"contract Kernel\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/KernelFactory.sol\":\"KernelFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/EntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n\\nimport \\\"../interfaces/IAccount.sol\\\";\\nimport \\\"../interfaces/IPaymaster.sol\\\";\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\nimport \\\"../utils/Exec.sol\\\";\\nimport \\\"./StakeManager.sol\\\";\\nimport \\\"./SenderCreator.sol\\\";\\nimport \\\"./Helpers.sol\\\";\\nimport \\\"./NonceManager.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\n\\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\\n\\n using UserOperationLib for UserOperation;\\n\\n SenderCreator private immutable senderCreator = new SenderCreator();\\n\\n // internal value used during simulation: need to query aggregator.\\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\\n\\n // marker for inner call revert on out of gas\\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\\n\\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\\n\\n /**\\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\\n * in case of signature failure, instead of revert.\\n */\\n uint256 public constant SIG_VALIDATION_FAILED = 1;\\n\\n /**\\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\\n * @param beneficiary the address to receive the fees\\n * @param amount amount to transfer.\\n */\\n function _compensate(address payable beneficiary, uint256 amount) internal {\\n require(beneficiary != address(0), \\\"AA90 invalid beneficiary\\\");\\n (bool success,) = beneficiary.call{value : amount}(\\\"\\\");\\n require(success, \\\"AA91 failed send to beneficiary\\\");\\n }\\n\\n /**\\n * execute a user op\\n * @param opIndex index into the opInfo array\\n * @param userOp the userOp to execute\\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\\n * @return collected the total amount this userOp paid.\\n */\\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\\n uint256 preGas = gasleft();\\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\\n\\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\\n collected = _actualGasCost;\\n } catch {\\n bytes32 innerRevertCode;\\n assembly {\\n returndatacopy(0, 0, 32)\\n innerRevertCode := mload(0)\\n }\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (innerRevertCode == INNER_OUT_OF_GAS) {\\n //report paymaster, since if it is not deliberately caused by the bundler,\\n // it must be a revert caused by paymaster.\\n revert FailedOp(opIndex, \\\"AA95 out of gas\\\");\\n }\\n\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\\n }\\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\\n\\n uint256 opslen = ops.length;\\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\\n\\n unchecked {\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[i];\\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\\n }\\n\\n uint256 collected = 0;\\n emit BeforeExecution();\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(i, ops[i], opInfos[i]);\\n }\\n\\n _compensate(beneficiary, collected);\\n } //unchecked\\n }\\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 ) public nonReentrant {\\n\\n uint256 opasLen = opsPerAggregator.length;\\n uint256 totalOps = 0;\\n for (uint256 i = 0; i < opasLen; i++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n //address(1) is special marker of \\\"signature error\\\"\\n require(address(aggregator) != address(1), \\\"AA96 invalid aggregator\\\");\\n\\n if (address(aggregator) != address(0)) {\\n // solhint-disable-next-line no-empty-blocks\\n try aggregator.validateSignatures(ops, opa.signature) {}\\n catch {\\n revert SignatureValidationFailed(address(aggregator));\\n }\\n }\\n\\n totalOps += ops.length;\\n }\\n\\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\\n\\n emit BeforeExecution();\\n\\n uint256 opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n uint256 opslen = ops.length;\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[opIndex];\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\\n opIndex++;\\n }\\n }\\n\\n uint256 collected = 0;\\n opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n emit SignatureAggregatorChanged(address(opa.aggregator));\\n UserOperation[] calldata ops = opa.userOps;\\n uint256 opslen = ops.length;\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\\n opIndex++;\\n }\\n }\\n emit SignatureAggregatorChanged(address(0));\\n\\n _compensate(beneficiary, collected);\\n }\\n\\n /// @inheritdoc IEntryPoint\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\\n\\n UserOpInfo memory opInfo;\\n _simulationOnlyValidations(op);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n\\n numberMarker();\\n uint256 paid = _executeUserOp(0, op, opInfo);\\n numberMarker();\\n bool targetSuccess;\\n bytes memory targetResult;\\n if (target != address(0)) {\\n (targetSuccess, targetResult) = target.call(targetCallData);\\n }\\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\\n }\\n\\n\\n // A memory copy of UserOp static fields only.\\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\\n struct MemoryUserOp {\\n address sender;\\n uint256 nonce;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n address paymaster;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n }\\n\\n struct UserOpInfo {\\n MemoryUserOp mUserOp;\\n bytes32 userOpHash;\\n uint256 prefund;\\n uint256 contextOffset;\\n uint256 preOpGas;\\n }\\n\\n /**\\n * inner function to handle a UserOperation.\\n * Must be declared \\\"external\\\" to open a call context, but it can only be called by handleOps.\\n */\\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n require(msg.sender == address(this), \\\"AA92 internal call only\\\");\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n\\n uint callGasLimit = mUserOp.callGasLimit;\\n unchecked {\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\\n assembly {\\n mstore(0, INNER_OUT_OF_GAS)\\n revert(0, 32)\\n }\\n }\\n }\\n\\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\\n if (callData.length > 0) {\\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\\n if (!success) {\\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\\n if (result.length > 0) {\\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\\n }\\n mode = IPaymaster.PostOpMode.opReverted;\\n }\\n }\\n\\n unchecked {\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\\n return _handlePostOp(0, mode, opInfo, context, actualGas);\\n }\\n }\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\\n }\\n\\n /**\\n * copy general fields from userOp into the memory opInfo structure.\\n */\\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\\n mUserOp.sender = userOp.sender;\\n mUserOp.nonce = userOp.nonce;\\n mUserOp.callGasLimit = userOp.callGasLimit;\\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\\n mUserOp.preVerificationGas = userOp.preVerificationGas;\\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes calldata paymasterAndData = userOp.paymasterAndData;\\n if (paymasterAndData.length > 0) {\\n require(paymasterAndData.length >= 20, \\\"AA93 invalid paymasterAndData\\\");\\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\\n } else {\\n mUserOp.paymaster = address(0);\\n }\\n }\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external {\\n UserOpInfo memory outOpInfo;\\n\\n _simulationOnlyValidations(userOp);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\\n StakeInfo memory factoryInfo;\\n {\\n bytes calldata initCode = userOp.initCode;\\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\\n factoryInfo = _getStakeInfo(factory);\\n }\\n\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n address aggregator = data.aggregator;\\n bool sigFailed = aggregator == address(1);\\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\\n\\n if (aggregator != address(0) && aggregator != address(1)) {\\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\\n }\\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\\n\\n }\\n\\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\\n unchecked {\\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\\n // our security model might call postOp eventually twice\\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\\n\\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\\n }\\n }\\n\\n // create the sender's contract if needed.\\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\\n if (initCode.length != 0) {\\n address sender = opInfo.mUserOp.sender;\\n if (sender.code.length != 0) revert FailedOp(opIndex, \\\"AA10 sender already constructed\\\");\\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\\n if (sender1 == address(0)) revert FailedOp(opIndex, \\\"AA13 initCode failed or OOG\\\");\\n if (sender1 != sender) revert FailedOp(opIndex, \\\"AA14 initCode must return sender\\\");\\n if (sender1.code.length == 0) revert FailedOp(opIndex, \\\"AA15 initCode must create sender\\\");\\n address factory = address(bytes20(initCode[0 : 20]));\\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\\n }\\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 calldata initCode) public {\\n address sender = senderCreator.createSender(initCode);\\n revert SenderAddressResult(sender);\\n }\\n\\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\\n // solhint-disable-next-line no-empty-blocks\\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\\n catch Error(string memory revertReason) {\\n if (bytes(revertReason).length != 0) {\\n revert FailedOp(0, revertReason);\\n }\\n }\\n }\\n\\n /**\\n * Called only during simulation.\\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\\n */\\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\\n if (initCode.length == 0 && sender.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA20 account not deployed\\\");\\n }\\n if (paymasterAndData.length >= 20) {\\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\\n if (paymaster.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA30 paymaster not deployed\\\");\\n }\\n }\\n // always revert\\n revert(\\\"\\\");\\n }\\n\\n /**\\n * call account.validateUserOp.\\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\\n * decrement account's deposit if needed\\n */\\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\\n unchecked {\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n address sender = mUserOp.sender;\\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\\n address paymaster = mUserOp.paymaster;\\n numberMarker();\\n uint256 missingAccountFunds = 0;\\n if (paymaster == address(0)) {\\n uint256 bal = balanceOf(sender);\\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\\n }\\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\\n returns (uint256 _validationData) {\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA23 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA23 reverted (or OOG)\\\");\\n }\\n if (paymaster == address(0)) {\\n DepositInfo storage senderInfo = deposits[sender];\\n uint256 deposit = senderInfo.deposit;\\n if (requiredPrefund > deposit) {\\n revert FailedOp(opIndex, \\\"AA21 didn't pay prefund\\\");\\n }\\n senderInfo.deposit = uint112(deposit - requiredPrefund);\\n }\\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\\n }\\n }\\n\\n /**\\n * In case the request has a paymaster:\\n * Validate paymaster has enough deposit.\\n * Call paymaster.validatePaymasterUserOp.\\n * Revert with proper FailedOp in case paymaster reverts.\\n * Decrement paymaster's deposit\\n */\\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\\n internal returns (bytes memory context, uint256 validationData) {\\n unchecked {\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \\\"AA41 too little verificationGas\\\");\\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\\n\\n address paymaster = mUserOp.paymaster;\\n DepositInfo storage paymasterInfo = deposits[paymaster];\\n uint256 deposit = paymasterInfo.deposit;\\n if (deposit < requiredPreFund) {\\n revert FailedOp(opIndex, \\\"AA31 paymaster deposit too low\\\");\\n }\\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\\n context = _context;\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA33 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA33 reverted (or OOG)\\\");\\n }\\n }\\n }\\n\\n /**\\n * revert if either account validationData or paymaster validationData is expired\\n */\\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\\n if (expectedAggregator != aggregator) {\\n revert FailedOp(opIndex, \\\"AA24 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA22 expired or not due\\\");\\n }\\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\\n address pmAggregator;\\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\\n if (pmAggregator != address(0)) {\\n revert FailedOp(opIndex, \\\"AA34 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA32 paymaster expired or not due\\\");\\n }\\n }\\n\\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\\n if (validationData == 0) {\\n return (address(0), false);\\n }\\n ValidationData memory data = _parseValidationData(validationData);\\n // solhint-disable-next-line not-rely-on-time\\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\\n aggregator = data.aggregator;\\n }\\n\\n /**\\n * validate account and paymaster (if defined).\\n * also make sure total validation doesn't exceed verificationGasLimit\\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\\n * @param opIndex the index of this userOp into the \\\"opInfos\\\" array\\n * @param userOp the userOp to validate\\n */\\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\\n private returns (uint256 validationData, uint256 paymasterValidationData) {\\n\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\\n _copyUserOpToMemory(userOp, mUserOp);\\n outOpInfo.userOpHash = getUserOpHash(userOp);\\n\\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\\n // and multiplied without causing overflow\\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\\n require(maxGasValues <= type(uint120).max, \\\"AA94 gas values overflow\\\");\\n\\n uint256 gasUsedByValidateAccountPrepayment;\\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\\n\\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\\n revert FailedOp(opIndex, \\\"AA25 invalid account nonce\\\");\\n }\\n\\n //a \\\"marker\\\" where account opcode validation is done and paymaster opcode validation is about to start\\n // (used only by off-chain simulateValidation)\\n numberMarker();\\n\\n bytes memory context;\\n if (mUserOp.paymaster != address(0)) {\\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\\n }\\n unchecked {\\n uint256 gasUsed = preGas - gasleft();\\n\\n if (userOp.verificationGasLimit < gasUsed) {\\n revert FailedOp(opIndex, \\\"AA40 over verificationGasLimit\\\");\\n }\\n outOpInfo.prefund = requiredPreFund;\\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\\n }\\n }\\n\\n /**\\n * process post-operation.\\n * called just after the callData is executed.\\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\\n * @param opIndex index in the batch\\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\\n * @param opInfo userOp fields and info collected during validation\\n * @param context the context returned in validatePaymasterUserOp\\n * @param actualGas the gas used so far by this user operation\\n */\\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n unchecked {\\n address refundAddress;\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\\n\\n address paymaster = mUserOp.paymaster;\\n if (paymaster == address(0)) {\\n refundAddress = mUserOp.sender;\\n } else {\\n refundAddress = paymaster;\\n if (context.length > 0) {\\n actualGasCost = actualGas * gasPrice;\\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\\n } else {\\n // solhint-disable-next-line no-empty-blocks\\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\\n catch Error(string memory reason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA50 postOp reverted: \\\", reason));\\n }\\n catch {\\n revert FailedOp(opIndex, \\\"AA50 postOp revert\\\");\\n }\\n }\\n }\\n }\\n actualGas += preGas - gasleft();\\n actualGasCost = actualGas * gasPrice;\\n if (opInfo.prefund < actualGasCost) {\\n revert FailedOp(opIndex, \\\"AA51 prefund below actualGasCost\\\");\\n }\\n uint256 refund = opInfo.prefund - actualGasCost;\\n _incrementDeposit(refundAddress, refund);\\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\\n } // unchecked\\n }\\n\\n /**\\n * the gas price this UserOp agrees to pay.\\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n */\\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\\n assembly {offset := data}\\n }\\n\\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\\n assembly {data := offset}\\n }\\n\\n //place the NUMBER opcode in the code.\\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\\n // account and paymaster.\\n function numberMarker() internal view {\\n assembly {mstore(0, number())}\\n }\\n}\\n\\n\",\"keccak256\":\"0x04f86318b47f052d7308795ffae6ecec0d023d2458b4e17751b89a0e4acfcdc6\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/NonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\n/**\\n * nonce management functionality\\n */\\ncontract NonceManager is INonceManager {\\n\\n /**\\n * The next valid sequence number for a given nonce key.\\n */\\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\\n\\n function getNonce(address sender, uint192 key)\\n public view override returns (uint256 nonce) {\\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\\n }\\n\\n // allow an account to manually increment its own nonce.\\n // (mainly so that during construction nonce can be made non-zero,\\n // to \\\"absorb\\\" the gas cost of first nonce increment to 1st transaction (construction),\\n // not to 2nd transaction)\\n function incrementNonce(uint192 key) public override {\\n nonceSequenceNumber[msg.sender][key]++;\\n }\\n\\n /**\\n * validate nonce uniqueness for this account.\\n * called just after validateUserOp()\\n */\\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\\n\\n uint192 key = uint192(nonce >> 64);\\n uint64 seq = uint64(nonce);\\n return nonceSequenceNumber[sender][key]++ == seq;\\n }\\n\\n}\\n\",\"keccak256\":\"0xa17a4a6fde70088ab18ffe6df830f3efa31f1cd0e1a7160336c96e3c94984d25\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/SenderCreator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/**\\n * helper contract for EntryPoint, to call userOp.initCode from a \\\"neutral\\\" address,\\n * which is explicitly not the entryPoint itself.\\n */\\ncontract SenderCreator {\\n\\n /**\\n * call the \\\"initCode\\\" factory to create and return the sender account address\\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\\n * @return sender the returned address of the created account, or zero address on failure.\\n */\\n function createSender(bytes calldata initCode) external returns (address sender) {\\n address factory = address(bytes20(initCode[0 : 20]));\\n bytes memory initCallData = initCode[20 :];\\n bool success;\\n /* solhint-disable no-inline-assembly */\\n assembly {\\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\\n sender := mload(0)\\n }\\n if (!success) {\\n sender = address(0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x44b9449fec82d6cdfb01d52fdd5a72f90099c651316123810cf9633f00b018c2\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/StakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IStakeManager.sol\\\";\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable not-rely-on-time */\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by a paymaster.\\n */\\nabstract contract StakeManager is IStakeManager {\\n\\n /// maps paymaster to their deposits and stakes\\n mapping(address => DepositInfo) public deposits;\\n\\n /// @inheritdoc IStakeManager\\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\\n return deposits[account];\\n }\\n\\n // internal method to return just the stake info\\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\\n DepositInfo storage depositInfo = deposits[addr];\\n info.stake = depositInfo.stake;\\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\\n }\\n\\n /// return the deposit (for gas payment) of the account\\n function balanceOf(address account) public view returns (uint256) {\\n return deposits[account].deposit;\\n }\\n\\n receive() external payable {\\n depositTo(msg.sender);\\n }\\n\\n function _incrementDeposit(address account, uint256 amount) internal {\\n DepositInfo storage info = deposits[account];\\n uint256 newAmount = info.deposit + amount;\\n require(newAmount <= type(uint112).max, \\\"deposit overflow\\\");\\n info.deposit = uint112(newAmount);\\n }\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) public payable {\\n _incrementDeposit(account, msg.value);\\n DepositInfo storage info = deposits[account];\\n emit Deposited(account, info.deposit);\\n }\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 unstakeDelaySec) public payable {\\n DepositInfo storage info = deposits[msg.sender];\\n require(unstakeDelaySec > 0, \\\"must specify unstake delay\\\");\\n require(unstakeDelaySec >= info.unstakeDelaySec, \\\"cannot decrease unstake time\\\");\\n uint256 stake = info.stake + msg.value;\\n require(stake > 0, \\\"no stake specified\\\");\\n require(stake <= type(uint112).max, \\\"stake overflow\\\");\\n deposits[msg.sender] = DepositInfo(\\n info.deposit,\\n true,\\n uint112(stake),\\n unstakeDelaySec,\\n 0\\n );\\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\\n }\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(info.unstakeDelaySec != 0, \\\"not staked\\\");\\n require(info.staked, \\\"already unstaking\\\");\\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\\n info.withdrawTime = withdrawTime;\\n info.staked = false;\\n emit StakeUnlocked(msg.sender, withdrawTime);\\n }\\n\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external {\\n DepositInfo storage info = deposits[msg.sender];\\n uint256 stake = info.stake;\\n require(stake > 0, \\\"No stake to withdraw\\\");\\n require(info.withdrawTime > 0, \\\"must call unlockStake() first\\\");\\n require(info.withdrawTime <= block.timestamp, \\\"Stake withdrawal is not due\\\");\\n info.unstakeDelaySec = 0;\\n info.withdrawTime = 0;\\n info.stake = 0;\\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\\n (bool success,) = withdrawAddress.call{value : stake}(\\\"\\\");\\n require(success, \\\"failed to withdraw stake\\\");\\n }\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(withdrawAmount <= info.deposit, \\\"Withdraw amount too large\\\");\\n info.deposit = uint112(info.deposit - withdrawAmount);\\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\\\"\\\");\\n require(success, \\\"failed to withdraw\\\");\\n }\\n}\\n\",\"keccak256\":\"0x21aa0956382bd000b1b8c3b1d19ca6ebcd6c9029eebb19c612fb38ee5dd2430a\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IPaymaster.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\\n */\\ninterface IPaymaster {\\n\\n enum PostOpMode {\\n opSucceeded, // user op succeeded\\n opReverted, // user op reverted. still has to pay for gas.\\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\\n }\\n\\n /**\\n * payment validation: check if paymaster agrees to pay.\\n * Must verify sender is the entryPoint.\\n * Revert to reject this request.\\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\\n * @param userOp the user operation\\n * @param userOpHash hash of the user's request data.\\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\\n * @return context value to send to a postOp\\n * zero length to signify postOp is not required.\\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\\n external returns (bytes memory context, uint256 validationData);\\n\\n /**\\n * post-operation handler.\\n * Must verify sender is the entryPoint\\n * @param mode enum with the following options:\\n * opSucceeded - user operation succeeded.\\n * opReverted - user op reverted. still has to pay for gas.\\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\\n * Now this is the 2nd call, after user's op was deliberately reverted.\\n * @param context - the context value returned by validatePaymasterUserOp\\n * @param actualGasCost - actual gas used so far (without this postOp call).\\n */\\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\\n}\\n\",\"keccak256\":\"0x36858ba8685024974f533530420688da3454d29996ebc42e410673a1ed2ec456\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n\\n function call(\\n address to,\\n uint256 value,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function staticcall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal view returns (bool success) {\\n assembly {\\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function delegateCall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n // get returned data from last call or calldelegate\\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\\n assembly {\\n let len := returndatasize()\\n if gt(len, maxLen) {\\n len := maxLen\\n }\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n // revert with explicit byte array (probably reverted info from call)\\n function revertWithData(bytes memory returnData) internal pure {\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n\\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\\n bool success = call(to,0,data,gasleft());\\n if (!success) {\\n revertWithData(getReturnData(maxLen));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b232117afbc2939f3ffc92745614867e9e1d475a3e1e5443adae13c200174f1\",\"license\":\"LGPL-3.0-only\"},\"lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x190dd6f8d592b7e4e930feb7f4313aeb8e1c4ad3154c27ce1cf6a512fc30d8cc\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(\\n uint256 amount,\\n bytes32 salt,\\n bytes memory bytecode\\n ) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(\\n bytes32 salt,\\n bytes32 bytecodeHash,\\n address deployer\\n ) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xafc07f37809f74d9c66d6461cc0f85fb5147ab855acd0acc30af4b2272130c61\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/Kernel.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"./plugin/IPlugin.sol\\\";\\nimport \\\"account-abstraction/core/Helpers.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport {EntryPoint} from \\\"account-abstraction/core/EntryPoint.sol\\\";\\nimport \\\"./utils/Exec.sol\\\";\\nimport \\\"./abstract/Compatibility.sol\\\";\\nimport \\\"./abstract/KernelStorage.sol\\\";\\n\\n/// @title Kernel\\n/// @author taek\\n/// @notice wallet kernel for minimal wallet functionality\\n/// @dev supports only 1 owner, multiple plugins\\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\\n error InvalidNonce();\\n error InvalidSignatureLength();\\n error QueryResult(bytes result);\\n\\n string public constant name = \\\"Kernel\\\";\\n\\n string public constant version = \\\"0.0.1\\\";\\n\\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\\n\\n /// @notice initialize wallet kernel\\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\\n /// @param _owner owner address\\n function initialize(address _owner) external {\\n WalletKernelStorage storage ws = getKernelStorage();\\n require(ws.owner == address(0), \\\"account: already initialized\\\");\\n ws.owner = _owner;\\n }\\n\\n /// @notice Query plugin for data\\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\\n /// @param _plugin Plugin address\\n /// @param _data Data to query\\n function queryPlugin(address _plugin, bytes calldata _data) external {\\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\\n if (success) {\\n revert QueryResult(_ret);\\n } else {\\n assembly {\\n revert(add(_ret, 32), mload(_ret))\\n }\\n }\\n }\\n\\n /// @notice execute function call to external contract\\n /// @dev this function will execute function call to external contract\\n /// @param to target contract address\\n /// @param value value to be sent\\n /// @param data data to be sent\\n /// @param operation operation type (call or delegatecall)\\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\\n \\\"account: not from entrypoint or owner\\\"\\n );\\n bool success;\\n bytes memory ret;\\n if (operation == Operation.DelegateCall) {\\n (success, ret) = Exec.delegateCall(to, data);\\n } else {\\n (success, ret) = Exec.call(to, value, data);\\n }\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n }\\n\\n /// @notice validate user operation\\n /// @dev this function will validate user operation and be called by EntryPoint\\n /// @param userOp user operation\\n /// @param userOpHash user operation hash\\n /// @param missingAccountFunds funds needed to be reimbursed\\n /// @return validationData validation data\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (uint256 validationData)\\n {\\n require(msg.sender == address(entryPoint), \\\"account: not from entryPoint\\\");\\n if (userOp.signature.length == 65) {\\n validationData = _validateUserOp(userOp, userOpHash);\\n } else if (userOp.signature.length > 97) {\\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\\n address plugin = address(bytes20(userOp.signature[0:20]));\\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\\n bytes memory signature = userOp.signature[32:97];\\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\\\"\\n ), // we are going to trust plugin for verification\\n plugin,\\n validUntil,\\n validAfter,\\n keccak256(data)\\n )\\n )\\n );\\n\\n address signer = ECDSA.recover(digest, signature);\\n if (getKernelStorage().owner != signer) {\\n return SIG_VALIDATION_FAILED;\\n }\\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\\n bool res = abi.decode(ret, (bool));\\n if (!res) {\\n return SIG_VALIDATION_FAILED;\\n }\\n validationData = _packValidationData(!res, validUntil, validAfter);\\n } else {\\n revert InvalidSignatureLength();\\n }\\n if (missingAccountFunds > 0) {\\n // we are going to assume signature is valid at this point\\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\\\"\\\");\\n (success);\\n return validationData;\\n }\\n }\\n\\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\\n internal\\n view\\n returns (uint256 validationData)\\n {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\\n return validationData;\\n }\\n\\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\\n address recovered = ECDSA.recover(hash, userOp.signature);\\n if (ws.owner != recovered) {\\n return SIG_VALIDATION_FAILED;\\n }\\n }\\n\\n /**\\n * delegate the contract call to the plugin\\n */\\n function _delegateToPlugin(\\n address plugin,\\n UserOperation calldata userOp,\\n bytes32 opHash,\\n uint256 missingAccountFunds\\n ) internal returns (bytes memory) {\\n bytes memory data =\\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n return ret;\\n }\\n\\n /// @notice validate signature using eip1271\\n /// @dev this function will validate signature using eip1271\\n /// @param _hash hash to be signed\\n /// @param _signature signature\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\\n return 0x1626ba7e;\\n }\\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\\n address recovered = ECDSA.recover(hash, _signature);\\n // Validate signatures\\n if (ws.owner == recovered) {\\n return 0x1626ba7e;\\n } else {\\n return 0xffffffff;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xee1651f7212298696da5a773709d0a33ee272ae8c06e31824655e71a2228ae25\",\"license\":\"MIT\"},\"src/KernelFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/Create2.sol\\\";\\nimport \\\"./factory/EIP1967Proxy.sol\\\";\\nimport \\\"./Kernel.sol\\\";\\n\\ncontract KernelFactory {\\n Kernel public immutable kernelTemplate;\\n\\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\\n\\n constructor(IEntryPoint _entryPoint) {\\n kernelTemplate = new Kernel(_entryPoint);\\n }\\n\\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n address addr = Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n if (addr.code.length > 0) {\\n return EIP1967Proxy(payable(addr));\\n }\\n proxy =\\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\\n emit AccountCreated(address(proxy), _owner, _index);\\n }\\n\\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n return Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x53a5dbafaf7d000de850be785d4c2d883980acf1772d231b510c122640ccf789\",\"license\":\"MIT\"},\"src/abstract/Compatibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract Compatibility {\\n receive() external payable {}\\n\\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n\\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\\n external\\n pure\\n returns (bytes4)\\n {\\n return this.onERC1155BatchReceived.selector;\\n }\\n\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\\n}\\n\",\"keccak256\":\"0x0d4634886db9ce6c2321db3a9bbbe0883cffe654cbce75dcfc9df1ec7eedb0b8\",\"license\":\"MIT\"},\"src/abstract/KernelStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\n\\nstruct WalletKernelStorage {\\n address owner;\\n}\\n\\ncontract KernelStorage {\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n IEntryPoint public immutable entryPoint;\\n\\n event Upgraded(address indexed newImplementation);\\n\\n // modifier for checking if the sender is the entrypoint or\\n // the account itself\\n modifier onlyFromEntryPointOrOwnerOrSelf() {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\\n \\\"account: not from entrypoint or owner or self\\\"\\n );\\n _;\\n }\\n\\n constructor(IEntryPoint _entryPoint) {\\n entryPoint = _entryPoint;\\n getKernelStorage().owner = address(1);\\n }\\n /// @notice get wallet kernel storage\\n /// @dev used to get wallet kernel storage\\n /// @return ws wallet kernel storage, consists of owner and nonces\\n\\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\\n bytes32 storagePosition = bytes32(uint256(keccak256(\\\"zerodev.kernel\\\")) - 1);\\n assembly {\\n ws.slot := storagePosition\\n }\\n }\\n\\n function getOwner() external view returns (address) {\\n return getKernelStorage().owner;\\n }\\n\\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n assembly {\\n sstore(slot, _newImplementation)\\n }\\n emit Upgraded(_newImplementation);\\n }\\n\\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\\n getKernelStorage().owner = _newOwner;\\n }\\n\\n function getNonce() public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), 0);\\n }\\n\\n function getNonce(uint192 key) public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), key);\\n }\\n}\\n \",\"keccak256\":\"0xe4512794b67794cf90eba665aee57b75efa60f2aacd1cc45eb17d3f3b255008c\",\"license\":\"MIT\"},\"src/factory/EIP1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ncontract EIP1967Proxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n constructor(address _logic, bytes memory _data) payable {\\n require(_logic != address(0), \\\"EIP1967Proxy: implementation is the zero address\\\");\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n sstore(slot, _logic)\\n }\\n if (_data.length > 0) {\\n (bool success,) = _logic.delegatecall(_data);\\n require(success, \\\"EIP1967Proxy: constructor call failed\\\");\\n }\\n }\\n\\n fallback() external payable {\\n address implementation = _implementation();\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n function _implementation() internal view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xbec8942c8258db6379a08dcb3b0a4aa0ee585972f26eba258c35ece87972d78b\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\nenum Operation {\\n Call,\\n DelegateCall\\n}\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n function call(address to, uint256 value, bytes memory data)\\n internal\\n returns (bool success, bytes memory returnData)\\n {\\n assembly {\\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\\n assembly {\\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\\n assembly {\\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1eef311d5073ff7f02b44311ae4d5c53f619ea19f1a059b8d17c028d141c2893\",\"license\":\"LGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b506040516200466d3803806200466d833981810160405281019062000037919062000136565b806040516200004690620000aa565b620000529190620001d3565b604051809103906000f0801580156200006f573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505050620001f0565b613527806200114683390190565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000ea82620000bd565b9050919050565b6000620000fe82620000dd565b9050919050565b6200011081620000f1565b81146200011c57600080fd5b50565b600081519050620001308162000105565b92915050565b6000602082840312156200014f576200014e620000b8565b5b60006200015f848285016200011f565b91505092915050565b6000819050919050565b6000620001936200018d6200018784620000bd565b62000168565b620000bd565b9050919050565b6000620001a78262000172565b9050919050565b6000620001bb826200019a565b9050919050565b620001cd81620001ae565b82525050565b6000602082019050620001ea6000830184620001c2565b92915050565b608051610f26620002206000396000818160db0152818161015a0152818161028a01526103830152610f266000f3fe60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c634300081200336101606040523480156200001257600080fd5b5060405162003527380380620035278339818101604052810190620000389190620002e2565b806040518060400160405280600681526020017f4b65726e656c00000000000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a081815250506200010e818484620001e760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050508073ffffffffffffffffffffffffffffffffffffffff166101408173ffffffffffffffffffffffffffffffffffffffff168152505060016200019e6200022360201b60201c565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505062000422565b60008383834630604051602001620002049594939291906200035b565b6040516020818303038152906040528051906020012090509392505050565b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c620002589190620003e7565b60001b90508091505090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002968262000269565b9050919050565b6000620002aa8262000289565b9050919050565b620002bc816200029d565b8114620002c857600080fd5b50565b600081519050620002dc81620002b1565b92915050565b600060208284031215620002fb57620002fa62000264565b5b60006200030b84828501620002cb565b91505092915050565b6000819050919050565b620003298162000314565b82525050565b6000819050919050565b62000344816200032f565b82525050565b620003558162000289565b82525050565b600060a0820190506200037260008301886200031e565b6200038160208301876200031e565b6200039060408301866200031e565b6200039f606083018562000339565b620003ae60808301846200034a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000620003f4826200032f565b915062000401836200032f565b92508282039050818111156200041c576200041b620003b8565b5b92915050565b60805160a05160c05160e051610100516101205161014051613080620004a76000396000818161057a0152818161071301528181610b1501528181610c2401528181610e0b01528181610f2f0152610fe701526000611800015260006118420152600061182101526000611756015260006117ac015260006117d501526130806000f3fe6080604052600436106100f75760003560e01c8063940d3c601161008a578063d087d28811610059578063d087d2881461035b578063f23a6e6114610386578063f2fde38b146103c3578063f333df55146103ec576100fe565b8063940d3c60146102a1578063b0d691fe146102ca578063bc197c81146102f5578063c4d66de814610332576100fe565b80633a871cdd116100c65780633a871cdd146101d15780633e1b08121461020e57806354fd4d501461024b578063893d20e814610276576100fe565b806306fdde0314610103578063150b7a021461012e5780631626ba7e1461016b5780633659cfe6146101a8576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b50610118610415565b6040516101259190611a4b565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611b7a565b61044e565b6040516101629190611c3d565b60405180910390f35b34801561017757600080fd5b50610192600480360381019061018d9190611dbe565b610463565b60405161019f9190611c3d565b60405180910390f35b3480156101b457600080fd5b506101cf60048036038101906101ca9190611e1a565b610578565b005b3480156101dd57600080fd5b506101f860048036038101906101f39190611e6c565b61070f565b6040516102059190611eea565b60405180910390f35b34801561021a57600080fd5b5061023560048036038101906102309190611f55565b610b11565b6040516102429190611eea565b60405180910390f35b34801561025757600080fd5b50610260610bb6565b60405161026d9190611a4b565b60405180910390f35b34801561028257600080fd5b5061028b610bef565b6040516102989190611f91565b60405180910390f35b3480156102ad57600080fd5b506102c860048036038101906102c39190611fd1565b610c22565b005b3480156102d657600080fd5b506102df610e09565b6040516102ec91906120b8565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612129565b610e2d565b6040516103299190611c3d565b60405180910390f35b34801561033e57600080fd5b5061035960048036038101906103549190611e1a565b610e45565b005b34801561036757600080fd5b50610370610f2b565b60405161037d9190611eea565b60405180910390f35b34801561039257600080fd5b506103ad60048036038101906103a89190612205565b610fcf565b6040516103ba9190611c3d565b60405180910390f35b3480156103cf57600080fd5b506103ea60048036038101906103e59190611e1a565b610fe5565b005b3480156103f857600080fd5b50610413600480360381019061040e919061229f565b611157565b005b6040518060400160405280600681526020017f4b65726e656c000000000000000000000000000000000000000000000000000081525081565b600063150b7a0260e01b905095945050505050565b60008061046e6111f7565b905061047a8484611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036104e057631626ba7e60e01b915050610572565b60006104eb8561125d565b905060006104f98286611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361056457631626ba7e60e01b9350505050610572565b63ffffffff60e01b93505050505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061062857506105d56111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061065e57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61069d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069490612371565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508181558173ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a25050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461079f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610796906123dd565b60405180910390fd5b6041848061014001906107b2919061240c565b9050036107ca576107c3848461128d565b9050610a8e565b6061848061014001906107dd919061240c565b90501115610a5b576000848061014001906107f8919061240c565b60009060149261080a93929190612479565b9061081591906124f8565b60601c905060008580610140019061082d919061240c565b601490601a9261083f93929190612479565b9061084a9190612583565b60d01c9050600086806101400190610862919061240c565b601a9060209261087493929190612479565b9061087f9190612583565b60d01c9050600087806101400190610897919061240c565b6020906061926108a993929190612479565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050600088806101400190610901919061240c565b606190809261091293929190612479565b81019061091f91906125e2565b50905060006109827f4584533bad8bbd8aa77024a548a56acb8d2807847381ce1b3364745ca396b2e3878787868051906020012060405160200161096795949392919061268a565b6040516020818303038152906040528051906020012061142e565b905060006109908285611236565b90508073ffffffffffffffffffffffffffffffffffffffff166109b16111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a00576001975050505050505050610b0a565b6000610a0e888d8d8d611448565b9050600081806020019051810190610a269190612715565b905080610a3f5760019950505050505050505050610b0a565b610a4b811589896114f4565b9950505050505050505050610a8d565b6040517f4be6321b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b6000821115610b095760003373ffffffffffffffffffffffffffffffffffffffff1683604051610abd90612773565b60006040518083038185875af1925050503d8060008114610afa576040519150601f19603f3d011682016040523d82523d6000602084013e610aff565b606091505b5050905050610b0a565b5b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a30846040518363ffffffff1660e01b8152600401610b6e929190612797565b602060405180830381865afa158015610b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baf91906127d5565b9050919050565b6040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b6000610bf96111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610cd25750610c7f6111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610d11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0890612874565b60405180910390fd5b60006060600180811115610d2857610d27612894565b5b836001811115610d3b57610d3a612894565b5b03610d9b57610d8e8786868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b8092508193505050610df3565b610dea878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611563565b80925081935050505b81610e0057805160208201fd5b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063bc197c8160e01b905098975050505050505050565b6000610e4f6111f7565b9050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610edb9061290f565b60405180910390fd5b818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a3060006040518363ffffffff1660e01b8152600401610f8992919061296a565b602060405180830381865afa158015610fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fca91906127d5565b905090565b600063f23a6e6160e01b90509695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061109557506110426111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806110cb57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61110a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110190612371565b60405180910390fd5b806111136111f7565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806111a88585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b9150915081156111ef57806040517fa52b21690000000000000000000000000000000000000000000000000000000081526004016111e691906129e8565b60405180910390fd5b805160208201fd5b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c61122a9190612a39565b60001b90508091505090565b6000806000611245858561159b565b91509150611252816115ec565b819250505092915050565b6000816040516020016112709190612ae5565b604051602081830303815290604052805190602001209050919050565b6000806112986111f7565b90506112f783858061014001906112af919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036113535750611428565b600061135e8461125d565b905060006113bf8287806101400190611377919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114245760019350505050611428565b5050505b92915050565b600061144161143b611752565b8361186c565b9050919050565b60606000639e2045ce60e01b85858560405160240161146993929190612d6b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000806114d5888461152d565b91509150816114e657805160208201fd5b809350505050949350505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b8561151c57600061151f565b60015b60ff16171790509392505050565b60006060600080845160208601875af491503d604051602082018101604052818152816000602083013e80925050509250929050565b6000606060008084516020860187895af191503d604051602082018101604052818152816000602083013e8092505050935093915050565b60008060418351036115dc5760008060006020860151925060408601519150606086015160001a90506115d08782858561189f565b945094505050506115e5565b60006002915091505b9250929050565b60006004811115611600576115ff612894565b5b81600481111561161357611612612894565b5b031561174f576001600481111561162d5761162c612894565b5b8160048111156116405761163f612894565b5b03611680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167790612df5565b60405180910390fd5b6002600481111561169457611693612894565b5b8160048111156116a7576116a6612894565b5b036116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116de90612e61565b60405180910390fd5b600360048111156116fb576116fa612894565b5b81600481111561170e5761170d612894565b5b0361174e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174590612ef3565b60405180910390fd5b5b50565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161480156117ce57507f000000000000000000000000000000000000000000000000000000000000000046145b156117fb577f00000000000000000000000000000000000000000000000000000000000000009050611869565b6118667f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611981565b90505b90565b60008282604051602001611881929190612f5f565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c11156118da576000600391509150611978565b6000600187878787604051600081526020016040526040516118ff9493929190612fb2565b6020604051602081039080840390855afa158015611921573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361196f57600060019250925050611978565b80600092509250505b94509492505050565b6000838383463060405160200161199c959493929190612ff7565b6040516020818303038152906040528051906020012090509392505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156119f55780820151818401526020810190506119da565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a1d826119bb565b611a2781856119c6565b9350611a378185602086016119d7565b611a4081611a01565b840191505092915050565b60006020820190508181036000830152611a658184611a12565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611aac82611a81565b9050919050565b611abc81611aa1565b8114611ac757600080fd5b50565b600081359050611ad981611ab3565b92915050565b6000819050919050565b611af281611adf565b8114611afd57600080fd5b50565b600081359050611b0f81611ae9565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611b3a57611b39611b15565b5b8235905067ffffffffffffffff811115611b5757611b56611b1a565b5b602083019150836001820283011115611b7357611b72611b1f565b5b9250929050565b600080600080600060808688031215611b9657611b95611a77565b5b6000611ba488828901611aca565b9550506020611bb588828901611aca565b9450506040611bc688828901611b00565b935050606086013567ffffffffffffffff811115611be757611be6611a7c565b5b611bf388828901611b24565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611c3781611c02565b82525050565b6000602082019050611c526000830184611c2e565b92915050565b6000819050919050565b611c6b81611c58565b8114611c7657600080fd5b50565b600081359050611c8881611c62565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611ccb82611a01565b810181811067ffffffffffffffff82111715611cea57611ce9611c93565b5b80604052505050565b6000611cfd611a6d565b9050611d098282611cc2565b919050565b600067ffffffffffffffff821115611d2957611d28611c93565b5b611d3282611a01565b9050602081019050919050565b82818337600083830152505050565b6000611d61611d5c84611d0e565b611cf3565b905082815260208101848484011115611d7d57611d7c611c8e565b5b611d88848285611d3f565b509392505050565b600082601f830112611da557611da4611b15565b5b8135611db5848260208601611d4e565b91505092915050565b60008060408385031215611dd557611dd4611a77565b5b6000611de385828601611c79565b925050602083013567ffffffffffffffff811115611e0457611e03611a7c565b5b611e1085828601611d90565b9150509250929050565b600060208284031215611e3057611e2f611a77565b5b6000611e3e84828501611aca565b91505092915050565b600080fd5b60006101608284031215611e6357611e62611e47565b5b81905092915050565b600080600060608486031215611e8557611e84611a77565b5b600084013567ffffffffffffffff811115611ea357611ea2611a7c565b5b611eaf86828701611e4c565b9350506020611ec086828701611c79565b9250506040611ed186828701611b00565b9150509250925092565b611ee481611adf565b82525050565b6000602082019050611eff6000830184611edb565b92915050565b600077ffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b611f3281611f05565b8114611f3d57600080fd5b50565b600081359050611f4f81611f29565b92915050565b600060208284031215611f6b57611f6a611a77565b5b6000611f7984828501611f40565b91505092915050565b611f8b81611aa1565b82525050565b6000602082019050611fa66000830184611f82565b92915050565b60028110611fb957600080fd5b50565b600081359050611fcb81611fac565b92915050565b600080600080600060808688031215611fed57611fec611a77565b5b6000611ffb88828901611aca565b955050602061200c88828901611b00565b945050604086013567ffffffffffffffff81111561202d5761202c611a7c565b5b61203988828901611b24565b9350935050606061204c88828901611fbc565b9150509295509295909350565b6000819050919050565b600061207e61207961207484611a81565b612059565b611a81565b9050919050565b600061209082612063565b9050919050565b60006120a282612085565b9050919050565b6120b281612097565b82525050565b60006020820190506120cd60008301846120a9565b92915050565b60008083601f8401126120e9576120e8611b15565b5b8235905067ffffffffffffffff81111561210657612105611b1a565b5b60208301915083602082028301111561212257612121611b1f565b5b9250929050565b60008060008060008060008060a0898b03121561214957612148611a77565b5b60006121578b828c01611aca565b98505060206121688b828c01611aca565b975050604089013567ffffffffffffffff81111561218957612188611a7c565b5b6121958b828c016120d3565b9650965050606089013567ffffffffffffffff8111156121b8576121b7611a7c565b5b6121c48b828c016120d3565b9450945050608089013567ffffffffffffffff8111156121e7576121e6611a7c565b5b6121f38b828c01611b24565b92509250509295985092959890939650565b60008060008060008060a0878903121561222257612221611a77565b5b600061223089828a01611aca565b965050602061224189828a01611aca565b955050604061225289828a01611b00565b945050606061226389828a01611b00565b935050608087013567ffffffffffffffff81111561228457612283611a7c565b5b61229089828a01611b24565b92509250509295509295509295565b6000806000604084860312156122b8576122b7611a77565b5b60006122c686828701611aca565b935050602084013567ffffffffffffffff8111156122e7576122e6611a7c565b5b6122f386828701611b24565b92509250509250925092565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572206f722073656c6600000000000000000000000000000000000000602082015250565b600061235b602d836119c6565b9150612366826122ff565b604082019050919050565b6000602082019050818103600083015261238a8161234e565b9050919050565b7f6163636f756e743a206e6f742066726f6d20656e747279506f696e7400000000600082015250565b60006123c7601c836119c6565b91506123d282612391565b602082019050919050565b600060208201905081810360008301526123f6816123ba565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612429576124286123fd565b5b80840192508235915067ffffffffffffffff82111561244b5761244a612402565b5b60208301925060018202360383131561246757612466612407565b5b509250929050565b600080fd5b600080fd5b6000808585111561248d5761248c61246f565b5b8386111561249e5761249d612474565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b600061250483836124b4565b8261250f81356124bf565b9250601482101561254f5761254a7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026124eb565b831692505b505092915050565b60007fffffffffffff000000000000000000000000000000000000000000000000000082169050919050565b600061258f83836124b4565b8261259a8135612557565b925060068210156125da576125d57fffffffffffff0000000000000000000000000000000000000000000000000000836006036008026124eb565b831692505b505092915050565b600080604083850312156125f9576125f8611a77565b5b600083013567ffffffffffffffff81111561261757612616611a7c565b5b61262385828601611d90565b925050602083013567ffffffffffffffff81111561264457612643611a7c565b5b61265085828601611d90565b9150509250929050565b61266381611c58565b82525050565b600065ffffffffffff82169050919050565b61268481612669565b82525050565b600060a08201905061269f600083018861265a565b6126ac6020830187611f82565b6126b9604083018661267b565b6126c6606083018561267b565b6126d3608083018461265a565b9695505050505050565b60008115159050919050565b6126f2816126dd565b81146126fd57600080fd5b50565b60008151905061270f816126e9565b92915050565b60006020828403121561272b5761272a611a77565b5b600061273984828501612700565b91505092915050565b600081905092915050565b50565b600061275d600083612742565b91506127688261274d565b600082019050919050565b600061277e82612750565b9150819050919050565b61279181611f05565b82525050565b60006040820190506127ac6000830185611f82565b6127b96020830184612788565b9392505050565b6000815190506127cf81611ae9565b92915050565b6000602082840312156127eb576127ea611a77565b5b60006127f9848285016127c0565b91505092915050565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b600061285e6025836119c6565b915061286982612802565b604082019050919050565b6000602082019050818103600083015261288d81612851565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6163636f756e743a20616c726561647920696e697469616c697a656400000000600082015250565b60006128f9601c836119c6565b9150612904826128c3565b602082019050919050565b60006020820190508181036000830152612928816128ec565b9050919050565b6000819050919050565b600061295461294f61294a8461292f565b612059565b611f05565b9050919050565b61296481612939565b82525050565b600060408201905061297f6000830185611f82565b61298c602083018461295b565b9392505050565b600081519050919050565b600082825260208201905092915050565b60006129ba82612993565b6129c4818561299e565b93506129d48185602086016119d7565b6129dd81611a01565b840191505092915050565b60006020820190508181036000830152612a0281846129af565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a4482611adf565b9150612a4f83611adf565b9250828203905081811115612a6757612a66612a0a565b5b92915050565b600081905092915050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000612aae601c83612a6d565b9150612ab982612a78565b601c82019050919050565b6000819050919050565b612adf612ada82611c58565b612ac4565b82525050565b6000612af082612aa1565b9150612afc8284612ace565b60208201915081905092915050565b6000612b1a6020840184611aca565b905092915050565b612b2b81611aa1565b82525050565b6000612b406020840184611b00565b905092915050565b612b5181611adf565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612b8357612b82612b61565b5b83810192508235915060208301925067ffffffffffffffff821115612bab57612baa612b57565b5b600182023603831315612bc157612bc0612b5c565b5b509250929050565b600082825260208201905092915050565b6000612be68385612bc9565b9350612bf3838584611d3f565b612bfc83611a01565b840190509392505050565b60006101608301612c1b6000840184612b0b565b612c286000860182612b22565b50612c366020840184612b31565b612c436020860182612b48565b50612c516040840184612b66565b8583036040870152612c64838284612bda565b92505050612c756060840184612b66565b8583036060870152612c88838284612bda565b92505050612c996080840184612b31565b612ca66080860182612b48565b50612cb460a0840184612b31565b612cc160a0860182612b48565b50612ccf60c0840184612b31565b612cdc60c0860182612b48565b50612cea60e0840184612b31565b612cf760e0860182612b48565b50612d06610100840184612b31565b612d14610100860182612b48565b50612d23610120840184612b66565b858303610120870152612d37838284612bda565b92505050612d49610140840184612b66565b858303610140870152612d5d838284612bda565b925050508091505092915050565b60006060820190508181036000830152612d858186612c07565b9050612d94602083018561265a565b612da16040830184611edb565b949350505050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000612ddf6018836119c6565b9150612dea82612da9565b602082019050919050565b60006020820190508181036000830152612e0e81612dd2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000612e4b601f836119c6565b9150612e5682612e15565b602082019050919050565b60006020820190508181036000830152612e7a81612e3e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000612edd6022836119c6565b9150612ee882612e81565b604082019050919050565b60006020820190508181036000830152612f0c81612ed0565b9050919050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000612f49600283612a6d565b9150612f5482612f13565b600282019050919050565b6000612f6a82612f3c565b9150612f768285612ace565b602082019150612f868284612ace565b6020820191508190509392505050565b600060ff82169050919050565b612fac81612f96565b82525050565b6000608082019050612fc7600083018761265a565b612fd46020830186612fa3565b612fe1604083018561265a565b612fee606083018461265a565b95945050505050565b600060a08201905061300c600083018861265a565b613019602083018761265a565b613026604083018661265a565b6130336060830185611edb565b6130406080830184611f82565b969550505050505056fea264697066735822122032ca1cf88a7b31318141bd230c1cabd5f99c4503ed694966da441ea9decb738c64736f6c63430008120033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/bsc/ZeroDevSessionKeyPlugin.json b/deployments/bsc/ZeroDevSessionKeyPlugin.json new file mode 100644 index 00000000..d40d77b4 --- /dev/null +++ b/deployments/bsc/ZeroDevSessionKeyPlugin.json @@ -0,0 +1,201 @@ +{ + "address": "0x6E2631aF80bF7a9cEE83F590eE496bCc2E40626D", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "key", + "type": "address" + } + ], + "name": "SessionKeyRevoked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_packed", + "type": "bytes" + } + ], + "name": "parseDataAndSignature", + "outputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revokeSessionKey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revoked", + "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": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "missingAccountFunds", + "type": "uint256" + } + ], + "name": "validatePluginData", + "outputs": [ + { + "internalType": "bool", + "name": "validated", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x53112219e534e41a623afa236976e25b64646934f66d924345e8be166d31f534", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x8d8a9Cf53b7D95C148cB159384D249F8FB68db3f", + "contractAddress": null, + "transactionIndex": 55, + "gasUsed": "1716069", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0156605cb8af3f6350be377c028adc6eda0025e52d2ee34e21503cc1c9b3b534", + "transactionHash": "0x53112219e534e41a623afa236976e25b64646934f66d924345e8be166d31f534", + "logs": [], + "blockNumber": 27931521, + "cumulativeGasUsed": "5705224", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"key\",\"type\":\"address\"}],\"name\":\"SessionKeyRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_packed\",\"type\":\"bytes\"}],\"name\":\"parseDataAndSignature\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revokeSessionKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revoked\",\"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\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"missingAccountFunds\",\"type\":\"uint256\"}],\"name\":\"validatePluginData\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"validated\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/plugin/ZeroDevSessionKeyPlugin.sol\":\"ZeroDevSessionKeyPlugin\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Tree proofs.\\n *\\n * The tree and the proofs can be generated using our\\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\\n * You will find a quickstart guide in the readme.\\n *\\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\\n * hashing, or use a hash function other than keccak256 for hashing leaves.\\n * This is because the concatenation of a sorted pair of internal nodes in\\n * the merkle tree could be reinterpreted as a leaf value.\\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\\n * against this attack out of the box.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {verify}\\n *\\n * _Available since v4.7._\\n */\\n function verifyCalldata(\\n bytes32[] calldata proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProofCalldata(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Calldata version of {processProof}\\n *\\n * _Available since v4.7._\\n */\\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerify(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProof(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {multiProofVerify}\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerifyCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\\n * respectively.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProof(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n /**\\n * @dev Calldata version of {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProofCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd466e8b07f4c6220eac16da5127f3ff142e65f0c15c03c7d38f257b02c8585e1\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/plugin/ZeroDevBasePlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport \\\"./IPlugin.sol\\\";\\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n override\\n returns (bool validated)\\n {\\n // data offset starts at 97\\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\\n validated = _validatePluginData(userOp, userOpHash, data, signature);\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal virtual returns (bool success);\\n\\n function parseDataAndSignature(bytes calldata _packed)\\n public\\n pure\\n returns (bytes calldata data, bytes calldata signature)\\n {\\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\\n\\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \\\"invalid data\\\");\\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \\\"invalid signature\\\");\\n }\\n}\\n\",\"keccak256\":\"0x600b768ba7d0766b2968c0d9bd6cd21154f14694eeb1e1a745d110d0fcb854e8\",\"license\":\"MIT\"},\"src/plugin/ZeroDevSessionKeyPlugin.sol\":{\"content\":\"//SPDX-License-Identifier: GPL\\npragma solidity ^0.8.7;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./ZeroDevBasePlugin.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\\\";\\nusing ECDSA for bytes32;\\n/**\\n * Main EIP4337 module.\\n * Called (through the fallback module) using \\\"delegate\\\" from the GnosisSafe as an \\\"IAccount\\\",\\n * so must implement validateUserOp\\n * holds an immutable reference to the EntryPoint\\n */\\n\\nstruct ZeroDevSessionKeyStorageStruct {\\n mapping(address => bool) revoked;\\n}\\n\\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\\n // return value in case of signature failure, with no time-range.\\n // equivalent to packSigTimeRange(true,0,0);\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n event SessionKeyRevoked(address indexed key);\\n\\n constructor() EIP712(\\\"ZeroDevSessionKeyPlugin\\\", \\\"0.0.1\\\") {}\\n\\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\\n bytes32 position = bytes32(uint256(keccak256(\\\"zero-dev.account.eip4337.sessionkey\\\")) - 1);\\n assembly {\\n s.slot := position\\n }\\n }\\n\\n // revoke session key\\n function revokeSessionKey(address _key) external {\\n getPolicyStorage().revoked[_key] = true;\\n emit SessionKeyRevoked(_key);\\n }\\n\\n function revoked(address _key) external view returns (bool) {\\n return getPolicyStorage().revoked[_key];\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal view override returns (bool) {\\n address sessionKey = address(bytes20(data[0:20]));\\n require(!getPolicyStorage().revoked[sessionKey], \\\"session key revoked\\\");\\n bytes32 merkleRoot = bytes32(data[20:52]);\\n if(merkleRoot == bytes32(0)) {\\n // means this session key has sudo permission\\n signature = signature[33:98];\\n } else {\\n uint8 leafLength = uint8(signature[0]);\\n bytes32[] memory proof;\\n bytes32 leaf;\\n if(leafLength == 20) {\\n leaf = keccak256(signature[1:21]);\\n proof = abi.decode(signature[86:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n signature = signature[21:86];\\n } else if(leafLength == 24) {\\n leaf = keccak256(signature[1:25]);\\n proof = abi.decode(signature[90:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\\n require(keccak256(sig) == keccak256(signature[21:25]));\\n signature = signature[25:90];\\n }\\n require(MerkleProof.verify(proof, merkleRoot, leaf), \\\"invalide merkle root\\\");\\n }\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\\"Session(bytes32 userOpHash,uint256 nonce)\\\"), // we are going to trust plugin for verification\\n userOpHash,\\n userOp.nonce\\n )\\n )\\n );\\n address recovered = digest.recover(signature);\\n require(recovered == sessionKey, \\\"account: invalid signature\\\");\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x7463f6b16e3dacf9d618a25e7cb6e12e210ff96682051c62d5a5d6e9243adb30\",\"license\":\"GPL\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b506040518060400160405280601781526020017f5a65726f44657653657373696f6e4b6579506c7567696e0000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a08181525050620000e88184846200013760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050506200024b565b6000838383463060405160200162000154959493929190620001ee565b6040516020818303038152906040528051906020012090509392505050565b6000819050919050565b620001888162000173565b82525050565b6000819050919050565b620001a3816200018e565b82525050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001d682620001a9565b9050919050565b620001e881620001c9565b82525050565b600060a0820190506200020560008301886200017d565b6200021460208301876200017d565b6200022360408301866200017d565b62000232606083018562000198565b620002416080830184620001dd565b9695505050505050565b60805160a05160c05160e0516101005161012051611e016200029b6000396000610bac01526000610bee01526000610bcd01526000610b0201526000610b5801526000610b810152611e016000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/bsc/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json b/deployments/bsc/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json new file mode 100644 index 00000000..d5d6537f --- /dev/null +++ b/deployments/bsc/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json @@ -0,0 +1,129 @@ +{ + "language": "Solidity", + "sources": { + "lib/account-abstraction/contracts/core/EntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n\nimport \"../interfaces/IAccount.sol\";\nimport \"../interfaces/IPaymaster.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\n\nimport \"../utils/Exec.sol\";\nimport \"./StakeManager.sol\";\nimport \"./SenderCreator.sol\";\nimport \"./Helpers.sol\";\nimport \"./NonceManager.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\n\n using UserOperationLib for UserOperation;\n\n SenderCreator private immutable senderCreator = new SenderCreator();\n\n // internal value used during simulation: need to query aggregator.\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\n\n // marker for inner call revert on out of gas\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\n\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\n\n /**\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\n * in case of signature failure, instead of revert.\n */\n uint256 public constant SIG_VALIDATION_FAILED = 1;\n\n /**\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\n * @param beneficiary the address to receive the fees\n * @param amount amount to transfer.\n */\n function _compensate(address payable beneficiary, uint256 amount) internal {\n require(beneficiary != address(0), \"AA90 invalid beneficiary\");\n (bool success,) = beneficiary.call{value : amount}(\"\");\n require(success, \"AA91 failed send to beneficiary\");\n }\n\n /**\n * execute a user op\n * @param opIndex index into the opInfo array\n * @param userOp the userOp to execute\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\n * @return collected the total amount this userOp paid.\n */\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\n uint256 preGas = gasleft();\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\n\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\n collected = _actualGasCost;\n } catch {\n bytes32 innerRevertCode;\n assembly {\n returndatacopy(0, 0, 32)\n innerRevertCode := mload(0)\n }\n // handleOps was called with gas limit too low. abort entire bundle.\n if (innerRevertCode == INNER_OUT_OF_GAS) {\n //report paymaster, since if it is not deliberately caused by the bundler,\n // it must be a revert caused by paymaster.\n revert FailedOp(opIndex, \"AA95 out of gas\");\n }\n\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\n }\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\n\n uint256 opslen = ops.length;\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\n\n unchecked {\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[i];\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\n }\n\n uint256 collected = 0;\n emit BeforeExecution();\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(i, ops[i], opInfos[i]);\n }\n\n _compensate(beneficiary, collected);\n } //unchecked\n }\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 ) public nonReentrant {\n\n uint256 opasLen = opsPerAggregator.length;\n uint256 totalOps = 0;\n for (uint256 i = 0; i < opasLen; i++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n //address(1) is special marker of \"signature error\"\n require(address(aggregator) != address(1), \"AA96 invalid aggregator\");\n\n if (address(aggregator) != address(0)) {\n // solhint-disable-next-line no-empty-blocks\n try aggregator.validateSignatures(ops, opa.signature) {}\n catch {\n revert SignatureValidationFailed(address(aggregator));\n }\n }\n\n totalOps += ops.length;\n }\n\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\n\n emit BeforeExecution();\n\n uint256 opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n uint256 opslen = ops.length;\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[opIndex];\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\n opIndex++;\n }\n }\n\n uint256 collected = 0;\n opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n emit SignatureAggregatorChanged(address(opa.aggregator));\n UserOperation[] calldata ops = opa.userOps;\n uint256 opslen = ops.length;\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\n opIndex++;\n }\n }\n emit SignatureAggregatorChanged(address(0));\n\n _compensate(beneficiary, collected);\n }\n\n /// @inheritdoc IEntryPoint\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\n\n UserOpInfo memory opInfo;\n _simulationOnlyValidations(op);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n\n numberMarker();\n uint256 paid = _executeUserOp(0, op, opInfo);\n numberMarker();\n bool targetSuccess;\n bytes memory targetResult;\n if (target != address(0)) {\n (targetSuccess, targetResult) = target.call(targetCallData);\n }\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\n }\n\n\n // A memory copy of UserOp static fields only.\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\n struct MemoryUserOp {\n address sender;\n uint256 nonce;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n address paymaster;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n }\n\n struct UserOpInfo {\n MemoryUserOp mUserOp;\n bytes32 userOpHash;\n uint256 prefund;\n uint256 contextOffset;\n uint256 preOpGas;\n }\n\n /**\n * inner function to handle a UserOperation.\n * Must be declared \"external\" to open a call context, but it can only be called by handleOps.\n */\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n require(msg.sender == address(this), \"AA92 internal call only\");\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n\n uint callGasLimit = mUserOp.callGasLimit;\n unchecked {\n // handleOps was called with gas limit too low. abort entire bundle.\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\n assembly {\n mstore(0, INNER_OUT_OF_GAS)\n revert(0, 32)\n }\n }\n }\n\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\n if (callData.length > 0) {\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\n if (!success) {\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\n if (result.length > 0) {\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\n }\n mode = IPaymaster.PostOpMode.opReverted;\n }\n }\n\n unchecked {\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\n return _handlePostOp(0, mode, opInfo, context, actualGas);\n }\n }\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\n }\n\n /**\n * copy general fields from userOp into the memory opInfo structure.\n */\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\n mUserOp.sender = userOp.sender;\n mUserOp.nonce = userOp.nonce;\n mUserOp.callGasLimit = userOp.callGasLimit;\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\n mUserOp.preVerificationGas = userOp.preVerificationGas;\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes calldata paymasterAndData = userOp.paymasterAndData;\n if (paymasterAndData.length > 0) {\n require(paymasterAndData.length >= 20, \"AA93 invalid paymasterAndData\");\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\n } else {\n mUserOp.paymaster = address(0);\n }\n }\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external {\n UserOpInfo memory outOpInfo;\n\n _simulationOnlyValidations(userOp);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\n StakeInfo memory factoryInfo;\n {\n bytes calldata initCode = userOp.initCode;\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\n factoryInfo = _getStakeInfo(factory);\n }\n\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n address aggregator = data.aggregator;\n bool sigFailed = aggregator == address(1);\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\n\n if (aggregator != address(0) && aggregator != address(1)) {\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\n }\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\n\n }\n\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\n unchecked {\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\n // our security model might call postOp eventually twice\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\n\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\n }\n }\n\n // create the sender's contract if needed.\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\n if (initCode.length != 0) {\n address sender = opInfo.mUserOp.sender;\n if (sender.code.length != 0) revert FailedOp(opIndex, \"AA10 sender already constructed\");\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\n if (sender1 == address(0)) revert FailedOp(opIndex, \"AA13 initCode failed or OOG\");\n if (sender1 != sender) revert FailedOp(opIndex, \"AA14 initCode must return sender\");\n if (sender1.code.length == 0) revert FailedOp(opIndex, \"AA15 initCode must create sender\");\n address factory = address(bytes20(initCode[0 : 20]));\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\n }\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 calldata initCode) public {\n address sender = senderCreator.createSender(initCode);\n revert SenderAddressResult(sender);\n }\n\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\n // solhint-disable-next-line no-empty-blocks\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\n catch Error(string memory revertReason) {\n if (bytes(revertReason).length != 0) {\n revert FailedOp(0, revertReason);\n }\n }\n }\n\n /**\n * Called only during simulation.\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\n */\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\n if (initCode.length == 0 && sender.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA20 account not deployed\");\n }\n if (paymasterAndData.length >= 20) {\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\n if (paymaster.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA30 paymaster not deployed\");\n }\n }\n // always revert\n revert(\"\");\n }\n\n /**\n * call account.validateUserOp.\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\n * decrement account's deposit if needed\n */\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\n unchecked {\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n address sender = mUserOp.sender;\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\n address paymaster = mUserOp.paymaster;\n numberMarker();\n uint256 missingAccountFunds = 0;\n if (paymaster == address(0)) {\n uint256 bal = balanceOf(sender);\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\n }\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\n returns (uint256 _validationData) {\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA23 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA23 reverted (or OOG)\");\n }\n if (paymaster == address(0)) {\n DepositInfo storage senderInfo = deposits[sender];\n uint256 deposit = senderInfo.deposit;\n if (requiredPrefund > deposit) {\n revert FailedOp(opIndex, \"AA21 didn't pay prefund\");\n }\n senderInfo.deposit = uint112(deposit - requiredPrefund);\n }\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\n }\n }\n\n /**\n * In case the request has a paymaster:\n * Validate paymaster has enough deposit.\n * Call paymaster.validatePaymasterUserOp.\n * Revert with proper FailedOp in case paymaster reverts.\n * Decrement paymaster's deposit\n */\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\n internal returns (bytes memory context, uint256 validationData) {\n unchecked {\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \"AA41 too little verificationGas\");\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\n\n address paymaster = mUserOp.paymaster;\n DepositInfo storage paymasterInfo = deposits[paymaster];\n uint256 deposit = paymasterInfo.deposit;\n if (deposit < requiredPreFund) {\n revert FailedOp(opIndex, \"AA31 paymaster deposit too low\");\n }\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\n context = _context;\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA33 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA33 reverted (or OOG)\");\n }\n }\n }\n\n /**\n * revert if either account validationData or paymaster validationData is expired\n */\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\n if (expectedAggregator != aggregator) {\n revert FailedOp(opIndex, \"AA24 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA22 expired or not due\");\n }\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\n address pmAggregator;\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\n if (pmAggregator != address(0)) {\n revert FailedOp(opIndex, \"AA34 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA32 paymaster expired or not due\");\n }\n }\n\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\n if (validationData == 0) {\n return (address(0), false);\n }\n ValidationData memory data = _parseValidationData(validationData);\n // solhint-disable-next-line not-rely-on-time\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\n aggregator = data.aggregator;\n }\n\n /**\n * validate account and paymaster (if defined).\n * also make sure total validation doesn't exceed verificationGasLimit\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\n * @param opIndex the index of this userOp into the \"opInfos\" array\n * @param userOp the userOp to validate\n */\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\n private returns (uint256 validationData, uint256 paymasterValidationData) {\n\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\n _copyUserOpToMemory(userOp, mUserOp);\n outOpInfo.userOpHash = getUserOpHash(userOp);\n\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\n // and multiplied without causing overflow\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\n require(maxGasValues <= type(uint120).max, \"AA94 gas values overflow\");\n\n uint256 gasUsedByValidateAccountPrepayment;\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\n\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\n revert FailedOp(opIndex, \"AA25 invalid account nonce\");\n }\n\n //a \"marker\" where account opcode validation is done and paymaster opcode validation is about to start\n // (used only by off-chain simulateValidation)\n numberMarker();\n\n bytes memory context;\n if (mUserOp.paymaster != address(0)) {\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\n }\n unchecked {\n uint256 gasUsed = preGas - gasleft();\n\n if (userOp.verificationGasLimit < gasUsed) {\n revert FailedOp(opIndex, \"AA40 over verificationGasLimit\");\n }\n outOpInfo.prefund = requiredPreFund;\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\n }\n }\n\n /**\n * process post-operation.\n * called just after the callData is executed.\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\n * @param opIndex index in the batch\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\n * @param opInfo userOp fields and info collected during validation\n * @param context the context returned in validatePaymasterUserOp\n * @param actualGas the gas used so far by this user operation\n */\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n unchecked {\n address refundAddress;\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\n\n address paymaster = mUserOp.paymaster;\n if (paymaster == address(0)) {\n refundAddress = mUserOp.sender;\n } else {\n refundAddress = paymaster;\n if (context.length > 0) {\n actualGasCost = actualGas * gasPrice;\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\n } else {\n // solhint-disable-next-line no-empty-blocks\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\n catch Error(string memory reason) {\n revert FailedOp(opIndex, string.concat(\"AA50 postOp reverted: \", reason));\n }\n catch {\n revert FailedOp(opIndex, \"AA50 postOp revert\");\n }\n }\n }\n }\n actualGas += preGas - gasleft();\n actualGasCost = actualGas * gasPrice;\n if (opInfo.prefund < actualGasCost) {\n revert FailedOp(opIndex, \"AA51 prefund below actualGasCost\");\n }\n uint256 refund = opInfo.prefund - actualGasCost;\n _incrementDeposit(refundAddress, refund);\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\n } // unchecked\n }\n\n /**\n * the gas price this UserOp agrees to pay.\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\n */\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\n assembly {offset := data}\n }\n\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\n assembly {data := offset}\n }\n\n //place the NUMBER opcode in the code.\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\n // account and paymaster.\n function numberMarker() internal view {\n assembly {mstore(0, number())}\n }\n}\n\n" + }, + "lib/account-abstraction/contracts/core/Helpers.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n * address(1) - the account failed to validate the signature.\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\n struct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n }\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n// intersect account and paymaster ranges.\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\n ValidationData memory accountValidationData = _parseValidationData(validationData);\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n address aggregator = accountValidationData.aggregator;\n if (aggregator == address(0)) {\n aggregator = pmValidationData.aggregator;\n }\n uint48 validAfter = accountValidationData.validAfter;\n uint48 validUntil = accountValidationData.validUntil;\n uint48 pmValidAfter = pmValidationData.validAfter;\n uint48 pmValidUntil = pmValidationData.validUntil;\n\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n }\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n }\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n\n" + }, + "lib/account-abstraction/contracts/core/NonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IEntryPoint.sol\";\n\n/**\n * nonce management functionality\n */\ncontract NonceManager is INonceManager {\n\n /**\n * The next valid sequence number for a given nonce key.\n */\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\n\n function getNonce(address sender, uint192 key)\n public view override returns (uint256 nonce) {\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\n }\n\n // allow an account to manually increment its own nonce.\n // (mainly so that during construction nonce can be made non-zero,\n // to \"absorb\" the gas cost of first nonce increment to 1st transaction (construction),\n // not to 2nd transaction)\n function incrementNonce(uint192 key) public override {\n nonceSequenceNumber[msg.sender][key]++;\n }\n\n /**\n * validate nonce uniqueness for this account.\n * called just after validateUserOp()\n */\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\n\n uint192 key = uint192(nonce >> 64);\n uint64 seq = uint64(nonce);\n return nonceSequenceNumber[sender][key]++ == seq;\n }\n\n}\n" + }, + "lib/account-abstraction/contracts/core/SenderCreator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/**\n * helper contract for EntryPoint, to call userOp.initCode from a \"neutral\" address,\n * which is explicitly not the entryPoint itself.\n */\ncontract SenderCreator {\n\n /**\n * call the \"initCode\" factory to create and return the sender account address\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\n * @return sender the returned address of the created account, or zero address on failure.\n */\n function createSender(bytes calldata initCode) external returns (address sender) {\n address factory = address(bytes20(initCode[0 : 20]));\n bytes memory initCallData = initCode[20 :];\n bool success;\n /* solhint-disable no-inline-assembly */\n assembly {\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\n sender := mload(0)\n }\n if (!success) {\n sender = address(0);\n }\n }\n}\n" + }, + "lib/account-abstraction/contracts/core/StakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IStakeManager.sol\";\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable not-rely-on-time */\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by a paymaster.\n */\nabstract contract StakeManager is IStakeManager {\n\n /// maps paymaster to their deposits and stakes\n mapping(address => DepositInfo) public deposits;\n\n /// @inheritdoc IStakeManager\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\n return deposits[account];\n }\n\n // internal method to return just the stake info\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\n DepositInfo storage depositInfo = deposits[addr];\n info.stake = depositInfo.stake;\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\n }\n\n /// return the deposit (for gas payment) of the account\n function balanceOf(address account) public view returns (uint256) {\n return deposits[account].deposit;\n }\n\n receive() external payable {\n depositTo(msg.sender);\n }\n\n function _incrementDeposit(address account, uint256 amount) internal {\n DepositInfo storage info = deposits[account];\n uint256 newAmount = info.deposit + amount;\n require(newAmount <= type(uint112).max, \"deposit overflow\");\n info.deposit = uint112(newAmount);\n }\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) public payable {\n _incrementDeposit(account, msg.value);\n DepositInfo storage info = deposits[account];\n emit Deposited(account, info.deposit);\n }\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 unstakeDelaySec) public payable {\n DepositInfo storage info = deposits[msg.sender];\n require(unstakeDelaySec > 0, \"must specify unstake delay\");\n require(unstakeDelaySec >= info.unstakeDelaySec, \"cannot decrease unstake time\");\n uint256 stake = info.stake + msg.value;\n require(stake > 0, \"no stake specified\");\n require(stake <= type(uint112).max, \"stake overflow\");\n deposits[msg.sender] = DepositInfo(\n info.deposit,\n true,\n uint112(stake),\n unstakeDelaySec,\n 0\n );\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\n }\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external {\n DepositInfo storage info = deposits[msg.sender];\n require(info.unstakeDelaySec != 0, \"not staked\");\n require(info.staked, \"already unstaking\");\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\n info.withdrawTime = withdrawTime;\n info.staked = false;\n emit StakeUnlocked(msg.sender, withdrawTime);\n }\n\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external {\n DepositInfo storage info = deposits[msg.sender];\n uint256 stake = info.stake;\n require(stake > 0, \"No stake to withdraw\");\n require(info.withdrawTime > 0, \"must call unlockStake() first\");\n require(info.withdrawTime <= block.timestamp, \"Stake withdrawal is not due\");\n info.unstakeDelaySec = 0;\n info.withdrawTime = 0;\n info.stake = 0;\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\n (bool success,) = withdrawAddress.call{value : stake}(\"\");\n require(success, \"failed to withdraw stake\");\n }\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\n DepositInfo storage info = deposits[msg.sender];\n require(withdrawAmount <= info.deposit, \"Withdraw amount too large\");\n info.deposit = uint112(info.deposit - withdrawAmount);\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\"\");\n require(success, \"failed to withdraw\");\n }\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAccount.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\ninterface IAccount {\n\n /**\n * Validate user's signature and nonce\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\n * This allows making a \"simulation call\" without a valid signature\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\n *\n * @dev Must validate caller is the entryPoint.\n * Must validate the signature and nonce\n * @param userOp the operation that is about to be executed.\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\n * The excess is left as a deposit in the entrypoint, for future calls.\n * can be withdrawn anytime using \"entryPoint.withdrawTo()\"\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external returns (uint256 validationData);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAggregator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n\n /**\n * validate aggregated signature.\n * revert if the aggregated signature does not match the given list of operations.\n */\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\n\n /**\n * validate signature of a single userOp\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n * @param userOp the userOperation received from the user.\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\n * (usually empty, unless account and aggregator support some kind of \"multisig\"\n */\n function validateUserOpSignature(UserOperation calldata userOp)\n external view returns (bytes memory sigForUserOp);\n\n /**\n * aggregate multiple signatures into a single value.\n * This method is called off-chain to calculate the signature to pass with handleOps()\n * bundler MAY use optimized custom code perform this aggregation\n * @param userOps array of UserOperations to collect the signatures from.\n * @return aggregatedSignature the aggregated signature\n */\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IEntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./UserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\n\n /***\n * An event emitted after each successful request\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\n * @param sender - the account that generates this request.\n * @param paymaster - if non-null, the paymaster that pays for this request.\n * @param nonce - the nonce value from the request.\n * @param success - true if the sender transaction succeeded, false if reverted.\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\n */\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\n\n /**\n * account \"sender\" was deployed.\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\n * @param sender the account that is deployed\n * @param factory the factory used to deploy this account (in the initCode)\n * @param paymaster the paymaster used by this UserOp\n */\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\n\n /**\n * An event emitted if the UserOperation \"callData\" reverted with non-zero length\n * @param userOpHash the request unique identifier.\n * @param sender the sender of this request\n * @param nonce the nonce used in the request\n * @param revertReason - the return bytes from the (reverted) call to \"callData\".\n */\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\n\n /**\n * an event emitted by handleOps(), before starting the execution loop.\n * any event emitted before this event, is part of the validation.\n */\n event BeforeExecution();\n\n /**\n * signature aggregator used by the following UserOperationEvents within this bundle.\n */\n event SignatureAggregatorChanged(address indexed aggregator);\n\n /**\n * a custom revert error of handleOps, to identify the offending op.\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\n * @param reason - revert reason\n * The string starts with a unique code \"AAmn\", where \"m\" is \"1\" for factory, \"2\" for account and \"3\" for paymaster issues,\n * so a failure can be attributed to the correct entity.\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\n */\n error FailedOp(uint256 opIndex, string reason);\n\n /**\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\n */\n error SignatureValidationFailed(address aggregator);\n\n /**\n * Successful result from simulateValidation.\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n */\n error ValidationResult(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\n\n /**\n * Successful result from simulateValidation, if the account returns a signature aggregator\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\n * bundler MUST use it to verify the signature, or reject the UserOperation\n */\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\n AggregatorStakeInfo aggregatorInfo);\n\n /**\n * return value of getSenderAddress\n */\n error SenderAddressResult(address sender);\n\n /**\n * return value of simulateHandleOp\n */\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\n\n //UserOps handled, per aggregator\n struct UserOpsPerAggregator {\n UserOperation[] userOps;\n\n // aggregator address\n IAggregator aggregator;\n // aggregated signature\n bytes signature;\n }\n\n /**\n * Execute a batch of UserOperation.\n * no signature aggregator is used.\n * if any account requires an aggregator (that is, it returned an aggregator when\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\n * @param ops the operations to execute\n * @param beneficiary the address to receive the fees\n */\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\n\n /**\n * Execute a batch of UserOperation with Aggregators\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\n * @param beneficiary the address to receive the fees\n */\n function handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n ) external;\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external;\n\n /**\n * gas and return values during simulation\n * @param preOpGas the gas used for validation (including preValidationGas)\n * @param prefund the required prefund for this operation\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\n */\n struct ReturnInfo {\n uint256 preOpGas;\n uint256 prefund;\n bool sigFailed;\n uint48 validAfter;\n uint48 validUntil;\n bytes paymasterContext;\n }\n\n /**\n * returned aggregated signature info.\n * the aggregator returned by the account, and its current stake.\n */\n struct AggregatorStakeInfo {\n address aggregator;\n StakeInfo stakeInfo;\n }\n\n /**\n * Get counterfactual sender address.\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n * this method always revert, and returns the address in SenderAddressResult error\n * @param initCode the constructor code to be passed into the UserOperation.\n */\n function getSenderAddress(bytes memory initCode) external;\n\n\n /**\n * simulate full execution of a UserOperation (including both validation and target execution)\n * this method will always revert with \"ExecutionResult\".\n * it performs full validation of the UserOperation, but ignores signature error.\n * an optional target address is called after the userop succeeds, and its value is returned\n * (before the entire call is reverted)\n * Note that in order to collect the the success/failure of the target call, it must be executed\n * with trace enabled to track the emitted events.\n * @param op the UserOperation to simulate\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\n * are set to the return from that call.\n * @param targetCallData callData to pass to target address\n */\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\n}\n\n" + }, + "lib/account-abstraction/contracts/interfaces/INonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\ninterface INonceManager {\n\n /**\n * Return the next nonce for this sender.\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\n * But UserOp with different keys can come with arbitrary order.\n *\n * @param sender the account address\n * @param key the high 192 bit of the nonce\n * @return nonce a full nonce to pass for next UserOp with this sender.\n */\n function getNonce(address sender, uint192 key)\n external view returns (uint256 nonce);\n\n /**\n * Manually increment the nonce of the sender.\n * This method is exposed just for completeness..\n * Account does NOT need to call it, neither during validation, nor elsewhere,\n * as the EntryPoint will update the nonce regardless.\n * Possible use-case is call it with various keys to \"initialize\" their nonces to one, so that future\n * UserOperations will not pay extra for the first transaction with a given key.\n */\n function incrementNonce(uint192 key) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IPaymaster.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\n */\ninterface IPaymaster {\n\n enum PostOpMode {\n opSucceeded, // user op succeeded\n opReverted, // user op reverted. still has to pay for gas.\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\n }\n\n /**\n * payment validation: check if paymaster agrees to pay.\n * Must verify sender is the entryPoint.\n * Revert to reject this request.\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\n * @param userOp the user operation\n * @param userOpHash hash of the user's request data.\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\n * @return context value to send to a postOp\n * zero length to signify postOp is not required.\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n external returns (bytes memory context, uint256 validationData);\n\n /**\n * post-operation handler.\n * Must verify sender is the entryPoint\n * @param mode enum with the following options:\n * opSucceeded - user operation succeeded.\n * opReverted - user op reverted. still has to pay for gas.\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\n * Now this is the 2nd call, after user's op was deliberately reverted.\n * @param context - the context value returned by validatePaymasterUserOp\n * @param actualGasCost - actual gas used so far (without this postOp call).\n */\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IStakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n\n event Deposited(\n address indexed account,\n uint256 totalDeposit\n );\n\n event Withdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /// Emitted when stake or unstake delay are modified\n event StakeLocked(\n address indexed account,\n uint256 totalStaked,\n uint256 unstakeDelaySec\n );\n\n /// Emitted once a stake is scheduled for withdrawal\n event StakeUnlocked(\n address indexed account,\n uint256 withdrawTime\n );\n\n event StakeWithdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /**\n * @param deposit the entity's deposit\n * @param staked true if this entity is staked.\n * @param stake actual amount of ether staked for this entity.\n * @param unstakeDelaySec minimum delay to withdraw the stake.\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\n * and the rest fit into a 2nd cell.\n * 112 bit allows for 10^15 eth\n * 48 bit for full timestamp\n * 32 bit allows 150 years for unstake delay\n */\n struct DepositInfo {\n uint112 deposit;\n bool staked;\n uint112 stake;\n uint32 unstakeDelaySec;\n uint48 withdrawTime;\n }\n\n //API struct used by getStakeInfo and simulateValidation\n struct StakeInfo {\n uint256 stake;\n uint256 unstakeDelaySec;\n }\n\n /// @return info - full deposit information of given account\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\n\n /// @return the deposit (for gas payment) of the account\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) external payable;\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 _unstakeDelaySec) external payable;\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external;\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external;\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/UserOperation.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\nimport {calldataKeccak} from \"../core/Helpers.sol\";\n\n/**\n * User Operation struct\n * @param sender the sender account of this request.\n * @param nonce unique value the sender uses to verify it is not a replay.\n * @param initCode if set, the account contract will be created by this constructor/\n * @param callData the method call to execute on this account.\n * @param callGasLimit the gas limit passed to the callData method call.\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\n * @param maxFeePerGas same as EIP-1559 gas parameter.\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n */\n struct UserOperation {\n\n address sender;\n uint256 nonce;\n bytes initCode;\n bytes callData;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n bytes paymasterAndData;\n bytes signature;\n }\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\n address data;\n //read sender from userOp, which is first userOp member (saves 800 gas...)\n assembly {data := calldataload(userOp)}\n return address(uint160(data));\n }\n\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\n // pay above what he signed for.\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\n address sender = getSender(userOp);\n uint256 nonce = userOp.nonce;\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n bytes32 hashCallData = calldataKeccak(userOp.callData);\n uint256 callGasLimit = userOp.callGasLimit;\n uint256 verificationGasLimit = userOp.verificationGasLimit;\n uint256 preVerificationGas = userOp.preVerificationGas;\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n return abi.encode(\n sender, nonce,\n hashInitCode, hashCallData,\n callGasLimit, verificationGasLimit, preVerificationGas,\n maxFeePerGas, maxPriorityFeePerGas,\n hashPaymasterAndData\n );\n }\n\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\n return keccak256(pack(userOp));\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n}\n" + }, + "lib/account-abstraction/contracts/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n\n function call(\n address to,\n uint256 value,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function staticcall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal view returns (bool success) {\n assembly {\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function delegateCall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n // get returned data from last call or calldelegate\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n assembly {\n let len := returndatasize()\n if gt(len, maxLen) {\n len := maxLen\n }\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n // revert with explicit byte array (probably reverted info from call)\n function revertWithData(bytes memory returnData) internal pure {\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\n bool success = call(to,0,data,gasleft());\n if (!success) {\n revertWithData(getReturnData(maxLen));\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Create2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts 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 * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\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 _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\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 bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n * respectively.\n *\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "src/abstract/Compatibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Compatibility {\n receive() external payable {}\n\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\n external\n pure\n returns (bytes4)\n {\n return this.onERC1155BatchReceived.selector;\n }\n\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "src/abstract/KernelStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\n\nstruct WalletKernelStorage {\n address owner;\n}\n\ncontract KernelStorage {\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n IEntryPoint public immutable entryPoint;\n\n event Upgraded(address indexed newImplementation);\n\n // modifier for checking if the sender is the entrypoint or\n // the account itself\n modifier onlyFromEntryPointOrOwnerOrSelf() {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\n \"account: not from entrypoint or owner or self\"\n );\n _;\n }\n\n constructor(IEntryPoint _entryPoint) {\n entryPoint = _entryPoint;\n getKernelStorage().owner = address(1);\n }\n /// @notice get wallet kernel storage\n /// @dev used to get wallet kernel storage\n /// @return ws wallet kernel storage, consists of owner and nonces\n\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\n bytes32 storagePosition = bytes32(uint256(keccak256(\"zerodev.kernel\")) - 1);\n assembly {\n ws.slot := storagePosition\n }\n }\n\n function getOwner() external view returns (address) {\n return getKernelStorage().owner;\n }\n\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n assembly {\n sstore(slot, _newImplementation)\n }\n emit Upgraded(_newImplementation);\n }\n\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\n getKernelStorage().owner = _newOwner;\n }\n\n function getNonce() public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), 0);\n }\n\n function getNonce(uint192 key) public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), key);\n }\n}\n " + }, + "src/factory/EIP1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract EIP1967Proxy {\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n constructor(address _logic, bytes memory _data) payable {\n require(_logic != address(0), \"EIP1967Proxy: implementation is the zero address\");\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n sstore(slot, _logic)\n }\n if (_data.length > 0) {\n (bool success,) = _logic.delegatecall(_data);\n require(success, \"EIP1967Proxy: constructor call failed\");\n }\n }\n\n fallback() external payable {\n address implementation = _implementation();\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 { revert(0, returndatasize()) }\n default { return(0, returndatasize()) }\n }\n }\n\n function _implementation() internal view returns (address impl) {\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n impl := sload(slot)\n }\n }\n}\n" + }, + "src/Kernel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"./plugin/IPlugin.sol\";\nimport \"account-abstraction/core/Helpers.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport {EntryPoint} from \"account-abstraction/core/EntryPoint.sol\";\nimport \"./utils/Exec.sol\";\nimport \"./abstract/Compatibility.sol\";\nimport \"./abstract/KernelStorage.sol\";\n\n/// @title Kernel\n/// @author taek\n/// @notice wallet kernel for minimal wallet functionality\n/// @dev supports only 1 owner, multiple plugins\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\n error InvalidNonce();\n error InvalidSignatureLength();\n error QueryResult(bytes result);\n\n string public constant name = \"Kernel\";\n\n string public constant version = \"0.0.1\";\n\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\n\n /// @notice initialize wallet kernel\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\n /// @param _owner owner address\n function initialize(address _owner) external {\n WalletKernelStorage storage ws = getKernelStorage();\n require(ws.owner == address(0), \"account: already initialized\");\n ws.owner = _owner;\n }\n\n /// @notice Query plugin for data\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\n /// @param _plugin Plugin address\n /// @param _data Data to query\n function queryPlugin(address _plugin, bytes calldata _data) external {\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\n if (success) {\n revert QueryResult(_ret);\n } else {\n assembly {\n revert(add(_ret, 32), mload(_ret))\n }\n }\n }\n\n /// @notice execute function call to external contract\n /// @dev this function will execute function call to external contract\n /// @param to target contract address\n /// @param value value to be sent\n /// @param data data to be sent\n /// @param operation operation type (call or delegatecall)\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\n \"account: not from entrypoint or owner\"\n );\n bool success;\n bytes memory ret;\n if (operation == Operation.DelegateCall) {\n (success, ret) = Exec.delegateCall(to, data);\n } else {\n (success, ret) = Exec.call(to, value, data);\n }\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n }\n\n /// @notice validate user operation\n /// @dev this function will validate user operation and be called by EntryPoint\n /// @param userOp user operation\n /// @param userOpHash user operation hash\n /// @param missingAccountFunds funds needed to be reimbursed\n /// @return validationData validation data\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (uint256 validationData)\n {\n require(msg.sender == address(entryPoint), \"account: not from entryPoint\");\n if (userOp.signature.length == 65) {\n validationData = _validateUserOp(userOp, userOpHash);\n } else if (userOp.signature.length > 97) {\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\n address plugin = address(bytes20(userOp.signature[0:20]));\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\n bytes memory signature = userOp.signature[32:97];\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\n \"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\"\n ), // we are going to trust plugin for verification\n plugin,\n validUntil,\n validAfter,\n keccak256(data)\n )\n )\n );\n\n address signer = ECDSA.recover(digest, signature);\n if (getKernelStorage().owner != signer) {\n return SIG_VALIDATION_FAILED;\n }\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\n bool res = abi.decode(ret, (bool));\n if (!res) {\n return SIG_VALIDATION_FAILED;\n }\n validationData = _packValidationData(!res, validUntil, validAfter);\n } else {\n revert InvalidSignatureLength();\n }\n if (missingAccountFunds > 0) {\n // we are going to assume signature is valid at this point\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\"\");\n (success);\n return validationData;\n }\n }\n\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\n internal\n view\n returns (uint256 validationData)\n {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\n return validationData;\n }\n\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\n address recovered = ECDSA.recover(hash, userOp.signature);\n if (ws.owner != recovered) {\n return SIG_VALIDATION_FAILED;\n }\n }\n\n /**\n * delegate the contract call to the plugin\n */\n function _delegateToPlugin(\n address plugin,\n UserOperation calldata userOp,\n bytes32 opHash,\n uint256 missingAccountFunds\n ) internal returns (bytes memory) {\n bytes memory data =\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n return ret;\n }\n\n /// @notice validate signature using eip1271\n /// @dev this function will validate signature using eip1271\n /// @param _hash hash to be signed\n /// @param _signature signature\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\n return 0x1626ba7e;\n }\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\n address recovered = ECDSA.recover(hash, _signature);\n // Validate signatures\n if (ws.owner == recovered) {\n return 0x1626ba7e;\n } else {\n return 0xffffffff;\n }\n }\n}\n" + }, + "src/KernelFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/Create2.sol\";\nimport \"./factory/EIP1967Proxy.sol\";\nimport \"./Kernel.sol\";\n\ncontract KernelFactory {\n Kernel public immutable kernelTemplate;\n\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\n\n constructor(IEntryPoint _entryPoint) {\n kernelTemplate = new Kernel(_entryPoint);\n }\n\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n address addr = Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n if (addr.code.length > 0) {\n return EIP1967Proxy(payable(addr));\n }\n proxy =\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\n emit AccountCreated(address(proxy), _owner, _index);\n }\n\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n return Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n }\n}\n" + }, + "src/plugin/IPlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/UserOperation.sol\";\n\ninterface IPlugin {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (bool);\n}\n" + }, + "src/plugin/ZeroDevBasePlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport \"./IPlugin.sol\";\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n override\n returns (bool validated)\n {\n // data offset starts at 97\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\n validated = _validatePluginData(userOp, userOpHash, data, signature);\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal virtual returns (bool success);\n\n function parseDataAndSignature(bytes calldata _packed)\n public\n pure\n returns (bytes calldata data, bytes calldata signature)\n {\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\n\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \"invalid data\");\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \"invalid signature\");\n }\n}\n" + }, + "src/plugin/ZeroDevSessionKeyPlugin.sol": { + "content": "//SPDX-License-Identifier: GPL\npragma solidity ^0.8.7;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./ZeroDevBasePlugin.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\";\nusing ECDSA for bytes32;\n/**\n * Main EIP4337 module.\n * Called (through the fallback module) using \"delegate\" from the GnosisSafe as an \"IAccount\",\n * so must implement validateUserOp\n * holds an immutable reference to the EntryPoint\n */\n\nstruct ZeroDevSessionKeyStorageStruct {\n mapping(address => bool) revoked;\n}\n\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\n // return value in case of signature failure, with no time-range.\n // equivalent to packSigTimeRange(true,0,0);\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n event SessionKeyRevoked(address indexed key);\n\n constructor() EIP712(\"ZeroDevSessionKeyPlugin\", \"0.0.1\") {}\n\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\n bytes32 position = bytes32(uint256(keccak256(\"zero-dev.account.eip4337.sessionkey\")) - 1);\n assembly {\n s.slot := position\n }\n }\n\n // revoke session key\n function revokeSessionKey(address _key) external {\n getPolicyStorage().revoked[_key] = true;\n emit SessionKeyRevoked(_key);\n }\n\n function revoked(address _key) external view returns (bool) {\n return getPolicyStorage().revoked[_key];\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal view override returns (bool) {\n address sessionKey = address(bytes20(data[0:20]));\n require(!getPolicyStorage().revoked[sessionKey], \"session key revoked\");\n bytes32 merkleRoot = bytes32(data[20:52]);\n if(merkleRoot == bytes32(0)) {\n // means this session key has sudo permission\n signature = signature[33:98];\n } else {\n uint8 leafLength = uint8(signature[0]);\n bytes32[] memory proof;\n bytes32 leaf;\n if(leafLength == 20) {\n leaf = keccak256(signature[1:21]);\n proof = abi.decode(signature[86:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n signature = signature[21:86];\n } else if(leafLength == 24) {\n leaf = keccak256(signature[1:25]);\n proof = abi.decode(signature[90:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\n require(keccak256(sig) == keccak256(signature[21:25]));\n signature = signature[25:90];\n }\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"invalide merkle root\");\n }\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\"Session(bytes32 userOpHash,uint256 nonce)\"), // we are going to trust plugin for verification\n userOpHash,\n userOp.nonce\n )\n )\n );\n address recovered = digest.recover(signature);\n require(recovered == sessionKey, \"account: invalid signature\");\n return true;\n }\n}\n" + }, + "src/test/TestCounter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\ncontract TestCounter {\n uint256 public counter;\n function increment() public {\n counter += 1;\n }\n}" + }, + "src/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\nenum Operation {\n Call,\n DelegateCall\n}\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n function call(address to, uint256 value, bytes memory data)\n internal\n returns (bool success, bytes memory returnData)\n {\n assembly {\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\n assembly {\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\n assembly {\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "@openzeppelin/=lib/openzeppelin-contracts/", + "account-abstraction/=lib/account-abstraction/contracts/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "openzeppelin-contracts/=lib/openzeppelin-contracts/" + ] + } +} \ No newline at end of file diff --git a/deployments/bscTestnet/.chainId b/deployments/bscTestnet/.chainId new file mode 100644 index 00000000..c4fbb1cf --- /dev/null +++ b/deployments/bscTestnet/.chainId @@ -0,0 +1 @@ +97 \ No newline at end of file diff --git a/deployments/bscTestnet/KernelFactory.json b/deployments/bscTestnet/KernelFactory.json new file mode 100644 index 00000000..1d2dfea6 --- /dev/null +++ b/deployments/bscTestnet/KernelFactory.json @@ -0,0 +1,140 @@ +{ + "address": "0x4E4946298614FC299B50c947289F4aD0572CB9ce", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "AccountCreated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "createAccount", + "outputs": [ + { + "internalType": "contract EIP1967Proxy", + "name": "proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getAccountAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kernelTemplate", + "outputs": [ + { + "internalType": "contract Kernel", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xe062f483e0ab89ea81891b011cd00aac790304f0daa6a3c704073e0b6b9a3b76", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x8d8a9Cf53b7D95C148cB159384D249F8FB68db3f", + "contractAddress": null, + "transactionIndex": 7, + "gasUsed": "3643894", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6d883639e00b01f598ffbc7b33e383283ecf0e0efc3c5e94a8ff3321c50aa7b2", + "transactionHash": "0xe062f483e0ab89ea81891b011cd00aac790304f0daa6a3c704073e0b6b9a3b76", + "logs": [], + "blockNumber": 29514611, + "cumulativeGasUsed": "4144964", + "status": 1, + "byzantium": true + }, + "args": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" + ], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IEntryPoint\",\"name\":\"_entryPoint\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"AccountCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"createAccount\",\"outputs\":[{\"internalType\":\"contract EIP1967Proxy\",\"name\":\"proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getAccountAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kernelTemplate\",\"outputs\":[{\"internalType\":\"contract Kernel\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/KernelFactory.sol\":\"KernelFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/EntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n\\nimport \\\"../interfaces/IAccount.sol\\\";\\nimport \\\"../interfaces/IPaymaster.sol\\\";\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\nimport \\\"../utils/Exec.sol\\\";\\nimport \\\"./StakeManager.sol\\\";\\nimport \\\"./SenderCreator.sol\\\";\\nimport \\\"./Helpers.sol\\\";\\nimport \\\"./NonceManager.sol\\\";\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\n\\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\\n\\n using UserOperationLib for UserOperation;\\n\\n SenderCreator private immutable senderCreator = new SenderCreator();\\n\\n // internal value used during simulation: need to query aggregator.\\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\\n\\n // marker for inner call revert on out of gas\\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\\n\\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\\n\\n /**\\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\\n * in case of signature failure, instead of revert.\\n */\\n uint256 public constant SIG_VALIDATION_FAILED = 1;\\n\\n /**\\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\\n * @param beneficiary the address to receive the fees\\n * @param amount amount to transfer.\\n */\\n function _compensate(address payable beneficiary, uint256 amount) internal {\\n require(beneficiary != address(0), \\\"AA90 invalid beneficiary\\\");\\n (bool success,) = beneficiary.call{value : amount}(\\\"\\\");\\n require(success, \\\"AA91 failed send to beneficiary\\\");\\n }\\n\\n /**\\n * execute a user op\\n * @param opIndex index into the opInfo array\\n * @param userOp the userOp to execute\\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\\n * @return collected the total amount this userOp paid.\\n */\\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\\n uint256 preGas = gasleft();\\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\\n\\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\\n collected = _actualGasCost;\\n } catch {\\n bytes32 innerRevertCode;\\n assembly {\\n returndatacopy(0, 0, 32)\\n innerRevertCode := mload(0)\\n }\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (innerRevertCode == INNER_OUT_OF_GAS) {\\n //report paymaster, since if it is not deliberately caused by the bundler,\\n // it must be a revert caused by paymaster.\\n revert FailedOp(opIndex, \\\"AA95 out of gas\\\");\\n }\\n\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\\n }\\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\\n\\n uint256 opslen = ops.length;\\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\\n\\n unchecked {\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[i];\\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\\n }\\n\\n uint256 collected = 0;\\n emit BeforeExecution();\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(i, ops[i], opInfos[i]);\\n }\\n\\n _compensate(beneficiary, collected);\\n } //unchecked\\n }\\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 ) public nonReentrant {\\n\\n uint256 opasLen = opsPerAggregator.length;\\n uint256 totalOps = 0;\\n for (uint256 i = 0; i < opasLen; i++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n //address(1) is special marker of \\\"signature error\\\"\\n require(address(aggregator) != address(1), \\\"AA96 invalid aggregator\\\");\\n\\n if (address(aggregator) != address(0)) {\\n // solhint-disable-next-line no-empty-blocks\\n try aggregator.validateSignatures(ops, opa.signature) {}\\n catch {\\n revert SignatureValidationFailed(address(aggregator));\\n }\\n }\\n\\n totalOps += ops.length;\\n }\\n\\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\\n\\n emit BeforeExecution();\\n\\n uint256 opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n UserOperation[] calldata ops = opa.userOps;\\n IAggregator aggregator = opa.aggregator;\\n\\n uint256 opslen = ops.length;\\n for (uint256 i = 0; i < opslen; i++) {\\n UserOpInfo memory opInfo = opInfos[opIndex];\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\\n opIndex++;\\n }\\n }\\n\\n uint256 collected = 0;\\n opIndex = 0;\\n for (uint256 a = 0; a < opasLen; a++) {\\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\\n emit SignatureAggregatorChanged(address(opa.aggregator));\\n UserOperation[] calldata ops = opa.userOps;\\n uint256 opslen = ops.length;\\n\\n for (uint256 i = 0; i < opslen; i++) {\\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\\n opIndex++;\\n }\\n }\\n emit SignatureAggregatorChanged(address(0));\\n\\n _compensate(beneficiary, collected);\\n }\\n\\n /// @inheritdoc IEntryPoint\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\\n\\n UserOpInfo memory opInfo;\\n _simulationOnlyValidations(op);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n\\n numberMarker();\\n uint256 paid = _executeUserOp(0, op, opInfo);\\n numberMarker();\\n bool targetSuccess;\\n bytes memory targetResult;\\n if (target != address(0)) {\\n (targetSuccess, targetResult) = target.call(targetCallData);\\n }\\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\\n }\\n\\n\\n // A memory copy of UserOp static fields only.\\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\\n struct MemoryUserOp {\\n address sender;\\n uint256 nonce;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n address paymaster;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n }\\n\\n struct UserOpInfo {\\n MemoryUserOp mUserOp;\\n bytes32 userOpHash;\\n uint256 prefund;\\n uint256 contextOffset;\\n uint256 preOpGas;\\n }\\n\\n /**\\n * inner function to handle a UserOperation.\\n * Must be declared \\\"external\\\" to open a call context, but it can only be called by handleOps.\\n */\\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n require(msg.sender == address(this), \\\"AA92 internal call only\\\");\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n\\n uint callGasLimit = mUserOp.callGasLimit;\\n unchecked {\\n // handleOps was called with gas limit too low. abort entire bundle.\\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\\n assembly {\\n mstore(0, INNER_OUT_OF_GAS)\\n revert(0, 32)\\n }\\n }\\n }\\n\\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\\n if (callData.length > 0) {\\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\\n if (!success) {\\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\\n if (result.length > 0) {\\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\\n }\\n mode = IPaymaster.PostOpMode.opReverted;\\n }\\n }\\n\\n unchecked {\\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\\n return _handlePostOp(0, mode, opInfo, context, actualGas);\\n }\\n }\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\\n }\\n\\n /**\\n * copy general fields from userOp into the memory opInfo structure.\\n */\\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\\n mUserOp.sender = userOp.sender;\\n mUserOp.nonce = userOp.nonce;\\n mUserOp.callGasLimit = userOp.callGasLimit;\\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\\n mUserOp.preVerificationGas = userOp.preVerificationGas;\\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes calldata paymasterAndData = userOp.paymasterAndData;\\n if (paymasterAndData.length > 0) {\\n require(paymasterAndData.length >= 20, \\\"AA93 invalid paymasterAndData\\\");\\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\\n } else {\\n mUserOp.paymaster = address(0);\\n }\\n }\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external {\\n UserOpInfo memory outOpInfo;\\n\\n _simulationOnlyValidations(userOp);\\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\\n StakeInfo memory factoryInfo;\\n {\\n bytes calldata initCode = userOp.initCode;\\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\\n factoryInfo = _getStakeInfo(factory);\\n }\\n\\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\\n address aggregator = data.aggregator;\\n bool sigFailed = aggregator == address(1);\\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\\n\\n if (aggregator != address(0) && aggregator != address(1)) {\\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\\n }\\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\\n\\n }\\n\\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\\n unchecked {\\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\\n // our security model might call postOp eventually twice\\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\\n\\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\\n }\\n }\\n\\n // create the sender's contract if needed.\\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\\n if (initCode.length != 0) {\\n address sender = opInfo.mUserOp.sender;\\n if (sender.code.length != 0) revert FailedOp(opIndex, \\\"AA10 sender already constructed\\\");\\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\\n if (sender1 == address(0)) revert FailedOp(opIndex, \\\"AA13 initCode failed or OOG\\\");\\n if (sender1 != sender) revert FailedOp(opIndex, \\\"AA14 initCode must return sender\\\");\\n if (sender1.code.length == 0) revert FailedOp(opIndex, \\\"AA15 initCode must create sender\\\");\\n address factory = address(bytes20(initCode[0 : 20]));\\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\\n }\\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 calldata initCode) public {\\n address sender = senderCreator.createSender(initCode);\\n revert SenderAddressResult(sender);\\n }\\n\\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\\n // solhint-disable-next-line no-empty-blocks\\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\\n catch Error(string memory revertReason) {\\n if (bytes(revertReason).length != 0) {\\n revert FailedOp(0, revertReason);\\n }\\n }\\n }\\n\\n /**\\n * Called only during simulation.\\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\\n */\\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\\n if (initCode.length == 0 && sender.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA20 account not deployed\\\");\\n }\\n if (paymasterAndData.length >= 20) {\\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\\n if (paymaster.code.length == 0) {\\n // it would revert anyway. but give a meaningful message\\n revert(\\\"AA30 paymaster not deployed\\\");\\n }\\n }\\n // always revert\\n revert(\\\"\\\");\\n }\\n\\n /**\\n * call account.validateUserOp.\\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\\n * decrement account's deposit if needed\\n */\\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\\n unchecked {\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n address sender = mUserOp.sender;\\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\\n address paymaster = mUserOp.paymaster;\\n numberMarker();\\n uint256 missingAccountFunds = 0;\\n if (paymaster == address(0)) {\\n uint256 bal = balanceOf(sender);\\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\\n }\\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\\n returns (uint256 _validationData) {\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA23 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA23 reverted (or OOG)\\\");\\n }\\n if (paymaster == address(0)) {\\n DepositInfo storage senderInfo = deposits[sender];\\n uint256 deposit = senderInfo.deposit;\\n if (requiredPrefund > deposit) {\\n revert FailedOp(opIndex, \\\"AA21 didn't pay prefund\\\");\\n }\\n senderInfo.deposit = uint112(deposit - requiredPrefund);\\n }\\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\\n }\\n }\\n\\n /**\\n * In case the request has a paymaster:\\n * Validate paymaster has enough deposit.\\n * Call paymaster.validatePaymasterUserOp.\\n * Revert with proper FailedOp in case paymaster reverts.\\n * Decrement paymaster's deposit\\n */\\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\\n internal returns (bytes memory context, uint256 validationData) {\\n unchecked {\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \\\"AA41 too little verificationGas\\\");\\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\\n\\n address paymaster = mUserOp.paymaster;\\n DepositInfo storage paymasterInfo = deposits[paymaster];\\n uint256 deposit = paymasterInfo.deposit;\\n if (deposit < requiredPreFund) {\\n revert FailedOp(opIndex, \\\"AA31 paymaster deposit too low\\\");\\n }\\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\\n context = _context;\\n validationData = _validationData;\\n } catch Error(string memory revertReason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA33 reverted: \\\", revertReason));\\n } catch {\\n revert FailedOp(opIndex, \\\"AA33 reverted (or OOG)\\\");\\n }\\n }\\n }\\n\\n /**\\n * revert if either account validationData or paymaster validationData is expired\\n */\\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\\n if (expectedAggregator != aggregator) {\\n revert FailedOp(opIndex, \\\"AA24 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA22 expired or not due\\\");\\n }\\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\\n address pmAggregator;\\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\\n if (pmAggregator != address(0)) {\\n revert FailedOp(opIndex, \\\"AA34 signature error\\\");\\n }\\n if (outOfTimeRange) {\\n revert FailedOp(opIndex, \\\"AA32 paymaster expired or not due\\\");\\n }\\n }\\n\\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\\n if (validationData == 0) {\\n return (address(0), false);\\n }\\n ValidationData memory data = _parseValidationData(validationData);\\n // solhint-disable-next-line not-rely-on-time\\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\\n aggregator = data.aggregator;\\n }\\n\\n /**\\n * validate account and paymaster (if defined).\\n * also make sure total validation doesn't exceed verificationGasLimit\\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\\n * @param opIndex the index of this userOp into the \\\"opInfos\\\" array\\n * @param userOp the userOp to validate\\n */\\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\\n private returns (uint256 validationData, uint256 paymasterValidationData) {\\n\\n uint256 preGas = gasleft();\\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\\n _copyUserOpToMemory(userOp, mUserOp);\\n outOpInfo.userOpHash = getUserOpHash(userOp);\\n\\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\\n // and multiplied without causing overflow\\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\\n require(maxGasValues <= type(uint120).max, \\\"AA94 gas values overflow\\\");\\n\\n uint256 gasUsedByValidateAccountPrepayment;\\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\\n\\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\\n revert FailedOp(opIndex, \\\"AA25 invalid account nonce\\\");\\n }\\n\\n //a \\\"marker\\\" where account opcode validation is done and paymaster opcode validation is about to start\\n // (used only by off-chain simulateValidation)\\n numberMarker();\\n\\n bytes memory context;\\n if (mUserOp.paymaster != address(0)) {\\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\\n }\\n unchecked {\\n uint256 gasUsed = preGas - gasleft();\\n\\n if (userOp.verificationGasLimit < gasUsed) {\\n revert FailedOp(opIndex, \\\"AA40 over verificationGasLimit\\\");\\n }\\n outOpInfo.prefund = requiredPreFund;\\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\\n }\\n }\\n\\n /**\\n * process post-operation.\\n * called just after the callData is executed.\\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\\n * @param opIndex index in the batch\\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\\n * @param opInfo userOp fields and info collected during validation\\n * @param context the context returned in validatePaymasterUserOp\\n * @param actualGas the gas used so far by this user operation\\n */\\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\\n uint256 preGas = gasleft();\\n unchecked {\\n address refundAddress;\\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\\n\\n address paymaster = mUserOp.paymaster;\\n if (paymaster == address(0)) {\\n refundAddress = mUserOp.sender;\\n } else {\\n refundAddress = paymaster;\\n if (context.length > 0) {\\n actualGasCost = actualGas * gasPrice;\\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\\n } else {\\n // solhint-disable-next-line no-empty-blocks\\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\\n catch Error(string memory reason) {\\n revert FailedOp(opIndex, string.concat(\\\"AA50 postOp reverted: \\\", reason));\\n }\\n catch {\\n revert FailedOp(opIndex, \\\"AA50 postOp revert\\\");\\n }\\n }\\n }\\n }\\n actualGas += preGas - gasleft();\\n actualGasCost = actualGas * gasPrice;\\n if (opInfo.prefund < actualGasCost) {\\n revert FailedOp(opIndex, \\\"AA51 prefund below actualGasCost\\\");\\n }\\n uint256 refund = opInfo.prefund - actualGasCost;\\n _incrementDeposit(refundAddress, refund);\\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\\n } // unchecked\\n }\\n\\n /**\\n * the gas price this UserOp agrees to pay.\\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n */\\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\\n assembly {offset := data}\\n }\\n\\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\\n assembly {data := offset}\\n }\\n\\n //place the NUMBER opcode in the code.\\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\\n // account and paymaster.\\n function numberMarker() internal view {\\n assembly {mstore(0, number())}\\n }\\n}\\n\\n\",\"keccak256\":\"0x04f86318b47f052d7308795ffae6ecec0d023d2458b4e17751b89a0e4acfcdc6\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/NonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\n\\n/**\\n * nonce management functionality\\n */\\ncontract NonceManager is INonceManager {\\n\\n /**\\n * The next valid sequence number for a given nonce key.\\n */\\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\\n\\n function getNonce(address sender, uint192 key)\\n public view override returns (uint256 nonce) {\\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\\n }\\n\\n // allow an account to manually increment its own nonce.\\n // (mainly so that during construction nonce can be made non-zero,\\n // to \\\"absorb\\\" the gas cost of first nonce increment to 1st transaction (construction),\\n // not to 2nd transaction)\\n function incrementNonce(uint192 key) public override {\\n nonceSequenceNumber[msg.sender][key]++;\\n }\\n\\n /**\\n * validate nonce uniqueness for this account.\\n * called just after validateUserOp()\\n */\\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\\n\\n uint192 key = uint192(nonce >> 64);\\n uint64 seq = uint64(nonce);\\n return nonceSequenceNumber[sender][key]++ == seq;\\n }\\n\\n}\\n\",\"keccak256\":\"0xa17a4a6fde70088ab18ffe6df830f3efa31f1cd0e1a7160336c96e3c94984d25\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/SenderCreator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/**\\n * helper contract for EntryPoint, to call userOp.initCode from a \\\"neutral\\\" address,\\n * which is explicitly not the entryPoint itself.\\n */\\ncontract SenderCreator {\\n\\n /**\\n * call the \\\"initCode\\\" factory to create and return the sender account address\\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\\n * @return sender the returned address of the created account, or zero address on failure.\\n */\\n function createSender(bytes calldata initCode) external returns (address sender) {\\n address factory = address(bytes20(initCode[0 : 20]));\\n bytes memory initCallData = initCode[20 :];\\n bool success;\\n /* solhint-disable no-inline-assembly */\\n assembly {\\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\\n sender := mload(0)\\n }\\n if (!success) {\\n sender = address(0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x44b9449fec82d6cdfb01d52fdd5a72f90099c651316123810cf9633f00b018c2\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/core/StakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\nimport \\\"../interfaces/IStakeManager.sol\\\";\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable not-rely-on-time */\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by a paymaster.\\n */\\nabstract contract StakeManager is IStakeManager {\\n\\n /// maps paymaster to their deposits and stakes\\n mapping(address => DepositInfo) public deposits;\\n\\n /// @inheritdoc IStakeManager\\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\\n return deposits[account];\\n }\\n\\n // internal method to return just the stake info\\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\\n DepositInfo storage depositInfo = deposits[addr];\\n info.stake = depositInfo.stake;\\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\\n }\\n\\n /// return the deposit (for gas payment) of the account\\n function balanceOf(address account) public view returns (uint256) {\\n return deposits[account].deposit;\\n }\\n\\n receive() external payable {\\n depositTo(msg.sender);\\n }\\n\\n function _incrementDeposit(address account, uint256 amount) internal {\\n DepositInfo storage info = deposits[account];\\n uint256 newAmount = info.deposit + amount;\\n require(newAmount <= type(uint112).max, \\\"deposit overflow\\\");\\n info.deposit = uint112(newAmount);\\n }\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) public payable {\\n _incrementDeposit(account, msg.value);\\n DepositInfo storage info = deposits[account];\\n emit Deposited(account, info.deposit);\\n }\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 unstakeDelaySec) public payable {\\n DepositInfo storage info = deposits[msg.sender];\\n require(unstakeDelaySec > 0, \\\"must specify unstake delay\\\");\\n require(unstakeDelaySec >= info.unstakeDelaySec, \\\"cannot decrease unstake time\\\");\\n uint256 stake = info.stake + msg.value;\\n require(stake > 0, \\\"no stake specified\\\");\\n require(stake <= type(uint112).max, \\\"stake overflow\\\");\\n deposits[msg.sender] = DepositInfo(\\n info.deposit,\\n true,\\n uint112(stake),\\n unstakeDelaySec,\\n 0\\n );\\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\\n }\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(info.unstakeDelaySec != 0, \\\"not staked\\\");\\n require(info.staked, \\\"already unstaking\\\");\\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\\n info.withdrawTime = withdrawTime;\\n info.staked = false;\\n emit StakeUnlocked(msg.sender, withdrawTime);\\n }\\n\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external {\\n DepositInfo storage info = deposits[msg.sender];\\n uint256 stake = info.stake;\\n require(stake > 0, \\\"No stake to withdraw\\\");\\n require(info.withdrawTime > 0, \\\"must call unlockStake() first\\\");\\n require(info.withdrawTime <= block.timestamp, \\\"Stake withdrawal is not due\\\");\\n info.unstakeDelaySec = 0;\\n info.withdrawTime = 0;\\n info.stake = 0;\\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\\n (bool success,) = withdrawAddress.call{value : stake}(\\\"\\\");\\n require(success, \\\"failed to withdraw stake\\\");\\n }\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\\n DepositInfo storage info = deposits[msg.sender];\\n require(withdrawAmount <= info.deposit, \\\"Withdraw amount too large\\\");\\n info.deposit = uint112(info.deposit - withdrawAmount);\\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\\\"\\\");\\n require(success, \\\"failed to withdraw\\\");\\n }\\n}\\n\",\"keccak256\":\"0x21aa0956382bd000b1b8c3b1d19ca6ebcd6c9029eebb19c612fb38ee5dd2430a\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IPaymaster.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\\n */\\ninterface IPaymaster {\\n\\n enum PostOpMode {\\n opSucceeded, // user op succeeded\\n opReverted, // user op reverted. still has to pay for gas.\\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\\n }\\n\\n /**\\n * payment validation: check if paymaster agrees to pay.\\n * Must verify sender is the entryPoint.\\n * Revert to reject this request.\\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\\n * @param userOp the user operation\\n * @param userOpHash hash of the user's request data.\\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\\n * @return context value to send to a postOp\\n * zero length to signify postOp is not required.\\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\\n external returns (bytes memory context, uint256 validationData);\\n\\n /**\\n * post-operation handler.\\n * Must verify sender is the entryPoint\\n * @param mode enum with the following options:\\n * opSucceeded - user operation succeeded.\\n * opReverted - user op reverted. still has to pay for gas.\\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\\n * Now this is the 2nd call, after user's op was deliberately reverted.\\n * @param context - the context value returned by validatePaymasterUserOp\\n * @param actualGasCost - actual gas used so far (without this postOp call).\\n */\\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\\n}\\n\",\"keccak256\":\"0x36858ba8685024974f533530420688da3454d29996ebc42e410673a1ed2ec456\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n\\n function call(\\n address to,\\n uint256 value,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function staticcall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal view returns (bool success) {\\n assembly {\\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n function delegateCall(\\n address to,\\n bytes memory data,\\n uint256 txGas\\n ) internal returns (bool success) {\\n assembly {\\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\\n }\\n }\\n\\n // get returned data from last call or calldelegate\\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\\n assembly {\\n let len := returndatasize()\\n if gt(len, maxLen) {\\n len := maxLen\\n }\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n // revert with explicit byte array (probably reverted info from call)\\n function revertWithData(bytes memory returnData) internal pure {\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n\\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\\n bool success = call(to,0,data,gasleft());\\n if (!success) {\\n revertWithData(getReturnData(maxLen));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b232117afbc2939f3ffc92745614867e9e1d475a3e1e5443adae13c200174f1\",\"license\":\"LGPL-3.0-only\"},\"lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x190dd6f8d592b7e4e930feb7f4313aeb8e1c4ad3154c27ce1cf6a512fc30d8cc\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(\\n uint256 amount,\\n bytes32 salt,\\n bytes memory bytecode\\n ) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(\\n bytes32 salt,\\n bytes32 bytecodeHash,\\n address deployer\\n ) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xafc07f37809f74d9c66d6461cc0f85fb5147ab855acd0acc30af4b2272130c61\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/Kernel.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"./plugin/IPlugin.sol\\\";\\nimport \\\"account-abstraction/core/Helpers.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport {EntryPoint} from \\\"account-abstraction/core/EntryPoint.sol\\\";\\nimport \\\"./utils/Exec.sol\\\";\\nimport \\\"./abstract/Compatibility.sol\\\";\\nimport \\\"./abstract/KernelStorage.sol\\\";\\n\\n/// @title Kernel\\n/// @author taek\\n/// @notice wallet kernel for minimal wallet functionality\\n/// @dev supports only 1 owner, multiple plugins\\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\\n error InvalidNonce();\\n error InvalidSignatureLength();\\n error QueryResult(bytes result);\\n\\n string public constant name = \\\"Kernel\\\";\\n\\n string public constant version = \\\"0.0.1\\\";\\n\\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\\n\\n /// @notice initialize wallet kernel\\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\\n /// @param _owner owner address\\n function initialize(address _owner) external {\\n WalletKernelStorage storage ws = getKernelStorage();\\n require(ws.owner == address(0), \\\"account: already initialized\\\");\\n ws.owner = _owner;\\n }\\n\\n /// @notice Query plugin for data\\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\\n /// @param _plugin Plugin address\\n /// @param _data Data to query\\n function queryPlugin(address _plugin, bytes calldata _data) external {\\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\\n if (success) {\\n revert QueryResult(_ret);\\n } else {\\n assembly {\\n revert(add(_ret, 32), mload(_ret))\\n }\\n }\\n }\\n\\n /// @notice execute function call to external contract\\n /// @dev this function will execute function call to external contract\\n /// @param to target contract address\\n /// @param value value to be sent\\n /// @param data data to be sent\\n /// @param operation operation type (call or delegatecall)\\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\\n \\\"account: not from entrypoint or owner\\\"\\n );\\n bool success;\\n bytes memory ret;\\n if (operation == Operation.DelegateCall) {\\n (success, ret) = Exec.delegateCall(to, data);\\n } else {\\n (success, ret) = Exec.call(to, value, data);\\n }\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n }\\n\\n /// @notice validate user operation\\n /// @dev this function will validate user operation and be called by EntryPoint\\n /// @param userOp user operation\\n /// @param userOpHash user operation hash\\n /// @param missingAccountFunds funds needed to be reimbursed\\n /// @return validationData validation data\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (uint256 validationData)\\n {\\n require(msg.sender == address(entryPoint), \\\"account: not from entryPoint\\\");\\n if (userOp.signature.length == 65) {\\n validationData = _validateUserOp(userOp, userOpHash);\\n } else if (userOp.signature.length > 97) {\\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\\n address plugin = address(bytes20(userOp.signature[0:20]));\\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\\n bytes memory signature = userOp.signature[32:97];\\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\\\"\\n ), // we are going to trust plugin for verification\\n plugin,\\n validUntil,\\n validAfter,\\n keccak256(data)\\n )\\n )\\n );\\n\\n address signer = ECDSA.recover(digest, signature);\\n if (getKernelStorage().owner != signer) {\\n return SIG_VALIDATION_FAILED;\\n }\\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\\n bool res = abi.decode(ret, (bool));\\n if (!res) {\\n return SIG_VALIDATION_FAILED;\\n }\\n validationData = _packValidationData(!res, validUntil, validAfter);\\n } else {\\n revert InvalidSignatureLength();\\n }\\n if (missingAccountFunds > 0) {\\n // we are going to assume signature is valid at this point\\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\\\"\\\");\\n (success);\\n return validationData;\\n }\\n }\\n\\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\\n internal\\n view\\n returns (uint256 validationData)\\n {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\\n return validationData;\\n }\\n\\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\\n address recovered = ECDSA.recover(hash, userOp.signature);\\n if (ws.owner != recovered) {\\n return SIG_VALIDATION_FAILED;\\n }\\n }\\n\\n /**\\n * delegate the contract call to the plugin\\n */\\n function _delegateToPlugin(\\n address plugin,\\n UserOperation calldata userOp,\\n bytes32 opHash,\\n uint256 missingAccountFunds\\n ) internal returns (bytes memory) {\\n bytes memory data =\\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\\n if (!success) {\\n assembly {\\n revert(add(ret, 32), mload(ret))\\n }\\n }\\n return ret;\\n }\\n\\n /// @notice validate signature using eip1271\\n /// @dev this function will validate signature using eip1271\\n /// @param _hash hash to be signed\\n /// @param _signature signature\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\\n WalletKernelStorage storage ws = getKernelStorage();\\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\\n return 0x1626ba7e;\\n }\\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\\n address recovered = ECDSA.recover(hash, _signature);\\n // Validate signatures\\n if (ws.owner == recovered) {\\n return 0x1626ba7e;\\n } else {\\n return 0xffffffff;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xee1651f7212298696da5a773709d0a33ee272ae8c06e31824655e71a2228ae25\",\"license\":\"MIT\"},\"src/KernelFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/Create2.sol\\\";\\nimport \\\"./factory/EIP1967Proxy.sol\\\";\\nimport \\\"./Kernel.sol\\\";\\n\\ncontract KernelFactory {\\n Kernel public immutable kernelTemplate;\\n\\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\\n\\n constructor(IEntryPoint _entryPoint) {\\n kernelTemplate = new Kernel(_entryPoint);\\n }\\n\\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n address addr = Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n if (addr.code.length > 0) {\\n return EIP1967Proxy(payable(addr));\\n }\\n proxy =\\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\\n emit AccountCreated(address(proxy), _owner, _index);\\n }\\n\\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\\n return Create2.computeAddress(\\n salt,\\n keccak256(\\n abi.encodePacked(\\n type(EIP1967Proxy).creationCode,\\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x53a5dbafaf7d000de850be785d4c2d883980acf1772d231b510c122640ccf789\",\"license\":\"MIT\"},\"src/abstract/Compatibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract Compatibility {\\n receive() external payable {}\\n\\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC721Received.selector;\\n }\\n\\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\\n external\\n pure\\n returns (bytes4)\\n {\\n return this.onERC1155BatchReceived.selector;\\n }\\n\\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\\n}\\n\",\"keccak256\":\"0x0d4634886db9ce6c2321db3a9bbbe0883cffe654cbce75dcfc9df1ec7eedb0b8\",\"license\":\"MIT\"},\"src/abstract/KernelStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\n\\nstruct WalletKernelStorage {\\n address owner;\\n}\\n\\ncontract KernelStorage {\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n IEntryPoint public immutable entryPoint;\\n\\n event Upgraded(address indexed newImplementation);\\n\\n // modifier for checking if the sender is the entrypoint or\\n // the account itself\\n modifier onlyFromEntryPointOrOwnerOrSelf() {\\n require(\\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\\n \\\"account: not from entrypoint or owner or self\\\"\\n );\\n _;\\n }\\n\\n constructor(IEntryPoint _entryPoint) {\\n entryPoint = _entryPoint;\\n getKernelStorage().owner = address(1);\\n }\\n /// @notice get wallet kernel storage\\n /// @dev used to get wallet kernel storage\\n /// @return ws wallet kernel storage, consists of owner and nonces\\n\\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\\n bytes32 storagePosition = bytes32(uint256(keccak256(\\\"zerodev.kernel\\\")) - 1);\\n assembly {\\n ws.slot := storagePosition\\n }\\n }\\n\\n function getOwner() external view returns (address) {\\n return getKernelStorage().owner;\\n }\\n\\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n assembly {\\n sstore(slot, _newImplementation)\\n }\\n emit Upgraded(_newImplementation);\\n }\\n\\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\\n getKernelStorage().owner = _newOwner;\\n }\\n\\n function getNonce() public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), 0);\\n }\\n\\n function getNonce(uint192 key) public view virtual returns (uint256) {\\n return entryPoint.getNonce(address(this), key);\\n }\\n}\\n \",\"keccak256\":\"0xe4512794b67794cf90eba665aee57b75efa60f2aacd1cc45eb17d3f3b255008c\",\"license\":\"MIT\"},\"src/factory/EIP1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ncontract EIP1967Proxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n constructor(address _logic, bytes memory _data) payable {\\n require(_logic != address(0), \\\"EIP1967Proxy: implementation is the zero address\\\");\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n sstore(slot, _logic)\\n }\\n if (_data.length > 0) {\\n (bool success,) = _logic.delegatecall(_data);\\n require(success, \\\"EIP1967Proxy: constructor call failed\\\");\\n }\\n }\\n\\n fallback() external payable {\\n address implementation = _implementation();\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n function _implementation() internal view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xbec8942c8258db6379a08dcb3b0a4aa0ee585972f26eba258c35ece87972d78b\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/utils/Exec.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.5 <0.9.0;\\n\\n// solhint-disable no-inline-assembly\\n\\nenum Operation {\\n Call,\\n DelegateCall\\n}\\n\\n/**\\n * Utility functions helpful when making different kinds of contract calls in Solidity.\\n */\\nlibrary Exec {\\n function call(address to, uint256 value, bytes memory data)\\n internal\\n returns (bool success, bytes memory returnData)\\n {\\n assembly {\\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\\n assembly {\\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n\\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\\n assembly {\\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\\n let len := returndatasize()\\n let ptr := mload(0x40)\\n mstore(0x40, add(ptr, add(len, 0x20)))\\n mstore(ptr, len)\\n returndatacopy(add(ptr, 0x20), 0, len)\\n returnData := ptr\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1eef311d5073ff7f02b44311ae4d5c53f619ea19f1a059b8d17c028d141c2893\",\"license\":\"LGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b506040516200466d3803806200466d833981810160405281019062000037919062000136565b806040516200004690620000aa565b620000529190620001d3565b604051809103906000f0801580156200006f573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505050620001f0565b613527806200114683390190565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000ea82620000bd565b9050919050565b6000620000fe82620000dd565b9050919050565b6200011081620000f1565b81146200011c57600080fd5b50565b600081519050620001308162000105565b92915050565b6000602082840312156200014f576200014e620000b8565b5b60006200015f848285016200011f565b91505092915050565b6000819050919050565b6000620001936200018d6200018784620000bd565b62000168565b620000bd565b9050919050565b6000620001a78262000172565b9050919050565b6000620001bb826200019a565b9050919050565b620001cd81620001ae565b82525050565b6000602082019050620001ea6000830184620001c2565b92915050565b608051610f26620002206000396000818160db0152818161015a0152818161028a01526103830152610f266000f3fe60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c634300081200336101606040523480156200001257600080fd5b5060405162003527380380620035278339818101604052810190620000389190620002e2565b806040518060400160405280600681526020017f4b65726e656c00000000000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a081815250506200010e818484620001e760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050508073ffffffffffffffffffffffffffffffffffffffff166101408173ffffffffffffffffffffffffffffffffffffffff168152505060016200019e6200022360201b60201c565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505062000422565b60008383834630604051602001620002049594939291906200035b565b6040516020818303038152906040528051906020012090509392505050565b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c620002589190620003e7565b60001b90508091505090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002968262000269565b9050919050565b6000620002aa8262000289565b9050919050565b620002bc816200029d565b8114620002c857600080fd5b50565b600081519050620002dc81620002b1565b92915050565b600060208284031215620002fb57620002fa62000264565b5b60006200030b84828501620002cb565b91505092915050565b6000819050919050565b620003298162000314565b82525050565b6000819050919050565b62000344816200032f565b82525050565b620003558162000289565b82525050565b600060a0820190506200037260008301886200031e565b6200038160208301876200031e565b6200039060408301866200031e565b6200039f606083018562000339565b620003ae60808301846200034a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000620003f4826200032f565b915062000401836200032f565b92508282039050818111156200041c576200041b620003b8565b5b92915050565b60805160a05160c05160e051610100516101205161014051613080620004a76000396000818161057a0152818161071301528181610b1501528181610c2401528181610e0b01528181610f2f0152610fe701526000611800015260006118420152600061182101526000611756015260006117ac015260006117d501526130806000f3fe6080604052600436106100f75760003560e01c8063940d3c601161008a578063d087d28811610059578063d087d2881461035b578063f23a6e6114610386578063f2fde38b146103c3578063f333df55146103ec576100fe565b8063940d3c60146102a1578063b0d691fe146102ca578063bc197c81146102f5578063c4d66de814610332576100fe565b80633a871cdd116100c65780633a871cdd146101d15780633e1b08121461020e57806354fd4d501461024b578063893d20e814610276576100fe565b806306fdde0314610103578063150b7a021461012e5780631626ba7e1461016b5780633659cfe6146101a8576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b50610118610415565b6040516101259190611a4b565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611b7a565b61044e565b6040516101629190611c3d565b60405180910390f35b34801561017757600080fd5b50610192600480360381019061018d9190611dbe565b610463565b60405161019f9190611c3d565b60405180910390f35b3480156101b457600080fd5b506101cf60048036038101906101ca9190611e1a565b610578565b005b3480156101dd57600080fd5b506101f860048036038101906101f39190611e6c565b61070f565b6040516102059190611eea565b60405180910390f35b34801561021a57600080fd5b5061023560048036038101906102309190611f55565b610b11565b6040516102429190611eea565b60405180910390f35b34801561025757600080fd5b50610260610bb6565b60405161026d9190611a4b565b60405180910390f35b34801561028257600080fd5b5061028b610bef565b6040516102989190611f91565b60405180910390f35b3480156102ad57600080fd5b506102c860048036038101906102c39190611fd1565b610c22565b005b3480156102d657600080fd5b506102df610e09565b6040516102ec91906120b8565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190612129565b610e2d565b6040516103299190611c3d565b60405180910390f35b34801561033e57600080fd5b5061035960048036038101906103549190611e1a565b610e45565b005b34801561036757600080fd5b50610370610f2b565b60405161037d9190611eea565b60405180910390f35b34801561039257600080fd5b506103ad60048036038101906103a89190612205565b610fcf565b6040516103ba9190611c3d565b60405180910390f35b3480156103cf57600080fd5b506103ea60048036038101906103e59190611e1a565b610fe5565b005b3480156103f857600080fd5b50610413600480360381019061040e919061229f565b611157565b005b6040518060400160405280600681526020017f4b65726e656c000000000000000000000000000000000000000000000000000081525081565b600063150b7a0260e01b905095945050505050565b60008061046e6111f7565b905061047a8484611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036104e057631626ba7e60e01b915050610572565b60006104eb8561125d565b905060006104f98286611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361056457631626ba7e60e01b9350505050610572565b63ffffffff60e01b93505050505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061062857506105d56111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061065e57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61069d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069490612371565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508181558173ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a25050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461079f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610796906123dd565b60405180910390fd5b6041848061014001906107b2919061240c565b9050036107ca576107c3848461128d565b9050610a8e565b6061848061014001906107dd919061240c565b90501115610a5b576000848061014001906107f8919061240c565b60009060149261080a93929190612479565b9061081591906124f8565b60601c905060008580610140019061082d919061240c565b601490601a9261083f93929190612479565b9061084a9190612583565b60d01c9050600086806101400190610862919061240c565b601a9060209261087493929190612479565b9061087f9190612583565b60d01c9050600087806101400190610897919061240c565b6020906061926108a993929190612479565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050600088806101400190610901919061240c565b606190809261091293929190612479565b81019061091f91906125e2565b50905060006109827f4584533bad8bbd8aa77024a548a56acb8d2807847381ce1b3364745ca396b2e3878787868051906020012060405160200161096795949392919061268a565b6040516020818303038152906040528051906020012061142e565b905060006109908285611236565b90508073ffffffffffffffffffffffffffffffffffffffff166109b16111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a00576001975050505050505050610b0a565b6000610a0e888d8d8d611448565b9050600081806020019051810190610a269190612715565b905080610a3f5760019950505050505050505050610b0a565b610a4b811589896114f4565b9950505050505050505050610a8d565b6040517f4be6321b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b6000821115610b095760003373ffffffffffffffffffffffffffffffffffffffff1683604051610abd90612773565b60006040518083038185875af1925050503d8060008114610afa576040519150601f19603f3d011682016040523d82523d6000602084013e610aff565b606091505b5050905050610b0a565b5b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a30846040518363ffffffff1660e01b8152600401610b6e929190612797565b602060405180830381865afa158015610b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baf91906127d5565b9050919050565b6040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b6000610bf96111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610cd25750610c7f6111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610d11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0890612874565b60405180910390fd5b60006060600180811115610d2857610d27612894565b5b836001811115610d3b57610d3a612894565b5b03610d9b57610d8e8786868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b8092508193505050610df3565b610dea878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611563565b80925081935050505b81610e0057805160208201fd5b50505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063bc197c8160e01b905098975050505050505050565b6000610e4f6111f7565b9050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610edb9061290f565b60405180910390fd5b818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335567e1a3060006040518363ffffffff1660e01b8152600401610f8992919061296a565b602060405180830381865afa158015610fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fca91906127d5565b905090565b600063f23a6e6160e01b90509695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061109557506110426111f7565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806110cb57503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61110a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110190612371565b60405180910390fd5b806111136111f7565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806111a88585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061152d565b9150915081156111ef57806040517fa52b21690000000000000000000000000000000000000000000000000000000081526004016111e691906129e8565b60405180910390fd5b805160208201fd5b60008060017f439ffe7df606b78489639bc0b827913bd09e1246fa6802968a5b3694c53e0dd960001c61122a9190612a39565b60001b90508091505090565b6000806000611245858561159b565b91509150611252816115ec565b819250505092915050565b6000816040516020016112709190612ae5565b604051602081830303815290604052805190602001209050919050565b6000806112986111f7565b90506112f783858061014001906112af919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b73ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036113535750611428565b600061135e8461125d565b905060006113bf8287806101400190611377919061240c565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611236565b90508073ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114245760019350505050611428565b5050505b92915050565b600061144161143b611752565b8361186c565b9050919050565b60606000639e2045ce60e01b85858560405160240161146993929190612d6b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000806114d5888461152d565b91509150816114e657805160208201fd5b809350505050949350505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b8561151c57600061151f565b60015b60ff16171790509392505050565b60006060600080845160208601875af491503d604051602082018101604052818152816000602083013e80925050509250929050565b6000606060008084516020860187895af191503d604051602082018101604052818152816000602083013e8092505050935093915050565b60008060418351036115dc5760008060006020860151925060408601519150606086015160001a90506115d08782858561189f565b945094505050506115e5565b60006002915091505b9250929050565b60006004811115611600576115ff612894565b5b81600481111561161357611612612894565b5b031561174f576001600481111561162d5761162c612894565b5b8160048111156116405761163f612894565b5b03611680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167790612df5565b60405180910390fd5b6002600481111561169457611693612894565b5b8160048111156116a7576116a6612894565b5b036116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116de90612e61565b60405180910390fd5b600360048111156116fb576116fa612894565b5b81600481111561170e5761170d612894565b5b0361174e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174590612ef3565b60405180910390fd5b5b50565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161480156117ce57507f000000000000000000000000000000000000000000000000000000000000000046145b156117fb577f00000000000000000000000000000000000000000000000000000000000000009050611869565b6118667f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611981565b90505b90565b60008282604051602001611881929190612f5f565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c11156118da576000600391509150611978565b6000600187878787604051600081526020016040526040516118ff9493929190612fb2565b6020604051602081039080840390855afa158015611921573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361196f57600060019250925050611978565b80600092509250505b94509492505050565b6000838383463060405160200161199c959493929190612ff7565b6040516020818303038152906040528051906020012090509392505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156119f55780820151818401526020810190506119da565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a1d826119bb565b611a2781856119c6565b9350611a378185602086016119d7565b611a4081611a01565b840191505092915050565b60006020820190508181036000830152611a658184611a12565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611aac82611a81565b9050919050565b611abc81611aa1565b8114611ac757600080fd5b50565b600081359050611ad981611ab3565b92915050565b6000819050919050565b611af281611adf565b8114611afd57600080fd5b50565b600081359050611b0f81611ae9565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611b3a57611b39611b15565b5b8235905067ffffffffffffffff811115611b5757611b56611b1a565b5b602083019150836001820283011115611b7357611b72611b1f565b5b9250929050565b600080600080600060808688031215611b9657611b95611a77565b5b6000611ba488828901611aca565b9550506020611bb588828901611aca565b9450506040611bc688828901611b00565b935050606086013567ffffffffffffffff811115611be757611be6611a7c565b5b611bf388828901611b24565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611c3781611c02565b82525050565b6000602082019050611c526000830184611c2e565b92915050565b6000819050919050565b611c6b81611c58565b8114611c7657600080fd5b50565b600081359050611c8881611c62565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611ccb82611a01565b810181811067ffffffffffffffff82111715611cea57611ce9611c93565b5b80604052505050565b6000611cfd611a6d565b9050611d098282611cc2565b919050565b600067ffffffffffffffff821115611d2957611d28611c93565b5b611d3282611a01565b9050602081019050919050565b82818337600083830152505050565b6000611d61611d5c84611d0e565b611cf3565b905082815260208101848484011115611d7d57611d7c611c8e565b5b611d88848285611d3f565b509392505050565b600082601f830112611da557611da4611b15565b5b8135611db5848260208601611d4e565b91505092915050565b60008060408385031215611dd557611dd4611a77565b5b6000611de385828601611c79565b925050602083013567ffffffffffffffff811115611e0457611e03611a7c565b5b611e1085828601611d90565b9150509250929050565b600060208284031215611e3057611e2f611a77565b5b6000611e3e84828501611aca565b91505092915050565b600080fd5b60006101608284031215611e6357611e62611e47565b5b81905092915050565b600080600060608486031215611e8557611e84611a77565b5b600084013567ffffffffffffffff811115611ea357611ea2611a7c565b5b611eaf86828701611e4c565b9350506020611ec086828701611c79565b9250506040611ed186828701611b00565b9150509250925092565b611ee481611adf565b82525050565b6000602082019050611eff6000830184611edb565b92915050565b600077ffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b611f3281611f05565b8114611f3d57600080fd5b50565b600081359050611f4f81611f29565b92915050565b600060208284031215611f6b57611f6a611a77565b5b6000611f7984828501611f40565b91505092915050565b611f8b81611aa1565b82525050565b6000602082019050611fa66000830184611f82565b92915050565b60028110611fb957600080fd5b50565b600081359050611fcb81611fac565b92915050565b600080600080600060808688031215611fed57611fec611a77565b5b6000611ffb88828901611aca565b955050602061200c88828901611b00565b945050604086013567ffffffffffffffff81111561202d5761202c611a7c565b5b61203988828901611b24565b9350935050606061204c88828901611fbc565b9150509295509295909350565b6000819050919050565b600061207e61207961207484611a81565b612059565b611a81565b9050919050565b600061209082612063565b9050919050565b60006120a282612085565b9050919050565b6120b281612097565b82525050565b60006020820190506120cd60008301846120a9565b92915050565b60008083601f8401126120e9576120e8611b15565b5b8235905067ffffffffffffffff81111561210657612105611b1a565b5b60208301915083602082028301111561212257612121611b1f565b5b9250929050565b60008060008060008060008060a0898b03121561214957612148611a77565b5b60006121578b828c01611aca565b98505060206121688b828c01611aca565b975050604089013567ffffffffffffffff81111561218957612188611a7c565b5b6121958b828c016120d3565b9650965050606089013567ffffffffffffffff8111156121b8576121b7611a7c565b5b6121c48b828c016120d3565b9450945050608089013567ffffffffffffffff8111156121e7576121e6611a7c565b5b6121f38b828c01611b24565b92509250509295985092959890939650565b60008060008060008060a0878903121561222257612221611a77565b5b600061223089828a01611aca565b965050602061224189828a01611aca565b955050604061225289828a01611b00565b945050606061226389828a01611b00565b935050608087013567ffffffffffffffff81111561228457612283611a7c565b5b61229089828a01611b24565b92509250509295509295509295565b6000806000604084860312156122b8576122b7611a77565b5b60006122c686828701611aca565b935050602084013567ffffffffffffffff8111156122e7576122e6611a7c565b5b6122f386828701611b24565b92509250509250925092565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572206f722073656c6600000000000000000000000000000000000000602082015250565b600061235b602d836119c6565b9150612366826122ff565b604082019050919050565b6000602082019050818103600083015261238a8161234e565b9050919050565b7f6163636f756e743a206e6f742066726f6d20656e747279506f696e7400000000600082015250565b60006123c7601c836119c6565b91506123d282612391565b602082019050919050565b600060208201905081810360008301526123f6816123ba565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612429576124286123fd565b5b80840192508235915067ffffffffffffffff82111561244b5761244a612402565b5b60208301925060018202360383131561246757612466612407565b5b509250929050565b600080fd5b600080fd5b6000808585111561248d5761248c61246f565b5b8386111561249e5761249d612474565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b600061250483836124b4565b8261250f81356124bf565b9250601482101561254f5761254a7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026124eb565b831692505b505092915050565b60007fffffffffffff000000000000000000000000000000000000000000000000000082169050919050565b600061258f83836124b4565b8261259a8135612557565b925060068210156125da576125d57fffffffffffff0000000000000000000000000000000000000000000000000000836006036008026124eb565b831692505b505092915050565b600080604083850312156125f9576125f8611a77565b5b600083013567ffffffffffffffff81111561261757612616611a7c565b5b61262385828601611d90565b925050602083013567ffffffffffffffff81111561264457612643611a7c565b5b61265085828601611d90565b9150509250929050565b61266381611c58565b82525050565b600065ffffffffffff82169050919050565b61268481612669565b82525050565b600060a08201905061269f600083018861265a565b6126ac6020830187611f82565b6126b9604083018661267b565b6126c6606083018561267b565b6126d3608083018461265a565b9695505050505050565b60008115159050919050565b6126f2816126dd565b81146126fd57600080fd5b50565b60008151905061270f816126e9565b92915050565b60006020828403121561272b5761272a611a77565b5b600061273984828501612700565b91505092915050565b600081905092915050565b50565b600061275d600083612742565b91506127688261274d565b600082019050919050565b600061277e82612750565b9150819050919050565b61279181611f05565b82525050565b60006040820190506127ac6000830185611f82565b6127b96020830184612788565b9392505050565b6000815190506127cf81611ae9565b92915050565b6000602082840312156127eb576127ea611a77565b5b60006127f9848285016127c0565b91505092915050565b7f6163636f756e743a206e6f742066726f6d20656e747279706f696e74206f722060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b600061285e6025836119c6565b915061286982612802565b604082019050919050565b6000602082019050818103600083015261288d81612851565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6163636f756e743a20616c726561647920696e697469616c697a656400000000600082015250565b60006128f9601c836119c6565b9150612904826128c3565b602082019050919050565b60006020820190508181036000830152612928816128ec565b9050919050565b6000819050919050565b600061295461294f61294a8461292f565b612059565b611f05565b9050919050565b61296481612939565b82525050565b600060408201905061297f6000830185611f82565b61298c602083018461295b565b9392505050565b600081519050919050565b600082825260208201905092915050565b60006129ba82612993565b6129c4818561299e565b93506129d48185602086016119d7565b6129dd81611a01565b840191505092915050565b60006020820190508181036000830152612a0281846129af565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a4482611adf565b9150612a4f83611adf565b9250828203905081811115612a6757612a66612a0a565b5b92915050565b600081905092915050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000612aae601c83612a6d565b9150612ab982612a78565b601c82019050919050565b6000819050919050565b612adf612ada82611c58565b612ac4565b82525050565b6000612af082612aa1565b9150612afc8284612ace565b60208201915081905092915050565b6000612b1a6020840184611aca565b905092915050565b612b2b81611aa1565b82525050565b6000612b406020840184611b00565b905092915050565b612b5181611adf565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112612b8357612b82612b61565b5b83810192508235915060208301925067ffffffffffffffff821115612bab57612baa612b57565b5b600182023603831315612bc157612bc0612b5c565b5b509250929050565b600082825260208201905092915050565b6000612be68385612bc9565b9350612bf3838584611d3f565b612bfc83611a01565b840190509392505050565b60006101608301612c1b6000840184612b0b565b612c286000860182612b22565b50612c366020840184612b31565b612c436020860182612b48565b50612c516040840184612b66565b8583036040870152612c64838284612bda565b92505050612c756060840184612b66565b8583036060870152612c88838284612bda565b92505050612c996080840184612b31565b612ca66080860182612b48565b50612cb460a0840184612b31565b612cc160a0860182612b48565b50612ccf60c0840184612b31565b612cdc60c0860182612b48565b50612cea60e0840184612b31565b612cf760e0860182612b48565b50612d06610100840184612b31565b612d14610100860182612b48565b50612d23610120840184612b66565b858303610120870152612d37838284612bda565b92505050612d49610140840184612b66565b858303610140870152612d5d838284612bda565b925050508091505092915050565b60006060820190508181036000830152612d858186612c07565b9050612d94602083018561265a565b612da16040830184611edb565b949350505050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000612ddf6018836119c6565b9150612dea82612da9565b602082019050919050565b60006020820190508181036000830152612e0e81612dd2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000612e4b601f836119c6565b9150612e5682612e15565b602082019050919050565b60006020820190508181036000830152612e7a81612e3e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000612edd6022836119c6565b9150612ee882612e81565b604082019050919050565b60006020820190508181036000830152612f0c81612ed0565b9050919050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000612f49600283612a6d565b9150612f5482612f13565b600282019050919050565b6000612f6a82612f3c565b9150612f768285612ace565b602082019150612f868284612ace565b6020820191508190509392505050565b600060ff82169050919050565b612fac81612f96565b82525050565b6000608082019050612fc7600083018761265a565b612fd46020830186612fa3565b612fe1604083018561265a565b612fee606083018461265a565b95945050505050565b600060a08201905061300c600083018861265a565b613019602083018761265a565b613026604083018661265a565b6130336060830185611edb565b6130406080830184611f82565b969550505050505056fea264697066735822122032ca1cf88a7b31318141bd230c1cabd5f99c4503ed694966da441ea9decb738c64736f6c63430008120033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c8063037637aa146200004b5780630d253d76146200006d5780635fbfb9cf14620000a3575b600080fd5b62000055620000d9565b604051620000649190620005a4565b60405180910390f35b6200008b600480360381019062000085919062000646565b620000fd565b6040516200009a91906200069e565b60405180910390f35b620000c16004803603810190620000bb919062000646565b6200022b565b604051620000d09190620006e0565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60008083836040516020016200011592919062000772565b60405160208183030381529060405280519060200120905062000222816040518060200162000144906200050b565b6020820181038252601f19601f820116604052507f0000000000000000000000000000000000000000000000000000000000000000876040516024016200018c91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620001e49291906200083c565b60405160208183030381529060405260405160200162000206929190620008b2565b60405160208183030381529060405280519060200120620004c9565b91505092915050565b60008083836040516020016200024392919062000772565b604051602081830303815290604052805190602001209050600062000352826040518060200162000274906200050b565b6020820181038252601f19601f820116604052507f000000000000000000000000000000000000000000000000000000000000000088604051602401620002bc91906200069e565b60405160208183030381529060405263c4d66de860e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051602001620003149291906200083c565b60405160208183030381529060405260405160200162000336929190620008b2565b60405160208183030381529060405280519060200120620004c9565b905060008173ffffffffffffffffffffffffffffffffffffffff163b111562000380578092505050620004c3565b817f000000000000000000000000000000000000000000000000000000000000000063c4d66de860e01b87604051602401620003bd91906200069e565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405162000428906200050b565b620004359291906200083c565b8190604051809103906000f590508015801562000456573d6000803e3d6000fd5b5092508473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f33310a89c32d8cc00057ad6ef6274d2f8fe22389a992cf89983e09fc84f6cfff86604051620004b89190620008eb565b60405180910390a350505b92915050565b6000620004d8838330620004e0565b905092915050565b6000604051836040820152846020820152828152600b810160ff815360558120925050509392505050565b6105e8806200090983390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005646200055e620005588462000519565b62000539565b62000519565b9050919050565b6000620005788262000543565b9050919050565b60006200058c826200056b565b9050919050565b6200059e816200057f565b82525050565b6000602082019050620005bb600083018462000593565b92915050565b600080fd5b6000620005d38262000519565b9050919050565b620005e581620005c6565b8114620005f157600080fd5b50565b6000813590506200060581620005da565b92915050565b6000819050919050565b62000620816200060b565b81146200062c57600080fd5b50565b600081359050620006408162000615565b92915050565b6000806040838503121562000660576200065f620005c1565b5b60006200067085828601620005f4565b925050602062000683858286016200062f565b9150509250929050565b6200069881620005c6565b82525050565b6000602082019050620006b560008301846200068d565b92915050565b6000620006c8826200056b565b9050919050565b620006da81620006bb565b82525050565b6000602082019050620006f76000830184620006cf565b92915050565b60008160601b9050919050565b60006200071782620006fd565b9050919050565b60006200072b826200070a565b9050919050565b620007476200074182620005c6565b6200071e565b82525050565b6000819050919050565b6200076c62000766826200060b565b6200074d565b82525050565b600062000780828562000732565b60148201915062000792828462000757565b6020820191508190509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015620007de578082015181840152602081019050620007c1565b60008484015250505050565b6000601f19601f8301169050919050565b60006200080882620007a2565b620008148185620007ad565b935062000826818560208601620007be565b6200083181620007ea565b840191505092915050565b60006040820190506200085360008301856200068d565b8181036020830152620008678184620007fb565b90509392505050565b600081905092915050565b60006200088882620007a2565b62000894818562000870565b9350620008a6818560208601620007be565b80840191505092915050565b6000620008c082856200087b565b9150620008ce82846200087b565b91508190509392505050565b620008e5816200060b565b82525050565b6000602082019050620009026000830184620008da565b9291505056fe60806040526040516105e83803806105e883398181016040528101906100259190610351565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161008b90610430565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508281556000825111156101765760008373ffffffffffffffffffffffffffffffffffffffff16836040516100f09190610497565b600060405180830381855af49150503d806000811461012b576040519150601f19603f3d011682016040523d82523d6000602084013e610130565b606091505b5050905080610174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016b90610520565b60405180910390fd5b505b505050610540565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101bd82610192565b9050919050565b6101cd816101b2565b81146101d857600080fd5b50565b6000815190506101ea816101c4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610243826101fa565b810181811067ffffffffffffffff821117156102625761026161020b565b5b80604052505050565b600061027561017e565b9050610281828261023a565b919050565b600067ffffffffffffffff8211156102a1576102a061020b565b5b6102aa826101fa565b9050602081019050919050565b60005b838110156102d55780820151818401526020810190506102ba565b60008484015250505050565b60006102f46102ef84610286565b61026b565b9050828152602081018484840111156103105761030f6101f5565b5b61031b8482856102b7565b509392505050565b600082601f830112610338576103376101f0565b5b81516103488482602086016102e1565b91505092915050565b6000806040838503121561036857610367610188565b5b6000610376858286016101db565b925050602083015167ffffffffffffffff8111156103975761039661018d565b5b6103a385828601610323565b9150509250929050565b600082825260208201905092915050565b7f4549503139363750726f78793a20696d706c656d656e746174696f6e2069732060008201527f746865207a65726f206164647265737300000000000000000000000000000000602082015250565b600061041a6030836103ad565b9150610425826103be565b604082019050919050565b600060208201905081810360008301526104498161040d565b9050919050565b600081519050919050565b600081905092915050565b600061047182610450565b61047b818561045b565b935061048b8185602086016102b7565b80840191505092915050565b60006104a38284610466565b915081905092915050565b7f4549503139363750726f78793a20636f6e7374727563746f722063616c6c206660008201527f61696c6564000000000000000000000000000000000000000000000000000000602082015250565b600061050a6025836103ad565b9150610515826104ae565b604082019050919050565b60006020820190508181036000830152610539816104fd565b9050919050565b609a8061054e6000396000f3fe60806040526000600c6033565b90503660008037600080366000845af43d6000803e8060008114602e573d6000f35b3d6000fd5b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905080549150509056fea2646970667358221220388bcbb27d5b065c1b785d1b94666d7f301b338574b92c716035a8fc03df3d4064736f6c63430008120033a2646970667358221220f50046c0d563594938691fabbaecaf185ed1de2d60d093c2816cf6a34a40c32a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/bscTestnet/ZeroDevSessionKeyPlugin.json b/deployments/bscTestnet/ZeroDevSessionKeyPlugin.json new file mode 100644 index 00000000..87a4b7b6 --- /dev/null +++ b/deployments/bscTestnet/ZeroDevSessionKeyPlugin.json @@ -0,0 +1,201 @@ +{ + "address": "0x6E2631aF80bF7a9cEE83F590eE496bCc2E40626D", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "key", + "type": "address" + } + ], + "name": "SessionKeyRevoked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_packed", + "type": "bytes" + } + ], + "name": "parseDataAndSignature", + "outputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revokeSessionKey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_key", + "type": "address" + } + ], + "name": "revoked", + "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": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "missingAccountFunds", + "type": "uint256" + } + ], + "name": "validatePluginData", + "outputs": [ + { + "internalType": "bool", + "name": "validated", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xa98daaa692b5c605213569431746f4f70fd5ec75037ff33047f4d1ff1a633d2a", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x8d8a9Cf53b7D95C148cB159384D249F8FB68db3f", + "contractAddress": null, + "transactionIndex": 5, + "gasUsed": "1716069", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x54b2ecbca76323ab9ca0d24e2e124ba4589bb1de539880b21e6176b0c90875fd", + "transactionHash": "0xa98daaa692b5c605213569431746f4f70fd5ec75037ff33047f4d1ff1a633d2a", + "logs": [], + "blockNumber": 29514650, + "cumulativeGasUsed": "2009244", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "b4f7aa20796f803709c4f0ee7de51b7f", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"key\",\"type\":\"address\"}],\"name\":\"SessionKeyRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_packed\",\"type\":\"bytes\"}],\"name\":\"parseDataAndSignature\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revokeSessionKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_key\",\"type\":\"address\"}],\"name\":\"revoked\",\"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\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"struct UserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"missingAccountFunds\",\"type\":\"uint256\"}],\"name\":\"validatePluginData\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"validated\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/plugin/ZeroDevSessionKeyPlugin.sol\":\"ZeroDevSessionKeyPlugin\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/=lib/openzeppelin-contracts/\",\":account-abstraction/=lib/account-abstraction/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"lib/account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"lib/account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"lib/account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts 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 * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\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 _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\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 bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev These functions deal with verification of Merkle Tree proofs.\\n *\\n * The tree and the proofs can be generated using our\\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\\n * You will find a quickstart guide in the readme.\\n *\\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\\n * hashing, or use a hash function other than keccak256 for hashing leaves.\\n * This is because the concatenation of a sorted pair of internal nodes in\\n * the merkle tree could be reinterpreted as a leaf value.\\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\\n * against this attack out of the box.\\n */\\nlibrary MerkleProof {\\n /**\\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\\n * defined by `root`. For this, a `proof` must be provided, containing\\n * sibling hashes on the branch from the leaf to the root of the tree. Each\\n * pair of leaves and each pair of pre-images are assumed to be sorted.\\n */\\n function verify(\\n bytes32[] memory proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProof(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {verify}\\n *\\n * _Available since v4.7._\\n */\\n function verifyCalldata(\\n bytes32[] calldata proof,\\n bytes32 root,\\n bytes32 leaf\\n ) internal pure returns (bool) {\\n return processProofCalldata(proof, leaf) == root;\\n }\\n\\n /**\\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\\n * hash matches the root of the tree. When processing the proof, the pairs\\n * of leafs & pre-images are assumed to be sorted.\\n *\\n * _Available since v4.4._\\n */\\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Calldata version of {processProof}\\n *\\n * _Available since v4.7._\\n */\\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\\n bytes32 computedHash = leaf;\\n for (uint256 i = 0; i < proof.length; i++) {\\n computedHash = _hashPair(computedHash, proof[i]);\\n }\\n return computedHash;\\n }\\n\\n /**\\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerify(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProof(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Calldata version of {multiProofVerify}\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function multiProofVerifyCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32 root,\\n bytes32[] memory leaves\\n ) internal pure returns (bool) {\\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\\n }\\n\\n /**\\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\\n * respectively.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProof(\\n bytes32[] memory proof,\\n bool[] memory proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n /**\\n * @dev Calldata version of {processMultiProof}.\\n *\\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\\n *\\n * _Available since v4.7._\\n */\\n function processMultiProofCalldata(\\n bytes32[] calldata proof,\\n bool[] calldata proofFlags,\\n bytes32[] memory leaves\\n ) internal pure returns (bytes32 merkleRoot) {\\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\\n // the merkle tree.\\n uint256 leavesLen = leaves.length;\\n uint256 totalHashes = proofFlags.length;\\n\\n // Check proof validity.\\n require(leavesLen + proof.length - 1 == totalHashes, \\\"MerkleProof: invalid multiproof\\\");\\n\\n // The xxxPos values are \\\"pointers\\\" to the next value to consume in each array. All accesses are done using\\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \\\"pop\\\".\\n bytes32[] memory hashes = new bytes32[](totalHashes);\\n uint256 leafPos = 0;\\n uint256 hashPos = 0;\\n uint256 proofPos = 0;\\n // At each step, we compute the next hash using two values:\\n // - a value from the \\\"main queue\\\". If not all leaves have been consumed, we get the next leaf, otherwise we\\n // get the next hash.\\n // - depending on the flag, either another value for the \\\"main queue\\\" (merging branches) or an element from the\\n // `proof` array.\\n for (uint256 i = 0; i < totalHashes; i++) {\\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\\n hashes[i] = _hashPair(a, b);\\n }\\n\\n if (totalHashes > 0) {\\n return hashes[totalHashes - 1];\\n } else if (leavesLen > 0) {\\n return leaves[0];\\n } else {\\n return proof[0];\\n }\\n }\\n\\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\\n }\\n\\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, a)\\n mstore(0x20, b)\\n value := keccak256(0x00, 0x40)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd466e8b07f4c6220eac16da5127f3ff142e65f0c15c03c7d38f257b02c8585e1\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"src/plugin/IPlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"account-abstraction/interfaces/UserOperation.sol\\\";\\n\\ninterface IPlugin {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xe560c14d4055e404a78ea0984006255a5b4d6acf29859de2f690520abf06a6a2\",\"license\":\"MIT\"},\"src/plugin/ZeroDevBasePlugin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\\\";\\nimport \\\"account-abstraction/interfaces/IAccount.sol\\\";\\nimport \\\"account-abstraction/interfaces/IEntryPoint.sol\\\";\\nimport \\\"./IPlugin.sol\\\";\\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external\\n override\\n returns (bool validated)\\n {\\n // data offset starts at 97\\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\\n validated = _validatePluginData(userOp, userOpHash, data, signature);\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal virtual returns (bool success);\\n\\n function parseDataAndSignature(bytes calldata _packed)\\n public\\n pure\\n returns (bytes calldata data, bytes calldata signature)\\n {\\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\\n\\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \\\"invalid data\\\");\\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \\\"invalid signature\\\");\\n }\\n}\\n\",\"keccak256\":\"0x600b768ba7d0766b2968c0d9bd6cd21154f14694eeb1e1a745d110d0fcb854e8\",\"license\":\"MIT\"},\"src/plugin/ZeroDevSessionKeyPlugin.sol\":{\"content\":\"//SPDX-License-Identifier: GPL\\npragma solidity ^0.8.7;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./ZeroDevBasePlugin.sol\\\";\\nimport \\\"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\\\";\\nusing ECDSA for bytes32;\\n/**\\n * Main EIP4337 module.\\n * Called (through the fallback module) using \\\"delegate\\\" from the GnosisSafe as an \\\"IAccount\\\",\\n * so must implement validateUserOp\\n * holds an immutable reference to the EntryPoint\\n */\\n\\nstruct ZeroDevSessionKeyStorageStruct {\\n mapping(address => bool) revoked;\\n}\\n\\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\\n // return value in case of signature failure, with no time-range.\\n // equivalent to packSigTimeRange(true,0,0);\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n\\n event SessionKeyRevoked(address indexed key);\\n\\n constructor() EIP712(\\\"ZeroDevSessionKeyPlugin\\\", \\\"0.0.1\\\") {}\\n\\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\\n bytes32 position = bytes32(uint256(keccak256(\\\"zero-dev.account.eip4337.sessionkey\\\")) - 1);\\n assembly {\\n s.slot := position\\n }\\n }\\n\\n // revoke session key\\n function revokeSessionKey(address _key) external {\\n getPolicyStorage().revoked[_key] = true;\\n emit SessionKeyRevoked(_key);\\n }\\n\\n function revoked(address _key) external view returns (bool) {\\n return getPolicyStorage().revoked[_key];\\n }\\n\\n function _validatePluginData(\\n UserOperation calldata userOp,\\n bytes32 userOpHash,\\n bytes calldata data,\\n bytes calldata signature\\n ) internal view override returns (bool) {\\n address sessionKey = address(bytes20(data[0:20]));\\n require(!getPolicyStorage().revoked[sessionKey], \\\"session key revoked\\\");\\n bytes32 merkleRoot = bytes32(data[20:52]);\\n if(merkleRoot == bytes32(0)) {\\n // means this session key has sudo permission\\n signature = signature[33:98];\\n } else {\\n uint8 leafLength = uint8(signature[0]);\\n bytes32[] memory proof;\\n bytes32 leaf;\\n if(leafLength == 20) {\\n leaf = keccak256(signature[1:21]);\\n proof = abi.decode(signature[86:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n signature = signature[21:86];\\n } else if(leafLength == 24) {\\n leaf = keccak256(signature[1:25]);\\n proof = abi.decode(signature[90:], (bytes32[]));\\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \\\"invalid session key\\\");\\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\\n require(keccak256(sig) == keccak256(signature[21:25]));\\n signature = signature[25:90];\\n }\\n require(MerkleProof.verify(proof, merkleRoot, leaf), \\\"invalide merkle root\\\");\\n }\\n bytes32 digest = _hashTypedDataV4(\\n keccak256(\\n abi.encode(\\n keccak256(\\\"Session(bytes32 userOpHash,uint256 nonce)\\\"), // we are going to trust plugin for verification\\n userOpHash,\\n userOp.nonce\\n )\\n )\\n );\\n address recovered = digest.recover(signature);\\n require(recovered == sessionKey, \\\"account: invalid signature\\\");\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x7463f6b16e3dacf9d618a25e7cb6e12e210ff96682051c62d5a5d6e9243adb30\",\"license\":\"GPL\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b506040518060400160405280601781526020017f5a65726f44657653657373696f6e4b6579506c7567696e0000000000000000008152506040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525060008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a08181525050620000e88184846200013760201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff168152505080610120818152505050505050506200024b565b6000838383463060405160200162000154959493929190620001ee565b6040516020818303038152906040528051906020012090509392505050565b6000819050919050565b620001888162000173565b82525050565b6000819050919050565b620001a3816200018e565b82525050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001d682620001a9565b9050919050565b620001e881620001c9565b82525050565b600060a0820190506200020560008301886200017d565b6200021460208301876200017d565b6200022360408301866200017d565b62000232606083018562000198565b620002416080830184620001dd565b9695505050505050565b60805160a05160c05160e0516101005161012051611e016200029b6000396000610bac01526000610bee01526000610bcd01526000610b0201526000610b5801526000610b810152611e016000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806384f4fc6a14610051578063970aa9ad1461006d5780639e2045ce146100a0578063fa01dc06146100d0575b600080fd5b61006b60048036038101906100669190610fd2565b610100565b005b61008760048036038101906100829190611064565b6101a7565b604051610097949392919061110f565b60405180910390f35b6100ba60048036038101906100b591906111db565b6103ba565b6040516100c79190611265565b60405180910390f35b6100ea60048036038101906100e59190610fd2565b61040f565b6040516100f79190611265565b60405180910390f35b600161010a61046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f17c796fb82086b3c9effaec517342e5ca9ed8fd78c339137ec082f748ab60cbe60405160405180910390a250565b3660003660008086866000906020926101c29392919061128a565b906101cd91906112dd565b60001c90506000878783906020856101e5919061136b565b926101f29392919061128a565b906101fd91906112dd565b60001c9050600088886020906040926102189392919061128a565b9061022391906112dd565b60001c905060008989839060208561023b919061136b565b926102489392919061128a565b9061025391906112dd565b60001c90508989602086610267919061136b565b9085602088610276919061136b565b610280919061136b565b9261028d9392919061128a565b9750975089896020846102a0919061136b565b90836020866102af919061136b565b6102b9919061136b565b926102c69392919061128a565b9550955081602080856102d991906113ce565b6102e391906113ff565b6040866102f0919061136b565b6102fa919061136b565b1461033a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103319061149e565b60405180910390fd5b898990506020808361034c91906113ce565b61035691906113ff565b604084610363919061136b565b61036d919061136b565b146103ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a49061150a565b60405180910390fd5b5050505092959194509250565b60003660003660006103ec888061014001906103d69190611539565b60619080926103e79392919061128a565b6101a7565b93509350935093506104028888868686866104ad565b9450505050509392505050565b600061041961046e565b60000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060017f6da8a1d7d4f224b5b2581a964c1890eb7e987638c691727e5a2a14ca24d03fd960001c6104a1919061159c565b60001b90508091505090565b60008085856000906014926104c49392919061128a565b906104cf91906115fc565b60601c90506104dc61046e565b60000160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561056a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610561906116a7565b60405180910390fd5b600086866014906034926105809392919061128a565b9061058b91906112dd565b90506000801b81036105b45784846021906062926105ab9392919061128a565b9450945061091a565b6000858560008181106105ca576105c96116c7565b5b9050013560f81c60f81b60f81c90506060600060148360ff16036106f55787876001906015926105fc9392919061128a565b60405161060a929190611726565b60405180910390209050878760569080926106279392919061128a565b810190610634919061187d565b9150878760019060159261064a9392919061128a565b604051610658929190611726565b60405180910390208c80606001906106709190611539565b6010906024926106829392919061128a565b604051610690929190611726565b6040518091039020146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90611912565b60405180910390fd5b87876015906056926106ec9392919061128a565b975097506108cc565b60188360ff16036108cb5787876001906019926107149392919061128a565b604051610722929190611726565b604051809103902090508787605a90809261073f9392919061128a565b81019061074c919061187d565b915087876001906015926107629392919061128a565b604051610770929190611726565b60405180910390208c80606001906107889190611539565b60109060249261079a9392919061128a565b6040516107a8929190611726565b6040518091039020146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790611912565b60405180910390fd5b60008c80606001906108029190611539565b6044906064926108149392919061128a565b9061081f91906112dd565b60001c90503660008e80606001906108379190611539565b602485610844919061136b565b90602886610852919061136b565b9261085f9392919061128a565b915091508a8a6015906019926108779392919061128a565b604051610885929190611726565b6040518091039020828260405161089d929190611932565b6040518091039020146108af57600080fd5b8a8a601990605a926108c39392919061128a565b9a509a505050505b5b6108d7828583610a50565b610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090d90611997565b60405180910390fd5b5050505b60006109737ff0a98eef9608fd8bfe5833dfbc8b73ab86d0355db37a1f539565c5985ad1c2428a8c60200135604051602001610958939291906119d5565b60405160208183030381529060405280519060200120610a67565b905060006109ce87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505083610a8190919063ffffffff16565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590611a58565b60405180910390fd5b60019450505050509695505050505050565b600082610a5d8584610aa8565b1490509392505050565b6000610a7a610a74610afe565b83610c18565b9050919050565b6000806000610a908585610c4b565b91509150610a9d81610c9c565b819250505092915050565b60008082905060005b8451811015610af357610ade82868381518110610ad157610ad06116c7565b5b6020026020010151610e02565b91508080610aeb90611a78565b915050610ab1565b508091505092915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610b7a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610ba7577f00000000000000000000000000000000000000000000000000000000000000009050610c15565b610c127f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610e2d565b90505b90565b60008282604051602001610c2d929190611b38565b60405160208183030381529060405280519060200120905092915050565b6000806041835103610c8c5760008060006020860151925060408601519150606086015160001a9050610c8087828585610e67565b94509450505050610c95565b60006002915091505b9250929050565b60006004811115610cb057610caf611b6f565b5b816004811115610cc357610cc2611b6f565b5b0315610dff5760016004811115610cdd57610cdc611b6f565b5b816004811115610cf057610cef611b6f565b5b03610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2790611bea565b60405180910390fd5b60026004811115610d4457610d43611b6f565b5b816004811115610d5757610d56611b6f565b5b03610d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8e90611c56565b60405180910390fd5b60036004811115610dab57610daa611b6f565b5b816004811115610dbe57610dbd611b6f565b5b03610dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df590611ce8565b60405180910390fd5b5b50565b6000818310610e1a57610e158284610f49565b610e25565b610e248383610f49565b5b905092915050565b60008383834630604051602001610e48959493929190611d17565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610ea2576000600391509150610f40565b600060018787878760405160008152602001604052604051610ec79493929190611d86565b6020604051602081039080840390855afa158015610ee9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f3757600060019250925050610f40565b80600092509250505b94509492505050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f9f82610f74565b9050919050565b610faf81610f94565b8114610fba57600080fd5b50565b600081359050610fcc81610fa6565b92915050565b600060208284031215610fe857610fe7610f6a565b5b6000610ff684828501610fbd565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261102457611023610fff565b5b8235905067ffffffffffffffff81111561104157611040611004565b5b60208301915083600182028301111561105d5761105c611009565b5b9250929050565b6000806020838503121561107b5761107a610f6a565b5b600083013567ffffffffffffffff81111561109957611098610f6f565b5b6110a58582860161100e565b92509250509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006110ee83856110b1565b93506110fb8385846110c2565b611104836110d1565b840190509392505050565b6000604082019050818103600083015261112a8186886110e2565b9050818103602083015261113f8184866110e2565b905095945050505050565b600080fd5b600061016082840312156111665761116561114a565b5b81905092915050565b6000819050919050565b6111828161116f565b811461118d57600080fd5b50565b60008135905061119f81611179565b92915050565b6000819050919050565b6111b8816111a5565b81146111c357600080fd5b50565b6000813590506111d5816111af565b92915050565b6000806000606084860312156111f4576111f3610f6a565b5b600084013567ffffffffffffffff81111561121257611211610f6f565b5b61121e8682870161114f565b935050602061122f86828701611190565b9250506040611240868287016111c6565b9150509250925092565b60008115159050919050565b61125f8161124a565b82525050565b600060208201905061127a6000830184611256565b92915050565b600080fd5b600080fd5b6000808585111561129e5761129d611280565b5b838611156112af576112ae611285565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006112e983836112c5565b826112f4813561116f565b925060208210156113345761132f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026112d0565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611376826111a5565b9150611381836111a5565b92508282019050808211156113995761139861133c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006113d9826111a5565b91506113e4836111a5565b9250826113f4576113f361139f565b5b828204905092915050565b600061140a826111a5565b9150611415836111a5565b9250828202611423816111a5565b9150828204841483151761143a5761143961133c565b5b5092915050565b600082825260208201905092915050565b7f696e76616c696420646174610000000000000000000000000000000000000000600082015250565b6000611488600c83611441565b915061149382611452565b602082019050919050565b600060208201905081810360008301526114b78161147b565b9050919050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b60006114f4601183611441565b91506114ff826114be565b602082019050919050565b60006020820190508181036000830152611523816114e7565b9050919050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115565761155561152a565b5b80840192508235915067ffffffffffffffff8211156115785761157761152f565b5b60208301925060018202360383131561159457611593611534565b5b509250929050565b60006115a7826111a5565b91506115b2836111a5565b92508282039050818111156115ca576115c961133c565b5b92915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061160883836112c5565b8261161381356115d0565b925060148210156116535761164e7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026112d0565b831692505b505092915050565b7f73657373696f6e206b6579207265766f6b656400000000000000000000000000600082015250565b6000611691601383611441565b915061169c8261165b565b602082019050919050565b600060208201905081810360008301526116c081611684565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081905092915050565b600061170d83856116f6565b935061171a8385846110c2565b82840190509392505050565b6000611733828486611701565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611777826110d1565b810181811067ffffffffffffffff821117156117965761179561173f565b5b80604052505050565b60006117a9610f60565b90506117b5828261176e565b919050565b600067ffffffffffffffff8211156117d5576117d461173f565b5b602082029050602081019050919050565b60006117f96117f4846117ba565b61179f565b9050808382526020820190506020840283018581111561181c5761181b611009565b5b835b8181101561184557806118318882611190565b84526020840193505060208101905061181e565b5050509392505050565b600082601f83011261186457611863610fff565b5b81356118748482602086016117e6565b91505092915050565b60006020828403121561189357611892610f6a565b5b600082013567ffffffffffffffff8111156118b1576118b0610f6f565b5b6118bd8482850161184f565b91505092915050565b7f696e76616c69642073657373696f6e206b657900000000000000000000000000600082015250565b60006118fc601383611441565b9150611907826118c6565b602082019050919050565b6000602082019050818103600083015261192b816118ef565b9050919050565b600061193f828486611701565b91508190509392505050565b7f696e76616c696465206d65726b6c6520726f6f74000000000000000000000000600082015250565b6000611981601483611441565b915061198c8261194b565b602082019050919050565b600060208201905081810360008301526119b081611974565b9050919050565b6119c08161116f565b82525050565b6119cf816111a5565b82525050565b60006060820190506119ea60008301866119b7565b6119f760208301856119b7565b611a0460408301846119c6565b949350505050565b7f6163636f756e743a20696e76616c6964207369676e6174757265000000000000600082015250565b6000611a42601a83611441565b9150611a4d82611a0c565b602082019050919050565b60006020820190508181036000830152611a7181611a35565b9050919050565b6000611a83826111a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ab557611ab461133c565b5b600182019050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000611b01600283611ac0565b9150611b0c82611acb565b600282019050919050565b6000819050919050565b611b32611b2d8261116f565b611b17565b82525050565b6000611b4382611af4565b9150611b4f8285611b21565b602082019150611b5f8284611b21565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000611bd4601883611441565b9150611bdf82611b9e565b602082019050919050565b60006020820190508181036000830152611c0381611bc7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611c40601f83611441565b9150611c4b82611c0a565b602082019050919050565b60006020820190508181036000830152611c6f81611c33565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000611cd2602283611441565b9150611cdd82611c76565b604082019050919050565b60006020820190508181036000830152611d0181611cc5565b9050919050565b611d1181610f94565b82525050565b600060a082019050611d2c60008301886119b7565b611d3960208301876119b7565b611d4660408301866119b7565b611d5360608301856119c6565b611d606080830184611d08565b9695505050505050565b600060ff82169050919050565b611d8081611d6a565b82525050565b6000608082019050611d9b60008301876119b7565b611da86020830186611d77565b611db560408301856119b7565b611dc260608301846119b7565b9594505050505056fea26469706673582212205d61a7056fe6bfe6f67806ccdffcd495a3b016728c92d497f976c9d84670b56a64736f6c63430008120033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/bscTestnet/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json b/deployments/bscTestnet/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json new file mode 100644 index 00000000..d5d6537f --- /dev/null +++ b/deployments/bscTestnet/solcInputs/b4f7aa20796f803709c4f0ee7de51b7f.json @@ -0,0 +1,129 @@ +{ + "language": "Solidity", + "sources": { + "lib/account-abstraction/contracts/core/EntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n\nimport \"../interfaces/IAccount.sol\";\nimport \"../interfaces/IPaymaster.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\n\nimport \"../utils/Exec.sol\";\nimport \"./StakeManager.sol\";\nimport \"./SenderCreator.sol\";\nimport \"./Helpers.sol\";\nimport \"./NonceManager.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\n\n using UserOperationLib for UserOperation;\n\n SenderCreator private immutable senderCreator = new SenderCreator();\n\n // internal value used during simulation: need to query aggregator.\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\n\n // marker for inner call revert on out of gas\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\n\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\n\n /**\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\n * in case of signature failure, instead of revert.\n */\n uint256 public constant SIG_VALIDATION_FAILED = 1;\n\n /**\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\n * @param beneficiary the address to receive the fees\n * @param amount amount to transfer.\n */\n function _compensate(address payable beneficiary, uint256 amount) internal {\n require(beneficiary != address(0), \"AA90 invalid beneficiary\");\n (bool success,) = beneficiary.call{value : amount}(\"\");\n require(success, \"AA91 failed send to beneficiary\");\n }\n\n /**\n * execute a user op\n * @param opIndex index into the opInfo array\n * @param userOp the userOp to execute\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\n * @return collected the total amount this userOp paid.\n */\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\n uint256 preGas = gasleft();\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\n\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\n collected = _actualGasCost;\n } catch {\n bytes32 innerRevertCode;\n assembly {\n returndatacopy(0, 0, 32)\n innerRevertCode := mload(0)\n }\n // handleOps was called with gas limit too low. abort entire bundle.\n if (innerRevertCode == INNER_OUT_OF_GAS) {\n //report paymaster, since if it is not deliberately caused by the bundler,\n // it must be a revert caused by paymaster.\n revert FailedOp(opIndex, \"AA95 out of gas\");\n }\n\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\n }\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(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\n\n uint256 opslen = ops.length;\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\n\n unchecked {\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[i];\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\n }\n\n uint256 collected = 0;\n emit BeforeExecution();\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(i, ops[i], opInfos[i]);\n }\n\n _compensate(beneficiary, collected);\n } //unchecked\n }\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 ) public nonReentrant {\n\n uint256 opasLen = opsPerAggregator.length;\n uint256 totalOps = 0;\n for (uint256 i = 0; i < opasLen; i++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n //address(1) is special marker of \"signature error\"\n require(address(aggregator) != address(1), \"AA96 invalid aggregator\");\n\n if (address(aggregator) != address(0)) {\n // solhint-disable-next-line no-empty-blocks\n try aggregator.validateSignatures(ops, opa.signature) {}\n catch {\n revert SignatureValidationFailed(address(aggregator));\n }\n }\n\n totalOps += ops.length;\n }\n\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\n\n emit BeforeExecution();\n\n uint256 opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n uint256 opslen = ops.length;\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[opIndex];\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\n opIndex++;\n }\n }\n\n uint256 collected = 0;\n opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n emit SignatureAggregatorChanged(address(opa.aggregator));\n UserOperation[] calldata ops = opa.userOps;\n uint256 opslen = ops.length;\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\n opIndex++;\n }\n }\n emit SignatureAggregatorChanged(address(0));\n\n _compensate(beneficiary, collected);\n }\n\n /// @inheritdoc IEntryPoint\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\n\n UserOpInfo memory opInfo;\n _simulationOnlyValidations(op);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n\n numberMarker();\n uint256 paid = _executeUserOp(0, op, opInfo);\n numberMarker();\n bool targetSuccess;\n bytes memory targetResult;\n if (target != address(0)) {\n (targetSuccess, targetResult) = target.call(targetCallData);\n }\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\n }\n\n\n // A memory copy of UserOp static fields only.\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\n struct MemoryUserOp {\n address sender;\n uint256 nonce;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n address paymaster;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n }\n\n struct UserOpInfo {\n MemoryUserOp mUserOp;\n bytes32 userOpHash;\n uint256 prefund;\n uint256 contextOffset;\n uint256 preOpGas;\n }\n\n /**\n * inner function to handle a UserOperation.\n * Must be declared \"external\" to open a call context, but it can only be called by handleOps.\n */\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n require(msg.sender == address(this), \"AA92 internal call only\");\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n\n uint callGasLimit = mUserOp.callGasLimit;\n unchecked {\n // handleOps was called with gas limit too low. abort entire bundle.\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\n assembly {\n mstore(0, INNER_OUT_OF_GAS)\n revert(0, 32)\n }\n }\n }\n\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\n if (callData.length > 0) {\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\n if (!success) {\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\n if (result.length > 0) {\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\n }\n mode = IPaymaster.PostOpMode.opReverted;\n }\n }\n\n unchecked {\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\n return _handlePostOp(0, mode, opInfo, context, actualGas);\n }\n }\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\n }\n\n /**\n * copy general fields from userOp into the memory opInfo structure.\n */\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\n mUserOp.sender = userOp.sender;\n mUserOp.nonce = userOp.nonce;\n mUserOp.callGasLimit = userOp.callGasLimit;\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\n mUserOp.preVerificationGas = userOp.preVerificationGas;\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes calldata paymasterAndData = userOp.paymasterAndData;\n if (paymasterAndData.length > 0) {\n require(paymasterAndData.length >= 20, \"AA93 invalid paymasterAndData\");\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\n } else {\n mUserOp.paymaster = address(0);\n }\n }\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external {\n UserOpInfo memory outOpInfo;\n\n _simulationOnlyValidations(userOp);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\n StakeInfo memory factoryInfo;\n {\n bytes calldata initCode = userOp.initCode;\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\n factoryInfo = _getStakeInfo(factory);\n }\n\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n address aggregator = data.aggregator;\n bool sigFailed = aggregator == address(1);\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\n\n if (aggregator != address(0) && aggregator != address(1)) {\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\n }\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\n\n }\n\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\n unchecked {\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\n // our security model might call postOp eventually twice\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\n\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\n }\n }\n\n // create the sender's contract if needed.\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\n if (initCode.length != 0) {\n address sender = opInfo.mUserOp.sender;\n if (sender.code.length != 0) revert FailedOp(opIndex, \"AA10 sender already constructed\");\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\n if (sender1 == address(0)) revert FailedOp(opIndex, \"AA13 initCode failed or OOG\");\n if (sender1 != sender) revert FailedOp(opIndex, \"AA14 initCode must return sender\");\n if (sender1.code.length == 0) revert FailedOp(opIndex, \"AA15 initCode must create sender\");\n address factory = address(bytes20(initCode[0 : 20]));\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\n }\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 calldata initCode) public {\n address sender = senderCreator.createSender(initCode);\n revert SenderAddressResult(sender);\n }\n\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\n // solhint-disable-next-line no-empty-blocks\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\n catch Error(string memory revertReason) {\n if (bytes(revertReason).length != 0) {\n revert FailedOp(0, revertReason);\n }\n }\n }\n\n /**\n * Called only during simulation.\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\n */\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\n if (initCode.length == 0 && sender.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA20 account not deployed\");\n }\n if (paymasterAndData.length >= 20) {\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\n if (paymaster.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA30 paymaster not deployed\");\n }\n }\n // always revert\n revert(\"\");\n }\n\n /**\n * call account.validateUserOp.\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\n * decrement account's deposit if needed\n */\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\n unchecked {\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n address sender = mUserOp.sender;\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\n address paymaster = mUserOp.paymaster;\n numberMarker();\n uint256 missingAccountFunds = 0;\n if (paymaster == address(0)) {\n uint256 bal = balanceOf(sender);\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\n }\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\n returns (uint256 _validationData) {\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA23 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA23 reverted (or OOG)\");\n }\n if (paymaster == address(0)) {\n DepositInfo storage senderInfo = deposits[sender];\n uint256 deposit = senderInfo.deposit;\n if (requiredPrefund > deposit) {\n revert FailedOp(opIndex, \"AA21 didn't pay prefund\");\n }\n senderInfo.deposit = uint112(deposit - requiredPrefund);\n }\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\n }\n }\n\n /**\n * In case the request has a paymaster:\n * Validate paymaster has enough deposit.\n * Call paymaster.validatePaymasterUserOp.\n * Revert with proper FailedOp in case paymaster reverts.\n * Decrement paymaster's deposit\n */\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\n internal returns (bytes memory context, uint256 validationData) {\n unchecked {\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \"AA41 too little verificationGas\");\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\n\n address paymaster = mUserOp.paymaster;\n DepositInfo storage paymasterInfo = deposits[paymaster];\n uint256 deposit = paymasterInfo.deposit;\n if (deposit < requiredPreFund) {\n revert FailedOp(opIndex, \"AA31 paymaster deposit too low\");\n }\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\n context = _context;\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA33 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA33 reverted (or OOG)\");\n }\n }\n }\n\n /**\n * revert if either account validationData or paymaster validationData is expired\n */\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\n if (expectedAggregator != aggregator) {\n revert FailedOp(opIndex, \"AA24 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA22 expired or not due\");\n }\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\n address pmAggregator;\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\n if (pmAggregator != address(0)) {\n revert FailedOp(opIndex, \"AA34 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA32 paymaster expired or not due\");\n }\n }\n\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\n if (validationData == 0) {\n return (address(0), false);\n }\n ValidationData memory data = _parseValidationData(validationData);\n // solhint-disable-next-line not-rely-on-time\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\n aggregator = data.aggregator;\n }\n\n /**\n * validate account and paymaster (if defined).\n * also make sure total validation doesn't exceed verificationGasLimit\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\n * @param opIndex the index of this userOp into the \"opInfos\" array\n * @param userOp the userOp to validate\n */\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\n private returns (uint256 validationData, uint256 paymasterValidationData) {\n\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\n _copyUserOpToMemory(userOp, mUserOp);\n outOpInfo.userOpHash = getUserOpHash(userOp);\n\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\n // and multiplied without causing overflow\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\n require(maxGasValues <= type(uint120).max, \"AA94 gas values overflow\");\n\n uint256 gasUsedByValidateAccountPrepayment;\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\n\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\n revert FailedOp(opIndex, \"AA25 invalid account nonce\");\n }\n\n //a \"marker\" where account opcode validation is done and paymaster opcode validation is about to start\n // (used only by off-chain simulateValidation)\n numberMarker();\n\n bytes memory context;\n if (mUserOp.paymaster != address(0)) {\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\n }\n unchecked {\n uint256 gasUsed = preGas - gasleft();\n\n if (userOp.verificationGasLimit < gasUsed) {\n revert FailedOp(opIndex, \"AA40 over verificationGasLimit\");\n }\n outOpInfo.prefund = requiredPreFund;\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\n }\n }\n\n /**\n * process post-operation.\n * called just after the callData is executed.\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\n * @param opIndex index in the batch\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\n * @param opInfo userOp fields and info collected during validation\n * @param context the context returned in validatePaymasterUserOp\n * @param actualGas the gas used so far by this user operation\n */\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n unchecked {\n address refundAddress;\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\n\n address paymaster = mUserOp.paymaster;\n if (paymaster == address(0)) {\n refundAddress = mUserOp.sender;\n } else {\n refundAddress = paymaster;\n if (context.length > 0) {\n actualGasCost = actualGas * gasPrice;\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\n } else {\n // solhint-disable-next-line no-empty-blocks\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\n catch Error(string memory reason) {\n revert FailedOp(opIndex, string.concat(\"AA50 postOp reverted: \", reason));\n }\n catch {\n revert FailedOp(opIndex, \"AA50 postOp revert\");\n }\n }\n }\n }\n actualGas += preGas - gasleft();\n actualGasCost = actualGas * gasPrice;\n if (opInfo.prefund < actualGasCost) {\n revert FailedOp(opIndex, \"AA51 prefund below actualGasCost\");\n }\n uint256 refund = opInfo.prefund - actualGasCost;\n _incrementDeposit(refundAddress, refund);\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\n } // unchecked\n }\n\n /**\n * the gas price this UserOp agrees to pay.\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\n */\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\n assembly {offset := data}\n }\n\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\n assembly {data := offset}\n }\n\n //place the NUMBER opcode in the code.\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\n // account and paymaster.\n function numberMarker() internal view {\n assembly {mstore(0, number())}\n }\n}\n\n" + }, + "lib/account-abstraction/contracts/core/Helpers.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n * address(1) - the account failed to validate the signature.\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\n struct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n }\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n// intersect account and paymaster ranges.\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\n ValidationData memory accountValidationData = _parseValidationData(validationData);\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n address aggregator = accountValidationData.aggregator;\n if (aggregator == address(0)) {\n aggregator = pmValidationData.aggregator;\n }\n uint48 validAfter = accountValidationData.validAfter;\n uint48 validUntil = accountValidationData.validUntil;\n uint48 pmValidAfter = pmValidationData.validAfter;\n uint48 pmValidUntil = pmValidationData.validUntil;\n\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n }\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n }\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n\n" + }, + "lib/account-abstraction/contracts/core/NonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IEntryPoint.sol\";\n\n/**\n * nonce management functionality\n */\ncontract NonceManager is INonceManager {\n\n /**\n * The next valid sequence number for a given nonce key.\n */\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\n\n function getNonce(address sender, uint192 key)\n public view override returns (uint256 nonce) {\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\n }\n\n // allow an account to manually increment its own nonce.\n // (mainly so that during construction nonce can be made non-zero,\n // to \"absorb\" the gas cost of first nonce increment to 1st transaction (construction),\n // not to 2nd transaction)\n function incrementNonce(uint192 key) public override {\n nonceSequenceNumber[msg.sender][key]++;\n }\n\n /**\n * validate nonce uniqueness for this account.\n * called just after validateUserOp()\n */\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\n\n uint192 key = uint192(nonce >> 64);\n uint64 seq = uint64(nonce);\n return nonceSequenceNumber[sender][key]++ == seq;\n }\n\n}\n" + }, + "lib/account-abstraction/contracts/core/SenderCreator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/**\n * helper contract for EntryPoint, to call userOp.initCode from a \"neutral\" address,\n * which is explicitly not the entryPoint itself.\n */\ncontract SenderCreator {\n\n /**\n * call the \"initCode\" factory to create and return the sender account address\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\n * @return sender the returned address of the created account, or zero address on failure.\n */\n function createSender(bytes calldata initCode) external returns (address sender) {\n address factory = address(bytes20(initCode[0 : 20]));\n bytes memory initCallData = initCode[20 :];\n bool success;\n /* solhint-disable no-inline-assembly */\n assembly {\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\n sender := mload(0)\n }\n if (!success) {\n sender = address(0);\n }\n }\n}\n" + }, + "lib/account-abstraction/contracts/core/StakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IStakeManager.sol\";\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable not-rely-on-time */\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by a paymaster.\n */\nabstract contract StakeManager is IStakeManager {\n\n /// maps paymaster to their deposits and stakes\n mapping(address => DepositInfo) public deposits;\n\n /// @inheritdoc IStakeManager\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\n return deposits[account];\n }\n\n // internal method to return just the stake info\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\n DepositInfo storage depositInfo = deposits[addr];\n info.stake = depositInfo.stake;\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\n }\n\n /// return the deposit (for gas payment) of the account\n function balanceOf(address account) public view returns (uint256) {\n return deposits[account].deposit;\n }\n\n receive() external payable {\n depositTo(msg.sender);\n }\n\n function _incrementDeposit(address account, uint256 amount) internal {\n DepositInfo storage info = deposits[account];\n uint256 newAmount = info.deposit + amount;\n require(newAmount <= type(uint112).max, \"deposit overflow\");\n info.deposit = uint112(newAmount);\n }\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) public payable {\n _incrementDeposit(account, msg.value);\n DepositInfo storage info = deposits[account];\n emit Deposited(account, info.deposit);\n }\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 unstakeDelaySec) public payable {\n DepositInfo storage info = deposits[msg.sender];\n require(unstakeDelaySec > 0, \"must specify unstake delay\");\n require(unstakeDelaySec >= info.unstakeDelaySec, \"cannot decrease unstake time\");\n uint256 stake = info.stake + msg.value;\n require(stake > 0, \"no stake specified\");\n require(stake <= type(uint112).max, \"stake overflow\");\n deposits[msg.sender] = DepositInfo(\n info.deposit,\n true,\n uint112(stake),\n unstakeDelaySec,\n 0\n );\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\n }\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external {\n DepositInfo storage info = deposits[msg.sender];\n require(info.unstakeDelaySec != 0, \"not staked\");\n require(info.staked, \"already unstaking\");\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\n info.withdrawTime = withdrawTime;\n info.staked = false;\n emit StakeUnlocked(msg.sender, withdrawTime);\n }\n\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external {\n DepositInfo storage info = deposits[msg.sender];\n uint256 stake = info.stake;\n require(stake > 0, \"No stake to withdraw\");\n require(info.withdrawTime > 0, \"must call unlockStake() first\");\n require(info.withdrawTime <= block.timestamp, \"Stake withdrawal is not due\");\n info.unstakeDelaySec = 0;\n info.withdrawTime = 0;\n info.stake = 0;\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\n (bool success,) = withdrawAddress.call{value : stake}(\"\");\n require(success, \"failed to withdraw stake\");\n }\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\n DepositInfo storage info = deposits[msg.sender];\n require(withdrawAmount <= info.deposit, \"Withdraw amount too large\");\n info.deposit = uint112(info.deposit - withdrawAmount);\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\"\");\n require(success, \"failed to withdraw\");\n }\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAccount.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\ninterface IAccount {\n\n /**\n * Validate user's signature and nonce\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\n * This allows making a \"simulation call\" without a valid signature\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\n *\n * @dev Must validate caller is the entryPoint.\n * Must validate the signature and nonce\n * @param userOp the operation that is about to be executed.\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\n * The excess is left as a deposit in the entrypoint, for future calls.\n * can be withdrawn anytime using \"entryPoint.withdrawTo()\"\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external returns (uint256 validationData);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IAggregator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n\n /**\n * validate aggregated signature.\n * revert if the aggregated signature does not match the given list of operations.\n */\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\n\n /**\n * validate signature of a single userOp\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n * @param userOp the userOperation received from the user.\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\n * (usually empty, unless account and aggregator support some kind of \"multisig\"\n */\n function validateUserOpSignature(UserOperation calldata userOp)\n external view returns (bytes memory sigForUserOp);\n\n /**\n * aggregate multiple signatures into a single value.\n * This method is called off-chain to calculate the signature to pass with handleOps()\n * bundler MAY use optimized custom code perform this aggregation\n * @param userOps array of UserOperations to collect the signatures from.\n * @return aggregatedSignature the aggregated signature\n */\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IEntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./UserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\n\n /***\n * An event emitted after each successful request\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\n * @param sender - the account that generates this request.\n * @param paymaster - if non-null, the paymaster that pays for this request.\n * @param nonce - the nonce value from the request.\n * @param success - true if the sender transaction succeeded, false if reverted.\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\n */\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\n\n /**\n * account \"sender\" was deployed.\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\n * @param sender the account that is deployed\n * @param factory the factory used to deploy this account (in the initCode)\n * @param paymaster the paymaster used by this UserOp\n */\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\n\n /**\n * An event emitted if the UserOperation \"callData\" reverted with non-zero length\n * @param userOpHash the request unique identifier.\n * @param sender the sender of this request\n * @param nonce the nonce used in the request\n * @param revertReason - the return bytes from the (reverted) call to \"callData\".\n */\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\n\n /**\n * an event emitted by handleOps(), before starting the execution loop.\n * any event emitted before this event, is part of the validation.\n */\n event BeforeExecution();\n\n /**\n * signature aggregator used by the following UserOperationEvents within this bundle.\n */\n event SignatureAggregatorChanged(address indexed aggregator);\n\n /**\n * a custom revert error of handleOps, to identify the offending op.\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\n * @param reason - revert reason\n * The string starts with a unique code \"AAmn\", where \"m\" is \"1\" for factory, \"2\" for account and \"3\" for paymaster issues,\n * so a failure can be attributed to the correct entity.\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\n */\n error FailedOp(uint256 opIndex, string reason);\n\n /**\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\n */\n error SignatureValidationFailed(address aggregator);\n\n /**\n * Successful result from simulateValidation.\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n */\n error ValidationResult(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\n\n /**\n * Successful result from simulateValidation, if the account returns a signature aggregator\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\n * bundler MUST use it to verify the signature, or reject the UserOperation\n */\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\n AggregatorStakeInfo aggregatorInfo);\n\n /**\n * return value of getSenderAddress\n */\n error SenderAddressResult(address sender);\n\n /**\n * return value of simulateHandleOp\n */\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\n\n //UserOps handled, per aggregator\n struct UserOpsPerAggregator {\n UserOperation[] userOps;\n\n // aggregator address\n IAggregator aggregator;\n // aggregated signature\n bytes signature;\n }\n\n /**\n * Execute a batch of UserOperation.\n * no signature aggregator is used.\n * if any account requires an aggregator (that is, it returned an aggregator when\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\n * @param ops the operations to execute\n * @param beneficiary the address to receive the fees\n */\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\n\n /**\n * Execute a batch of UserOperation with Aggregators\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\n * @param beneficiary the address to receive the fees\n */\n function handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n ) external;\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external;\n\n /**\n * gas and return values during simulation\n * @param preOpGas the gas used for validation (including preValidationGas)\n * @param prefund the required prefund for this operation\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\n */\n struct ReturnInfo {\n uint256 preOpGas;\n uint256 prefund;\n bool sigFailed;\n uint48 validAfter;\n uint48 validUntil;\n bytes paymasterContext;\n }\n\n /**\n * returned aggregated signature info.\n * the aggregator returned by the account, and its current stake.\n */\n struct AggregatorStakeInfo {\n address aggregator;\n StakeInfo stakeInfo;\n }\n\n /**\n * Get counterfactual sender address.\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n * this method always revert, and returns the address in SenderAddressResult error\n * @param initCode the constructor code to be passed into the UserOperation.\n */\n function getSenderAddress(bytes memory initCode) external;\n\n\n /**\n * simulate full execution of a UserOperation (including both validation and target execution)\n * this method will always revert with \"ExecutionResult\".\n * it performs full validation of the UserOperation, but ignores signature error.\n * an optional target address is called after the userop succeeds, and its value is returned\n * (before the entire call is reverted)\n * Note that in order to collect the the success/failure of the target call, it must be executed\n * with trace enabled to track the emitted events.\n * @param op the UserOperation to simulate\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\n * are set to the return from that call.\n * @param targetCallData callData to pass to target address\n */\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\n}\n\n" + }, + "lib/account-abstraction/contracts/interfaces/INonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\ninterface INonceManager {\n\n /**\n * Return the next nonce for this sender.\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\n * But UserOp with different keys can come with arbitrary order.\n *\n * @param sender the account address\n * @param key the high 192 bit of the nonce\n * @return nonce a full nonce to pass for next UserOp with this sender.\n */\n function getNonce(address sender, uint192 key)\n external view returns (uint256 nonce);\n\n /**\n * Manually increment the nonce of the sender.\n * This method is exposed just for completeness..\n * Account does NOT need to call it, neither during validation, nor elsewhere,\n * as the EntryPoint will update the nonce regardless.\n * Possible use-case is call it with various keys to \"initialize\" their nonces to one, so that future\n * UserOperations will not pay extra for the first transaction with a given key.\n */\n function incrementNonce(uint192 key) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IPaymaster.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\n */\ninterface IPaymaster {\n\n enum PostOpMode {\n opSucceeded, // user op succeeded\n opReverted, // user op reverted. still has to pay for gas.\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\n }\n\n /**\n * payment validation: check if paymaster agrees to pay.\n * Must verify sender is the entryPoint.\n * Revert to reject this request.\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\n * @param userOp the user operation\n * @param userOpHash hash of the user's request data.\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\n * @return context value to send to a postOp\n * zero length to signify postOp is not required.\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n external returns (bytes memory context, uint256 validationData);\n\n /**\n * post-operation handler.\n * Must verify sender is the entryPoint\n * @param mode enum with the following options:\n * opSucceeded - user operation succeeded.\n * opReverted - user op reverted. still has to pay for gas.\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\n * Now this is the 2nd call, after user's op was deliberately reverted.\n * @param context - the context value returned by validatePaymasterUserOp\n * @param actualGasCost - actual gas used so far (without this postOp call).\n */\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/IStakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n\n event Deposited(\n address indexed account,\n uint256 totalDeposit\n );\n\n event Withdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /// Emitted when stake or unstake delay are modified\n event StakeLocked(\n address indexed account,\n uint256 totalStaked,\n uint256 unstakeDelaySec\n );\n\n /// Emitted once a stake is scheduled for withdrawal\n event StakeUnlocked(\n address indexed account,\n uint256 withdrawTime\n );\n\n event StakeWithdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /**\n * @param deposit the entity's deposit\n * @param staked true if this entity is staked.\n * @param stake actual amount of ether staked for this entity.\n * @param unstakeDelaySec minimum delay to withdraw the stake.\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\n * and the rest fit into a 2nd cell.\n * 112 bit allows for 10^15 eth\n * 48 bit for full timestamp\n * 32 bit allows 150 years for unstake delay\n */\n struct DepositInfo {\n uint112 deposit;\n bool staked;\n uint112 stake;\n uint32 unstakeDelaySec;\n uint48 withdrawTime;\n }\n\n //API struct used by getStakeInfo and simulateValidation\n struct StakeInfo {\n uint256 stake;\n uint256 unstakeDelaySec;\n }\n\n /// @return info - full deposit information of given account\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\n\n /// @return the deposit (for gas payment) of the account\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) external payable;\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 _unstakeDelaySec) external payable;\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external;\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external;\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\n}\n" + }, + "lib/account-abstraction/contracts/interfaces/UserOperation.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\nimport {calldataKeccak} from \"../core/Helpers.sol\";\n\n/**\n * User Operation struct\n * @param sender the sender account of this request.\n * @param nonce unique value the sender uses to verify it is not a replay.\n * @param initCode if set, the account contract will be created by this constructor/\n * @param callData the method call to execute on this account.\n * @param callGasLimit the gas limit passed to the callData method call.\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\n * @param maxFeePerGas same as EIP-1559 gas parameter.\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n */\n struct UserOperation {\n\n address sender;\n uint256 nonce;\n bytes initCode;\n bytes callData;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n bytes paymasterAndData;\n bytes signature;\n }\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\n address data;\n //read sender from userOp, which is first userOp member (saves 800 gas...)\n assembly {data := calldataload(userOp)}\n return address(uint160(data));\n }\n\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\n // pay above what he signed for.\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\n address sender = getSender(userOp);\n uint256 nonce = userOp.nonce;\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n bytes32 hashCallData = calldataKeccak(userOp.callData);\n uint256 callGasLimit = userOp.callGasLimit;\n uint256 verificationGasLimit = userOp.verificationGasLimit;\n uint256 preVerificationGas = userOp.preVerificationGas;\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n return abi.encode(\n sender, nonce,\n hashInitCode, hashCallData,\n callGasLimit, verificationGasLimit, preVerificationGas,\n maxFeePerGas, maxPriorityFeePerGas,\n hashPaymasterAndData\n );\n }\n\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\n return keccak256(pack(userOp));\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n}\n" + }, + "lib/account-abstraction/contracts/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n\n function call(\n address to,\n uint256 value,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function staticcall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal view returns (bool success) {\n assembly {\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function delegateCall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n // get returned data from last call or calldelegate\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n assembly {\n let len := returndatasize()\n if gt(len, maxLen) {\n len := maxLen\n }\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n // revert with explicit byte array (probably reverted info from call)\n function revertWithData(bytes memory returnData) internal pure {\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\n bool success = call(to,0,data,gasleft());\n if (!success) {\n revertWithData(getReturnData(maxLen));\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Create2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.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 specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts 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 * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\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 _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\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 bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\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) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n * respectively.\n *\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "src/abstract/Compatibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Compatibility {\n receive() external payable {}\n\n function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)\n external\n pure\n returns (bytes4)\n {\n return this.onERC1155BatchReceived.selector;\n }\n\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "src/abstract/KernelStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\n\nstruct WalletKernelStorage {\n address owner;\n}\n\ncontract KernelStorage {\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n IEntryPoint public immutable entryPoint;\n\n event Upgraded(address indexed newImplementation);\n\n // modifier for checking if the sender is the entrypoint or\n // the account itself\n modifier onlyFromEntryPointOrOwnerOrSelf() {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner || msg.sender == address(this),\n \"account: not from entrypoint or owner or self\"\n );\n _;\n }\n\n constructor(IEntryPoint _entryPoint) {\n entryPoint = _entryPoint;\n getKernelStorage().owner = address(1);\n }\n /// @notice get wallet kernel storage\n /// @dev used to get wallet kernel storage\n /// @return ws wallet kernel storage, consists of owner and nonces\n\n function getKernelStorage() internal pure returns (WalletKernelStorage storage ws) {\n bytes32 storagePosition = bytes32(uint256(keccak256(\"zerodev.kernel\")) - 1);\n assembly {\n ws.slot := storagePosition\n }\n }\n\n function getOwner() external view returns (address) {\n return getKernelStorage().owner;\n }\n\n function upgradeTo(address _newImplementation) external onlyFromEntryPointOrOwnerOrSelf {\n bytes32 slot = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n assembly {\n sstore(slot, _newImplementation)\n }\n emit Upgraded(_newImplementation);\n }\n\n function transferOwnership(address _newOwner) external onlyFromEntryPointOrOwnerOrSelf {\n getKernelStorage().owner = _newOwner;\n }\n\n function getNonce() public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), 0);\n }\n\n function getNonce(uint192 key) public view virtual returns (uint256) {\n return entryPoint.getNonce(address(this), key);\n }\n}\n " + }, + "src/factory/EIP1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract EIP1967Proxy {\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n constructor(address _logic, bytes memory _data) payable {\n require(_logic != address(0), \"EIP1967Proxy: implementation is the zero address\");\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n sstore(slot, _logic)\n }\n if (_data.length > 0) {\n (bool success,) = _logic.delegatecall(_data);\n require(success, \"EIP1967Proxy: constructor call failed\");\n }\n }\n\n fallback() external payable {\n address implementation = _implementation();\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 { revert(0, returndatasize()) }\n default { return(0, returndatasize()) }\n }\n }\n\n function _implementation() internal view returns (address impl) {\n bytes32 slot = _IMPLEMENTATION_SLOT;\n assembly {\n impl := sload(slot)\n }\n }\n}\n" + }, + "src/Kernel.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"./plugin/IPlugin.sol\";\nimport \"account-abstraction/core/Helpers.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport {EntryPoint} from \"account-abstraction/core/EntryPoint.sol\";\nimport \"./utils/Exec.sol\";\nimport \"./abstract/Compatibility.sol\";\nimport \"./abstract/KernelStorage.sol\";\n\n/// @title Kernel\n/// @author taek\n/// @notice wallet kernel for minimal wallet functionality\n/// @dev supports only 1 owner, multiple plugins\ncontract Kernel is IAccount, EIP712, Compatibility, KernelStorage {\n error InvalidNonce();\n error InvalidSignatureLength();\n error QueryResult(bytes result);\n\n string public constant name = \"Kernel\";\n\n string public constant version = \"0.0.1\";\n\n constructor(IEntryPoint _entryPoint) EIP712(name, version) KernelStorage(_entryPoint) {}\n\n /// @notice initialize wallet kernel\n /// @dev this function should be called only once, implementation initialize is blocked by owner = address(1)\n /// @param _owner owner address\n function initialize(address _owner) external {\n WalletKernelStorage storage ws = getKernelStorage();\n require(ws.owner == address(0), \"account: already initialized\");\n ws.owner = _owner;\n }\n\n /// @notice Query plugin for data\n /// @dev this function will always fail, it should be used only to query plugin for data using error message\n /// @param _plugin Plugin address\n /// @param _data Data to query\n function queryPlugin(address _plugin, bytes calldata _data) external {\n (bool success, bytes memory _ret) = Exec.delegateCall(_plugin, _data);\n if (success) {\n revert QueryResult(_ret);\n } else {\n assembly {\n revert(add(_ret, 32), mload(_ret))\n }\n }\n }\n\n /// @notice execute function call to external contract\n /// @dev this function will execute function call to external contract\n /// @param to target contract address\n /// @param value value to be sent\n /// @param data data to be sent\n /// @param operation operation type (call or delegatecall)\n function executeAndRevert(address to, uint256 value, bytes calldata data, Operation operation) external {\n require(\n msg.sender == address(entryPoint) || msg.sender == getKernelStorage().owner,\n \"account: not from entrypoint or owner\"\n );\n bool success;\n bytes memory ret;\n if (operation == Operation.DelegateCall) {\n (success, ret) = Exec.delegateCall(to, data);\n } else {\n (success, ret) = Exec.call(to, value, data);\n }\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n }\n\n /// @notice validate user operation\n /// @dev this function will validate user operation and be called by EntryPoint\n /// @param userOp user operation\n /// @param userOpHash user operation hash\n /// @param missingAccountFunds funds needed to be reimbursed\n /// @return validationData validation data\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (uint256 validationData)\n {\n require(msg.sender == address(entryPoint), \"account: not from entryPoint\");\n if (userOp.signature.length == 65) {\n validationData = _validateUserOp(userOp, userOpHash);\n } else if (userOp.signature.length > 97) {\n // userOp.signature = address(plugin) + validUntil + validAfter + pluginData + pluginSignature\n address plugin = address(bytes20(userOp.signature[0:20]));\n uint48 validUntil = uint48(bytes6(userOp.signature[20:26]));\n uint48 validAfter = uint48(bytes6(userOp.signature[26:32]));\n bytes memory signature = userOp.signature[32:97];\n (bytes memory data,) = abi.decode(userOp.signature[97:], (bytes, bytes));\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\n \"ValidateUserOpPlugin(address plugin,uint48 validUntil,uint48 validAfter,bytes data)\"\n ), // we are going to trust plugin for verification\n plugin,\n validUntil,\n validAfter,\n keccak256(data)\n )\n )\n );\n\n address signer = ECDSA.recover(digest, signature);\n if (getKernelStorage().owner != signer) {\n return SIG_VALIDATION_FAILED;\n }\n bytes memory ret = _delegateToPlugin(plugin, userOp, userOpHash, missingAccountFunds);\n bool res = abi.decode(ret, (bool));\n if (!res) {\n return SIG_VALIDATION_FAILED;\n }\n validationData = _packValidationData(!res, validUntil, validAfter);\n } else {\n revert InvalidSignatureLength();\n }\n if (missingAccountFunds > 0) {\n // we are going to assume signature is valid at this point\n (bool success,) = msg.sender.call{value: missingAccountFunds}(\"\");\n (success);\n return validationData;\n }\n }\n\n function _validateUserOp(UserOperation calldata userOp, bytes32 userOpHash)\n internal\n view\n returns (uint256 validationData)\n {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(userOpHash, userOp.signature)) {\n return validationData;\n }\n\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\n address recovered = ECDSA.recover(hash, userOp.signature);\n if (ws.owner != recovered) {\n return SIG_VALIDATION_FAILED;\n }\n }\n\n /**\n * delegate the contract call to the plugin\n */\n function _delegateToPlugin(\n address plugin,\n UserOperation calldata userOp,\n bytes32 opHash,\n uint256 missingAccountFunds\n ) internal returns (bytes memory) {\n bytes memory data =\n abi.encodeWithSelector(IPlugin.validatePluginData.selector, userOp, opHash, missingAccountFunds);\n (bool success, bytes memory ret) = Exec.delegateCall(plugin, data); // Q: should we allow value > 0?\n if (!success) {\n assembly {\n revert(add(ret, 32), mload(ret))\n }\n }\n return ret;\n }\n\n /// @notice validate signature using eip1271\n /// @dev this function will validate signature using eip1271\n /// @param _hash hash to be signed\n /// @param _signature signature\n function isValidSignature(bytes32 _hash, bytes memory _signature) public view override returns (bytes4) {\n WalletKernelStorage storage ws = getKernelStorage();\n if (ws.owner == ECDSA.recover(_hash, _signature)) {\n return 0x1626ba7e;\n }\n bytes32 hash = ECDSA.toEthSignedMessageHash(_hash);\n address recovered = ECDSA.recover(hash, _signature);\n // Validate signatures\n if (ws.owner == recovered) {\n return 0x1626ba7e;\n } else {\n return 0xffffffff;\n }\n }\n}\n" + }, + "src/KernelFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/Create2.sol\";\nimport \"./factory/EIP1967Proxy.sol\";\nimport \"./Kernel.sol\";\n\ncontract KernelFactory {\n Kernel public immutable kernelTemplate;\n\n event AccountCreated(address indexed account, address indexed owner, uint256 index);\n\n constructor(IEntryPoint _entryPoint) {\n kernelTemplate = new Kernel(_entryPoint);\n }\n\n function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n address addr = Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n if (addr.code.length > 0) {\n return EIP1967Proxy(payable(addr));\n }\n proxy =\n new EIP1967Proxy{salt: salt}(address(kernelTemplate), abi.encodeWithSelector(Kernel.initialize.selector, _owner));\n emit AccountCreated(address(proxy), _owner, _index);\n }\n\n function getAccountAddress(address _owner, uint256 _index) public view returns (address) {\n bytes32 salt = keccak256(abi.encodePacked(_owner, _index));\n return Create2.computeAddress(\n salt,\n keccak256(\n abi.encodePacked(\n type(EIP1967Proxy).creationCode,\n abi.encode(address(kernelTemplate), abi.encodeCall(Kernel.initialize, (_owner)))\n )\n )\n );\n }\n}\n" + }, + "src/plugin/IPlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"account-abstraction/interfaces/UserOperation.sol\";\n\ninterface IPlugin {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n returns (bool);\n}\n" + }, + "src/plugin/ZeroDevBasePlugin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol\";\nimport \"account-abstraction/interfaces/IAccount.sol\";\nimport \"account-abstraction/interfaces/IEntryPoint.sol\";\nimport \"./IPlugin.sol\";\nabstract contract ZeroDevBasePlugin is IPlugin, EIP712 {\n function validatePluginData(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external\n override\n returns (bool validated)\n {\n // data offset starts at 97\n (bytes calldata data, bytes calldata signature) = parseDataAndSignature(userOp.signature[97:]);\n validated = _validatePluginData(userOp, userOpHash, data, signature);\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal virtual returns (bool success);\n\n function parseDataAndSignature(bytes calldata _packed)\n public\n pure\n returns (bytes calldata data, bytes calldata signature)\n {\n uint256 dataPosition = uint256(bytes32(_packed[0:32]));\n uint256 dataLength = uint256(bytes32(_packed[dataPosition:dataPosition + 32]));\n uint256 signaturePosition = uint256(bytes32(_packed[32:64]));\n uint256 signatureLength = uint256(bytes32(_packed[signaturePosition:signaturePosition + 32]));\n data = _packed[dataPosition + 32:dataPosition + 32 + dataLength];\n signature = _packed[signaturePosition + 32:signaturePosition + 32 + signatureLength];\n\n require(dataPosition + 64 + ((dataLength) / 32) * 32 == signaturePosition, \"invalid data\");\n require(signaturePosition + 64 + ((signatureLength) / 32) * 32 == _packed.length, \"invalid signature\");\n }\n}\n" + }, + "src/plugin/ZeroDevSessionKeyPlugin.sol": { + "content": "//SPDX-License-Identifier: GPL\npragma solidity ^0.8.7;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./ZeroDevBasePlugin.sol\";\nimport \"openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol\";\nusing ECDSA for bytes32;\n/**\n * Main EIP4337 module.\n * Called (through the fallback module) using \"delegate\" from the GnosisSafe as an \"IAccount\",\n * so must implement validateUserOp\n * holds an immutable reference to the EntryPoint\n */\n\nstruct ZeroDevSessionKeyStorageStruct {\n mapping(address => bool) revoked;\n}\n\ncontract ZeroDevSessionKeyPlugin is ZeroDevBasePlugin {\n // return value in case of signature failure, with no time-range.\n // equivalent to packSigTimeRange(true,0,0);\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n\n event SessionKeyRevoked(address indexed key);\n\n constructor() EIP712(\"ZeroDevSessionKeyPlugin\", \"0.0.1\") {}\n\n function getPolicyStorage() internal pure returns (ZeroDevSessionKeyStorageStruct storage s) {\n bytes32 position = bytes32(uint256(keccak256(\"zero-dev.account.eip4337.sessionkey\")) - 1);\n assembly {\n s.slot := position\n }\n }\n\n // revoke session key\n function revokeSessionKey(address _key) external {\n getPolicyStorage().revoked[_key] = true;\n emit SessionKeyRevoked(_key);\n }\n\n function revoked(address _key) external view returns (bool) {\n return getPolicyStorage().revoked[_key];\n }\n\n function _validatePluginData(\n UserOperation calldata userOp,\n bytes32 userOpHash,\n bytes calldata data,\n bytes calldata signature\n ) internal view override returns (bool) {\n address sessionKey = address(bytes20(data[0:20]));\n require(!getPolicyStorage().revoked[sessionKey], \"session key revoked\");\n bytes32 merkleRoot = bytes32(data[20:52]);\n if(merkleRoot == bytes32(0)) {\n // means this session key has sudo permission\n signature = signature[33:98];\n } else {\n uint8 leafLength = uint8(signature[0]);\n bytes32[] memory proof;\n bytes32 leaf;\n if(leafLength == 20) {\n leaf = keccak256(signature[1:21]);\n proof = abi.decode(signature[86:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n signature = signature[21:86];\n } else if(leafLength == 24) {\n leaf = keccak256(signature[1:25]);\n proof = abi.decode(signature[90:], (bytes32[]));\n require(keccak256(userOp.callData[16:36]) == keccak256(signature[1:21]), \"invalid session key\");\n uint256 offset = uint256(bytes32(userOp.callData[68:100]));\n bytes calldata sig = userOp.callData[offset + 36: offset + 40];\n require(keccak256(sig) == keccak256(signature[21:25]));\n signature = signature[25:90];\n }\n require(MerkleProof.verify(proof, merkleRoot, leaf), \"invalide merkle root\");\n }\n bytes32 digest = _hashTypedDataV4(\n keccak256(\n abi.encode(\n keccak256(\"Session(bytes32 userOpHash,uint256 nonce)\"), // we are going to trust plugin for verification\n userOpHash,\n userOp.nonce\n )\n )\n );\n address recovered = digest.recover(signature);\n require(recovered == sessionKey, \"account: invalid signature\");\n return true;\n }\n}\n" + }, + "src/test/TestCounter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\ncontract TestCounter {\n uint256 public counter;\n function increment() public {\n counter += 1;\n }\n}" + }, + "src/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\nenum Operation {\n Call,\n DelegateCall\n}\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n function call(address to, uint256 value, bytes memory data)\n internal\n returns (bool success, bytes memory returnData)\n {\n assembly {\n success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function staticcall(address to, bytes memory data) internal view returns (bool success, bytes memory returnData) {\n assembly {\n success := staticcall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n function delegateCall(address to, bytes memory data) internal returns (bool success, bytes memory returnData) {\n assembly {\n success := delegatecall(gas(), to, add(data, 0x20), mload(data), 0, 0)\n let len := returndatasize()\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "@openzeppelin/=lib/openzeppelin-contracts/", + "account-abstraction/=lib/account-abstraction/contracts/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "openzeppelin-contracts/=lib/openzeppelin-contracts/" + ] + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index b0c7b670..2a9163c5 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -49,7 +49,31 @@ const config: HardhatUserConfig = { url: `https://arbitrum-mainnet.infura.io/v3/${process.env.INFURA_ID}`, accounts: getAccounts(), }, + arbitrumGoerli: { + url: `https://arbitrum-goerli.infura.io/v3/${process.env.INFURA_ID}`, + accounts: getAccounts(), + }, + optimism: { + url: `https://optimism-mainnet.infura.io/v3/${process.env.INFURA_ID}`, + accounts: getAccounts(), + }, + optimismGoerli: { + url: `https://optimism-goerli.infura.io/v3/${process.env.INFURA_ID}`, + accounts: getAccounts(), + }, + bscTestnet: { + url: `https://sly-indulgent-paper.bsc-testnet.discover.quiknode.pro/ab7e00c229f5967334160958e40fd6a4d893fb93`, + accounts: getAccounts(), + }, + bsc: { + url: `https://wandering-quaint-reel.bsc.quiknode.pro/508c3d245c14adb8689ed4073d29aa5795dfa24e`, + accounts: getAccounts(), + }, + baseGoerli: { + url: `https://icy-long-mountain.base-goerli.quiknode.pro/5b80d93e97cc9412a63c10a30841869abbef9596`, + accounts: getAccounts(), + }, } }; -export default config; \ No newline at end of file +export default config;