Skip to content

Commit

Permalink
refactor: remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
zkfriendly committed Dec 12, 2024
1 parent 88631eb commit 9d736ee
Showing 1 changed file with 15 additions and 34 deletions.
49 changes: 15 additions & 34 deletions packages/contracts/script/DeployRecoveryController.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -97,7 +78,7 @@ contract Deploy is BaseDeployScript {
keccak256("EMAIL_AUTH_IMPL")
);
}
logDeployment("EmailAuth", emailAuthImpl);
console.log("EmailAuth: %s", emailAuthImpl);

// Create RecoveryController
recoveryController = deploySingleton(
Expand All @@ -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(
Expand All @@ -115,6 +96,6 @@ contract Deploy is BaseDeployScript {
abi.encode(initialOwner, recoveryController),
keccak256("SIMPLE_WALLET")
);
logDeployment("SimpleWallet", simpleWallet);
console.log("SimpleWallet: %s", simpleWallet);
}
}

0 comments on commit 9d736ee

Please sign in to comment.