Skip to content

Commit

Permalink
refactor: removed obsolete address comparison from sma creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zer0dot committed Aug 19, 2024
1 parent 57577f0 commit 4ab5b75
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/account/AccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ contract AccountFactory is Ownable {
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(
IEntryPoint _entryPoint,
UpgradeableModularAccount _accountImpl,
Expand Down Expand Up @@ -78,21 +76,15 @@ contract AccountFactory is Ownable {

bytes memory immutables = _getImmutableArgs(owner);

address addr = _getAddressSemiModular(immutables, fullSalt);

// LibClone short-circuits if it's already deployed.
(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);
emit SemiModularAccountDeployed(instance, owner, salt);
}

return SemiModularAccount(payable(addr));
return SemiModularAccount(payable(instance));
}

function addStake(uint32 unstakeDelay) external payable onlyOwner {
Expand Down

0 comments on commit 4ab5b75

Please sign in to comment.