Skip to content

Commit

Permalink
fix: init/deinit module via safe account
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroknots committed Feb 21, 2024
1 parent 0ae520a commit d7a2fe3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions accounts/safe7579/src/core/HookManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,23 @@ abstract contract HookManager is ModuleManager {
revert HookAlreadyInstalled(currentHook);
}
_setHook(hook);
IHook(hook).onInstall(data);

_execute({
safe: msg.sender,
target: hook,
value: 0,
callData: abi.encodeCall(IModule.onInstall, (data))
});
}

function _uninstallHook(address hook, bytes calldata data) internal virtual {
_setHook(address(0));
IHook(hook).onUninstall(data);
_execute({
safe: msg.sender,
target: hook,
value: 0,
callData: abi.encodeCall(IModule.onUninstall, (data))
});
}

function _getHook(address smartAccount) internal view returns (address _hook) {
Expand Down

0 comments on commit d7a2fe3

Please sign in to comment.