From 1233cf1b0359f2552b1126ffd08e29405faa3203 Mon Sep 17 00:00:00 2001 From: Gonzalo Othacehe Date: Sun, 20 Jul 2025 18:50:39 -0300 Subject: [PATCH 1/3] up IERC4337 to better reflect the ERC --- contracts/interfaces/draft-IERC4337.sol | 42 +++++++++++++++++-------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/contracts/interfaces/draft-IERC4337.sol b/contracts/interfaces/draft-IERC4337.sol index 752e4e432c0..e4ec88e0872 100644 --- a/contracts/interfaces/draft-IERC4337.sol +++ b/contracts/interfaces/draft-IERC4337.sol @@ -107,34 +107,50 @@ interface IEntryPointNonces { */ interface IEntryPointStake { /** - * @dev Returns the balance of the account. + * @dev Adds stake to the account with an unstake delay of `unstakeDelaySec`. */ - function balanceOf(address account) external view returns (uint256); + function addStake(uint32 unstakeDelaySec) external payable; /** - * @dev Deposits `msg.value` to the account. + * @dev Unlocks the stake of the account. */ - function depositTo(address account) external payable; + function unlockStake() external; /** - * @dev Withdraws `withdrawAmount` from the account to `withdrawAddress`. + * @dev Withdraws the stake of the account to `withdrawAddress`. */ - function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external; + function withdrawStake(address payable withdrawAddress) external; +} + +/** + * @dev Handle deposit management for entities (i.e. accounts, paymasters). + * + * The paymaster must have a deposit, which the EntryPoint will charge UserOperation costs from. + * The deposit (for paying gas fees) is separate from the stake (which is locked). + * + * The EntryPoint must implement the following interface to allow Paymasters (and optionally Accounts) + * to manage their deposit. + */ +interface IEntryPointDeposit { + /** + * @dev Returns the balance of the account. + */ + function balanceOf(address account) external view returns (uint256); /** - * @dev Adds stake to the account with an unstake delay of `unstakeDelaySec`. + * @dev Deposits `msg.value` to the account. */ - function addStake(uint32 unstakeDelaySec) external payable; + function depositTo(address account) external payable; /** - * @dev Unlocks the stake of the account. + * @dev Withdraws `withdrawAmount` from the account to `withdrawAddress`. */ - function unlockStake() external; + function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external; /** - * @dev Withdraws the stake of the account to `withdrawAddress`. + * @dev Add to the deposit of the calling account */ - function withdrawStake(address payable withdrawAddress) external; + receive() external payable; } /** @@ -142,7 +158,7 @@ interface IEntryPointStake { * * User operations are validated and executed by this contract. */ -interface IEntryPoint is IEntryPointNonces, IEntryPointStake { +interface IEntryPoint is IEntryPointNonces, IEntryPointStake, IEntryPointDeposit { /** * @dev A user operation at `opIndex` failed with `reason`. */ From 8e43dc4b0a9e2fd96611819f29ba0d49d4729688 Mon Sep 17 00:00:00 2001 From: Gonzalo Othacehe Date: Sun, 20 Jul 2025 18:54:02 -0300 Subject: [PATCH 2/3] up --- contracts/interfaces/draft-IERC4337.sol | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/contracts/interfaces/draft-IERC4337.sol b/contracts/interfaces/draft-IERC4337.sol index e4ec88e0872..903dd73cf96 100644 --- a/contracts/interfaces/draft-IERC4337.sol +++ b/contracts/interfaces/draft-IERC4337.sol @@ -98,30 +98,6 @@ interface IEntryPointNonces { function getNonce(address sender, uint192 key) external view returns (uint256 nonce); } -/** - * @dev Handle stake management for entities (i.e. accounts, paymasters, factories). - * - * The EntryPoint must implement the following API to let entities like paymasters have a stake, - * 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 { - /** - * @dev Adds stake to the account with an unstake delay of `unstakeDelaySec`. - */ - function addStake(uint32 unstakeDelaySec) external payable; - - /** - * @dev Unlocks the stake of the account. - */ - function unlockStake() external; - - /** - * @dev Withdraws the stake of the account to `withdrawAddress`. - */ - function withdrawStake(address payable withdrawAddress) external; -} - /** * @dev Handle deposit management for entities (i.e. accounts, paymasters). * @@ -153,6 +129,30 @@ interface IEntryPointDeposit { receive() external payable; } +/** + * @dev Handle stake management for entities (i.e. accounts, paymasters, factories). + * + * The EntryPoint must implement the following API to let entities like paymasters have a stake, + * 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 { + /** + * @dev Adds stake to the account with an unstake delay of `unstakeDelaySec`. + */ + function addStake(uint32 unstakeDelaySec) external payable; + + /** + * @dev Unlocks the stake of the account. + */ + function unlockStake() external; + + /** + * @dev Withdraws the stake of the account to `withdrawAddress`. + */ + function withdrawStake(address payable withdrawAddress) external; +} + /** * @dev Entry point for user operations. * From c4e2d4c54904873f9d04a9aae16df3c3a192e3eb Mon Sep 17 00:00:00 2001 From: Gonzalo Othacehe Date: Sun, 20 Jul 2025 19:19:51 -0300 Subject: [PATCH 3/3] remove added receive statement defined in erc --- contracts/interfaces/draft-IERC4337.sol | 5 ----- 1 file changed, 5 deletions(-) diff --git a/contracts/interfaces/draft-IERC4337.sol b/contracts/interfaces/draft-IERC4337.sol index 903dd73cf96..f049edc6a52 100644 --- a/contracts/interfaces/draft-IERC4337.sol +++ b/contracts/interfaces/draft-IERC4337.sol @@ -122,11 +122,6 @@ interface IEntryPointDeposit { * @dev Withdraws `withdrawAmount` from the account to `withdrawAddress`. */ function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external; - - /** - * @dev Add to the deposit of the calling account - */ - receive() external payable; } /**