Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ERC to ERC4337 interface names #5468

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions contracts/interfaces/draft-IERC4337.sol

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your erlckme

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct PackedUserOperation {
*
* See https://eips.ethereum.org/EIPS/eip-7766[ERC-7766]
*/
interface IAggregator {
interface IERC4337Aggregator {
/**
* @dev Validates the signature for a user operation.
* Returns an alternative signature that should be used during bundling.
Expand Down Expand Up @@ -89,7 +89,7 @@ interface IAggregator {
*
* See https://eips.ethereum.org/EIPS/eip-4337#semi-abstracted-nonce-support[ERC-4337 semi-abstracted nonce support].
*/
interface IEntryPointNonces {
interface IERC4337EntryPointNonces {
/**
* @dev Returns the nonce for a `sender` account and a `key`.
*
Expand All @@ -105,7 +105,7 @@ interface IEntryPointNonces {
* and thus have more flexibility in their storage access
* (see https://eips.ethereum.org/EIPS/eip-4337#reputation-scoring-and-throttlingbanning-for-global-entities[reputation, throttling and banning.])
*/
interface IEntryPointStake {
interface IERC4337EntryPointStake {
/**
* @dev Returns the balance of the account.
*/
Expand Down Expand Up @@ -142,7 +142,7 @@ interface IEntryPointStake {
*
* User operations are validated and executed by this contract.
*/
interface IEntryPoint is IEntryPointNonces, IEntryPointStake {
interface IERC4337EntryPoint is IERC4337EntryPointNonces, IERC4337EntryPointStake {
/**
* @dev A user operation at `opIndex` failed with `reason`.
*/
Expand All @@ -158,7 +158,7 @@ interface IEntryPoint is IEntryPointNonces, IEntryPointStake {
*/
struct UserOpsPerAggregator {
PackedUserOperation[] userOps;
IAggregator aggregator;
IERC4337Aggregator aggregator;
bytes signature;
}

Expand All @@ -181,7 +181,7 @@ interface IEntryPoint is IEntryPointNonces, IEntryPointStake {
/**
* @dev Base interface for an ERC-4337 account.
*/
interface IAccount {
interface IERC4337Account {
/**
* @dev Validates a user operation.
*
Expand All @@ -208,7 +208,7 @@ interface IAccount {
* @dev Support for executing user operations by prepending the {executeUserOp} function selector
* to the UserOperation's `callData`.
*/
interface IAccountExecute {
interface IERC4337AccountExecute {
/**
* @dev Executes a user operation.
*/
Expand All @@ -220,7 +220,7 @@ interface IAccountExecute {
*
* NOTE: A paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.
*/
interface IPaymaster {
interface IERC4337Paymaster {
enum PostOpMode {
opSucceeded,
opReverted,
Expand All @@ -229,7 +229,7 @@ interface IPaymaster {

/**
* @dev Validates whether the paymaster is willing to pay for the user operation. See
* {IAccount-validateUserOp} for additional information on the return value.
* {IERC4337Account-validateUserOp} for additional information on the return value.
*
* NOTE: Bundlers will reject this method if it modifies the state, unless it's whitelisted.
*/
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/draft-IERC7579.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface IERC7579Validator is IERC7579Module {
*
* MUST validate that the signature is a valid signature of the userOpHash
* SHOULD return ERC-4337's SIG_VALIDATION_FAILED (and not revert) on signature mismatch
* See {IAccount-validateUserOp} for additional information on the return value
* See {IERC4337Account-validateUserOp} for additional information on the return value
*/
function validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash) external returns (uint256);

Expand Down
14 changes: 8 additions & 6 deletions test/account/utils/draft-ERC7579Utils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ pragma solidity ^0.8.24;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import {PackedUserOperation, IAccount, IEntryPoint} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";
import {PackedUserOperation, IERC4337Account, IERC4337EntryPoint} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";
import {ERC4337Utils} from "@openzeppelin/contracts/account/utils/draft-ERC4337Utils.sol";
import {ERC7579Utils, Mode, CallType, ExecType, ModeSelector, ModePayload, Execution} from "@openzeppelin/contracts/account/utils/draft-ERC7579Utils.sol";
import {Test, Vm, console} from "forge-std/Test.sol";

contract SampleAccount is IAccount, Ownable {
contract SampleAccount is IERC4337Account, Ownable {
using ECDSA for *;
using MessageHashUtils for *;
using ERC4337Utils for *;
using ERC7579Utils for *;

IEntryPoint internal constant ENTRY_POINT = IEntryPoint(payable(0x0000000071727De22E5E9d8BAf0edAc6f37da032));
IERC4337EntryPoint internal constant ENTRY_POINT =
IERC4337EntryPoint(payable(0x0000000071727De22E5E9d8BAf0edAc6f37da032));

event Log(bool duringValidation, Execution[] calls);

Expand Down Expand Up @@ -105,7 +106,8 @@ contract ERC7579UtilsTest is Test {
using ERC4337Utils for *;
using ERC7579Utils for *;

IEntryPoint private constant ENTRYPOINT = IEntryPoint(payable(0x0000000071727De22E5E9d8BAf0edAc6f37da032));
IERC4337EntryPoint private constant ENTRYPOINT =
IERC4337EntryPoint(payable(0x0000000071727De22E5E9d8BAf0edAc6f37da032));
address private _owner;
uint256 private _ownerKey;
address private _account;
Expand Down Expand Up @@ -218,7 +220,7 @@ contract ERC7579UtilsTest is Test {

vm.expectRevert(
abi.encodeWithSelector(
IEntryPoint.FailedOpWithRevert.selector,
IERC4337EntryPoint.FailedOpWithRevert.selector,
0,
"AA23 reverted",
abi.encodeWithSelector(ERC7579Utils.ERC7579DecodingError.selector)
Expand Down Expand Up @@ -276,7 +278,7 @@ contract ERC7579UtilsTest is Test {

vm.expectRevert(
abi.encodeWithSelector(
IEntryPoint.FailedOpWithRevert.selector,
IERC4337EntryPoint.FailedOpWithRevert.selector,
0,
"AA23 reverted",
abi.encodeWithSelector(ERC7579Utils.ERC7579DecodingError.selector)
Expand Down
Loading