-
Notifications
You must be signed in to change notification settings - Fork 4
/
snapshotter_autofill.sh
executable file
·117 lines (85 loc) · 3.87 KB
/
snapshotter_autofill.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
#This script is run from high level docker-compose. Refer to https://github.com/PowerLoom/deploy
set -e
echo 'populating setting from environment values...';
if [ -z "$SIGNER_ACCOUNT_ADDRESS" ]; then
echo "SIGNER_ACCOUNT_ADDRESS not found, please set this in your .env!";
exit 1;
fi
if [ -z "$SIGNER_ACCOUNT_PRIVATE_KEY" ]; then
echo "SIGNER_ACCOUNT_PRIVATE_KEY not found, please set this in your .env!";
exit 1;
fi
echo "Found SIGNER ACCOUNT ADDRESS ${SIGNER_ACCOUNT_ADDRESS}";
if [ "$PROST_RPC_URL" ]; then
echo "Found PROST_RPC_URL ${PROST_RPC_URL}";
fi
if [ "$IPFS_URL" ]; then
echo "Found IPFS_URL ${IPFS_URL}";
fi
if [ "$PROTOCOL_STATE_CONTRACT" ]; then
echo "Found PROTOCOL_STATE_CONTRACT ${PROTOCOL_STATE_CONTRACT}";
fi
if [ "$RELAYER_HOST" ]; then
echo "Found RELAYER_HOST ${RELAYER_HOST}";
fi
if [ "$SLACK_REPORTING_URL" ]; then
echo "Found SLACK_REPORTING_URL ${SLACK_REPORTING_URL}";
fi
if [ "$POWERLOOM_REPORTING_URL" ]; then
echo "Found SLACK_REPORTING_URL ${POWERLOOM_REPORTING_URL}";
fi
if [ "$WEB3_STORAGE_TOKEN" ]; then
echo "Found WEB3_STORAGE_TOKEN ${WEB3_STORAGE_TOKEN}";
fi
if [ "$NAMESPACE" ]; then
echo "Found NAMESPACE ${NAMESPACE}";
fi
if [ "$PROST_CHAIN_ID" ]; then
echo "Found PROST_CHAIN_ID ${PROST_CHAIN_ID}";
fi
cp settings.example.json settings.json
export namespace="${NAMESPACE:-UNISWAPV2}"
export prost_rpc_url="${PROST_RPC_URL:-https://rpc-prost1b.powerloom.io}"
export prost_chain_id="${PROST_CHAIN_ID:-103}"
export ipfs_url="${IPFS_URL:-/dns/ipfs/tcp/5001}"
export ipfs_api_key="${IPFS_API_KEY:-}"
export ipfs_api_secret="${IPFS_API_SECRET:-}"
export protocol_state_contract="${PROTOCOL_STATE_CONTRACT:-0x102Af943b34FAC403a6ACB8e463f44bE164aa942}"
export relayer_host="${RELAYER_HOST:-https://relayer-prod1b.powerloom.io/75822d76fa4d497ab3b409b3f097f4fa}"
export slack_reporting_url="${SLACK_REPORTING_URL:-}"
export powerloom_reporting_url="${POWERLOOM_REPORTING_URL:-}"
export web3_storage_token="${WEB3_STORAGE_TOKEN:-}"
# If IPFS_URL is empty, clear IPFS API key and secret
if [ -z "$IPFS_URL" ]; then
ipfs_api_key=""
ipfs_api_secret=""
fi
echo "Using Namespace: ${namespace}"
echo "Using Prost RPC URL: ${prost_rpc_url}"
echo "Using Prost Chain ID: ${prost_chain_id}"
echo "Using IPFS URL: ${ipfs_url}"
echo "Using IPFS API KEY: ${ipfs_api_key}"
echo "Using protocol state contract: ${protocol_state_contract}"
echo "Using relayer host: ${relayer_host}"
echo "Using slack reporting url: ${slack_reporting_url}"
echo "Using powerloom reporting url: ${powerloom_reporting_url}"
echo "Using web3 storage token: ${web3_storage_token}"
sed -i'.backup' "s#relevant-namespace#$namespace#" settings.json
sed -i'.backup' "s#https://prost-rpc-url#$prost_rpc_url#" settings.json
sed -i'.backup' "s#prost-chain-id#$prost_chain_id#" settings.json
sed -i'.backup' "s#ipfs-writer-url#$ipfs_url#" settings.json
sed -i'.backup' "s#ipfs-writer-key#$ipfs_api_key#" settings.json
sed -i'.backup' "s#ipfs-writer-secret#$ipfs_api_secret#" settings.json
sed -i'.backup' "s#ipfs-reader-url#$ipfs_url#" settings.json
sed -i'.backup' "s#ipfs-reader-key#$ipfs_api_key#" settings.json
sed -i'.backup' "s#ipfs-reader-secret#$ipfs_api_secret#" settings.json
sed -i'.backup' "s#web3-storage-token#$web3_storage_token#" settings.json
sed -i'.backup' "s#protocol-state-contract#$protocol_state_contract#" settings.json
sed -i'.backup' "s#signer-account-address#$SIGNER_ACCOUNT_ADDRESS#" settings.json
sed -i'.backup' "s#signer-account-private-key#$SIGNER_ACCOUNT_PRIVATE_KEY#" settings.json
sed -i'.backup' "s#account-address#$SIGNER_ACCOUNT_ADDRESS#" settings.json
sed -i'.backup' "s#https://relayer-url#$relayer_host#" settings.json
sed -i'.backup' "s#https://slack-reporting-url#$slack_reporting_url#" settings.json
sed -i'.backup' "s#https://powerloom-reporting-url#$powerloom_reporting_url#" settings.json
echo 'settings has been populated!'