-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update safe integration test #11
Changes from 8 commits
a56abd2
af631f2
b07fa5f
16e8bfb
8683505
f076ca8
2918d40
ca8f535
cb19445
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,68 @@ | |
pragma solidity ^0.8.25; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import { console } from "forge-std/console.sol"; | ||
import { SafeRecoverySubjectHandler } from "src/handlers/SafeRecoverySubjectHandler.sol"; | ||
import { EmailRecoveryManager } from "src/EmailRecoveryManager.sol"; | ||
import { UniversalEmailRecoveryModule } from "src/modules/UniversalEmailRecoveryModule.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 DeploySafeRecoveryScript is Script { | ||
import { Safe7579 } from "safe7579/Safe7579.sol"; | ||
import { Safe7579Launchpad } from "safe7579/Safe7579Launchpad.sol"; | ||
import { IERC7484 } from "safe7579/interfaces/IERC7484.sol"; | ||
|
||
// 1. `source .env` | ||
// 2. `forge script --chain sepolia script/DeploySafeRecovery.s.sol:DeploySafeRecovery_Script | ||
// --rpc-url $BASE_SEPOLIA_RPC_URL --broadcast -vvvv` | ||
contract DeploySafeRecovery_Script is Script { | ||
function run() public { | ||
address verifier = 0xEdC642bbaD91E21cCE6cd436Fdc6F040FD0fF998; | ||
address dkimRegistry = 0xC83256CCf7B94d310e49edA05077899ca036eb78; | ||
address emailAuthImpl = 0x1C76Aa365c17B40c7E944DcCdE4dC6e6D2A7b748; | ||
bytes32 salt = bytes32(uint256(0)); | ||
address entryPoint = address(0x0000000071727De22E5E9d8BAf0edAc6f37da032); | ||
IERC7484 registry = IERC7484(0xe0cde9239d16bEf05e62Bbf7aA93e420f464c826); | ||
|
||
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("SIGNER", address(0)); | ||
address emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); | ||
|
||
if (verifier == address(0)) { | ||
verifier = address(new Verifier()); | ||
console.log("Deployed Verifier at", verifier); | ||
} | ||
|
||
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); | ||
} | ||
|
||
SafeRecoverySubjectHandler emailRecoveryHandler = new SafeRecoverySubjectHandler(); | ||
if (emailAuthImpl == address(0)) { | ||
emailAuthImpl = address(new EmailAuth()); | ||
console.log("Deployed Email Auth at", emailAuthImpl); | ||
} | ||
|
||
EmailRecoveryManager emailRecoveryManager = new EmailRecoveryManager( | ||
verifier, dkimRegistry, emailAuthImpl, address(emailRecoveryHandler) | ||
address emailRecoveryHandler = address(new SafeRecoverySubjectHandler()); | ||
address emailRecoveryManager = address( | ||
new EmailRecoveryManager(verifier, dkimRegistry, emailAuthImpl, emailRecoveryHandler) | ||
); | ||
address emailRecoveryModule = | ||
address(new UniversalEmailRecoveryModule(emailRecoveryManager)); | ||
|
||
EmailRecoveryManager(emailRecoveryManager).initialize(emailRecoveryModule); | ||
|
||
address safe7579 = address(new Safe7579{ salt: salt }()); | ||
address safe7579Launchpad = | ||
address(new Safe7579Launchpad{ salt: salt }(entryPoint, registry)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where/when does this safe account install necessary modules? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this script, it is to deploy the contracts for the frontend demo. The module is installed via the frontend. |
||
|
||
new UniversalEmailRecoveryModule(address(emailRecoveryManager)); | ||
console.log("Deployed Email Recovery Module at ", vm.toString(emailRecoveryModule)); | ||
console.log("Deployed Email Recovery Manager at ", vm.toString(emailRecoveryManager)); | ||
console.log("Deployed Email Recovery Handler at ", vm.toString(emailRecoveryHandler)); | ||
console.log("Deployed Safe 7579 at ", vm.toString(safe7579)); | ||
console.log("Deployed Safe 7579 Launchpad at ", vm.toString(safe7579Launchpad)); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the salt fixed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah maybe that is inconsistent with the other code. Deployed other contracts with factory which uses salts.
The code to deploy the launchpad and safe7579 contract had a salt like this, so I guess I copied it over