nitro-stack/stack-orchestrator/config/nitro-contracts/deploy-l1-contracts.sh
nabarun b3e58e8d74 Remove unused environment variables from compose files (#9)
Part of [Create bridge channel in go-nitro](https://www.notion.so/Create-bridge-channel-in-go-nitro-22ce80a0d8ae4edb80020a8f250ea270)
- Use variable for chain ID instead of hardcoding

Co-authored-by: Neeraj <neeraj.rtly@gmail.com>
Reviewed-on: #9
2024-09-04 10:27:10 +00:00

37 lines
1.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"
echo "Using the following environment variables:"
echo "GETH_URL: ${GETH_URL}"
echo "GETH_CHAIN_ID: ${GETH_CHAIN_ID}"
echo "GETH_DEPLOYER_PK: ${GETH_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
echo "Done"
# Keep the container running for future asset transfers
tail -f /dev/null