-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpio_env_setup.sh
executable file
·96 lines (74 loc) · 3.3 KB
/
pio_env_setup.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# I'm using a provenance "run" instance for these tests
# provenance setup, clean project, make, adjust the voting period in the config to test msg based fee proposals:
# 'make clean ; make build; make run-config; cat ./build/run/provenanced/config/genesis.json | jq '\'' .app_state.gov.voting_params.voting_period="20s" '\'' | tee ./build/run/provenanced/config/genesis.json; cat ./build/run/provenanced/config/genesis.json'
PROVENANCE_DEV_DIR=~/code/provenance
PROVENANCE_DEV_BUILD=build/provenanced
PIO_ENV_FLAGS="-t --home ${PROVENANCE_DEV_DIR}/build/run/provenanced"
PIO_CMD="${PROVENANCE_DEV_DIR}/${PROVENANCE_DEV_BUILD} ${PIO_ENV_FLAGS}"
MNEMONICS_DIR=~/code/pio-scratch/mnemonics
COMMON_TX_FLAGS="--gas auto --gas-prices 1905nhash --gas-adjustment 2 --yes -o json"
######################################### SETUP FOR ATS CONTRACT EXECUTION ##############################################
${PIO_CMD} keys add buyer --recover --keyring-backend test < ${MNEMONICS_DIR}/buyer.txt
${PIO_CMD} keys add seller --recover --keyring-backend test < ${MNEMONICS_DIR}/seller.txt
${PIO_CMD} keys add feebucket --recover --keyring-backend test < ${MNEMONICS_DIR}/feebucket.txt
${PIO_CMD} keys add merchant --recover --keyring-backend test < ${MNEMONICS_DIR}/merchant.txt
VALIDATOR_ID=$(${PROVENANCE_DEV_DIR}/build/provenanced keys show -a validator --home ${PROVENANCE_DEV_DIR}/build/run/provenanced -t)
BUYER=$(${PROVENANCE_DEV_DIR}/build/provenanced keys show -a buyer --home ${PROVENANCE_DEV_DIR}/build/run/provenanced -t)
SELLER=$(${PROVENANCE_DEV_DIR}/build/provenanced keys show -a seller --home ${PROVENANCE_DEV_DIR}/build/run/provenanced -t)
echo "Creating marker gme"
${PIO_CMD} \
tx marker new 1000gme.local \
--type COIN \
--from validator \
--fees 101000000000nhash \
--chain-id testing --keyring-backend test --yes -o json | jq
echo "Grant marker gme"
${PIO_CMD} \
tx marker grant ${VALIDATOR_ID} gme.local mint,burn,admin,withdraw,deposit \
--from validator \
${COMMON_TX_FLAGS} | jq
echo "Finalize marker gme"
${PIO_CMD} \
tx marker finalize gme.local \
--from validator \
${COMMON_TX_FLAGS} | jq
echo "Activate marker gme"
${PIO_CMD} \
tx marker activate gme.local \
--from validator \
${COMMON_TX_FLAGS} | jq
echo "Creating marker usd"
${PIO_CMD} \
tx marker new 1000usd.local \
--type COIN \
--from validator \
--fees 101000000000nhash \
--chain-id testing --keyring-backend test --yes -o json | jq
echo "Creating marker usd"
${PIO_CMD} \
tx marker grant ${VALIDATOR_ID} usd.local mint,burn,admin,withdraw,deposit \
--from validator \
${COMMON_TX_FLAGS} | jq
${PIO_CMD} \
tx marker finalize usd.local \
--from validator \
${COMMON_TX_FLAGS} | jq
${PIO_CMD} \
tx marker activate usd.local \
--from validator \
${COMMON_TX_FLAGS} | jq
# FUNDING ACCOUNTS STUFF
#
#
echo "Funding all accounts"
${PIO_CMD} tx bank send ${VALIDATOR_ID} ${BUYER} 1000000000000000nhash \
${COMMON_TX_FLAGS} | jq
${PIO_CMD} tx marker withdraw usd.local 1000usd.local ${BUYER} \
--from validator \
${COMMON_TX_FLAGS} | jq
${PIO_CMD} tx bank send ${VALIDATOR_ID} ${SELLER} 1000000000000000nhash \
${COMMON_TX_FLAGS} | jq
${PIO_CMD} tx marker withdraw gme.local 1000gme.local ${SELLER} \
--from validator \
${COMMON_TX_FLAGS} | jq