Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
InoMurko committed Oct 29, 2024
1 parent 5d90dcd commit 9821184
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 23 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions examples/setup-fast-withdrawal-multisig/.env.example
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions examples/setup-fast-withdrawal-multisig/README.md
Original file line number Diff line number Diff line change
@@ -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
```
File renamed without changes.
15 changes: 15 additions & 0 deletions examples/setup-fast-withdrawal-multisig/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
8 changes: 8 additions & 0 deletions examples/setup-fast-withdrawal-multisig/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.base.json",
"include": ["./**/*"],
"compilerOptions": {
"moduleResolution": "NodeNext",
"module": "NodeNext",
}
}
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit 9821184

Please sign in to comment.