Skip to content

Commit

Permalink
Use EmailRecoveryManager with native safe module
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnGuilding committed Jul 30, 2024
1 parent 4c8dc88 commit 92eea21
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 584 deletions.
28 changes: 5 additions & 23 deletions script/DeploySafeNativeRecovery.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,18 @@ pragma solidity ^0.8.25;
import { Script } from "forge-std/Script.sol";
import { console } from "forge-std/console.sol";
import { SafeEmailRecoveryModule } from "src/modules/SafeEmailRecoveryModule.sol";
import { Verifier } from "ether-email-auth/packages/contracts/src/utils/Verifier.sol";
import { ECDSAOwnedDKIMRegistry } from
"ether-email-auth/packages/contracts/src/utils/ECDSAOwnedDKIMRegistry.sol";
import { EmailAuth } from "ether-email-auth/packages/contracts/src/EmailAuth.sol";

contract DeploySafeNativeRecovery_Script is Script {
function run() public {
vm.startBroadcast(vm.envUint("PRIVATE_KEY"));
address verifier = vm.envOr("VERIFIER", address(0));
address dkimRegistry = vm.envOr("DKIM_REGISTRY", address(0));
address dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0));
address emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0));
address manager = vm.envOr("VERIFIER", address(0));

if (verifier == address(0)) {
verifier = address(new Verifier());
console.log("Deployed Verifier at", verifier);
if (manager == address(0)) {
manager = address(1);
console.log("Deployed Manager at", manager);
}

if (dkimRegistry == address(0)) {
require(dkimRegistrySigner != address(0), "DKIM_REGISTRY_SIGNER is required");
dkimRegistry = address(new ECDSAOwnedDKIMRegistry(dkimRegistrySigner));
console.log("Deployed DKIM Registry at", dkimRegistry);
}

if (emailAuthImpl == address(0)) {
emailAuthImpl = address(new EmailAuth());
console.log("Deployed Email Auth at", emailAuthImpl);
}

address module = address(new SafeEmailRecoveryModule(verifier, dkimRegistry, emailAuthImpl));
address module = address(new SafeEmailRecoveryModule(manager));

console.log("Deployed Email Recovery Module at ", vm.toString(module));

Expand Down
8 changes: 8 additions & 0 deletions src/interfaces/ISafe.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@ interface ISafe {
)
external
returns (bool success);
function execTransactionFromModuleReturnData(
address to,
uint256 value,
bytes memory data,
uint8 operation
)
external
returns (bool success, bytes memory returnData);
function isModuleEnabled(address module) external view returns (bool);
}
Loading

0 comments on commit 92eea21

Please sign in to comment.