-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update deployment scripts with more combinations
- Loading branch information
1 parent
c866ecb
commit 93344c7
Showing
19 changed files
with
449 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
script/7579/EmailRecoveryModule/DeployEmailRecoveryModuleWithAccountHiding.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.25; | ||
|
||
/* solhint-disable no-console, gas-custom-errors */ | ||
|
||
import { console } from "forge-std/console.sol"; | ||
import { AccountHidingRecoveryCommandHandler } from | ||
"src/handlers/AccountHidingRecoveryCommandHandler.sol"; | ||
import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; | ||
import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; | ||
import { EmailRecoveryFactory } from "src/factories/EmailRecoveryFactory.sol"; | ||
import { OwnableValidator } from "src/test/OwnableValidator.sol"; | ||
import { BaseDeployScript } from "../../BaseDeployScript.s.sol"; | ||
|
||
contract DeployEmailRecoveryModuleScript is BaseDeployScript { | ||
address verifier; | ||
address dkim; | ||
address emailAuthImpl; | ||
address commandHandler; | ||
uint256 minimumDelay; | ||
address killSwitchAuthorizer; | ||
address validatorAddr; | ||
|
||
address initialOwner; | ||
address dkimRegistrySigner; | ||
uint256 dkimDelay; | ||
uint256 salt; | ||
|
||
function run() public override { | ||
super.run(); | ||
vm.startBroadcast(vm.envUint("PRIVATE_KEY")); | ||
verifier = vm.envOr("VERIFIER", address(0)); | ||
dkim = vm.envOr("DKIM_REGISTRY", address(0)); | ||
emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); | ||
commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); | ||
minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); | ||
killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); | ||
validatorAddr = vm.envOr("VALIDATOR", address(0)); | ||
|
||
initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); | ||
dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); | ||
dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); | ||
salt = vm.envOr("CREATE2_SALT", uint256(0)); | ||
|
||
if (verifier == address(0)) { | ||
verifier = deployVerifier(initialOwner, salt); | ||
} | ||
|
||
if (dkim == address(0)) { | ||
dkim = deployUserOverrideableDKIMRegistry( | ||
initialOwner, dkimRegistrySigner, dkimDelay, salt | ||
); | ||
} | ||
|
||
if (emailAuthImpl == address(0)) { | ||
emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); | ||
console.log("EmailAuth implemenation deployed at", emailAuthImpl); | ||
} | ||
|
||
if (validatorAddr == address(0)) { | ||
validatorAddr = address(new OwnableValidator{ salt: bytes32(salt) }()); | ||
console.log("OwnableValidator deployed at", validatorAddr); | ||
} | ||
|
||
address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); | ||
if (_factory == address(0)) { | ||
_factory = | ||
address(new EmailRecoveryFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl)); | ||
console.log("EmailRecoveryFactory deployed at", _factory); | ||
} | ||
|
||
EmailRecoveryFactory factory = EmailRecoveryFactory(_factory); | ||
(address module, address commandHandler) = factory.deployEmailRecoveryModule( | ||
bytes32(uint256(0)), | ||
bytes32(uint256(0)), | ||
type(AccountHidingRecoveryCommandHandler).creationCode, | ||
minimumDelay, | ||
killSwitchAuthorizer, | ||
address(dkim), | ||
validatorAddr, | ||
bytes4(keccak256(bytes("changeOwner(address)"))) | ||
); | ||
|
||
console.log("EmailRecoveryModule deployed at", vm.toString(module)); | ||
console.log("AccountHidingRecoveryCommandHandler deployed at", vm.toString(commandHandler)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.25; | ||
|
||
/* solhint-disable no-console, gas-custom-errors */ | ||
|
||
import { console } from "forge-std/console.sol"; | ||
import { EmailRecoveryCommandHandler } from "src/handlers/EmailRecoveryCommandHandler.sol"; | ||
import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; | ||
import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; | ||
import { EmailRecoveryUniversalFactory } from "src/factories/EmailRecoveryUniversalFactory.sol"; | ||
import { BaseDeployScript } from "../../BaseDeployScript.s.sol"; | ||
|
||
contract DeployUniversalEmailRecoveryModuleScript is BaseDeployScript { | ||
address verifier; | ||
address dkim; | ||
address emailAuthImpl; | ||
address commandHandler; | ||
uint256 minimumDelay; | ||
address killSwitchAuthorizer; | ||
|
||
address initialOwner; | ||
address dkimRegistrySigner; | ||
uint256 dkimDelay; | ||
uint256 salt; | ||
|
||
function run() public override { | ||
super.run(); | ||
vm.startBroadcast(vm.envUint("PRIVATE_KEY")); | ||
verifier = vm.envOr("VERIFIER", address(0)); | ||
dkim = vm.envOr("DKIM_REGISTRY", address(0)); | ||
emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); | ||
commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); | ||
minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); | ||
killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); | ||
|
||
initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); | ||
dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); | ||
dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); | ||
salt = vm.envOr("CREATE2_SALT", uint256(0)); | ||
|
||
if (verifier == address(0)) { | ||
verifier = deployVerifier(initialOwner, salt); | ||
} | ||
|
||
if (dkim == address(0)) { | ||
dkim = deployUserOverrideableDKIMRegistry( | ||
initialOwner, dkimRegistrySigner, dkimDelay, salt | ||
); | ||
} | ||
|
||
if (emailAuthImpl == address(0)) { | ||
emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); | ||
console.log("EmailAuth implemenation deployed at", emailAuthImpl); | ||
} | ||
|
||
address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); | ||
if (_factory == address(0)) { | ||
_factory = address( | ||
new EmailRecoveryUniversalFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl) | ||
); | ||
console.log("EmailRecoveryUniversalFactory deployed at", _factory); | ||
} | ||
|
||
EmailRecoveryUniversalFactory factory = EmailRecoveryUniversalFactory(_factory); | ||
(address module, address commandHandler) = factory.deployUniversalEmailRecoveryModule( | ||
bytes32(uint256(0)), | ||
bytes32(uint256(0)), | ||
type(EmailRecoveryCommandHandler).creationCode, | ||
minimumDelay, | ||
killSwitchAuthorizer, | ||
address(dkim) | ||
); | ||
|
||
console.log("UniversalEmailRecoveryModule deployed at", vm.toString(module)); | ||
console.log("EmailRecoveryCommandHandler deployed at", vm.toString(commandHandler)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...79/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModuleWithAccountHiding.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.25; | ||
|
||
/* solhint-disable no-console, gas-custom-errors */ | ||
|
||
import { console } from "forge-std/console.sol"; | ||
import { AccountHidingRecoveryCommandHandler } from | ||
"src/handlers/AccountHidingRecoveryCommandHandler.sol"; | ||
import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; | ||
import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; | ||
import { EmailRecoveryUniversalFactory } from "src/factories/EmailRecoveryUniversalFactory.sol"; | ||
import { BaseDeployScript } from "../../BaseDeployScript.s.sol"; | ||
|
||
contract DeployUniversalEmailRecoveryModuleScript is BaseDeployScript { | ||
address verifier; | ||
address dkim; | ||
address emailAuthImpl; | ||
address commandHandler; | ||
uint256 minimumDelay; | ||
address killSwitchAuthorizer; | ||
|
||
address initialOwner; | ||
address dkimRegistrySigner; | ||
uint256 dkimDelay; | ||
uint256 salt; | ||
|
||
function run() public override { | ||
super.run(); | ||
vm.startBroadcast(vm.envUint("PRIVATE_KEY")); | ||
verifier = vm.envOr("VERIFIER", address(0)); | ||
dkim = vm.envOr("DKIM_REGISTRY", address(0)); | ||
emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); | ||
commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); | ||
minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); | ||
killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); | ||
|
||
initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); | ||
dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); | ||
dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); | ||
salt = vm.envOr("CREATE2_SALT", uint256(0)); | ||
|
||
if (verifier == address(0)) { | ||
verifier = deployVerifier(initialOwner, salt); | ||
} | ||
|
||
if (dkim == address(0)) { | ||
dkim = deployUserOverrideableDKIMRegistry( | ||
initialOwner, dkimRegistrySigner, dkimDelay, salt | ||
); | ||
} | ||
|
||
if (emailAuthImpl == address(0)) { | ||
emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); | ||
console.log("EmailAuth implemenation deployed at", emailAuthImpl); | ||
} | ||
|
||
address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); | ||
if (_factory == address(0)) { | ||
_factory = address( | ||
new EmailRecoveryUniversalFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl) | ||
); | ||
console.log("EmailRecoveryUniversalFactory deployed at", _factory); | ||
} | ||
|
||
EmailRecoveryUniversalFactory factory = EmailRecoveryUniversalFactory(_factory); | ||
(address module, address commandHandler) = factory.deployUniversalEmailRecoveryModule( | ||
bytes32(uint256(0)), | ||
bytes32(uint256(0)), | ||
type(AccountHidingRecoveryCommandHandler).creationCode, | ||
minimumDelay, | ||
killSwitchAuthorizer, | ||
address(dkim) | ||
); | ||
|
||
console.log("UniversalEmailRecoveryModule deployed at", vm.toString(module)); | ||
console.log("AccountHidingRecoveryCommandHandler deployed at", vm.toString(commandHandler)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.