-
Notifications
You must be signed in to change notification settings - Fork 10
/
launch
executable file
·103 lines (78 loc) · 2.96 KB
/
launch
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
#!/bin/bash
#set -e
#set -o pipefail
<< LICENSE
The MIT License (MIT)
Copyright 2017 - 2018, Alchemy Limited, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
LICENSE
usage()
{
cat <<- _EOM_
Launch metronome to a local parity instance by default,
overriding auction launch date, price and supply, if specified.
By default, launch to a local clean ETH "dev chain" instance of parity.
If --test is offered, it will connect to the New Alchemy test network and
launch. Note you will need NA testnet ETH. Contact your SA for help.
If --live is offered, it will connect to the default parity instance.
usage: launch [-O | --owner <owner eth address> ] [-P | --pass <password> ]
[--live | --test | --devnet] [-p <parity host>] [--acution <genesis time>] [--isa_endtime <isa end time>]
_EOM_
}
source ./basescript
if [[ "$CHAIN" = "etc" ]]
then
if [[ $ISA_ENDTIME = 0 ]]
then
echo "Initial auction end time can not be 0 for etc chain"
exit 1
fi
fi
if [[ $OWNER_ADDRESS = 0x0 ]]
then
echo "Requires owner's address. Use -O or --owner."
exit 1
fi
echo "About to launch Metronome, genesis time $AUCTION (`date -r $AUCTION`) to $DEST.."
if [[ $LOCAL = 1 ]] && [[ $TIMESCALE = 1 ]]
then
echo "Running on local chain but realtime.. Can I suggest -t 1000?"
fi
read -p "Press enter to continue"
rm $CHAIN_DIR/const_launch.js 2>/dev/null
sleep 5
cat <<EOF > $CHAIN_DIR/const_launch.js
// File generated by deploy -- edits will get overwritten!
var PRICE = 2
var ONE = 1
var NUMTOKENS = $SUPPLY
var START = $AUCTION
var TIMESCALE = 1
var MINPRICE = 3300000000000
var OWNER_ADDRESS = '$OWNER_ADDRESS'
var OWNER_PASS = '$PASS'
var ISA_ENDTIME = '$ISA_ENDTIME'
EOF
currentTime=$(expr `date +%s` + 10)
if [[ $CHAIN = "eth" ]] && [[ $LIVE = 1 ]] && [[ $AUCTION < $currentTime ]]
then
echo "Auction start time can not be past time in eth chain"
exit 1
fi
geth attach $PARITY_URL --preload $CHAIN_DIR/metronome.js,$CHAIN_DIR/const_launch.js,js/common.js,$CHAIN_DIR/launchMetronome.js$SEED
exit 0