diff --git a/examples/setup-fast-withdrawal/.env.example b/examples/setup-fast-withdrawal-eoa/.env.example similarity index 100% rename from examples/setup-fast-withdrawal/.env.example rename to examples/setup-fast-withdrawal-eoa/.env.example diff --git a/examples/setup-fast-withdrawal/README.md b/examples/setup-fast-withdrawal-eoa/README.md similarity index 63% rename from examples/setup-fast-withdrawal/README.md rename to examples/setup-fast-withdrawal-eoa/README.md index f3672c58..baba9ad5 100644 --- a/examples/setup-fast-withdrawal/README.md +++ b/examples/setup-fast-withdrawal-eoa/README.md @@ -53,21 +53,3 @@ You need to set the following environment variables in an .env file: yarn dev ``` - - -## Multisig ownership -Beware: At least one of the signers needs to be an EOA account so that it can propose transactions through this script. - -1. Build this example: rm -rf dist/ && tsc --outDir dist && ls dist -2. OWNER_1_ADDRESS_PRIVATE_KEY= PARENT_CHAIN_ID= SAFE_ADDRESS= FC_VALIDATORS='["0x1234567890123456789012345678901234567890"]' node ./dist/1-create_multisig.js -This step will create a new Safe on the parent chain and add fast confirmation validators as owners. - -If you want to use this script then you need to make sure the owner of the Rollup has been transfered to a Multisig. - -3. OWNER_1_ADDRESS_PRIVATE_KEY= PARENT_CHAIN_ID= SAFE_ADDRESS= FC_VALIDATORS_SAFE_ADDRESS= FC_VALIDATORS='["0x1234567890123456789012345678901234567890"]' ROLLUP_ADDRESS= RPC= node ./dist/2-add_validators.js -the validators list is expanded with the Safe created with step 1 (1-create_multisig). That's why you need to provide FC_VALIDATORS_SAFE_ADDRESS. - -4. OWNER_1_ADDRESS_PRIVATE_KEY= PARENT_CHAIN_ID= SAFE_ADDRESS= FC_VALIDATORS_SAFE_ADDRESS= ROLLUP_ADDRESS= RPC= node ./dist/3-set-any-trust-fast-confirmer.js -We also add this Safe as `fast confirmer`. - -5. OWNER_1_ADDRESS_PRIVATE_KEY= PARENT_CHAIN_ID= SAFE_ADDRESS= MINIMUM_ASSERTION_PERIOD=1 ROLLUP_ADDRESS= RPC= node ./dist/4-configure-minimum-assertion-period.js diff --git a/examples/setup-fast-withdrawal/index.ts b/examples/setup-fast-withdrawal-eoa/index.ts similarity index 100% rename from examples/setup-fast-withdrawal/index.ts rename to examples/setup-fast-withdrawal-eoa/index.ts diff --git a/examples/setup-fast-withdrawal/package.json b/examples/setup-fast-withdrawal-eoa/package.json similarity index 100% rename from examples/setup-fast-withdrawal/package.json rename to examples/setup-fast-withdrawal-eoa/package.json diff --git a/examples/setup-fast-withdrawal/tsconfig.json b/examples/setup-fast-withdrawal-eoa/tsconfig.json similarity index 100% rename from examples/setup-fast-withdrawal/tsconfig.json rename to examples/setup-fast-withdrawal-eoa/tsconfig.json diff --git a/examples/setup-fast-withdrawal-multisig/.env.example b/examples/setup-fast-withdrawal-multisig/.env.example new file mode 100644 index 00000000..aea0e8b2 --- /dev/null +++ b/examples/setup-fast-withdrawal-multisig/.env.example @@ -0,0 +1,57 @@ +#step 1 +#signer of the Safe multisignature contract that can propose a transaction +OWNER_1_ADDRESS_PRIVATE_KEY= +#parent chain id - 1 etheruem, 42161 arbitrum one +PARENT_CHAIN_ID= +#Safe multisignature contract address +SAFE_ADDRESS= +#stakers and validators that are whitelisted on the Rollup contract +FC_VALIDATORS='["0x1234567890123456789012345678901234567890"]' + +#step 2 +#Rollup contract address +ROLLUP_ADDRESS= +#Safe address that was created on step 1 +FC_VALIDATORS_SAFE_ADDRESS= +#RPC url +RPC= +#signer of the Safe multisignature contract that can propose a transaction +OWNER_1_ADDRESS_PRIVATE_KEY= +#parent chain id - 1 etheruem, 42161 arbitrum one +PARENT_CHAIN_ID= +#Safe multisignature contract address +SAFE_ADDRESS= +#stakers and validators that are whitelisted on the Rollup contract +FC_VALIDATORS='["0x1234567890123456789012345678901234567890"]' + +#step 3 +#Rollup contract address +ROLLUP_ADDRESS= +#add Safe address that was created on step 1 as fast-confirmer (setAnyTrustFastConfirmerPrepareTransactionRequest - fastConfirmer: safeAddress) +FC_VALIDATORS_SAFE_ADDRESS= +#RPC url +RPC= +#signer of the Safe multisignature contract that can propose a transaction +OWNER_1_ADDRESS_PRIVATE_KEY= +#parent chain id - 1 etheruem, 42161 arbitrum one +PARENT_CHAIN_ID= +#Safe multisignature contract address +SAFE_ADDRESS= +#stakers and validators that are whitelisted on the Rollup contract +FC_VALIDATORS='["0x1234567890123456789012345678901234567890"]' + +#step 4 +#Rollup contract address +ROLLUP_ADDRESS= +#Safe address that was created on step 1 +FC_VALIDATORS_SAFE_ADDRESS= +#RPC url +RPC= +#signer of the Safe multisignature contract that can propose a transaction +OWNER_1_ADDRESS_PRIVATE_KEY= +#parent chain id - 1 etheruem, 42161 arbitrum one +PARENT_CHAIN_ID= +#Safe multisignature contract address +SAFE_ADDRESS= +#default is 75 (15minutes) +MINIMUM_ASSERTION_PERIOD=1 diff --git a/examples/setup-fast-withdrawal/1-create_multisig.ts b/examples/setup-fast-withdrawal-multisig/1-create_multisig.ts similarity index 100% rename from examples/setup-fast-withdrawal/1-create_multisig.ts rename to examples/setup-fast-withdrawal-multisig/1-create_multisig.ts diff --git a/examples/setup-fast-withdrawal/2-add_validators.ts b/examples/setup-fast-withdrawal-multisig/2-add_validators.ts similarity index 100% rename from examples/setup-fast-withdrawal/2-add_validators.ts rename to examples/setup-fast-withdrawal-multisig/2-add_validators.ts diff --git a/examples/setup-fast-withdrawal/3-set-any-trust-fast-confirmer.ts b/examples/setup-fast-withdrawal-multisig/3-set-any-trust-fast-confirmer.ts similarity index 100% rename from examples/setup-fast-withdrawal/3-set-any-trust-fast-confirmer.ts rename to examples/setup-fast-withdrawal-multisig/3-set-any-trust-fast-confirmer.ts diff --git a/examples/setup-fast-withdrawal/4-configure-minimum-assertion-period.ts b/examples/setup-fast-withdrawal-multisig/4-configure-minimum-assertion-period.ts similarity index 100% rename from examples/setup-fast-withdrawal/4-configure-minimum-assertion-period.ts rename to examples/setup-fast-withdrawal-multisig/4-configure-minimum-assertion-period.ts diff --git a/examples/setup-fast-withdrawal-multisig/README.md b/examples/setup-fast-withdrawal-multisig/README.md new file mode 100644 index 00000000..87a001f7 --- /dev/null +++ b/examples/setup-fast-withdrawal-multisig/README.md @@ -0,0 +1,26 @@ + + +## Multisig ownership +Beware: At least one of the signers needs to be an EOA account so that it can propose transactions through this script. +If you want to use this script then you need to make sure the owner of the Rollup has been transfered to a Multisig contract and it has execution rights on L1 Executor Contract. + +1. Build this example: yarn dev +2. This step will create a new Safe on the parent chain and add fast confirmation validators as owners. +``` +node ./dist/1-create_multisig.js +``` +3. The validators list is expanded with the Safe created with step 1 (1-create_multisig). That's why you need to provide FC_VALIDATORS_SAFE_ADDRESS. +``` +node ./dist/2-add_validators.js +``` + +4. We also add Safe as `fast confirmer`. +``` +node ./dist/3-set-any-trust-fast-confirmer.js +``` + + +5. Configure minimum assertion period. The default is 75 (~15 minutes) +``` +node ./dist/4-configure-minimum-assertion-period.js +``` diff --git a/examples/setup-fast-withdrawal/common.ts b/examples/setup-fast-withdrawal-multisig/common.ts similarity index 100% rename from examples/setup-fast-withdrawal/common.ts rename to examples/setup-fast-withdrawal-multisig/common.ts diff --git a/examples/setup-fast-withdrawal-multisig/package.json b/examples/setup-fast-withdrawal-multisig/package.json new file mode 100644 index 00000000..1377971b --- /dev/null +++ b/examples/setup-fast-withdrawal-multisig/package.json @@ -0,0 +1,15 @@ +{ + "name": "setup-fast-withdrawal", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "tsc --outDir dist" + }, + "devDependencies": { + "@types/node": "^20.9.0", + "typescript": "^5.2.2", + "@safe-global/api-kit": "^2.4.5", + "@safe-global/safe-core-sdk-types": "^5.1.0" + } +} diff --git a/examples/setup-fast-withdrawal-multisig/tsconfig.json b/examples/setup-fast-withdrawal-multisig/tsconfig.json new file mode 100644 index 00000000..7101af0f --- /dev/null +++ b/examples/setup-fast-withdrawal-multisig/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.base.json", + "include": ["./**/*"], + "compilerOptions": { + "moduleResolution": "NodeNext", + "module": "NodeNext", + } +} diff --git a/package.json b/package.json index 439de957..c93d3b55 100644 --- a/package.json +++ b/package.json @@ -35,10 +35,5 @@ "**/@wagmi/cli/viem/ws": "8.17.1", "**/@ethersproject/providers/ws": "7.5.10", "**/elliptic": "6.5.7" - }, - "dependencies": { - "@safe-global/api-kit": "^2.4.5", - "@safe-global/protocol-kit": "4.0.2", - "@safe-global/safe-core-sdk-types": "^5.1.0" } }