Deploy Protocols on L2
This guide provides detailed steps for deploying and configuring the Bridge, Signal Service, and ERC20 Vault protocols on Layer 2.
- 1. Bridge Configuration
- 2. Signal Service Configuration
- 3. ERC20 Vault Configuration
Bridge Configuration
The bridge protocol enables asset transfers between Layer 1 and Layer 2. Follow the steps below to configure the bridge on L2.
Required Information
- L1 Chain ID:
3151908
- L1 Bridge Address:
0x63e6DDE6763C3466C7b45Be880f7eE5dC2ca3E25
- L2 Shared Address Manager:
0x7633740000000000000000000000000000000006
- L2 Prefunded Account Private Key:
0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
- L2 RPC URL: Replace
http://localhost:8547
with your actual L2 endpoint.
Set Environment Variables
Run the following commands to configure environment variables:
export FOUNDRY_PROFILE=layer1
export DOMAIN=3151908
export ADDRESS=0x63e6DDE6763C3466C7b45Be880f7eE5dC2ca3E25
export NAME=0x6272696467650000000000000000000000000000000000000000000000000000
export PROXY_ADDRESS=0x7633740000000000000000000000000000000006
export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
export L2_RPC_URL=http://localhost:8547
Execute Bridge Setup Script
The following Docker command deploys the bridge configuration to L2:
docker run \
-e FOUNDRY_PROFILE=${FOUNDRY_PROFILE} \
-e DOMAIN=${DOMAIN} \
-e ADDRESS=${ADDRESS} \
-e NAME=${NAME} \
-e PROXY_ADDRESS=${PROXY_ADDRESS} \
-e PRIVATE_KEY=${PRIVATE_KEY} \
nethsurge/protocol:surge-devnet \
forge script ./script/shared/SetAddress.s.sol \
--private-key ${PRIVATE_KEY} \
--fork-url ${L2_RPC_URL} \
--broadcast -vvv
Signal Service Configuration
The signal service facilitates communication between protocols on L1 and L2. Follow the steps below to deploy this service.
Required Information
- L1 Chain ID:
3151908
- L1 Signal Service Address:
0x72ae2643518179cF01bcA3278a37ceAD408DE8b2
- L2 Shared Address Manager:
0x7633740000000000000000000000000000000006
- L2 Prefunded Account Private Key:
0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
- L2 RPC URL: Replace
http://localhost:8547
with your actual L2 endpoint.
Set Environment Variables
Run the following commands to configure environment variables:
export FOUNDRY_PROFILE=layer1
export DOMAIN=3151908
export ADDRESS=0x72ae2643518179cF01bcA3278a37ceAD408DE8b2
export NAME=0x7369676e616c5f73657276696365000000000000000000000000000000000000
export PROXY_ADDRESS=0x7633740000000000000000000000000000000006
export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
export L2_RPC_URL=http://localhost:8547
Execute Signal Service Setup Script
Deploy the signal service with the following command:
docker run \
-e FOUNDRY_PROFILE=${FOUNDRY_PROFILE} \
-e DOMAIN=${DOMAIN} \
-e ADDRESS=${ADDRESS} \
-e NAME=${NAME} \
-e PROXY_ADDRESS=${PROXY_ADDRESS} \
-e PRIVATE_KEY=${PRIVATE_KEY} \
nethsurge/protocol:surge-devnet \
forge script ./script/shared/SetAddress.s.sol \
--private-key ${PRIVATE_KEY} \
--fork-url ${L2_RPC_URL} \
--broadcast -vvv
ERC20 Vault Configuration
The ERC20 Vault manages token deposits and withdrawals between L1 and L2. Follow these steps to deploy the ERC20 Vault.
Required Information
- L1 Chain ID:
3151908
- L1 ERC20 Vault Address:
0xEE0fCB8E5cCAD0b4197BAabd633333886f5C364d
- L2 Shared Address Manager:
0x7633740000000000000000000000000000000006
- L2 Prefunded Account Private Key:
0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
- L2 RPC URL: Replace
http://localhost:8547
with your actual L2 endpoint.
Set Environment Variables
Configure environment variables:
export FOUNDRY_PROFILE=layer1
export DOMAIN=3151908
export ADDRESS=0xEE0fCB8E5cCAD0b4197BAabd633333886f5C364d
export NAME=0x65726332305f7661756c74000000000000000000000000000000000000000000
export PROXY_ADDRESS=0x7633740000000000000000000000000000000006
export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
export L2_RPC_URL=http://localhost:8547
Execute ERC20 Vault Setup Script
Deploy the ERC20 Vault using the following command:
docker run \
-e FOUNDRY_PROFILE=${FOUNDRY_PROFILE} \
-e DOMAIN=${DOMAIN} \
-e ADDRESS=${ADDRESS} \
-e NAME=${NAME} \
-e PROXY_ADDRESS=${PROXY_ADDRESS} \
-e PRIVATE_KEY=${PRIVATE_KEY} \
nethsurge/protocol:surge-devnet \
forge script ./script/shared/SetAddress.s.sol \
--private-key ${PRIVATE_KEY} \
--fork-url ${L2_RPC_URL} \
--broadcast -vvv
Verification
During the deployment of each of the three components above, your terminal should display output similar to the following if the deployment is successful:
Compiling 36 files with Solc 0.8.27
Solc 0.8.27 finished in 18.14s
Compiler run successful!
Script ran successfully.
## Setting up 1 EVM.
==========================
Chain 763374
Estimated gas price: 0.199839459 gwei
Estimated total gas used for script: 79059
Estimated amount required: 0.000015799107789081 ETH
==========================
==========================
ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
Transactions saved to: /app/broadcast/SetAddress.s.sol/763374/run-latest.json
Sensitive values saved to: /app/cache/SetAddress.s.sol/763374/run-latest.json
Complete verification of the Surge devnet occurs after deploying additional services in subsequent steps.