forked from cerc-io/stack-orchestrator
Nabarun Gogoi
94e38ceaba
* Set optimism geth endpoint from env file * Set L1 account private keys from env * Only deploy contract and generate invite in mobymask container * Add readme for running mobymask v2 stack independently * Modify mobymask container to stop running server and update readmes * Check deployer account balance before deploying contract * Fix for checking account balance before deploying * Update readme description * Update MobyMask repo tag in readme
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
set -x
|
|
fi
|
|
|
|
|
|
if [ -f /geth-accounts/accounts.csv ]; then
|
|
echo "Using L1 private key from the mounted volume"
|
|
# Read the private key of L1 account to deploy contract
|
|
PRIVATE_KEY_DEPLOYER=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
|
else
|
|
echo "Using PRIVATE_KEY_DEPLOYER from env"
|
|
fi
|
|
|
|
# Set the private key
|
|
jq --arg privateKey "$PRIVATE_KEY_DEPLOYER" '.privateKey = $privateKey' secrets-template.json > secrets.json
|
|
|
|
export L2_GETH_URL="http://${L2_GETH_HOST}:${L2_GETH_PORT}"
|
|
jq --arg rpcUrl "$L2_GETH_URL" '.rpcUrl = $rpcUrl' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json
|
|
|
|
cd ../hardhat
|
|
export RPC_URL="${L2_GETH_URL}"
|
|
|
|
while true; do
|
|
ACCOUNT_BALANCE=$(yarn hardhat --network optimism balance $PRIVATE_KEY_DEPLOYER | grep ETH)
|
|
|
|
if [ "$ACCOUNT_BALANCE" != "0.0 ETH" ]; then
|
|
echo "Account balance updated: $ACCOUNT_BALANCE"
|
|
break # exit the loop
|
|
fi
|
|
|
|
echo "Account balance not updated: $ACCOUNT_BALANCE"
|
|
echo "Checking after 2 seconds"
|
|
sleep 2
|
|
done
|
|
|
|
cd ../server
|
|
npm run deployAndGenerateInvite
|