Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@ contract DeployScript is Script {
console2.log("EP: ", address(entryPoint));
console2.log("Factory owner: ", owner);

vm.startBroadcast();
_deployAccountImpl(accountImplSalt, accountImpl);
_deploySingleSignerValidation(singleSignerValidationSalt, singleSignerValidation);
_deployAccountFactory(factorySalt, factory);
_addStakeForFactory(uint32(requiredUnstakeDelay), requiredStakeAmount);
vm.stopBroadcast();
}

function _deployAccountImpl(bytes32 salt, address expected) internal {
console2.log(string.concat("Deploying AccountImpl with salt: ", vm.toString(salt)));

address addr = Create2.computeAddress(
salt, keccak256(abi.encodePacked(type(UpgradeableModularAccount).creationCode, abi.encode(entryPoint)))
salt,
keccak256(abi.encodePacked(type(UpgradeableModularAccount).creationCode, abi.encode(entryPoint))),
CREATE2_FACTORY
);
if (addr != expected) {
console2.log("Expected address mismatch");
Expand Down Expand Up @@ -72,8 +76,9 @@ contract DeployScript is Script {
function _deploySingleSignerValidation(bytes32 salt, address expected) internal {
console2.log(string.concat("Deploying SingleSignerValidation with salt: ", vm.toString(salt)));

address addr =
Create2.computeAddress(salt, keccak256(abi.encodePacked(type(SingleSignerValidation).creationCode)));
address addr = Create2.computeAddress(
salt, keccak256(abi.encodePacked(type(SingleSignerValidation).creationCode)), CREATE2_FACTORY
);
if (addr != expected) {
console2.log("Expected address mismatch");
console2.log("Expected: ", expected);
Expand Down Expand Up @@ -108,7 +113,8 @@ contract DeployScript is Script {
type(AccountFactory).creationCode,
abi.encode(entryPoint, accountImpl, singleSignerValidation, owner)
)
)
),
CREATE2_FACTORY
);
if (addr != expected) {
console2.log("Expected address mismatch");
Expand Down
9 changes: 3 additions & 6 deletions test/script/Deploy.s.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,16 @@ contract DeployTest is Test {
vm.setEnv("ENTRYPOINT", vm.toString(address(_entryPoint)));
vm.setEnv("OWNER", vm.toString(_owner));

// Create1 derivation of the 2nd address deployed
address deployScriptAddr = address(0x2e234DAe75C793f67A35089C9d99245E1C58470b);

_accountImpl = Create2.computeAddress(
bytes32(0),
keccak256(
abi.encodePacked(type(UpgradeableModularAccount).creationCode, abi.encode(address(_entryPoint)))
),
deployScriptAddr
CREATE2_FACTORY
);

_singleSignerValidation = Create2.computeAddress(
bytes32(0), keccak256(abi.encodePacked(type(SingleSignerValidation).creationCode)), deployScriptAddr
bytes32(0), keccak256(abi.encodePacked(type(SingleSignerValidation).creationCode)), CREATE2_FACTORY
);

_factory = Create2.computeAddress(
Expand All @@ -53,7 +50,7 @@ contract DeployTest is Test {
abi.encode(address(_entryPoint), _accountImpl, _singleSignerValidation, _owner)
)
),
deployScriptAddr
CREATE2_FACTORY
);

vm.setEnv("ACCOUNT_IMPL", vm.toString(address(_accountImpl)));
Expand Down