forked from playmint/ds-hammer-factory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·31 lines (25 loc) · 813 Bytes
/
init.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
#!/bin/bash
set -eu
set -o pipefail
RPC_URL="${RPC_URL:-"http://localhost:8545"}"
PRIVATE_KEY="${PRIVATE_KEY:-"0x6335c92c05660f35b36148bbfb2105a68dd40275ebf16eff9524d487fb5d57a8"}"
function deploy() {
contract="$1"
shift
address=$(
forge create \
--rpc-url "${RPC_URL}" \
--private-key "${PRIVATE_KEY}" \
"${contract}" \
$@ \
| grep 'Deployed to' | awk '{ print $3 }'
)
mkdir -p deployments
deploymentfile="$(echo $contract | cut -d ":" -f 2)"
echo "{\"address\": \"${address}\"}" > deployments/${deploymentfile}.json
echo "${address}"
}
# deploy dawnseekers contracts
DAWNSEEKERS_ADDRESS=$(cd lib/ds-contracts && ./init.sh)
EXTENSION_ADDRESS=$(deploy ./src/Game.sol:Extension --constructor-args "${DAWNSEEKERS_ADDRESS}")
echo "${EXTENSION_ADDRESS} extends ${DAWNSEEKERS_ADDRESS}"