Skip to content

Commit 3640efc

Browse files
authored
refactor: add ERC6900 prefix to interfaces (#216)
1 parent 31a9d96 commit 3640efc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+322
-291
lines changed

src/account/AccountStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.20;
33

44
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
55

6-
import {HookConfig, ModuleEntity, ValidationFlags} from "../interfaces/IModularAccount.sol";
6+
import {HookConfig, ModuleEntity, ValidationFlags} from "../interfaces/IERC6900Account.sol";
77

88
// bytes = keccak256("ERC6900.ReferenceModularAccount.Storage")
99
bytes32 constant _ACCOUNT_STORAGE_SLOT = 0xc531f081ecdb5a90f38c197521797881a6e5c752a7d451780f325a95f8b91f45;

src/account/ModularAccountView.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeab
55
import {EnumerableMap} from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
66
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
77

8-
import {HookConfig, IModularAccount, ModuleEntity} from "../interfaces/IModularAccount.sol";
9-
import {ExecutionDataView, IModularAccountView, ValidationDataView} from "../interfaces/IModularAccountView.sol";
8+
import {HookConfig, IERC6900Account, ModuleEntity} from "../interfaces/IERC6900Account.sol";
9+
import {ExecutionDataView, IERC6900AccountView, ValidationDataView} from "../interfaces/IERC6900AccountView.sol";
1010
import {HookConfigLib} from "../libraries/HookConfigLib.sol";
1111
import {ExecutionStorage, ValidationStorage, getAccountStorage, toHookConfig} from "./AccountStorage.sol";
1212

13-
abstract contract ModularAccountView is IModularAccountView {
13+
abstract contract ModularAccountView is IERC6900AccountView {
1414
using EnumerableSet for EnumerableSet.Bytes32Set;
1515
using EnumerableMap for EnumerableMap.AddressToUintMap;
1616
using HookConfigLib for HookConfig;
1717

18-
/// @inheritdoc IModularAccountView
18+
/// @inheritdoc IERC6900AccountView
1919
function getExecutionData(bytes4 selector) external view override returns (ExecutionDataView memory data) {
2020
if (
21-
selector == IModularAccount.execute.selector || selector == IModularAccount.executeBatch.selector
21+
selector == IERC6900Account.execute.selector || selector == IERC6900Account.executeBatch.selector
2222
|| selector == UUPSUpgradeable.upgradeToAndCall.selector
23-
|| selector == IModularAccount.installExecution.selector
24-
|| selector == IModularAccount.uninstallExecution.selector
23+
|| selector == IERC6900Account.installExecution.selector
24+
|| selector == IERC6900Account.uninstallExecution.selector
2525
) {
2626
data.module = address(this);
2727
data.allowGlobalValidation = true;
@@ -39,7 +39,7 @@ abstract contract ModularAccountView is IModularAccountView {
3939
}
4040
}
4141

42-
/// @inheritdoc IModularAccountView
42+
/// @inheritdoc IERC6900AccountView
4343
function getValidationData(ModuleEntity validationFunction)
4444
external
4545
view

src/account/ModuleManagerInternals.sol

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet
55

66
import {collectReturnData} from "../helpers/CollectReturnData.sol";
77
import {MAX_VALIDATION_ASSOC_HOOKS} from "../helpers/Constants.sol";
8-
import {ExecutionManifest, ManifestExecutionHook} from "../interfaces/IExecutionModule.sol";
8+
99
import {
1010
HookConfig,
11-
IModularAccount,
11+
IERC6900Account,
1212
ModuleEntity,
1313
ValidationConfig,
1414
ValidationFlags
15-
} from "../interfaces/IModularAccount.sol";
16-
import {IModule} from "../interfaces/IModule.sol";
15+
} from "../interfaces/IERC6900Account.sol";
16+
17+
import {ExecutionManifest, ManifestExecutionHook} from "../interfaces/IERC6900ExecutionModule.sol";
18+
import {IERC6900Module} from "../interfaces/IERC6900Module.sol";
1719
import {HookConfigLib} from "../libraries/HookConfigLib.sol";
1820
import {KnownSelectorsLib} from "../libraries/KnownSelectorsLib.sol";
1921
import {ModuleEntityLib} from "../libraries/ModuleEntityLib.sol";
@@ -28,7 +30,7 @@ import {
2830
toSetValue
2931
} from "./AccountStorage.sol";
3032

31-
abstract contract ModuleManagerInternals is IModularAccount {
33+
abstract contract ModuleManagerInternals is IERC6900Account {
3234
using EnumerableSet for EnumerableSet.Bytes32Set;
3335
using ModuleEntityLib for ModuleEntity;
3436
using ValidationConfigLib for ValidationConfig;
@@ -67,7 +69,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
6769
revert NativeFunctionNotAllowed(selector);
6870
}
6971

70-
// Make sure incoming execution function is not a function in IModule
72+
// Make sure incoming execution function is not a function in IERC6900Module
7173
if (KnownSelectorsLib.isIModuleFunction(selector)) {
7274
revert IModuleFunctionNotAllowed(selector);
7375
}
@@ -194,7 +196,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
194196
function _onInstall(address module, bytes calldata data) internal {
195197
if (data.length > 0) {
196198
// solhint-disable-next-line no-empty-blocks
197-
try IModule(module).onInstall(data) {}
199+
try IERC6900Module(module).onInstall(data) {}
198200
catch {
199201
bytes memory revertReason = collectReturnData();
200202
revert ModuleInstallCallbackFailed(module, revertReason);
@@ -207,7 +209,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
207209
if (data.length > 0) {
208210
// Clear the module storage for the account.
209211
// solhint-disable-next-line no-empty-blocks
210-
try IModule(module).onUninstall(data) {}
212+
try IERC6900Module(module).onUninstall(data) {}
211213
catch {
212214
onUninstallSuccess = false;
213215
}

src/account/ReferenceModularAccount.sol

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet
1313
import {collectReturnData} from "../helpers/CollectReturnData.sol";
1414
import {DIRECT_CALL_VALIDATION_ENTITY_ID} from "../helpers/Constants.sol";
1515
import {_coalescePreValidation, _coalesceValidation} from "../helpers/ValidationResHelpers.sol";
16-
import {IExecutionHookModule} from "../interfaces/IExecutionHookModule.sol";
17-
import {ExecutionManifest} from "../interfaces/IExecutionModule.sol";
16+
1817
import {
1918
Call,
20-
IModularAccount,
19+
IERC6900Account,
2120
ModuleEntity,
2221
ValidationConfig,
2322
ValidationFlags
24-
} from "../interfaces/IModularAccount.sol";
25-
import {IValidationHookModule} from "../interfaces/IValidationHookModule.sol";
26-
import {IValidationModule} from "../interfaces/IValidationModule.sol";
23+
} from "../interfaces/IERC6900Account.sol";
24+
import {IERC6900ExecutionHookModule} from "../interfaces/IERC6900ExecutionHookModule.sol";
25+
import {ExecutionManifest} from "../interfaces/IERC6900ExecutionModule.sol";
26+
import {IERC6900ValidationHookModule} from "../interfaces/IERC6900ValidationHookModule.sol";
27+
import {IERC6900ValidationModule} from "../interfaces/IERC6900ValidationModule.sol";
2728
import {HookConfig, HookConfigLib} from "../libraries/HookConfigLib.sol";
2829
import {ModuleEntityLib} from "../libraries/ModuleEntityLib.sol";
2930
import {SparseCalldataSegmentLib} from "../libraries/SparseCalldataSegmentLib.sol";
@@ -35,7 +36,7 @@ import {ModularAccountView} from "./ModularAccountView.sol";
3536
import {ModuleManagerInternals} from "./ModuleManagerInternals.sol";
3637

3738
contract ReferenceModularAccount is
38-
IModularAccount,
39+
IERC6900Account,
3940
AccountExecutor,
4041
ModularAccountView,
4142
AccountStorageInitializable,
@@ -159,7 +160,7 @@ contract ReferenceModularAccount is
159160
_doCachedPostExecHooks(postValidatorExecHooks);
160161
}
161162

162-
/// @inheritdoc IModularAccount
163+
/// @inheritdoc IERC6900Account
163164
/// @notice May be validated by a global validation.
164165
function execute(address target, uint256 value, bytes calldata data)
165166
external
@@ -171,7 +172,7 @@ contract ReferenceModularAccount is
171172
result = _exec(target, value, data);
172173
}
173174

174-
/// @inheritdoc IModularAccount
175+
/// @inheritdoc IERC6900Account
175176
/// @notice May be validated by a global validation function.
176177
function executeBatch(Call[] calldata calls)
177178
external
@@ -188,7 +189,7 @@ contract ReferenceModularAccount is
188189
}
189190
}
190191

191-
/// @inheritdoc IModularAccount
192+
/// @inheritdoc IERC6900Account
192193
function executeWithRuntimeValidation(bytes calldata data, bytes calldata authorization)
193194
external
194195
payable
@@ -225,7 +226,7 @@ contract ReferenceModularAccount is
225226
return returnData;
226227
}
227228

228-
/// @inheritdoc IModularAccount
229+
/// @inheritdoc IERC6900Account
229230
/// @notice May be validated by a global validation.
230231
function installExecution(
231232
address module,
@@ -235,7 +236,7 @@ contract ReferenceModularAccount is
235236
_installExecution(module, manifest, moduleInstallData);
236237
}
237238

238-
/// @inheritdoc IModularAccount
239+
/// @inheritdoc IERC6900Account
239240
/// @notice May be validated by a global validation.
240241
function uninstallExecution(
241242
address module,
@@ -256,7 +257,7 @@ contract ReferenceModularAccount is
256257
_installValidation(validationConfig, selectors, installData, hooks);
257258
}
258259

259-
/// @inheritdoc IModularAccount
260+
/// @inheritdoc IERC6900Account
260261
/// @notice May be validated by a global validation.
261262
/// @dev This function can be used to update (to a certain degree) previously installed validation functions.
262263
/// - preValidationHook, executionHooks, and selectors can be added later. Though they won't be deleted.
@@ -270,7 +271,7 @@ contract ReferenceModularAccount is
270271
_installValidation(validationConfig, selectors, installData, hooks);
271272
}
272273

273-
/// @inheritdoc IModularAccount
274+
/// @inheritdoc IERC6900Account
274275
/// @notice May be validated by a global validation.
275276
function uninstallValidation(
276277
ModuleEntity validationFunction,
@@ -295,7 +296,7 @@ contract ReferenceModularAccount is
295296
return getAccountStorage().supportedIfaces[interfaceId] > 0;
296297
}
297298

298-
/// @inheritdoc IModularAccount
299+
/// @inheritdoc IERC6900Account
299300
function accountId() external pure virtual returns (string memory) {
300301
return "erc6900.reference-modular-account.0.8.0";
301302
}
@@ -328,7 +329,7 @@ contract ReferenceModularAccount is
328329
(currentSignatureSegment, signature) = signature.advanceSegmentIfAtIndex(uint8(i));
329330

330331
// If this reverts, bubble up revert reason.
331-
IValidationHookModule(hookModule).preSignatureValidationHook(
332+
IERC6900ValidationHookModule(hookModule).preSignatureValidationHook(
332333
hookEntityId, msg.sender, hash, currentSignatureSegment
333334
);
334335
}
@@ -398,7 +399,7 @@ contract ReferenceModularAccount is
398399

399400
(address module, uint32 entityId) = preUserOpValidationHooks[i].moduleEntity().unpack();
400401
uint256 currentValidationRes =
401-
IValidationHookModule(module).preUserOpValidationHook(entityId, userOp, userOpHash);
402+
IERC6900ValidationHookModule(module).preUserOpValidationHook(entityId, userOp, userOpHash);
402403

403404
if (uint160(currentValidationRes) > 1) {
404405
// If the aggregator is not 0 or 1, it is an unexpected value
@@ -486,7 +487,7 @@ contract ReferenceModularAccount is
486487
returns (bytes memory preExecHookReturnData)
487488
{
488489
(address module, uint32 entityId) = preExecHook.unpack();
489-
try IExecutionHookModule(module).preExecutionHook(entityId, msg.sender, msg.value, data) returns (
490+
try IERC6900ExecutionHookModule(module).preExecutionHook(entityId, msg.sender, msg.value, data) returns (
490491
bytes memory returnData
491492
) {
492493
preExecHookReturnData = returnData;
@@ -511,12 +512,14 @@ contract ReferenceModularAccount is
511512
}
512513

513514
(address module, uint32 entityId) = postHookToRun.postExecHook.unpack();
514-
// solhint-disable-next-line no-empty-blocks
515-
try IExecutionHookModule(module).postExecutionHook(entityId, postHookToRun.preExecHookReturnData) {}
516-
catch {
515+
/* solhint-disable no-empty-blocks */
516+
try IERC6900ExecutionHookModule(module).postExecutionHook(
517+
entityId, postHookToRun.preExecHookReturnData
518+
) {} catch {
517519
bytes memory revertReason = collectReturnData();
518520
revert PostExecHookReverted(module, entityId, revertReason);
519521
}
522+
/* solhint-enable no-empty-blocks */
520523
}
521524
}
522525

@@ -526,7 +529,7 @@ contract ReferenceModularAccount is
526529
bytes memory currentAuthData
527530
) internal {
528531
(address hookModule, uint32 hookEntityId) = validationHook.unpack();
529-
try IValidationHookModule(hookModule).preRuntimeValidationHook(
532+
try IERC6900ValidationHookModule(hookModule).preRuntimeValidationHook(
530533
hookEntityId, msg.sender, msg.value, callData, currentAuthData
531534
)
532535
// forgefmt: disable-start
@@ -608,7 +611,7 @@ contract ReferenceModularAccount is
608611
revert UserOpValidationInvalid(module, entityId);
609612
}
610613

611-
return IValidationModule(module).validateUserOp(entityId, userOp, userOpHash);
614+
return IERC6900ValidationModule(module).validateUserOp(entityId, userOp, userOpHash);
612615
}
613616

614617
function _execRuntimeValidation(
@@ -618,7 +621,7 @@ contract ReferenceModularAccount is
618621
) internal virtual {
619622
(address module, uint32 entityId) = runtimeValidationFunction.unpack();
620623

621-
try IValidationModule(module).validateRuntime(
624+
try IERC6900ValidationModule(module).validateRuntime(
622625
address(this), entityId, msg.sender, msg.value, callData, authorization
623626
)
624627
// forgefmt: disable-start
@@ -644,8 +647,9 @@ contract ReferenceModularAccount is
644647
}
645648

646649
if (
647-
IValidationModule(module).validateSignature(address(this), entityId, msg.sender, hash, signature)
648-
== _1271_MAGIC_VALUE
650+
IERC6900ValidationModule(module).validateSignature(
651+
address(this), entityId, msg.sender, hash, signature
652+
) == _1271_MAGIC_VALUE
649653
) {
650654
return _1271_MAGIC_VALUE;
651655
}
@@ -684,15 +688,15 @@ contract ReferenceModularAccount is
684688

685689
_checkIfValidationAppliesSelector(outerSelector, validationFunction, checkingType);
686690

687-
if (outerSelector == IModularAccount.execute.selector) {
691+
if (outerSelector == IERC6900Account.execute.selector) {
688692
(address target,,) = abi.decode(callData[4:], (address, uint256, bytes));
689693

690694
if (target == address(this)) {
691695
// There is no point to call `execute` to recurse exactly once - this is equivalent to just having
692696
// the calldata as a top-level call.
693697
revert SelfCallRecursionDepthExceeded();
694698
}
695-
} else if (outerSelector == IModularAccount.executeBatch.selector) {
699+
} else if (outerSelector == IERC6900Account.executeBatch.selector) {
696700
// executeBatch may be used to batch account actions together, by targetting the account itself.
697701
// If this is done, we must ensure all of the inner calls are allowed by the provided validation
698702
// function.
@@ -704,8 +708,8 @@ contract ReferenceModularAccount is
704708
bytes4 nestedSelector = bytes4(calls[i].data);
705709

706710
if (
707-
nestedSelector == IModularAccount.execute.selector
708-
|| nestedSelector == IModularAccount.executeBatch.selector
711+
nestedSelector == IERC6900Account.execute.selector
712+
|| nestedSelector == IERC6900Account.executeBatch.selector
709713
) {
710714
// To prevent arbitrarily-deep recursive checking, we limit the depth of self-calls to one
711715
// for the purposes of batching.

src/account/SemiModularAccount.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interface
77

88
import {ModuleEntityLib} from "../libraries/ModuleEntityLib.sol";
99

10-
import {IModularAccount, ModuleEntity, ValidationConfig} from "../interfaces/IModularAccount.sol";
10+
import {IERC6900Account, ModuleEntity, ValidationConfig} from "../interfaces/IERC6900Account.sol";
1111

1212
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
1313
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
@@ -91,7 +91,7 @@ contract SemiModularAccount is ReferenceModularAccount {
9191
revert InitializerDisabled();
9292
}
9393

94-
/// @inheritdoc IModularAccount
94+
/// @inheritdoc IERC6900Account
9595
function accountId() external pure virtual override returns (string memory) {
9696
return "erc6900.reference-semi-modular-account.0.8.0";
9797
}

src/account/SemiModularAccount7702.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-3.0
22
pragma solidity ^0.8.20;
33

4-
import {IModularAccount} from "../interfaces/IModularAccount.sol";
4+
import {IERC6900Account} from "../interfaces/IERC6900Account.sol";
55
import {SemiModularAccount} from "./SemiModularAccount.sol";
66
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";
77

@@ -10,7 +10,7 @@ contract SemiModularAccount7702 is SemiModularAccount {
1010

1111
constructor(IEntryPoint anEntryPoint) SemiModularAccount(anEntryPoint) {}
1212

13-
/// @inheritdoc IModularAccount
13+
/// @inheritdoc IERC6900Account
1414
function accountId() external pure virtual override returns (string memory) {
1515
return "erc6900.reference-semi-modular-account-7702.0.8.0";
1616
}

src/interfaces/IModularAccount.sol renamed to src/interfaces/IERC6900Account.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: CC0-1.0
22
pragma solidity ^0.8.20;
33

4-
import {ExecutionManifest} from "./IExecutionModule.sol";
4+
import {ExecutionManifest} from "./IERC6900ExecutionModule.sol";
55

66
type ModuleEntity is bytes24;
77
// ModuleEntity is a packed representation of a module function
@@ -47,7 +47,7 @@ struct Call {
4747
bytes data;
4848
}
4949

50-
interface IModularAccount {
50+
interface IERC6900Account {
5151
event ExecutionInstalled(address indexed module, ExecutionManifest manifest);
5252
event ExecutionUninstalled(address indexed module, bool onUninstallSucceeded, ExecutionManifest manifest);
5353
event ValidationInstalled(address indexed module, uint32 indexed entityId);

src/interfaces/IModularAccountView.sol renamed to src/interfaces/IERC6900AccountView.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: CC0-1.0
22
pragma solidity ^0.8.20;
33

4-
import {HookConfig, ModuleEntity, ValidationFlags} from "../interfaces/IModularAccount.sol";
4+
import {HookConfig, ModuleEntity, ValidationFlags} from "../interfaces/IERC6900Account.sol";
55

66
/// @dev Represents data associated with a specific function selector.
77
struct ExecutionDataView {
@@ -34,7 +34,7 @@ struct ValidationDataView {
3434
bytes4[] selectors;
3535
}
3636

37-
interface IModularAccountView {
37+
interface IERC6900AccountView {
3838
/// @notice Get the execution data for a selector.
3939
/// @dev If the selector is a native function, the module address will be the address of the account.
4040
/// @param selector The selector to get the data for.

0 commit comments

Comments
 (0)