Safe Contracts and Infrastructure
Safe is a multisig wallet infrastructure that provides secure, timelocked governance for Surge's protocol upgrades, ensuring Stage 2 security compliance with a 45-day delay for any changes while maintaining decentralization.
To see how more details on Safe, refer to the Safe Infrastructure documentation.
Safe Contracts Deployment
You can skip this if you are using Surge default setup and you don't need to customize the chain id.
Adding custom chain id to Safe deployments is still a work in progress.
Safe Infrastructure Deployment
1. Clone Repository
Clone the Safe Infrastructure repository and navigate into the directory:
git clone https://github.com/NethermindEth/safe-infrastructure.git
cd safe-infrastructure
2. Configure Environment
Create your environment configuration file (.env
) by copying the provided sample:
cp .env.sample .env
Make sure to update the RPC_NODE_URL
to your RPC endpoint, and set the NEXT_PUBLIC_DEFAULT_MAINNET_CHAIN_ID
to your chain id.
If you need Wallet Connect feature, you also need to set the NEXT_PUBLIC_WC_PROJECT_ID
.
3. Run Safe Infrastructure Setup Script
./scripts/run_locally.sh
The script will prompt you for setting up Django admin credentials, please follow the prompts to set up the credentials.
4. Add ChainInfo
Access http://localhost:8000/cfg/admin/chains/chain/add/ and add the following information:
- Chain id: 763374
- Chain name: Surge
- EIP-3770 short name: surge
- L2: true
- Is testnet: true
- Rpc authentication: No Authentication
- Rpc uri: http://localhost:8547
- Safe apps rpc uri: http://localhost:8547
- Public rpc uri: http://localhost:8547
- Block explorer uri address template: http://localhost:3001/address/{{address}}
- Block explorer uri tx hash template: http://localhost:3001/tx/{{txHash}}
- Block explorer uri api template: http://localhost:3001/api?module={{module}}&action={{action}}&address={{address}}&apiKey={{apiKey}}
- Currency name: Ether
- Currency symbol: ETH
- Currency decimals: 18
- Transaction service uri: http://nginx:8000/txs
- Vpc transaction service uri: http://nginx:8000/txs
- Recommended master copy version: 1.4.1
And save the chain info.
5. Configure Transaction Service
By default, tx service will auto setup MasterCopies and Proxy Factories for Surge. Or you can add the addresses manually in http://localhost:8000/txs/admin/:
- Visit http://localhost:8000/txs/admin/history/proxyfactory/ and confirm if you have
0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67
listed. If not, click on top right ADD PROXY FACTORY button. - Visit http://localhost:8000/txs/admin/history/safemastercopy/ and confirm if you have
0x41675C099F32341bf84BFc5382aF534df5C7461a
and0x29fcB43b46531BcA003ddC8FCB67FFE91900C762
listed. If not, click on top right ADD SAFE MASTER COPY button.
6. Configure Wallet Connect feature
Access http://localhost:8000/cfg/admin/chains/feature/add, select your chain and add the following information:
- Key: NATIVE_WALLETCONNECT
- Description: Wallet Connect feature
Double confirm if you have set the NEXT_PUBLIC_WC_PROJECT_ID
in the .env
file, and make sure the feature is enabled in the chain info.
Verification
After http://localhost:8000/ is accessible, ensure everything is running correctly by:
- Checking the chain info in https://safe-ui.surge.wtf/cgw/v1/chains/, make sure the chain info is there and is correct.