Skip to content

Commit

Permalink
Towards 2step creation (allow multple guardians)
Browse files Browse the repository at this point in the history
  • Loading branch information
eloi010 committed Nov 17, 2023
1 parent d0d1273 commit 38f2e27
Show file tree
Hide file tree
Showing 6 changed files with 642 additions and 40 deletions.
4 changes: 2 additions & 2 deletions contracts/core/BaseOpenfortAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ abstract contract BaseOpenfortAccount is

mapping(address sessionKey => SessionKeyStruct sessionKeyData) public sessionKeys;

event AccountCreated(address indexed creator);
event AccountImplementationDeployed(address indexed creator);
event SessionKeyRegistered(address indexed key);
event SessionKeyRevoked(address indexed key);

Expand All @@ -71,7 +71,7 @@ abstract contract BaseOpenfortAccount is
receive() external payable virtual {}

constructor() {
emit AccountCreated(msg.sender);
emit AccountImplementationDeployed(msg.sender);
_disableInitializers();
}

Expand Down
5 changes: 0 additions & 5 deletions contracts/core/eip6551/EIP6551OpenfortAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ contract EIP6551OpenfortAccount is BaseOpenfortAccount, IERC6551Account, IERC655

receive() external payable override(BaseOpenfortAccount, IERC6551Account) {}

constructor() {
emit AccountCreated(msg.sender);
_disableInitializers();
}

/*
* @notice Initialize the smart contract wallet.
*/
Expand Down
37 changes: 4 additions & 33 deletions contracts/core/recoverable/RecoverableOpenfortFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,9 @@ contract RecoverableOpenfortFactory is IBaseOpenfortFactory {
}

emit AccountCreated(account, _admin);
account = address(
new OpenfortRecoverableProxy{salt: salt}(
accountImplementation,
abi.encodeCall(
RecoverableOpenfortAccount.initialize,
(
_admin,
entrypointContract,
recoveryPeriod,
securityPeriod,
securityWindow,
lockPeriod,
openfortGuardian)
)
)
account = address(new OpenfortRecoverableProxy{salt: salt}(accountImplementation, ""));
RecoverableOpenfortAccount(payable(account)).initialize(
_admin, entrypointContract, recoveryPeriod, securityPeriod, securityWindow, lockPeriod, openfortGuardian
);
}

Expand All @@ -88,24 +76,7 @@ contract RecoverableOpenfortFactory is IBaseOpenfortFactory {
return Create2.computeAddress(
salt,
keccak256(
abi.encodePacked(
type(OpenfortRecoverableProxy).creationCode,
abi.encode(
accountImplementation,
abi.encodeCall(
RecoverableOpenfortAccount.initialize,
(
_admin,
entrypointContract,
recoveryPeriod,
securityPeriod,
securityWindow,
lockPeriod,
openfortGuardian
)
)
)
)
abi.encodePacked(type(OpenfortRecoverableProxy).creationCode, abi.encode(accountImplementation, ""))
)
);
}
Expand Down
Loading

0 comments on commit 38f2e27

Please sign in to comment.