-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy.sh
executable file
·181 lines (136 loc) · 55.9 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/env bash
set -e
set -u
set -o errtrace
set -o pipefail
readonly ENV_FILE=".abi_testnet.env"
[ ! -f ${ENV_FILE} ] && printf "file %s does not exist\n" "${ENV_FILE}" && exit 1
source "${ENV_FILE}"
[ -z ${BACKEND+x} ] && BACKEND=http://localhost:8545
[ -z ${BZZACCOUNTS+x} ] && BZZACCOUNTS="bf4f9637c281ddfb1fbd3be5a1dae6531d408f11 c45d64d8f9642a604db93c59fd38492b262391ca"
readonly TOKEN_BIN=0x60806040523480156200001157600080fd5b506040516200210f3803806200210f83398101604081905262000034916200044e565b8282818160056200004683826200054f565b5060066200005582826200054f565b50506007805460ff19169055506200006f600033620000f0565b6200009b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000f0565b620000c77f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33620000f0565b50506008819055620000db600033620000f0565b620000e7338262000100565b5050506200063d565b620000fc8282620001d7565b5050565b6001600160a01b0382166200015c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064015b60405180910390fd5b6200016a6000838362000202565b80600460008282546200017e91906200061b565b90915550506001600160a01b0382166000818152600260209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b620001e382826200020f565b6000828152600160205260409020620001fd9082620002af565b505050565b620001fd838383620002cf565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000fc576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200026b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620002c6836001600160a01b03841662000337565b90505b92915050565b60075460ff1615620001fd5760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b606482015260840162000153565b60008181526001830160205260408120546200038057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620002c9565b506000620002c9565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620003b157600080fd5b81516001600160401b0380821115620003ce57620003ce62000389565b604051601f8301601f19908116603f01168101908282118183101715620003f957620003f962000389565b816040528381526020925086838588010111156200041657600080fd5b600091505b838210156200043a57858201830151818301840152908201906200041b565b600093810190920192909252949350505050565b6000806000606084860312156200046457600080fd5b83516001600160401b03808211156200047c57600080fd5b6200048a878388016200039f565b94506020860151915080821115620004a157600080fd5b50620004b0868287016200039f565b925050604084015190509250925092565b600181811c90821680620004d657607f821691505b602082108103620004f757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001fd57600081815260208120601f850160051c81016020861015620005265750805b601f850160051c820191505b81811015620005475782815560010162000532565b505050505050565b81516001600160401b038111156200056b576200056b62000389565b62000583816200057c8454620004c1565b84620004fd565b602080601f831160018114620005bb5760008415620005a25750858301515b600019600386901b1c1916600185901b17855562000547565b600085815260208120601f198616915b82811015620005ec57888601518255948401946001909101908401620005cb565b50858210156200060b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115620002c957634e487b7160e01b600052601160045260246000fd5b611ac2806200064d6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063a457c2d711610097578063d539139311610071578063d5391393146103d3578063d547741f146103fa578063dd62ed3e1461040d578063e63ab1e91461044657600080fd5b8063a457c2d71461039a578063a9059cbb146103ad578063ca15c873146103c057600080fd5b80639010d07c116100d35780639010d07c1461032857806391d148541461035357806395d89b411461038a578063a217fddf1461039257600080fd5b806370a08231146102e457806379cc67901461030d5780638456cb591461032057600080fd5b8063313ce567116101665780633f4ba83a116101405780633f4ba83a146102ab57806340c10f19146102b357806342966c68146102c65780635c975abb146102d957600080fd5b8063313ce5671461027657806336568abe14610285578063395093511461029857600080fd5b806318160ddd116101a257806318160ddd1461021957806323b872dd1461022b578063248a9ca31461023e5780632f2ff15d1461026157600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063095ea7b314610206575b600080fd5b6101dc6101d7366004611776565b61046d565b60405190151581526020015b60405180910390f35b6101f96104b1565b6040516101e891906117c4565b6101dc610214366004611813565b610543565b6004545b6040519081526020016101e8565b6101dc61023936600461183d565b61055b565b61021d61024c366004611879565b60009081526020819052604090206001015490565b61027461026f366004611892565b61057f565b005b604051601081526020016101e8565b610274610293366004611892565b6105a9565b6101dc6102a6366004611813565b61063a565b610274610679565b6102746102c1366004611813565b61071f565b6102746102d4366004611879565b6107c5565b60075460ff166101dc565b61021d6102f23660046118be565b6001600160a01b031660009081526002602052604090205490565b61027461031b366004611813565b6107d2565b6102746107e7565b61033b6103363660046118d9565b61088b565b6040516001600160a01b0390911681526020016101e8565b6101dc610361366004611892565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6101f96108aa565b61021d600081565b6101dc6103a8366004611813565b6108b9565b6101dc6103bb366004611813565b610963565b61021d6103ce366004611879565b610971565b61021d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b610274610408366004611892565b610988565b61021d61041b3660046118fb565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61021d7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60006001600160e01b031982167f5a05180f0000000000000000000000000000000000000000000000000000000014806104ab57506104ab826109ad565b92915050565b6060600580546104c090611925565b80601f01602080910402602001604051908101604052809291908181526020018280546104ec90611925565b80156105395780601f1061050e57610100808354040283529160200191610539565b820191906000526020600020905b81548152906001019060200180831161051c57829003601f168201915b5050505050905090565b600033610551818585610a14565b5060019392505050565b600033610569858285610b6c565b610574858585610bfe565b506001949350505050565b60008281526020819052604090206001015461059a81610dfd565b6105a48383610e07565b505050565b6001600160a01b038116331461062c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6106368282610e29565b5050565b3360008181526003602090815260408083206001600160a01b03871684529091528120549091906105519082908690610674908790611975565b610a14565b6106a37f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610361565b6107155760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e7061757365000000000000006064820152608401610623565b61071d610e4b565b565b6107497f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633610361565b6107bb5760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f7665206d696e74657220726f6c6520746f206d696e74000000000000000000006064820152608401610623565b6106368282610e9d565b6107cf3382610f6a565b50565b6107dd823383610b6c565b6106368282610f6a565b6108117f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610361565b6108835760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f2070617573650000000000000000006064820152608401610623565b61071d6110e1565b60008281526001602052604081206108a3908361111e565b9392505050565b6060600680546104c090611925565b3360008181526003602090815260408083206001600160a01b0387168452909152812054909190838110156109565760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610623565b6105748286868403610a14565b600033610551818585610bfe565b60008181526001602052604081206104ab9061112a565b6000828152602081905260409020600101546109a381610dfd565b6105a48383610e29565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806104ab57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146104ab565b6001600160a01b038316610a8f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610623565b6001600160a01b038216610b0b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610623565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600360209081526040808320938616835292905220546000198114610bf85781811015610beb5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610623565b610bf88484848403610a14565b50505050565b6001600160a01b038316610c7a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610623565b6001600160a01b038216610cf65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610623565b610d01838383611134565b6001600160a01b03831660009081526002602052604090205481811015610d905760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610623565b6001600160a01b0380851660008181526002602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610df09086815260200190565b60405180910390a3610bf8565b6107cf813361113f565b610e1182826111b2565b60008281526001602052604090206105a49082611250565b610e338282611265565b60008281526001602052604090206105a490826112e4565b610e536112f9565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610ef35760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610623565b610eff60008383611134565b8060046000828254610f119190611975565b90915550506001600160a01b0382166000818152600260209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b038216610fe65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610623565b610ff282600083611134565b6001600160a01b038216600090815260026020526040902054818110156110815760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610623565b6001600160a01b03831660008181526002602090815260408083208686039055600480548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6110e961134b565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e803390565b60006108a3838361139e565b60006104ab825490565b6105a48383836113c8565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166106365761117081611441565b61117b836020611453565b60405160200161118c929190611988565b60408051601f198184030181529082905262461bcd60e51b8252610623916004016117c4565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610636576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561120c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006108a3836001600160a01b038416611634565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610636576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006108a3836001600160a01b038416611683565b60075460ff1661071d5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610623565b60075460ff161561071d5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610623565b60008260000182815481106113b5576113b5611a09565b9060005260206000200154905092915050565b60075460ff16156105a45760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e7366657220776860448201527f696c6520706175736564000000000000000000000000000000000000000000006064820152608401610623565b60606104ab6001600160a01b03831660145b60606000611462836002611a1f565b61146d906002611975565b67ffffffffffffffff81111561148557611485611a36565b6040519080825280601f01601f1916602001820160405280156114af576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106114e6576114e6611a09565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061153157611531611a09565b60200101906001600160f81b031916908160001a9053506000611555846002611a1f565b611560906001611975565b90505b60018111156115e5577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106115a1576115a1611a09565b1a60f81b8282815181106115b7576115b7611a09565b60200101906001600160f81b031916908160001a90535060049490941c936115de81611a4c565b9050611563565b5083156108a35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610623565b600081815260018301602052604081205461167b575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556104ab565b5060006104ab565b6000818152600183016020526040812054801561176c5760006116a7600183611a63565b85549091506000906116bb90600190611a63565b90508181146117205760008660000182815481106116db576116db611a09565b90600052602060002001549050808760000184815481106116fe576116fe611a09565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061173157611731611a76565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506104ab565b60009150506104ab565b60006020828403121561178857600080fd5b81356001600160e01b0319811681146108a357600080fd5b60005b838110156117bb5781810151838201526020016117a3565b50506000910152565b60208152600082518060208401526117e38160408501602087016117a0565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461180e57600080fd5b919050565b6000806040838503121561182657600080fd5b61182f836117f7565b946020939093013593505050565b60008060006060848603121561185257600080fd5b61185b846117f7565b9250611869602085016117f7565b9150604084013590509250925092565b60006020828403121561188b57600080fd5b5035919050565b600080604083850312156118a557600080fd5b823591506118b5602084016117f7565b90509250929050565b6000602082840312156118d057600080fd5b6108a3826117f7565b600080604083850312156118ec57600080fd5b50508035926020909101359150565b6000806040838503121561190e57600080fd5b611917836117f7565b91506118b5602084016117f7565b600181811c9082168061193957607f821691505b60208210810361195957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104ab576104ab61195f565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516119c08160178501602088016117a0565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516119fd8160288401602088016117a0565b01602801949350505050565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176104ab576104ab61195f565b634e487b7160e01b600052604160045260246000fd5b600081611a5b57611a5b61195f565b506000190190565b818103818111156104ab576104ab61195f565b634e487b7160e01b600052603160045260246000fdfea26469706673582212203620aca8c9d1a7c1605549c86f17d4dab4d7ed55f980b6be0398dcb6d883aaa064736f6c63430008130033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000108b2a2c2802909400000000000000000000000000000000000000000000000000000000000000000000473425a5a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000473425a5a00000000000000000000000000000000000000000000000000000000
readonly LEGACY_FACTORY_BIN=0x608060405234801561001057600080fd5b50604051611df2380380611df283398101604081905261002f91610112565b600180546001600160a01b0319166001600160a01b03831617905560405160009061005990610105565b604051809103906000f080158015610075573d6000803e3d6000fd5b506040516343431f6360e11b81529091506001600160a01b038216906386863ec6906100ab906001906000908190600401610140565b600060405180830381600087803b1580156100c557600080fd5b505af11580156100d9573d6000803e3d6000fd5b5050600280546001600160a01b0319166001600160a01b03949094169390931790925550610164915050565b6118e58061050d83390190565b600060208284031215610123578081fd5b81516001600160a01b0381168114610139578182fd5b9392505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b61039a806101736000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806315efd8a714610051578063a6021ace1461007a578063c70242ad14610082578063ee97f7f3146100a2575b600080fd5b61006461005f3660046102d6565b6100aa565b6040516100719190610308565b60405180910390f35b6100646101bb565b6100956100903660046102b5565b6101ca565b6040516100719190610359565b6100646101df565b60025460405160009182916100ee916001600160a01b0316906100d3903390879060200161031c565b604051602081830303815290604052805190602001206101ee565b6001546040516343431f6360e11b81529192506001600160a01b03808416926386863ec692610126928a929116908990600401610335565b600060405180830381600087803b15801561014057600080fd5b505af1158015610154573d6000803e3d6000fd5b5050506001600160a01b03821660009081526020819052604090819020805460ff19166001179055517fc0ffc525a1c7689549d7f79b49eca900e61ac49b43d977f680bcc3b36224c00491506101ab908390610308565b60405180910390a1949350505050565b6001546001600160a01b031681565b60006020819052908152604090205460ff1681565b6002546001600160a01b031681565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528360601b60148201526e5af43d82803e903d91602b57fd5bf360881b6028820152826037826000f59150506001600160a01b038116610293576040805162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c6564000000000000000000604482015290519081900360640190fd5b92915050565b80356001600160a01b03811681146102b057600080fd5b919050565b6000602082840312156102c6578081fd5b6102cf82610299565b9392505050565b6000806000606084860312156102ea578182fd5b6102f384610299565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b90151581526020019056fea2646970667358221220b260612b64b2388a58a0d557b99cc9121129d7c5aaa1c649d70eac8f0870b29c64736f6c63430007060033608060405234801561001057600080fd5b506118c5806100206000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c8063946f46a2116100c3578063b7ec1a331161007c578063b7ec1a331461027f578063c49f91d314610287578063c76a4d311461028f578063d4c9a8e8146102a2578063e0bcf13a146102b5578063fc0c546a146102bd5761014d565b8063946f46a214610211578063b6343b0d14610224578063b648b41714610247578063b69ef8a81461025c578063b777035014610264578063b7998907146102775761014d565b80631d143848116101155780631d143848146101a85780632e1a7d4d146101bd578063338f3fed146101d0578063488b017c146101e357806381f03fcb146101eb57806386863ec6146101fe5761014d565b80630d5f26591461015257806312101021146101675780631357e1dc1461018557806315c3343f1461018d5780631633fb1d14610195575b600080fd5b61016561016036600461146b565b6102c5565b005b61016f6102d8565b60405161017c9190611563565b60405180910390f35b61016f6102de565b61016f6102e4565b6101656101a33660046113ae565b610308565b6101b061036c565b60405161017c919061152b565b6101656101cb3660046114e0565b61037b565b6101656101de366004611442565b610473565b61016f610556565b61016f6101f9366004611359565b61057a565b61016561020c366004611373565b61058c565b61016561021f366004611359565b610610565b610237610232366004611359565b6106d0565b60405161017c94939291906115c7565b61024f6106f7565b60405161017c9190611558565b61016f610707565b610165610272366004611442565b61078d565b61016f610867565b61016f61088b565b61016f6108a1565b61016f61029d366004611359565b6108c5565b6101656102b036600461146b565b6108f8565b61016f6109b4565b6101b06109ba565b6102d33384846000856109c9565b505050565b60005481565b60035481565b7f48ebe6deff4a5ee645c01506a026031e2a945d6f41f1f4e5098ad65347492c1281565b61031e6103183033878987610dd2565b84610e30565b6001600160a01b0316866001600160a01b0316146103575760405162461bcd60e51b815260040161034e906117d5565b60405180910390fd5b61036486868685856109c9565b505050505050565b6006546001600160a01b031681565b6006546001600160a01b031633146103a55760405162461bcd60e51b815260040161034e906115e2565b6103ad61088b565b8111156103cc5760405162461bcd60e51b815260040161034e90611695565b60015460065460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb9261040292911690859060040161153f565b602060405180830381600087803b15801561041c57600080fd5b505af1158015610430573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045491906114c0565b6104705760405162461bcd60e51b815260040161034e9061180c565b50565b6006546001600160a01b0316331461049d5760405162461bcd60e51b815260040161034e90611665565b6104a5610707565b6005546104b29083610e7f565b11156104d05760405162461bcd60e51b815260040161034e90611730565b6001600160a01b038216600090815260046020526040902080546104f49083610e7f565b81556005546105039083610e7f565b6005556000600382015580546040516001600160a01b038516917f2506c43272ded05d095b91dbba876e66e46888157d3e078db5691496e96c5fad916105499190611563565b60405180910390a2505050565b7f7d824962dd0f01520922ea1766c987b1db570cd5db90bdba5ccf5e320607950281565b60026020526000908152604090205481565b6001600160a01b0383166105b25760405162461bcd60e51b815260040161034e9061163d565b6006546001600160a01b0316156105db5760405162461bcd60e51b815260040161034e906116cc565b600680546001600160a01b039485166001600160a01b0319918216179091556001805493909416921691909117909155600055565b6001600160a01b03811660009081526004602052604090206003810154421080159061063f5750600381015415155b61065b5760405162461bcd60e51b815260040161034e90611606565b6001810154815461066b91610ee0565b815560006003820155600181015460055461068591610ee0565b60055580546040516001600160a01b038416917f2506c43272ded05d095b91dbba876e66e46888157d3e078db5691496e96c5fad916106c49190611563565b60405180910390a25050565b60046020526000908152604090208054600182015460028301546003909301549192909184565b600654600160a01b900460ff1681565b6001546040516370a0823160e01b81526000916001600160a01b0316906370a082319061073890309060040161152b565b60206040518083038186803b15801561075057600080fd5b505afa158015610764573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078891906114f8565b905090565b6006546001600160a01b031633146107b75760405162461bcd60e51b815260040161034e90611665565b6001600160a01b038216600090815260046020526040902080548211156107f05760405162461bcd60e51b815260040161034e906116f9565b6000816002015460001461080857816002015461080c565b6000545b4281016003840155600183018490556040519091506001600160a01b038516907fc8305077b495025ec4c1d977b176a762c350bb18cad4666ce1ee85c32b78698a90610859908690611563565b60405180910390a250505050565b7fe95f353750f192082df064ca5142d3a2d6f0bef0f3ffad66d80d8af86b7a749a81565b600061078860055461089b610707565b90610ee0565b7fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e81565b6001600160a01b0381166000908152600460205260408120546108f0906108ea61088b565b90610e7f565b90505b919050565b6006546001600160a01b031633146109225760405162461bcd60e51b815260040161034e906115e2565b610936610930308585610f3d565b82610e30565b6001600160a01b0316836001600160a01b0316146109665760405162461bcd60e51b815260040161034e906117d5565b6001600160a01b03831660008181526004602052604090819020600201849055517f7b816003a769eb718bd9c66bdbd2dd5827da3f92bc6645276876bd7957b08cf090610549908590611563565b60055481565b6001546001600160a01b031681565b6006546001600160a01b03163314610a16576109e9610930308786610f95565b6006546001600160a01b03908116911614610a165760405162461bcd60e51b815260040161034e9061179e565b6001600160a01b038516600090815260026020526040812054610a3a908590610ee0565b90506000610a5082610a4b896108c5565b610fce565b6001600160a01b03881660009081526004602052604081205491925090610a78908390610fce565b905084821015610a9a5760405162461bcd60e51b815260040161034e90611767565b8015610aed576001600160a01b038816600090815260046020526040902054610ac39082610ee0565b6001600160a01b038916600090815260046020526040902055600554610ae99082610ee0565b6005555b6001600160a01b038816600090815260026020526040902054610b109083610e7f565b6001600160a01b038916600090815260026020526040902055600354610b369083610e7f565b600355828214610b7d576006805460ff60a01b1916600160a01b1790556040517f3f4449c047e11092ec54dc0751b6b4817a9162745de856c893a26e611d18ffc490600090a15b8415610ccf5760015460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610bb5903390899060040161153f565b602060405180830381600087803b158015610bcf57600080fd5b505af1158015610be3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0791906114c0565b610c235760405162461bcd60e51b815260040161034e9061180c565b6001546001600160a01b031663a9059cbb88610c3f8589610ee0565b6040518363ffffffff1660e01b8152600401610c5c92919061153f565b602060405180830381600087803b158015610c7657600080fd5b505af1158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae91906114c0565b610cca5760405162461bcd60e51b815260040161034e9061180c565b610d6f565b60015460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610d01908a90869060040161153f565b602060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5391906114c0565b610d6f5760405162461bcd60e51b815260040161034e9061180c565b336001600160a01b0316876001600160a01b0316896001600160a01b03167f950494fc3642fae5221b6c32e0e45765c95ebb382a04a71b160db0843e74c99f858a8a604051610dc093929190611835565b60405180910390a45050505050505050565b60007f7d824962dd0f01520922ea1766c987b1db570cd5db90bdba5ccf5e32060795028686868686604051602001610e0f96959493929190611591565b60405160208183030381529060405280519060200120905095945050505050565b600080610e43610e3e610fe4565b61103e565b84604051602001610e55929190611510565b604051602081830303815290604052805190602001209050610e7781846110ae565b949350505050565b600082820183811015610ed9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600082821115610f37576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60007fe95f353750f192082df064ca5142d3a2d6f0bef0f3ffad66d80d8af86b7a749a848484604051602001610f76949392919061156c565b6040516020818303038152906040528051906020012090509392505050565b60007f48ebe6deff4a5ee645c01506a026031e2a945d6f41f1f4e5098ad65347492c12848484604051602001610f76949392919061156c565b6000818310610fdd5781610ed9565b5090919050565b610fec6112ac565b506040805160a081018252600a6060820190815269436865717565626f6f6b60b01b608083015281528151808301835260038152620312e360ec1b602082810191909152820152469181019190915290565b60007fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e826000015180519060200120836020015180519060200120846040015160405160200161109194939291906115c7565b604051602081830303815290604052805190602001209050919050565b60008151604114611106576040805162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015290519081900360640190fd5b60208201516040830151606084015160001a6111248682858561112e565b9695505050505050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561118f5760405162461bcd60e51b815260040180806020018281038252602281526020018061184c6022913960400191505060405180910390fd5b8360ff16601b14806111a457508360ff16601c145b6111df5760405162461bcd60e51b815260040180806020018281038252602281526020018061186e6022913960400191505060405180910390fd5b600060018686868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561123b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112a3576040805162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015290519081900360640190fd5b95945050505050565b60405180606001604052806060815260200160608152602001600081525090565b80356001600160a01b03811681146108f357600080fd5b600082601f8301126112f4578081fd5b813567ffffffffffffffff8082111561130957fe5b604051601f8301601f19168101602001828111828210171561132757fe5b60405282815284830160200186101561133e578384fd5b82602086016020830137918201602001929092529392505050565b60006020828403121561136a578081fd5b610ed9826112cd565b600080600060608486031215611387578182fd5b611390846112cd565b925061139e602085016112cd565b9150604084013590509250925092565b60008060008060008060c087890312156113c6578182fd5b6113cf876112cd565b95506113dd602088016112cd565b945060408701359350606087013567ffffffffffffffff80821115611400578384fd5b61140c8a838b016112e4565b94506080890135935060a0890135915080821115611428578283fd5b5061143589828a016112e4565b9150509295509295509295565b60008060408385031215611454578182fd5b61145d836112cd565b946020939093013593505050565b60008060006060848603121561147f578283fd5b611488846112cd565b925060208401359150604084013567ffffffffffffffff8111156114aa578182fd5b6114b6868287016112e4565b9150509250925092565b6000602082840312156114d1578081fd5b81518015158114610ed9578182fd5b6000602082840312156114f1578081fd5b5035919050565b600060208284031215611509578081fd5b5051919050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b9384526001600160a01b03928316602085015291166040830152606082015260800190565b9586526001600160a01b03948516602087015292841660408601526060850191909152909116608083015260a082015260c00190565b93845260208401929092526040830152606082015260800190565b6020808252600a90820152693737ba1034b9b9bab2b960b11b604082015260600190565b60208082526019908201527f6465706f736974206e6f74207965742074696d6564206f757400000000000000604082015260600190565b6020808252600e908201526d34b73b30b634b21034b9b9bab2b960911b604082015260600190565b60208082526016908201527529b4b6b83632a9bbb0b81d103737ba1034b9b9bab2b960511b604082015260600190565b6020808252601c908201527f6c697175696442616c616e6365206e6f742073756666696369656e7400000000604082015260600190565b602080825260139082015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604082015260600190565b6020808252601b908201527f68617264206465706f736974206e6f742073756666696369656e740000000000604082015260600190565b6020808252601c908201527f68617264206465706f73697420657863656564732062616c616e636500000000604082015260600190565b6020808252601d908201527f53696d706c65537761703a2063616e6e6f74207061792063616c6c6572000000604082015260600190565b60208082526018908201527f696e76616c696420697373756572207369676e61747572650000000000000000604082015260600190565b6020808252601d908201527f696e76616c69642062656e6566696369617279207369676e6174757265000000604082015260600190565b6020808252600f908201526e1d1c985b9cd9995c8819985a5b1959608a1b604082015260600190565b928352602083019190915260408201526060019056fe45434453413a20696e76616c6964207369676e6174757265202773272076616c756545434453413a20696e76616c6964207369676e6174757265202776272076616c7565a2646970667358221220b270820590249f6db00f7142812273c92ea84cea0862f4083a5c75edd08f437264736f6c63430007060033__TOKEN_ADDRESS__
readonly FACTORY_BIN=0x608060405234801561001057600080fd5b50604051611df2380380611df283398101604081905261002f91610112565b600180546001600160a01b0319166001600160a01b03831617905560405160009061005990610105565b604051809103906000f080158015610075573d6000803e3d6000fd5b506040516343431f6360e11b81529091506001600160a01b038216906386863ec6906100ab906001906000908190600401610140565b600060405180830381600087803b1580156100c557600080fd5b505af11580156100d9573d6000803e3d6000fd5b5050600280546001600160a01b0319166001600160a01b03949094169390931790925550610164915050565b6118e58061050d83390190565b600060208284031215610123578081fd5b81516001600160a01b0381168114610139578182fd5b9392505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b61039a806101736000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806315efd8a714610051578063a6021ace1461007a578063c70242ad14610082578063ee97f7f3146100a2575b600080fd5b61006461005f3660046102d6565b6100aa565b6040516100719190610308565b60405180910390f35b6100646101bb565b6100956100903660046102b5565b6101ca565b6040516100719190610359565b6100646101df565b60025460405160009182916100ee916001600160a01b0316906100d3903390879060200161031c565b604051602081830303815290604052805190602001206101ee565b6001546040516343431f6360e11b81529192506001600160a01b03808416926386863ec692610126928a929116908990600401610335565b600060405180830381600087803b15801561014057600080fd5b505af1158015610154573d6000803e3d6000fd5b5050506001600160a01b03821660009081526020819052604090819020805460ff19166001179055517fc0ffc525a1c7689549d7f79b49eca900e61ac49b43d977f680bcc3b36224c00491506101ab908390610308565b60405180910390a1949350505050565b6001546001600160a01b031681565b60006020819052908152604090205460ff1681565b6002546001600160a01b031681565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528360601b60148201526e5af43d82803e903d91602b57fd5bf360881b6028820152826037826000f59150506001600160a01b038116610293576040805162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c6564000000000000000000604482015290519081900360640190fd5b92915050565b80356001600160a01b03811681146102b057600080fd5b919050565b6000602082840312156102c6578081fd5b6102cf82610299565b9392505050565b6000806000606084860312156102ea578182fd5b6102f384610299565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b90151581526020019056fea2646970667358221220b260612b64b2388a58a0d557b99cc9121129d7c5aaa1c649d70eac8f0870b29c64736f6c63430007060033608060405234801561001057600080fd5b506118c5806100206000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c8063946f46a2116100c3578063b7ec1a331161007c578063b7ec1a331461027f578063c49f91d314610287578063c76a4d311461028f578063d4c9a8e8146102a2578063e0bcf13a146102b5578063fc0c546a146102bd5761014d565b8063946f46a214610211578063b6343b0d14610224578063b648b41714610247578063b69ef8a81461025c578063b777035014610264578063b7998907146102775761014d565b80631d143848116101155780631d143848146101a85780632e1a7d4d146101bd578063338f3fed146101d0578063488b017c146101e357806381f03fcb146101eb57806386863ec6146101fe5761014d565b80630d5f26591461015257806312101021146101675780631357e1dc1461018557806315c3343f1461018d5780631633fb1d14610195575b600080fd5b61016561016036600461146b565b6102c5565b005b61016f6102d8565b60405161017c9190611563565b60405180910390f35b61016f6102de565b61016f6102e4565b6101656101a33660046113ae565b610308565b6101b061036c565b60405161017c919061152b565b6101656101cb3660046114e0565b61037b565b6101656101de366004611442565b610473565b61016f610556565b61016f6101f9366004611359565b61057a565b61016561020c366004611373565b61058c565b61016561021f366004611359565b610610565b610237610232366004611359565b6106d0565b60405161017c94939291906115c7565b61024f6106f7565b60405161017c9190611558565b61016f610707565b610165610272366004611442565b61078d565b61016f610867565b61016f61088b565b61016f6108a1565b61016f61029d366004611359565b6108c5565b6101656102b036600461146b565b6108f8565b61016f6109b4565b6101b06109ba565b6102d33384846000856109c9565b505050565b60005481565b60035481565b7f48ebe6deff4a5ee645c01506a026031e2a945d6f41f1f4e5098ad65347492c1281565b61031e6103183033878987610dd2565b84610e30565b6001600160a01b0316866001600160a01b0316146103575760405162461bcd60e51b815260040161034e906117d5565b60405180910390fd5b61036486868685856109c9565b505050505050565b6006546001600160a01b031681565b6006546001600160a01b031633146103a55760405162461bcd60e51b815260040161034e906115e2565b6103ad61088b565b8111156103cc5760405162461bcd60e51b815260040161034e90611695565b60015460065460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb9261040292911690859060040161153f565b602060405180830381600087803b15801561041c57600080fd5b505af1158015610430573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045491906114c0565b6104705760405162461bcd60e51b815260040161034e9061180c565b50565b6006546001600160a01b0316331461049d5760405162461bcd60e51b815260040161034e90611665565b6104a5610707565b6005546104b29083610e7f565b11156104d05760405162461bcd60e51b815260040161034e90611730565b6001600160a01b038216600090815260046020526040902080546104f49083610e7f565b81556005546105039083610e7f565b6005556000600382015580546040516001600160a01b038516917f2506c43272ded05d095b91dbba876e66e46888157d3e078db5691496e96c5fad916105499190611563565b60405180910390a2505050565b7f7d824962dd0f01520922ea1766c987b1db570cd5db90bdba5ccf5e320607950281565b60026020526000908152604090205481565b6001600160a01b0383166105b25760405162461bcd60e51b815260040161034e9061163d565b6006546001600160a01b0316156105db5760405162461bcd60e51b815260040161034e906116cc565b600680546001600160a01b039485166001600160a01b0319918216179091556001805493909416921691909117909155600055565b6001600160a01b03811660009081526004602052604090206003810154421080159061063f5750600381015415155b61065b5760405162461bcd60e51b815260040161034e90611606565b6001810154815461066b91610ee0565b815560006003820155600181015460055461068591610ee0565b60055580546040516001600160a01b038416917f2506c43272ded05d095b91dbba876e66e46888157d3e078db5691496e96c5fad916106c49190611563565b60405180910390a25050565b60046020526000908152604090208054600182015460028301546003909301549192909184565b600654600160a01b900460ff1681565b6001546040516370a0823160e01b81526000916001600160a01b0316906370a082319061073890309060040161152b565b60206040518083038186803b15801561075057600080fd5b505afa158015610764573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078891906114f8565b905090565b6006546001600160a01b031633146107b75760405162461bcd60e51b815260040161034e90611665565b6001600160a01b038216600090815260046020526040902080548211156107f05760405162461bcd60e51b815260040161034e906116f9565b6000816002015460001461080857816002015461080c565b6000545b4281016003840155600183018490556040519091506001600160a01b038516907fc8305077b495025ec4c1d977b176a762c350bb18cad4666ce1ee85c32b78698a90610859908690611563565b60405180910390a250505050565b7fe95f353750f192082df064ca5142d3a2d6f0bef0f3ffad66d80d8af86b7a749a81565b600061078860055461089b610707565b90610ee0565b7fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e81565b6001600160a01b0381166000908152600460205260408120546108f0906108ea61088b565b90610e7f565b90505b919050565b6006546001600160a01b031633146109225760405162461bcd60e51b815260040161034e906115e2565b610936610930308585610f3d565b82610e30565b6001600160a01b0316836001600160a01b0316146109665760405162461bcd60e51b815260040161034e906117d5565b6001600160a01b03831660008181526004602052604090819020600201849055517f7b816003a769eb718bd9c66bdbd2dd5827da3f92bc6645276876bd7957b08cf090610549908590611563565b60055481565b6001546001600160a01b031681565b6006546001600160a01b03163314610a16576109e9610930308786610f95565b6006546001600160a01b03908116911614610a165760405162461bcd60e51b815260040161034e9061179e565b6001600160a01b038516600090815260026020526040812054610a3a908590610ee0565b90506000610a5082610a4b896108c5565b610fce565b6001600160a01b03881660009081526004602052604081205491925090610a78908390610fce565b905084821015610a9a5760405162461bcd60e51b815260040161034e90611767565b8015610aed576001600160a01b038816600090815260046020526040902054610ac39082610ee0565b6001600160a01b038916600090815260046020526040902055600554610ae99082610ee0565b6005555b6001600160a01b038816600090815260026020526040902054610b109083610e7f565b6001600160a01b038916600090815260026020526040902055600354610b369083610e7f565b600355828214610b7d576006805460ff60a01b1916600160a01b1790556040517f3f4449c047e11092ec54dc0751b6b4817a9162745de856c893a26e611d18ffc490600090a15b8415610ccf5760015460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610bb5903390899060040161153f565b602060405180830381600087803b158015610bcf57600080fd5b505af1158015610be3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0791906114c0565b610c235760405162461bcd60e51b815260040161034e9061180c565b6001546001600160a01b031663a9059cbb88610c3f8589610ee0565b6040518363ffffffff1660e01b8152600401610c5c92919061153f565b602060405180830381600087803b158015610c7657600080fd5b505af1158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae91906114c0565b610cca5760405162461bcd60e51b815260040161034e9061180c565b610d6f565b60015460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610d01908a90869060040161153f565b602060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5391906114c0565b610d6f5760405162461bcd60e51b815260040161034e9061180c565b336001600160a01b0316876001600160a01b0316896001600160a01b03167f950494fc3642fae5221b6c32e0e45765c95ebb382a04a71b160db0843e74c99f858a8a604051610dc093929190611835565b60405180910390a45050505050505050565b60007f7d824962dd0f01520922ea1766c987b1db570cd5db90bdba5ccf5e32060795028686868686604051602001610e0f96959493929190611591565b60405160208183030381529060405280519060200120905095945050505050565b600080610e43610e3e610fe4565b61103e565b84604051602001610e55929190611510565b604051602081830303815290604052805190602001209050610e7781846110ae565b949350505050565b600082820183811015610ed9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600082821115610f37576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60007fe95f353750f192082df064ca5142d3a2d6f0bef0f3ffad66d80d8af86b7a749a848484604051602001610f76949392919061156c565b6040516020818303038152906040528051906020012090509392505050565b60007f48ebe6deff4a5ee645c01506a026031e2a945d6f41f1f4e5098ad65347492c12848484604051602001610f76949392919061156c565b6000818310610fdd5781610ed9565b5090919050565b610fec6112ac565b506040805160a081018252600a6060820190815269436865717565626f6f6b60b01b608083015281528151808301835260038152620312e360ec1b602082810191909152820152469181019190915290565b60007fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e826000015180519060200120836020015180519060200120846040015160405160200161109194939291906115c7565b604051602081830303815290604052805190602001209050919050565b60008151604114611106576040805162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015290519081900360640190fd5b60208201516040830151606084015160001a6111248682858561112e565b9695505050505050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561118f5760405162461bcd60e51b815260040180806020018281038252602281526020018061184c6022913960400191505060405180910390fd5b8360ff16601b14806111a457508360ff16601c145b6111df5760405162461bcd60e51b815260040180806020018281038252602281526020018061186e6022913960400191505060405180910390fd5b600060018686868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561123b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166112a3576040805162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015290519081900360640190fd5b95945050505050565b60405180606001604052806060815260200160608152602001600081525090565b80356001600160a01b03811681146108f357600080fd5b600082601f8301126112f4578081fd5b813567ffffffffffffffff8082111561130957fe5b604051601f8301601f19168101602001828111828210171561132757fe5b60405282815284830160200186101561133e578384fd5b82602086016020830137918201602001929092529392505050565b60006020828403121561136a578081fd5b610ed9826112cd565b600080600060608486031215611387578182fd5b611390846112cd565b925061139e602085016112cd565b9150604084013590509250925092565b60008060008060008060c087890312156113c6578182fd5b6113cf876112cd565b95506113dd602088016112cd565b945060408701359350606087013567ffffffffffffffff80821115611400578384fd5b61140c8a838b016112e4565b94506080890135935060a0890135915080821115611428578283fd5b5061143589828a016112e4565b9150509295509295509295565b60008060408385031215611454578182fd5b61145d836112cd565b946020939093013593505050565b60008060006060848603121561147f578283fd5b611488846112cd565b925060208401359150604084013567ffffffffffffffff8111156114aa578182fd5b6114b6868287016112e4565b9150509250925092565b6000602082840312156114d1578081fd5b81518015158114610ed9578182fd5b6000602082840312156114f1578081fd5b5035919050565b600060208284031215611509578081fd5b5051919050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b9384526001600160a01b03928316602085015291166040830152606082015260800190565b9586526001600160a01b03948516602087015292841660408601526060850191909152909116608083015260a082015260c00190565b93845260208401929092526040830152606082015260800190565b6020808252600a90820152693737ba1034b9b9bab2b960b11b604082015260600190565b60208082526019908201527f6465706f736974206e6f74207965742074696d6564206f757400000000000000604082015260600190565b6020808252600e908201526d34b73b30b634b21034b9b9bab2b960911b604082015260600190565b60208082526016908201527529b4b6b83632a9bbb0b81d103737ba1034b9b9bab2b960511b604082015260600190565b6020808252601c908201527f6c697175696442616c616e6365206e6f742073756666696369656e7400000000604082015260600190565b602080825260139082015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604082015260600190565b6020808252601b908201527f68617264206465706f736974206e6f742073756666696369656e740000000000604082015260600190565b6020808252601c908201527f68617264206465706f73697420657863656564732062616c616e636500000000604082015260600190565b6020808252601d908201527f53696d706c65537761703a2063616e6e6f74207061792063616c6c6572000000604082015260600190565b60208082526018908201527f696e76616c696420697373756572207369676e61747572650000000000000000604082015260600190565b6020808252601d908201527f696e76616c69642062656e6566696369617279207369676e6174757265000000604082015260600190565b6020808252600f908201526e1d1c985b9cd9995c8819985a5b1959608a1b604082015260600190565b928352602083019190915260408201526060019056fe45434453413a20696e76616c6964207369676e6174757265202773272076616c756545434453413a20696e76616c6964207369676e6174757265202776272076616c7565a2646970667358221220b270820590249f6db00f7142812273c92ea84cea0862f4083a5c75edd08f437264736f6c63430007060033__TOKEN_ADDRESS__
readonly TOKEN_MINT_DATA=0x40c10f19__RECIPIENT____AMOUNT__
readonly STAKING_BIN="${STAKING_BYTECODE}"
readonly POSTAGE_STAMP_BIN="${POSTAGE_STAMP_BYTECODE}"
readonly INCENTIVES_PRICE_ORACLE_BIN="${INCENTIVES_PRICE_ORACLE_BYTECODE}"
readonly REDISTRIBUTION_BIN="${REDISTRIBUTION_BYTECODE}"
readonly SWAP_PRICE_ORACLE_BIN=0x608060405234801561001057600080fd5b5060405161043038038061043083398101604081905261002f91610096565b61003833610046565b6001919091556002556100ba565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100a957600080fd5b505080516020909101519092909150565b610367806100c96000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806398d5fdca1161005b57806398d5fdca146100dd578063a035b1fe146100f8578063dd4899321461010f578063f2fde38b1461011857600080fd5b8063710f2dd11461008d578063715018a6146100a25780638d6cc56d146100aa5780638da5cb5b146100bd575b600080fd5b6100a061009b3660046102e8565b61012b565b005b6100a061016f565b6100a06100b83660046102e8565b610183565b6000546040516001600160a01b0390911681526020015b60405180910390f35b600154600254604080519283526020830191909152016100d4565b61010160015481565b6040519081526020016100d4565b61010160025481565b6100a0610126366004610301565b6101c0565b61013361023e565b60028190556040518181527f0f45948e42a1e34f851df8452200e744563dae2029a99b8178ff6530458bd3df906020015b60405180910390a150565b61017761023e565b6101816000610298565b565b61018b61023e565b60018190556040518181527fae46785019700e30375a5d7b4f91e32f8060ef085111f896ebf889450aa2ab5a90602001610164565b6101c861023e565b6001600160a01b0381166102325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61023b81610298565b50565b6000546001600160a01b031633146101815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610229565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102fa57600080fd5b5035919050565b60006020828403121561031357600080fd5b81356001600160a01b038116811461032a57600080fd5b939250505056fea2646970667358221220cc0eb1563cb11f13344db1e6c2ca1f5562f241aaf91c5e2eaf8b21e5d97962f264736f6c6343000813003300000000000000000000000000000000000000000000000000000000000186a00000000000000000000000000000000000000000000000000000000000000064
function to_hex() {
printf '0x%x\n' $1
}
function to_abi_hex() {
printf "%0$2x" "$1" | tr ' ' '0'
}
function to_abi_address() {
left_pad $(echo "$1" | cut -c 3-) 64
}
function left_pad() {
printf "%0$2s" "$1" | tr ' ' '0'
}
function jsonrpc_raw() {
curl -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"$1\",\"params\":$2, \"id\":\"1\" }" "$BACKEND"
}
function jsonrpc() {
local ret
ret=$(jsonrpc_raw "$1" "$2")
if test $? -eq 7
then
echo could not connect to backend >&2
return 2
fi
if echo "$ret" | jq -e .error > /dev/null
then
echo "$ret" | jq -e .error >&2
return 1
else
echo "$ret" | jq -e .result
fi
}
function eth_accounts() {
jsonrpc eth_accounts "[]"
}
function primary_account() {
eth_accounts | jq -r '.[0]'
}
function eth_sendTransaction() {
local args=''
[ ! -z ${FROM+x} ] && args="$args --arg from $FROM"
[ ! -z ${TO+x} ] && args="$args --arg to $TO"
[ ! -z ${VALUE+x} ] && args="$args --arg value $(to_hex $VALUE)"
[ ! -z ${DATA+x} ] && args="$args --arg data $DATA"
[ ! -z ${GAS+x} ] && args="$args --arg gas $(to_hex $GAS)"
jsonrpc eth_sendTransaction "$(jq -n $args '[. + $ARGS.named'])" | jq -r
}
function wait_for_tx() {
local txhash="$1"
while
local receipt=$(jsonrpc eth_getTransactionReceipt "[\"$txhash\"]")
[ "$receipt" == "null" ]
do
sleep 1
done
echo "$receipt"
}
function wait_for_deploy() {
wait_for_tx "$@" | jq -r .contractAddress
}
function mint_erc20() {
local data=$(echo $TOKEN_MINT_DATA | sed -e "s.__RECIPIENT__.$(to_abi_address $2)." -e "s.__AMOUNT__.$(to_abi_hex $3 64).")
wait_for_tx $(FROM=$(primary_account) TO="$1" DATA="$data" eth_sendTransaction)
}
function grantPriceOracleRole() {
wait_for_tx $(FROM=$(primary_account) TO="$1" DATA="0x2f2ff15ddd24a0f121e5ab7c3e97c63eaaf859e0b46792c3e0edfd86e2b3ad50f63011d8$(to_abi_address $2)" eth_sendTransaction)
}
function grantRedistributorRole() {
wait_for_tx $(FROM=$(primary_account) TO="$1" DATA="0x2f2ff15d3e35b14a9f4fef84b59f9bdcd3044fc28783144b7e42bfb2cd075e6a02cb0828$(to_abi_address $2)" eth_sendTransaction)
}
function grantPriceUpdaterRole() {
wait_for_tx $(FROM=$(primary_account) TO="$1" DATA="0x2f2ff15d74b366a297145849fa9687e16ecad1e3a60cf84f6c2256ae73e20a9f76669804$(to_abi_address $2)" eth_sendTransaction)
}
function setPriceTriggerEvent() {
wait_for_tx $(FROM=$(primary_account) TO="$1" DATA="0xdaafe0a50000000000000000000000000000000000000000000000000000000000005dc0" eth_sendTransaction)
}
PRIMARY_ACCOUNT=$(primary_account)
echo found primary account $PRIMARY_ACCOUNT >&2
TOKEN_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA=$TOKEN_BIN GAS=3500000 eth_sendTransaction))
echo deployed token to $TOKEN_ADDRESS >&2
PATCHED_LEGACY_FACTORY_BIN=$(echo $LEGACY_FACTORY_BIN | sed -e "s.__TOKEN_ADDRESS__.$(to_abi_address $TOKEN_ADDRESS).")
LEGACY_FACTORY_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA=$PATCHED_LEGACY_FACTORY_BIN GAS=3500000 eth_sendTransaction))
echo deployed legacy factory to $LEGACY_FACTORY_ADDRESS >&2
POSTAGE_STAMP_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA="${POSTAGE_STAMP_BIN}$(to_abi_address $TOKEN_ADDRESS)$(to_abi_hex 16 64)$(to_abi_address $PRIMARY_ACCOUNT)" GAS=3500000 eth_sendTransaction))
echo deployed postage stamp contract to $POSTAGE_STAMP_ADDRESS >&2
SWAP_PRICE_ORACLE_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA="${SWAP_PRICE_ORACLE_BIN}$(to_abi_hex 100000 64)$(to_abi_hex 1 64)" GAS=3500000 eth_sendTransaction))
echo deployed swap price oracle contract to $SWAP_PRICE_ORACLE_ADDRESS >&2
PATCHED_FACTORY_BIN=$(echo $FACTORY_BIN | sed -e "s.__TOKEN_ADDRESS__.$(to_abi_address $TOKEN_ADDRESS).")
FACTORY_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA=$PATCHED_FACTORY_BIN GAS=3500000 eth_sendTransaction))
echo deployed factory to $FACTORY_ADDRESS >&2
INCENTIVES_PRICE_ORACLE_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA="${INCENTIVES_PRICE_ORACLE_BIN}$(to_abi_address $POSTAGE_STAMP_ADDRESS)$(to_abi_address $PRIMARY_ACCOUNT)" GAS=3500000 eth_sendTransaction))
echo deployed incentives price oracle contract to $INCENTIVES_PRICE_ORACLE_ADDRESS >&2
STAKING_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA="${STAKING_BIN}$(to_abi_address $TOKEN_ADDRESS)$(to_abi_hex 12345 64)$(to_abi_address $PRIMARY_ACCOUNT)" GAS=3500000 eth_sendTransaction))
echo deployed staking contract to $STAKING_ADDRESS >&2
REDISTRIBUTION_ADDRESS=$(wait_for_deploy $(FROM=$PRIMARY_ACCOUNT DATA="${REDISTRIBUTION_BIN}$(to_abi_address $STAKING_ADDRESS)$(to_abi_address $POSTAGE_STAMP_ADDRESS)$(to_abi_address $INCENTIVES_PRICE_ORACLE_ADDRESS)$(to_abi_address $PRIMARY_ACCOUNT)" GAS=3500000 eth_sendTransaction))
echo deployed redistribution contract to $REDISTRIBUTION_ADDRESS >&2
grantPriceOracleRole $POSTAGE_STAMP_ADDRESS $PRIMARY_ACCOUNT > /dev/null &
grantRedistributorRole $POSTAGE_STAMP_ADDRESS $REDISTRIBUTION_ADDRESS > /dev/null &
grantRedistributorRole $STAKING_ADDRESS $REDISTRIBUTION_ADDRESS > /dev/null &
grantPriceUpdaterRole $INCENTIVES_PRICE_ORACLE_ADDRESS $REDISTRIBUTION_ADDRESS > /dev/null &
setPriceTriggerEvent $INCENTIVES_PRICE_ORACLE_ADDRESS > /dev/null &
for NODEACCOUNT in $BZZACCOUNTS
do
echo "minting tokens for $NODEACCOUNT" >&2
mint_erc20 $TOKEN_ADDRESS 0x$NODEACCOUNT 1000000000000000000 > /dev/null &
echo "sending eth to $NODEACCOUNT" >&2
wait_for_tx $(FROM=$PRIMARY_ACCOUNT TO=0x$NODEACCOUNT VALUE=1000000000000000000 eth_sendTransaction) > /dev/null &
done
wait
echo "----- USE THE COMMANDS BELOW TO SETUP YOUR TERMINALS -----" >&2
echo export BEE_SWAP_ENDPOINT=$BACKEND
echo export BEE_SWAP_FACTORY_ADDRESS=$FACTORY_ADDRESS
echo export BEE_SWAP_PRICE_ORACLE_ADDRESS=$SWAP_PRICE_ORACLE_ADDRESS
echo export BEE_SWAP_LEGACY_FACTORY_ADDRESSES=$LEGACY_FACTORY_ADDRESS
echo export BEE_STAKING_ADDRESS=$STAKING_ADDRESS
echo export BEE_POSTAGE_STAMP_ADDRESS=$POSTAGE_STAMP_ADDRESS
echo export BEE_INCENTIVES_PRICE_ORACLE_ADDRESS=$INCENTIVES_PRICE_ORACLE_ADDRESS
echo export BEE_REDISTRIBUTION_ADDRESS=$REDISTRIBUTION_ADDRESS