Skip to content

Commit

Permalink
feat: add SMA deploy event
Browse files Browse the repository at this point in the history
  • Loading branch information
Zer0dot committed Aug 16, 2024
1 parent 4ecf2ec commit 6a25eef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/account/AccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ contract AccountFactory is Ownable {
address public immutable SINGLE_SIGNER_VALIDATION_MODULE;

event ModularAccountDeployed(address indexed account, address indexed owner, uint256 salt);

event SemiModularAccountDeployed(address indexed account, address indexed owner, uint256 salt);

error SemiModularAccountAddressMismatch(address expected, address returned);

constructor(
Expand Down Expand Up @@ -80,13 +81,17 @@ contract AccountFactory is Ownable {
address addr = _getAddressFallbackSigner(immutables, fullSalt);

// LibClone short-circuits if it's already deployed.
(, address instance) =
(bool alreadyDeployed, address instance) =
LibClone.createDeterministicERC1967(address(SEMI_MODULAR_ACCOUNT_IMPL), immutables, fullSalt);

if (instance != addr) {
revert SemiModularAccountAddressMismatch(addr, instance);
}

if (!alreadyDeployed) {
emit SemiModularAccountDeployed(addr, owner, salt);
}

return SemiModularAccount(payable(addr));
}

Expand Down

0 comments on commit 6a25eef

Please sign in to comment.