Skip to content

Commit

Permalink
chore: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Aug 30, 2024
1 parent 9da8900 commit 54f599b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/account/ModuleManagerInternals.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
error InterfaceNotSupported(address module);
error NativeFunctionNotAllowed(bytes4 selector);
error NullModule();
error ExecutionHookAlreadySet(ModuleEntity validationFunction, HookConfig hookConfig);
error ExecutionHookAlreadySet(HookConfig hookConfig);
error ModuleInstallCallbackFailed(address module, bytes revertReason);
error ModuleNotInstalled(address module);
error PreValidationHookLimitExceeded();
Expand Down Expand Up @@ -103,7 +103,9 @@ abstract contract ModuleManagerInternals is IModularAccount {
}

function _addExecHooks(EnumerableSet.Bytes32Set storage hooks, HookConfig hookConfig) internal {
hooks.add(toSetValue(hookConfig));
if (!hooks.add(toSetValue(hookConfig))) {
revert ExecutionHookAlreadySet(hookConfig);
}
}

function _removeExecHooks(EnumerableSet.Bytes32Set storage hooks, HookConfig hookConfig) internal {
Expand Down Expand Up @@ -245,9 +247,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
continue;
}
// Hook is an execution hook
if (!_validationData.executionHooks.add(toSetValue(hookConfig))) {
revert ExecutionHookAlreadySet(moduleEntity, hookConfig);
}
_addExecHooks(_validationData.executionHooks, hookConfig);

_onInstall(hookConfig.module(), hookData, type(IExecutionHookModule).interfaceId);
}
Expand Down

0 comments on commit 54f599b

Please sign in to comment.