e3a8b25850
* Rename service for nitro node * Update nitro node setup * Rename nitro-contracts image to nitro-client * Fix nitro node config setup * Add env variable for deterministic deployment * Keep nitro-contracts service running * Start nitro-bridge service after asset file is ready * Update environment variables for all services * Use quotes for bridge address * Update nitro-node and bridge stack readme * Fix nitro-node readme --------- Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
64 lines
2.1 KiB
Bash
Executable File
64 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
set -x
|
|
fi
|
|
|
|
addresses_deployment_file="packages/nitro-protocol/addresses.json"
|
|
nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
|
bridge_assets_map_file="/app/deployment/bridge-assets-map.toml"
|
|
|
|
echo "Using the following environment variables:"
|
|
echo "GETH_URL: ${GETH_URL}"
|
|
echo "OPTIMISM_URL: ${OPTIMISM_URL}"
|
|
echo "GETH_CHAIN_ID: ${GETH_CHAIN_ID}"
|
|
echo "OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID}"
|
|
echo "GETH_DEPLOYER_PK: ${GETH_DEPLOYER_PK}"
|
|
echo "OPTIMISM_DEPLOYER_PK: ${OPTIMISM_DEPLOYER_PK}"
|
|
echo "TOKEN_NAME: ${TOKEN_NAME}"
|
|
echo "TOKEN_SYMBOL: ${TOKEN_SYMBOL}"
|
|
echo "INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}"
|
|
echo "DISABLE_DETERMINISTIC_DEPLOYMENT: ${DISABLE_DETERMINISTIC_DEPLOYMENT}"
|
|
|
|
# Check if L1 chain id key is present for L1 deployment
|
|
if [ -f "$nitro_addresses_file" ] && jq -e "has(\"$GETH_CHAIN_ID\")" ${nitro_addresses_file} > /dev/null; then
|
|
echo "L1 addresses found in ${nitro_addresses_file}, skipping deployment"
|
|
else
|
|
# Deploy Nitro contracts
|
|
yarn contracts:deploy-geth
|
|
|
|
# Deploy custom token
|
|
yarn contracts:deploy-token-geth
|
|
|
|
cp ${addresses_deployment_file} ${nitro_addresses_file}
|
|
fi
|
|
|
|
# Check if L1 chain id key is present for L1 deployment
|
|
if [ -f "$nitro_addresses_file" ] && jq -e "has(\"$OPTIMISM_CHAIN_ID\")" ${nitro_addresses_file} > /dev/null; then
|
|
echo "L2 addresses found in ${nitro_addresses_file}, skipping deployment"
|
|
else
|
|
# Deploy Nitro contracts
|
|
yarn contracts:deploy-optimism
|
|
|
|
# Deploy custom token
|
|
yarn contracts:deploy-token-optimism
|
|
|
|
cp ${addresses_deployment_file} ${nitro_addresses_file}
|
|
fi
|
|
|
|
L1_ASSET_ADDRESS=$(jq -r ".\"$GETH_CHAIN_ID\"[0].contracts.Token.address" ${nitro_addresses_file})
|
|
L2_ASSET_ADDRESS=$(jq -r ".\"$OPTIMISM_CHAIN_ID\"[0].contracts.Token.address" ${nitro_addresses_file})
|
|
|
|
# Deploy custom tokens and create bridge-assets-map.toml
|
|
cat <<EOF > "$bridge_assets_map_file"
|
|
[[assets]]
|
|
l1AssetAddress = "$L1_ASSET_ADDRESS"
|
|
l2AssetAddress = "$L2_ASSET_ADDRESS"
|
|
EOF
|
|
|
|
echo "Done"
|
|
|
|
# Keep the container running for future asset transfers
|
|
tail -f /dev/null
|