@@ -25,9 +25,15 @@ import {UUPSUpgradeable} from "../utils/UUPSUpgradeable.sol";
2525/// the click on "Is this a proxy?" on the clone's page on Etherscan.
2626///
2727/// Note:
28- /// - ERC6551 accounts are not compatible with ERC4337
29- /// (at least not without crazy hacks)
30- /// due to storage access limitations during ERC4337 UserOp validation.
28+ /// - This implementation does NOT include ERC4337 functionality.
29+ /// This is intentional, because the canonical ERC4337 entry point may still change and we
30+ /// don't want to encourage upgradeability by default for ERC6551 accounts just to handle this.
31+ /// We may include ERC4337 functionality once ERC4337 has been finalized.
32+ /// Recent updates to the account abstraction validation scope rules
33+ /// [ERC7562](https://eips.ethereum.org/EIPS/eip-7562) has made ERC6551 compatible with ERC4337.
34+ /// For an opinionated implementation, see https://github.com/tokenbound/contracts.
35+ /// If you want to add it yourself, you'll just need to add in the
36+ /// user operation validation functionality (and use ERC6551's execution functionality).
3137/// - Please refer to the official [ERC6551](https://github.com/erc6551/reference) reference
3238/// for latest updates on the ERC6551 standard, as well as canonical registry information.
3339abstract contract ERC6551 is UUPSUpgradeable , Receiver , ERC1271 {
@@ -172,15 +178,26 @@ abstract contract ERC6551 is UUPSUpgradeable, Receiver, ERC1271 {
172178 /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
173179
174180 /// @dev Execute a call from this account.
181+ /// Reverts and bubbles up error if operation fails.
182+ /// Returns the result of the operation.
183+ ///
184+ /// Accounts MUST accept the following operation parameter values:
185+ /// - 0 = CALL
186+ /// - 1 = DELEGATECALL
187+ /// - 2 = CREATE
188+ /// - 3 = CREATE2
189+ ///
190+ /// Accounts MAY support additional operations or restrict a signer's
191+ /// ability to execute certain operations.
175192 function execute (address target , uint256 value , bytes calldata data , uint8 operation )
176193 public
177194 payable
178195 virtual
179196 onlyValidSigner
180- onlyValidExecuteOperation (operation)
181197 incrementState
182198 returns (bytes memory result )
183199 {
200+ if (operation != 0 ) revert OperationNotSupported ();
184201 /// @solidity memory-safe-assembly
185202 assembly {
186203 result := mload (0x40 )
@@ -198,15 +215,19 @@ abstract contract ERC6551 is UUPSUpgradeable, Receiver, ERC1271 {
198215 }
199216
200217 /// @dev Execute a sequence of calls from this account.
218+ /// Reverts and bubbles up error if an operation fails.
219+ /// Returns the results of the operations.
220+ ///
221+ /// This is a batch variant of `execute` and is not required for `IERC6551Executable`.
201222 function executeBatch (Call[] calldata calls , uint8 operation )
202223 public
203224 payable
204225 virtual
205226 onlyValidSigner
206- onlyValidExecuteOperation (operation)
207227 incrementState
208228 returns (bytes [] memory results )
209229 {
230+ if (operation != 0 ) revert OperationNotSupported ();
210231 /// @solidity memory-safe-assembly
211232 assembly {
212233 results := mload (0x40 )
@@ -235,12 +256,6 @@ abstract contract ERC6551 is UUPSUpgradeable, Receiver, ERC1271 {
235256 }
236257 }
237258
238- /// @dev Requires that the execute `operation` is supported.
239- modifier onlyValidExecuteOperation (uint8 operation ) virtual {
240- if (operation != 0 ) revert OperationNotSupported ();
241- _;
242- }
243-
244259 /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
245260 /* ERC165 */
246261 /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
@@ -252,8 +267,8 @@ abstract contract ERC6551 is UUPSUpgradeable, Receiver, ERC1271 {
252267 /// @solidity memory-safe-assembly
253268 assembly {
254269 let s := shr (224 , interfaceId)
255- // ERC165: 0x01ffc9a7, ERC6551: 0x6faff5f1, ERC6551Executable: 0x74420f4c .
256- result := or (or (eq (s, 0x01ffc9a7 ), eq (s, 0x6faff5f1 )), eq (s, 0x74420f4c ))
270+ // ERC165: 0x01ffc9a7, ERC6551: 0x6faff5f1, ERC6551Executable: 0x51945447 .
271+ result := or (or (eq (s, 0x01ffc9a7 ), eq (s, 0x6faff5f1 )), eq (s, 0x51945447 ))
257272 }
258273 }
259274
0 commit comments