-
Notifications
You must be signed in to change notification settings - Fork 5
/
CustomAccessModularAccount.sol
40 lines (34 loc) · 1.29 KB
/
CustomAccessModularAccount.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.23;
import {SoulWalletCore} from "../contracts/SoulWalletCore.sol";
import {ModuleInstaller} from "../contracts/extensions/ModuleInstaller.sol";
import {HookInstaller} from "../contracts/extensions/HookInstaller.sol";
import {ValidatorInstaller} from "../contracts/extensions/ValidatorInstaller.sol";
contract BasicModularAccount is SoulWalletCore, ValidatorInstaller, HookInstaller, ModuleInstaller {
uint256 private _initialized;
modifier initializer() {
require(_initialized == 0);
_initialized = 1;
_;
}
constructor(address _entryPoint) SoulWalletCore(_entryPoint) initializer {}
function initialize(
bytes32 owner,
bytes calldata validatorAndData,
address defaultFallback,
address[] calldata modules
) external initializer {
_addOwner(owner);
_installValidator(address(bytes20(validatorAndData[:20])), validatorAndData[20:]);
_setFallbackHandler(defaultFallback);
for (uint256 i = 0; i < modules.length; i++) {
_installModule(modules[i]);
}
}
/**
* Only authorized modules can manage hooks and modules.
*/
function pluginManagementAccess() internal view override {
_onlyModule();
}
}