Skip to content

Commit

Permalink
fix: pr review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Jul 23, 2024
1 parent 268b487 commit 4278acf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/account/AccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {UpgradeableModularAccount} from "../account/UpgradeableModularAccount.so
import {ValidationConfigLib} from "../helpers/ValidationConfigLib.sol";

contract AccountFactory is Ownable {
UpgradeableModularAccount public accountImplementation;
UpgradeableModularAccount public immutable ACCOUNT_IMPL;
bytes32 private immutable _PROXY_BYTECODE_HASH;
uint32 public constant UNSTAKE_DELAY = 1 weeks;
IEntryPoint public immutable ENTRY_POINT;
Expand All @@ -23,7 +23,7 @@ contract AccountFactory is Ownable {
ENTRY_POINT = _entryPoint;
_PROXY_BYTECODE_HASH =
keccak256(abi.encodePacked(type(ERC1967Proxy).creationCode, abi.encode(address(_accountImpl), "")));
accountImplementation = _accountImpl;
ACCOUNT_IMPL = _accountImpl;
SINGLE_SIGNER_VALIDATION = _singleSignerValidation;
}

Expand All @@ -45,7 +45,7 @@ contract AccountFactory is Ownable {
if (addr.code.length == 0) {
bytes memory pluginInstallData = abi.encode(entityId, owner);
// not necessary to check return addr since next call will fail if so
new ERC1967Proxy{salt: combinedSalt}(address(accountImplementation), "");
new ERC1967Proxy{salt: combinedSalt}(address(ACCOUNT_IMPL), "");
// point proxy to actual implementation and init plugins
UpgradeableModularAccount(payable(addr)).initializeWithValidation(
ValidationConfigLib.pack(SINGLE_SIGNER_VALIDATION, entityId, true, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ contract AccountFactoryTest is AccountTestBase {
assertEq(address(account.entryPoint()), address(entryPoint));
}

function test_createAccountAndGetAddress() public {
UpgradeableModularAccount account = _factory.createAccount(address(this), 100, 0);

assertEq(address(account), address(_factory.createAccount(address(this), 100, 0)));
}

function test_multipleDeploy() public {
UpgradeableModularAccount account = _factory.createAccount(address(this), 100, 0);

Expand Down

0 comments on commit 4278acf

Please sign in to comment.