Take L2 RPC endpoint from the env file

This commit is contained in:
Prathamesh Musale 2023-04-05 19:21:29 +05:30
parent b05109259b
commit 24aff2189b
5 changed files with 12 additions and 10 deletions

View File

@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
echo "Using L2 RPC endpoint ${L2_GETH_RPC}"
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
@ -16,10 +18,9 @@ fi
jq --arg privateKey "$PRIVATE_KEY_DEPLOYER" '.privateKey = $privateKey' secrets-template.json > secrets.json
# Set the RPC URL
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
jq --arg rpcUrl "$L2_GETH_RPC" '.rpcUrl = $rpcUrl' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json
export RPC_URL="${L2_GETH_URL}"
export RPC_URL="${L2_GETH_RPC}"
if [[ -n "$DEPLOYED_CONTRACT" ]]; then
echo "DEPLOYED_CONTRACT is set to '$DEPLOYED_CONTRACT'"
@ -48,7 +49,7 @@ fi
# Wait until balance for deployer account is reflected
cd ../hardhat
while true; do
ACCOUNT_BALANCE=$(yarn balance --network optimism $PRIVATE_KEY_DEPLOYER | grep ETH)
ACCOUNT_BALANCE=$(yarn balance --network optimism "$PRIVATE_KEY_DEPLOYER" | grep ETH)
if [ "$ACCOUNT_BALANCE" != "0.0 ETH" ]; then
echo "Account balance updated: $ACCOUNT_BALANCE"

View File

@ -1,9 +1,10 @@
# Change if pointing to an external optimism geth endpoint
# L2 endpoints
# TODO: Add another env for complete URL to handle https
L2_GETH_RPC="http://op-geth:8545"
L2_GETH_HOST="op-geth"
L2_GETH_PORT=8545
L2_NODE_HOST="op-node"
L2_NODE_PORT=8547

View File

@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
echo "Using L2 RPC endpoint ${L2_GETH_RPC}"
# Assign deployed contract address from server config
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
@ -17,9 +19,7 @@ fi
sed "s/REPLACE_WITH_PRIVATE_KEY/${PRIVATE_KEY_PEER}/" environments/watcher-config-template.toml > environments/local.toml
sed -i "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/local.toml
export L2_GETH_URL="http://${L2_GETH_HOST}:${L2_GETH_PORT}"
sed -i 's|REPLACE_WITH_L2_GETH_URL|'"${L2_GETH_URL}"'|' environments/local.toml
sed -i 's|REPLACE_WITH_L2_GETH_RPC_ENDPOINT|'"${L2_GETH_RPC}"'|' environments/local.toml
echo 'yarn server'
yarn server

View File

@ -59,7 +59,7 @@
[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
rpcProviderEndpoint = "REPLACE_WITH_L2_GETH_URL"
rpcProviderEndpoint = "REPLACE_WITH_L2_GETH_RPC_ENDPOINT"
blockDelayInMilliSecs = 60000
[upstream.cache]

View File

@ -4,7 +4,7 @@ Instructions to setup and deploy MobyMask v2 watcher independently
## Setup
Prerequisite: An L2 Optimism RPC endpoint
Prerequisite: L2 Optimism Geth and Node RPC endpoints
Clone required repositories: