Fund accounts for txs on L2
This commit is contained in:
parent
b6f8015ab9
commit
d2b249dd79
@ -20,12 +20,13 @@ services:
|
||||
volumes:
|
||||
- ../config/network/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
|
||||
- ../config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh:/app/packages/contracts-bedrock/deploy-contracts.sh
|
||||
- ../config/fixturenet-optimism/optimism-contracts/fund-accounts-on-l2.sh:/app/packages/contracts-bedrock/fund-accounts-on-l2.sh
|
||||
- l2_accounts:/l2-accounts
|
||||
- l1_deployment:/l1-deployment
|
||||
- l2_config:/l2-config
|
||||
# Waits for L1 endpoint to be up before running the contract deploy script
|
||||
command: |
|
||||
"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- ./deploy-contracts.sh"
|
||||
"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- ./deploy-contracts.sh && ./fund-accounts-on-l2.sh"
|
||||
|
||||
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
|
||||
op-geth:
|
||||
|
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
|
||||
|
||||
CERC_L1_ACCOUNTS_CSV_URL="${CERC_L1_ACCOUNTS_CSV_URL:-${DEFAULT_CERC_L1_ACCOUNTS_CSV_URL}}"
|
||||
|
||||
# Fetch the L1 funded accounts
|
||||
curl -o accounts.csv $CERC_L1_ACCOUNTS_CSV_URL
|
||||
|
||||
# Use the accounts other than the ones used for Optimism deployment
|
||||
ACCOUNT_1=$(awk -F ',' 'NR == 5 {print $2}' accounts.csv)
|
||||
ACCOUNT_1_KEY=$(awk -F ',' 'NR == 5 {print $3}' accounts.csv)
|
||||
|
||||
ACCOUNT_2=$(awk -F ',' 'NR == 6 {print $2}' accounts.csv)
|
||||
ACCOUNT_2_KEY=$(awk -F ',' 'NR == 6 {print $3}' accounts.csv)
|
||||
|
||||
# Get the bridge contract address
|
||||
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
|
||||
BRIDGE=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address)
|
||||
|
||||
# Send balance to bridge contract on L1
|
||||
cast send --from $ACCOUNT_1 --rpc-url $CERC_L1_RPC --value 1000ether $BRIDGE --private-key $ACCOUNT_1_KEY
|
||||
cast send --from $ACCOUNT_2 --rpc-url $CERC_L1_RPC --value 1000ether $BRIDGE --private-key $ACCOUNT_2_KEY
|
||||
|
||||
echo "Following accounts have been funded; use them for transactions on L2:"
|
||||
echo "${ACCOUNT_1}"
|
||||
echo "${ACCOUNT_2}"
|
Loading…
Reference in New Issue
Block a user