forked from flow-hydraulics/flow-pds
-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.sh
executable file
·54 lines (43 loc) · 1.83 KB
/
deploy.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
#!/bin/bash
if ! command -v flow &> /dev/null
then
echo "Flow CLI could not be found"
exit
fi
if ! command -v go &> /dev/null
then
echo "Go could not be found"
exit
fi
# Check to see if it's running in the right directory
if [ ! -f "./flow.json" ]; then
echo "IMPORTANT: This script must be run from the 'flow-pds' root folder, not a subdirectory"
exit 1
fi
set -a # Mark variables which are modified or created for export to the environment of subsequent commands. Needed for 'go run deploy/main.go' later in the script.
source .env
set +a
# errexit + xtrace
set -ex
shopt -s expand_aliases
# Run the emulator with the config in ./flow.json
if [ "${NETWORK}" == "emulator" ]; then
SIGNER=emulator-account
# Create owner, issuer, pds, account, note all accounts have the same keys in this setup
# addresses are deterministic and listed in flow.json
PK=46acb0e0918e09a50fc2a6b12f14fc00822ad7dac6c6fd92427ec675b9745cbe5ae93d790e6fdd0683d7dd17b6156cc4201def8d6a992807796a5ce4a789005f
flow accounts create --network="$NETWORK" --key="$PK" --signer="$SIGNER"
flow accounts create --network="$NETWORK" --key="$PK" --signer="$SIGNER"
flow accounts create --network="$NETWORK" --key="$PK" --signer="$SIGNER"
# Owner
flow transactions send ./cadence-transactions/flowTokens/transfer_flow_tokens_emulator.cdc \
100.0 0x01cf0e2f2f715450 --signer="$SIGNER" --network="$NETWORK"
# Issuer
flow transactions send ./cadence-transactions/flowTokens/transfer_flow_tokens_emulator.cdc \
100.0 0x179b6b1cb6755e31 --signer="$SIGNER" --network="$NETWORK"
# PDS account
flow transactions send ./cadence-transactions/flowTokens/transfer_flow_tokens_emulator.cdc \
100.0 0xf3fcd2c1a78f5eee --signer="$SIGNER" --network="$NETWORK"
fi
flow project deploy --network="$NETWORK" --update=true
(cd go-contracts/; go run deploy/main.go)