From 3cf44ec993aa82b5139c0a43d1e9f6b9adf76871 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Fri, 20 Dec 2024 16:48:26 +0000 Subject: [PATCH] Make deterministic deployer configurable --- src/cli/config/bundler.ts | 1 + src/cli/config/options.ts | 7 +++++++ src/cli/deploySimulationsContract.ts | 8 +++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/cli/config/bundler.ts b/src/cli/config/bundler.ts index 6f81d0b2..fde19e44 100644 --- a/src/cli/config/bundler.ts +++ b/src/cli/config/bundler.ts @@ -26,6 +26,7 @@ export const bundlerArgsSchema = z.object({ ) return validatedAddresses }), + "deterministic-deployer-address": addressSchema, "entrypoint-simulation-contract": z.preprocess( (v) => (v === "" ? undefined : v), addressSchema.optional() diff --git a/src/cli/config/options.ts b/src/cli/config/options.ts index 874ba3d7..3a17f3aa 100644 --- a/src/cli/config/options.ts +++ b/src/cli/config/options.ts @@ -19,6 +19,13 @@ export const bundlerOptions: CliCommandOptions = { alias: "e", require: true }, + "deterministic-deployer-address": { + description: "Address of the deterministic deployer contract", + type: "string", + alias: "d", + require: false, + default: "0x4e59b44847b379578588920ca78fbf26c0b4956c" + }, "entrypoint-simulation-contract": { description: "Address of the EntryPoint simulations contract", type: "string", diff --git a/src/cli/deploySimulationsContract.ts b/src/cli/deploySimulationsContract.ts index fdec1ad7..be447459 100644 --- a/src/cli/deploySimulationsContract.ts +++ b/src/cli/deploySimulationsContract.ts @@ -15,8 +15,6 @@ import { import type { CamelCasedProperties } from "./parseArgs" import type { IOptions } from "@alto/cli" -const DETERMINISTIC_DEPLOYER = "0x4e59b44847b379578588920ca78fbf26c0b4956c" - const isContractDeployed = async ({ publicClient, address @@ -60,7 +58,7 @@ export const deploySimulationsContract = async ({ if ( !(await isContractDeployed({ publicClient, - address: DETERMINISTIC_DEPLOYER + address: args.deterministicDeployerAddress })) ) { const deterministicDeployHash = await walletClient.sendRawTransaction({ @@ -75,7 +73,7 @@ export const deploySimulationsContract = async ({ const contractAddress = getContractAddress({ opcode: "CREATE2", bytecode: PimlicoEntryPointSimulationsDeployBytecode, - from: DETERMINISTIC_DEPLOYER, + from: args.deterministicDeployerAddress, salt: "0x3132333400000000000000000000000000000000000000000000000000000000" as Hex }) @@ -85,7 +83,7 @@ export const deploySimulationsContract = async ({ const deployHash = await walletClient.sendTransaction({ chain: publicClient.chain, - to: DETERMINISTIC_DEPLOYER, + to: args.deterministicDeployerAddress, data: ENTRY_POINT_SIMULATIONS_CREATECALL })