forked from playmint/ds-hammer-factory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·56 lines (44 loc) · 1.23 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -eu
set -o pipefail
# this is a entrypoint for a dockerized hardhat evm node
# it starts the hardhat node, runs our deployment scripts
# builds the required deployment confgiuration
# it is used for local development
_term() {
echo "Terminated by user!"
exit 1
}
trap _term SIGINT
trap _term SIGTERM
# remove any existing deployments for clean start
mkdir -p deployments
rm -f deployments/*
# must match the value for the target hardhat networks
ACCOUNT_MNEMONIC="thunder road vendor cradle rigid subway isolate ridge feel illegal whale lens"
# set blocktime - sometimes it is useful to simulate slower mining
: ${MINER_BLOCKTIME:=0}
echo "+-------------------+"
echo "| starting evm node |"
echo "+-------------------+"
anvil \
--host 0.0.0.0 \
-m "${ACCOUNT_MNEMONIC}" \
-b 1 \
&
# wait for node to start
while ! curl -sf -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' localhost:8545 >/dev/null; do
echo "waiting for evm node to start..."
sleep 1
done
echo "+---------------------+"
echo "| deploying contracts |"
echo "+---------------------+"
./init.sh
echo "+-------+"
echo "| ready |"
echo "+-------+"
echo ""
# wait and bail if either migration or evm node crash
wait -n
exit $?