diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..7950a44 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18.17.0 diff --git a/hardhat.config.ts b/hardhat.config.ts index 4c98d94..9b57129 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -41,6 +41,10 @@ const config: HardhatUserConfig = { url: 'https://rpc.dev.immutable.com', accounts: [] }, + l1devnet: { + url: 'https://rpc.ankr.com/eth_holesky', + accounts: [] + }, testnet: { url: 'https://rpc.testnet.immutable.com', accounts: [] diff --git a/scripts/README.md b/scripts/README.md index 8fb4951..d19c7a8 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -41,7 +41,10 @@ in the `contract.ts` file. ## Step 5 -Create a `.env` file. Use the `env.example` as a template. +Create a `.env` file. Use the `env.example` as a template. Set the following values in the `.env` + +* Set the DEPLOYER_CONTRACT_ADDRESS to match the address of the OwnableCreate2Deployer factory. +* Set the MULTICALL_ADMIN_PUB_KEY and FACTORY_ADMIN_PUB_KEY to match the address of the address of the privileged transaction multisig. This address for reference should be `0x0E2D55943f4EF07c336C12A85d083c20FF189182`. ## Execution steps @@ -52,53 +55,57 @@ in this step because we want the `Factory` contract to have the same address acr this address is used to produce a deterministic counter factual address for the smart contract wallets across all the chains. -* Set the `accountIndex` to 10. +* Set the value of RELAYER_SUBMITTER_EOA_PUB_KEY to match the EOA of the primary Relayer submitter. +* Set the `accountIndex` to 10 in `wallet-options.ts`. * Execute the command `npx hardhat run scripts/step1.ts --network ` ### `step2.ts` In this step we deploy the contract that tracks the location of the latest wallet implementation. As this step -just uses the CREATE2 contract factory we use the standard deployment key. +just uses the CREATE2 contract factory we use the standard deployment key (Orange Key!!!). +* Set the value of WALLET_IMPL_LOCATOR_ADMIN, and WALLET_IMPL_CHANGER_ADMIN environment variables to the public key of the Priveleged key. * Set the `accountIndex` to 0. * Execute the command `npx hardhat run scripts/step2.ts --network ` ### `step3.ts` -In this step we deploy the startup wallet. This wallet address is used to generate the CFA, and hence like the Factory -uses a Passport nonce reserver key. +In this step we deploy the startup wallet. This wallet address is used to generate the CFA, and hence like the Factory uses a Passport nonce reserver key. * Set the `accountIndex` to 10. +* WARNING: COPY the `LatestWalletImplLocator` address into the `step3.ts` script from step2. * Execute the command `npx hardhat run scripts/step3.ts --network ` - * WARNING: COPY the `LatestWalletImplLocator` address into the `step3.ts` script from step2. ### `step4.ts` -In this step we deploy the `MainModuleDynamicAuth` module, and it can simply use the standard deployment key. +In this step we deploy the `MainModuleDynamicAuth` module, and it should use the standard deployment key (Orange Key!!!) * Set the `accountIndex` to 0. +* WARNING: COPY the `FactoryAddress` address into the `step4.ts` script from step1. +* WARNING: COPY the `StartupWalletImpl` address into the `step4.ts` script from step3. * Execute the command `npx hardhat run scripts/step4.ts --network ` - * WARNING: COPY the `FactoryAddress` address into the `step4.ts` script from step1. - * WARNING: COPY the `StartupWalletImpl` address into the `step4.ts` script from step3. ### `step5.ts` In this step we deploy the Signer contract, which is also used to generate the CFA, and hence like the Factory, and -Startup wallet implementation, we use the Passport nonce reserver key in this step. +Startup wallet implementation, we use the Passport nonce reserver key (Black Key!!!) in this step. * Set the `accountIndex` to 10. +* Set the SIGNER_ROOT_ADMIN_PUB_KEY to the Privileged public key. +* Set the SIGNER_ADMIN_PUB_KEY to the relevant Breakglass public key. +* Set the IMMUTABLE_SIGNER_PUB_KEY * Execute the command `npx hardhat run scripts/step5.ts --network ` ### `step6.ts` In this step we point the `LatestWalletImplLocator` to the `MainModuleDynamicAuth` module address. In this step -we use the privileged deployment key, as we gave this key authority to alter the implementation address in `step2.ts` +we use the privileged deployment key (Purple Key!!!), as we gave this key authority to alter the implementation address in `step2.ts`. above. * Set the `accountIndex` to 10. +* WARNING: COPY the `MainModuleDynamicAuth` address into the `step6.ts` script from step4. +* WARNING: COPY the `LatestWalletImplLocator` address into the `step6.ts` script from step2. * Execute the command `npx hardhat run scripts/step6.ts --network ` - * WARNING: COPY the `MainModuleDynamicAuth` address into the `step6.ts` script from step4. - * WARNING: COPY the `LatestWalletImplLocator` address into the `step6.ts` script from step2. ## Update Relayer and Passport Environment diff --git a/scripts/contract.ts b/scripts/contract.ts index 71157bd..338b694 100644 --- a/scripts/contract.ts +++ b/scripts/contract.ts @@ -17,7 +17,7 @@ const getSaltFromKey = (): string => { }; /** - * Load the OwnableCreate2Deployer + * Load the OwnableCreate2Deployer */ const loadDeployerContract = async (env: EnvironmentInfo, walletOptions: WalletOptions): Promise => { return new Contract(env.deployerContractAddress, ContractDeployerInterface.abi, walletOptions.getWallet()); @@ -39,8 +39,8 @@ export async function deployContractViaCREATE2( // Deploy the contract let tx = await deployer.deploy(bytecode, salt, { - gasLimit: 30000000, - maxFeePerGas: 10000000000, + gasLimit: 10_000_000, + maxFeePerGas: 40000000000, maxPriorityFeePerGas: 10000000000, }); await tx.wait(); diff --git a/scripts/deployment_artefacts/l1devnet_deploy/step1.json b/scripts/deployment_artefacts/l1devnet_deploy/step1.json new file mode 100644 index 0000000..a6c1afa --- /dev/null +++ b/scripts/deployment_artefacts/l1devnet_deploy/step1.json @@ -0,0 +1,6 @@ +{ + "multiCallAdminPubKey": "0x0E2D55943f4EF07c336C12A85d083c20FF189182", + "factoryAdminPubKey": "0x0E2D55943f4EF07c336C12A85d083c20FF189182", + "multiCallDeploy": "0x307d214799D3B1625D1eC70F83d170d5fd0ee5A1", + "factory": "0x8Fa5088dF65855E0DaF87FA6591659893b24871d" +} \ No newline at end of file diff --git a/scripts/deployment_artefacts/l1devnet_deploy/step2.json b/scripts/deployment_artefacts/l1devnet_deploy/step2.json new file mode 100644 index 0000000..3d929be --- /dev/null +++ b/scripts/deployment_artefacts/l1devnet_deploy/step2.json @@ -0,0 +1,5 @@ +{ + "walletImplLocatorAdmin": "0x0E2D55943f4EF07c336C12A85d083c20FF189182", + "walletImplChangerAdmin": "0x0E2D55943f4EF07c336C12A85d083c20FF189182", + "latestWalletImplLocator": "0x889b5e1B25351AB543bf6D81bFD0777EA02EC879" +} \ No newline at end of file diff --git a/scripts/deployment_artefacts/l1devnet_deploy/step3.json b/scripts/deployment_artefacts/l1devnet_deploy/step3.json new file mode 100644 index 0000000..6d65de1 --- /dev/null +++ b/scripts/deployment_artefacts/l1devnet_deploy/step3.json @@ -0,0 +1,4 @@ +{ + "walletImplLocatorAddress": "0x889b5e1B25351AB543bf6D81bFD0777EA02EC879", + "startupWalletImpl": "0x8FD900677aabcbB368e0a27566cCd0C7435F1926" +} \ No newline at end of file diff --git a/scripts/deployment_artefacts/l1devnet_deploy/step4.json b/scripts/deployment_artefacts/l1devnet_deploy/step4.json new file mode 100644 index 0000000..8c6b8bc --- /dev/null +++ b/scripts/deployment_artefacts/l1devnet_deploy/step4.json @@ -0,0 +1,5 @@ +{ + "factoryAddress": "0x8Fa5088dF65855E0DaF87FA6591659893b24871d", + "startupWalletImplAddress": "0x8FD900677aabcbB368e0a27566cCd0C7435F1926", + "mainModuleDynamicAuth": "0x9e9Ee944fEB02F4D05B02950ca118027D2Db3cF2" +} \ No newline at end of file diff --git a/scripts/deployment_artefacts/l1devnet_deploy/step5.json b/scripts/deployment_artefacts/l1devnet_deploy/step5.json new file mode 100644 index 0000000..a8acae4 --- /dev/null +++ b/scripts/deployment_artefacts/l1devnet_deploy/step5.json @@ -0,0 +1,6 @@ +{ + "signerRootAdminPubKey": "0x0E2D55943f4EF07c336C12A85d083c20FF189182", + "signerAdminPubKey": "0xB3533118Ff0f823fAF916AC499bB2a3E9054A698", + "signerAddress": "0x1cE50560686b1297B6311F36B47dbe5d6E04D0f8", + "immutableSigner": "0xcff469E561D9dCe5B1185CD2AC1Fa961F8fbDe61" +} \ No newline at end of file diff --git a/scripts/deployment_artefacts/l1devnet_deploy/step6.json b/scripts/deployment_artefacts/l1devnet_deploy/step6.json new file mode 100644 index 0000000..a04d328 --- /dev/null +++ b/scripts/deployment_artefacts/l1devnet_deploy/step6.json @@ -0,0 +1,5 @@ +{ + "mainModuleDynamicAuth": "0x9e9Ee944fEB02F4D05B02950ca118027D2Db3cF2", + "walletImplLocatorContractAddress": "0x889b5e1B25351AB543bf6D81bFD0777EA02EC879", + "signerAddress": "0x1cE50560686b1297B6311F36B47dbe5d6E04D0f8" +} \ No newline at end of file diff --git a/scripts/step1.ts b/scripts/step1.ts index 7ba94a5..73074dc 100644 --- a/scripts/step1.ts +++ b/scripts/step1.ts @@ -15,13 +15,12 @@ import { waitForInput } from './helper-functions'; **/ async function step1(): Promise { const env = loadEnvironmentInfo(hre.network.name); - const { network, submitterAddress, signerAddress, } = env; + const { network, submitterAddress } = env; const multiCallAdminPubKey = process.env.MULTICALL_ADMIN_PUB_KEY; const factoryAdminPubKey = process.env.FACTORY_ADMIN_PUB_KEY; console.log(`[${network}] Starting deployment...`); console.log(`[${network}] Submitter address ${submitterAddress}`); - console.log(`[${network}] Signer address ${signerAddress}`); console.log(`[${network}] multiCallAdminPubKey ${multiCallAdminPubKey}`); console.log(`[${network}] factoryAdminPubKey ${factoryAdminPubKey}`); diff --git a/scripts/step3.ts b/scripts/step3.ts index f511810..6ac97c5 100644 --- a/scripts/step3.ts +++ b/scripts/step3.ts @@ -11,7 +11,7 @@ import { waitForInput } from './helper-functions'; async function step3(): Promise { const env = loadEnvironmentInfo(hre.network.name); const { network } = env; - const walletImplLocatorAddress = '0x09BfBa65266e35b7Aa481Ee6fddbE4bA8845C8Af'; + const walletImplLocatorAddress = '0x889b5e1B25351AB543bf6D81bFD0777EA02EC879'; console.log(`[${network}] Starting deployment...`); console.log(`[${network}] WalletImplLocator address ${walletImplLocatorAddress}`); diff --git a/scripts/step6.ts b/scripts/step6.ts index 153adc1..4c2da7e 100644 --- a/scripts/step6.ts +++ b/scripts/step6.ts @@ -1,3 +1,4 @@ +import * as fs from 'fs'; import * as hre from 'hardhat'; import { Contract, ContractFactory, utils } from 'ethers'; import { newContractFactory, waitForInput } from './helper-functions'; @@ -10,8 +11,8 @@ import { newWalletOptions, WalletOptions } from './wallet-options'; async function step6(): Promise { const env = loadEnvironmentInfo(hre.network.name); const { network, signerAddress, } = env; - const mainModuleDynamicAuthAddress = '0x38D64731246b62fd7A79731ff1cC4D579aA420D0'; - const walletImplLocatorContractAddress = '0x09BfBa65266e35b7Aa481Ee6fddbE4bA8845C8Af'; + const mainModuleDynamicAuthAddress = '0x9e9Ee944fEB02F4D05B02950ca118027D2Db3cF2'; + const walletImplLocatorContractAddress = '0x889b5e1B25351AB543bf6D81bFD0777EA02EC879'; console.log(`[${network}] Starting deployment...`); console.log(`[${network}] mainModuleDynamicAuth address ${mainModuleDynamicAuthAddress}`); @@ -33,13 +34,19 @@ async function step6(): Promise { const tx = await walletImplLocator .connect(wallets.getWallet()) .changeWalletImplementation(mainModuleDynamicAuthAddress, { - gasLimit: 30000000, + gasLimit: 10000000, maxFeePerGas: 10000000000, maxPriorityFeePerGas: 10000000000, }); await tx.wait(); console.log(`[${network}] Wallet Impl Locator implementation changed to: ${mainModuleDynamicAuthAddress}`); + fs.writeFileSync('step6.json', JSON.stringify({ + mainModuleDynamicAuth: mainModuleDynamicAuthAddress, + walletImplLocatorContractAddress: walletImplLocatorContractAddress, + signerAddress: signerAddress, + }, null, 1)); + return env; } diff --git a/scripts/wallet-options.ts b/scripts/wallet-options.ts index 12e116f..877ef94 100644 --- a/scripts/wallet-options.ts +++ b/scripts/wallet-options.ts @@ -19,7 +19,7 @@ export class WalletOptions { constructor(env: EnvironmentInfo, coldWallet: Signer, walletImplLocatorImplChanger: Signer) { console.log(`[${env.network}] Using ledger for operations...`); this.useLedger = true; - const accountIndex0 = 0; + const accountIndex0 = 10; const derivationPath0 = `m/44'/60'/${accountIndex0.toString()}'/0/0`; this.ledger = new LedgerSigner(hardhat.provider, derivationPath0);