diff --git a/packages/contracts/script/DeployRecoveryController.s.sol b/packages/contracts/script/DeployRecoveryController.s.sol index 0ee1f09..6243da8 100644 --- a/packages/contracts/script/DeployRecoveryController.s.sol +++ b/packages/contracts/script/DeployRecoveryController.s.sol @@ -6,10 +6,7 @@ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {SimpleWallet} from "../test/helpers/SimpleWallet.sol"; import {RecoveryController} from "../test/helpers/RecoveryController.sol"; import {Verifier} from "../src/utils/Verifier.sol"; -import {Groth16Verifier} from "../src/utils/Groth16Verifier.sol"; -import {ECDSAOwnedDKIMRegistry} from "../src/utils/ECDSAOwnedDKIMRegistry.sol"; import {EmailAuth} from "../src/EmailAuth.sol"; -import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; import {UserOverrideableDKIMRegistry} from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; import {BaseDeployScript} from "./BaseDeployScript.sol"; import {SafeSingletonDeployer} from "safe-singleton-deployer/SafeSingletonDeployer.sol"; @@ -38,31 +35,6 @@ contract Deploy is BaseDeployScript { ); } - function deployDKIMRegistry( - uint256 deployerPrivateKey, - address initialOwner - ) private returns (address) { - address dkimSigner = vm.envAddress("DKIM_SIGNER"); - if (dkimSigner == address(0)) { - revert("DKIM_SIGNER env var not set"); - } - - uint256 timeDelay = vm.envOr("DKIM_DELAY", uint256(0)); - console.log("DKIM_DELAY: %s", timeDelay); - - return - deploySingleton( - deployerPrivateKey, - type(UserOverrideableDKIMRegistry).creationCode, - abi.encode(initialOwner, dkimSigner, timeDelay), - keccak256("DKIM_REGISTRY") - ); - } - - function logDeployment(string memory name, address addr) private view { - console.log("%s: %s", name, addr); - } - function run() public override { super.run(); uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); @@ -71,9 +43,18 @@ contract Deploy is BaseDeployScript { // Deploy User-overrideable DKIM registry dkim = vm.envOr("DKIM", address(0)); if (dkim == address(0)) { - dkim = deployDKIMRegistry(deployerPrivateKey, initialOwner); + address dkimSigner = vm.envAddress("DKIM_SIGNER"); + require(dkimSigner != address(0), "DKIM_SIGNER env var not set"); + uint256 timeDelay = vm.envOr("DKIM_DELAY", uint256(0)); + + dkim = deploySingleton( + deployerPrivateKey, + type(UserOverrideableDKIMRegistry).creationCode, + abi.encode(initialOwner, dkimSigner, timeDelay), + keccak256("DKIM_REGISTRY") + ); } - logDeployment("UserOverrideableDKIMRegistry", dkim); + console.log("UserOverrideableDKIMRegistry: %s", dkim); // Deploy Verifier verifier = vm.envOr("VERIFIER", address(0)); @@ -85,7 +66,7 @@ contract Deploy is BaseDeployScript { keccak256("VERIFIER") ); } - logDeployment("Verifier", verifier); + console.log("Verifier: %s", verifier); // Deploy EmailAuth Implementation emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); @@ -97,7 +78,7 @@ contract Deploy is BaseDeployScript { keccak256("EMAIL_AUTH_IMPL") ); } - logDeployment("EmailAuth", emailAuthImpl); + console.log("EmailAuth: %s", emailAuthImpl); // Create RecoveryController recoveryController = deploySingleton( @@ -106,7 +87,7 @@ contract Deploy is BaseDeployScript { abi.encode(initialOwner, verifier, dkim, emailAuthImpl), keccak256("RECOVERY_CONTROLLER") ); - logDeployment("RecoveryController", recoveryController); + console.log("RecoveryController: %s", recoveryController); // Deploy SimpleWallet Implementation simpleWallet = deploySingleton( @@ -115,6 +96,6 @@ contract Deploy is BaseDeployScript { abi.encode(initialOwner, recoveryController), keccak256("SIMPLE_WALLET") ); - logDeployment("SimpleWallet", simpleWallet); + console.log("SimpleWallet: %s", simpleWallet); } }