/**
* User Operation struct
* @param sender - The sender account of this request.
* 请求的发送者账户。
* @param nonce - Unique value the sender uses to verify it is not a replay. In MADV, the validator identifier is encoded in the high 192 bit (`key`) of the nonce value
* 发送者用于验证它不是重放的唯一值。在 MADV 中,验证器标识符编码在 nonce 值的较高 192 位(`key`)中
* @param initCode - If set, the account contract will be created by this constructor/
* 如果设置,账户合约将由此构造函数创建/
* @param callData - The method call to execute on this account.
* 在此账户上执行的方法调用。
* @param accountGasLimits - Packed gas limits for validateUserOp and gas limit passed to the callData method call.
* validateUserOp 的打包 gas 限制和传递给 callData 方法调用的 gas 限制。
* @param preVerificationGas - Gas not calculated by the handleOps method, but added to the gas paid.
* 不由 handleOps 方法计算的气体,但添加到支付的气体中。
* Covers batch overhead.
* 涵盖批量开销。
* @param gasFees - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters.
* 打包的 gas 字段 maxPriorityFeePerGas 和 maxFeePerGas - 与 EIP-1559 gas 参数相同。
* @param paymasterAndData - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data
* 如果设置,此字段保存支付者的地址、验证 gas 限制、postOp gas 限制和特定于支付者的额外数据
* The paymaster will pay for the transaction instead of the sender.
* 支付者将支付交易费用而不是发送者。
* @param signature - Sender-verified signature over the entire request, the EntryPoint address and the chain ID.
* 发送者验证的整个请求、EntryPoint 地址和链 ID 的签名。
*/structPackedUserOperation{addresssender;uint256nonce;bytesinitCode;bytescallData;bytes32accountGasLimits;uint256preVerificationGas;bytes32gasFees;bytespaymasterAndData;bytessignature;}
IAccount 接口
interfaceIAccount{/**
* Validate user's signature and nonce
* 验证用户的签名和 nonce
* the entryPoint will make the call to the recipient only if this validation call returns successfully.
* 只有此验证调用成功返回,entryPoint 才会调用接收者。
* signature failure should be reported by returning SIG_VALIDATION_FAILED (1).
* 签名失败应通过返回 SIG_VALIDATION_FAILED (1) 来报告。
* This allows making a "simulation call" without a valid signature
* 这允许在没有有效签名的情况下进行“模拟调用”
* Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.
* 其他失败(例如,nonce 不匹配或无效的签名格式)仍应恢复以表示失败。
*
* @dev Must validate caller is the entryPoint.
* 必须验证调用者是 entryPoint。
* Must validate the signature and nonce
* 必须验证签名和 nonce
* @param userOp - The operation that is about to be executed.
* 即将执行的操作。
* @param userOpHash - Hash of the user's request data. can be used as the basis for signature.
* 用户请求数据的哈希值。可以用作签名的基础。
* @param missingAccountFunds - Missing funds on the account's deposit in the entrypoint.
* 入口点中帐户存款中缺少的资金。
* This is the minimum amount to transfer to the sender(entryPoint) to be
* 这是转移到发送者(entryPoint)的最小金额
* able to make the call. The excess is left as a deposit in the entrypoint
* 能够进行调用。多余的部分作为存款留在入口点中
* for future calls. Can be withdrawn anytime using "entryPoint.withdrawTo()".
* 用于未来的调用。可以使用“entryPoint.withdrawTo()”随时提取。
* In case there is a paymaster in the request (or the current deposit is high
* 如果请求中有支付者(或当前存款很高)
* enough), this value will be zero.
* 够高),此值将为零。
* @return validationData - Packaged ValidationData structure. use `_packValidationData` and
* 打包的 ValidationData 结构。使用 `_packValidationData` 和
* `_unpackValidationData` to encode and decode.
* `_unpackValidationData` 进行编码和解码。
* <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,
* <20 字节> sigAuthorizer - 0 表示有效签名,1 表示标记签名失败,
* otherwise, an address of an "authorizer" contract.
* 否则,表示“授权者”合约的地址。
* <6-byte> validUntil - Last timestamp this operation is valid. 0 for "indefinite"
* <6 字节> validUntil - 此操作有效的最后一个时间戳。0 表示“无限期”
* <6-byte> validAfter - First timestamp this operation is valid
* <6 字节> validAfter - 此操作有效的第一个时间戳
* If an account doesn't use time-range, it is enough to
* 如果帐户不使用时间范围,则足以
* return SIG_VALIDATION_FAILED value (1) for signature failure.
* 返回 SIG_VALIDATION_FAILED 值 (1) 以表示签名失败。
* Note that the validation code cannot use block.timestamp (or block.number) directly.
* 请注意,验证代码不能直接使用 block.timestamp(或 block.number)。
*/functionvalidateUserOp(PackedUserOperationcalldatauserOp,bytes32userOpHash,uint256missingAccountFunds)externalreturns(uint256validationData);}
NonceManager 接口
/**
* Return the next nonce for this sender.
* 返回此发送者的下一个 nonce。
* Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)
* 在给定的 key 中,nonce 值是按顺序排列的(从零开始,并在每个 userop 上递增 1)
* But UserOp with different keys can come with arbitrary order.
* 但是具有不同 key 的 UserOp 可以以任意顺序出现。
*
* @param sender the account address
* 发送者账户地址
* @param key the high 192 bit of the nonce, in MADV the validator identifier is encoded here
* nonce 的高 192 位,在 MADV 中,验证器标识符在此处编码
* @return nonce a full nonce to pass for next UserOp with this sender.
* nonce,一个完整的 nonce,用于传递给此发送者的下一个 UserOp。
*/functiongetNonce(addresssender,uint192key)externalviewreturns(uint256nonce);
UserOperationEvent
/***
* An event emitted after each successful request
* 每次成功请求后发出的事件
* @param userOpHash - unique identifier for the request (hash its entire content, except signature).
* userOpHash - 请求的唯一标识符(对其整个内容进行哈希处理,除了签名)。
* @param sender - the account that generates this request.
* sender - 生成此请求的帐户。
* @param paymaster - if non-null, the paymaster that pays for this request.
* paymaster - 如果非空,则是为此请求付费的支付者。
* @param nonce - the nonce value from the request.
* nonce - 来自请求的 nonce 值。
* @param success - true if the sender transaction succeeded, false if reverted.
* success - 如果发送者交易成功,则为 true,如果回滚,则为 false。
* @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.
* actualGasCost - 为此 UserOperation 支付的实际金额(由帐户或支付者支付)。
* @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).
* actualGasUsed - 此 UserOperation 使用的总 gas(包括 preVerification、创建、验证和执行)。
*/eventUserOperationEvent(bytes32indexeduserOpHash,addressindexedsender,addressindexedpaymaster,uint256nonce,boolsuccess,uint256actualGasCost,uint256actualGasUsed);