@@ -54,13 +54,11 @@ var name = undefined;
54
54
var symbol = undefined ;
55
55
var allowance = undefined ;
56
56
var safeLowGasPrice = setSafeLowGasPrice ( ) ;
57
- var numRegistrants = getNumRegistrants ( ) ;
58
57
var quota = getQuota ( ) ;
59
58
var ticketIsValid = true ;
60
59
61
60
62
61
setInterval ( function ( ) {
63
- getNumRegistrants ( ) ;
64
62
getQuota ( ) ;
65
63
getTickets ( ) ;
66
64
total = quota - numRegistrants ;
@@ -194,8 +192,29 @@ function getEthBalance() {
194
192
}
195
193
} ) )
196
194
}
197
-
198
-
195
+ function setSafeLowGasPrice ( ) {
196
+ var HttpClient = function ( ) {
197
+ this . get = function ( aUrl , aCallback ) {
198
+ var anHttpRequest = new XMLHttpRequest ( ) ;
199
+ anHttpRequest . onreadystatechange = function ( ) {
200
+ if ( anHttpRequest . readyState == 4 && anHttpRequest . status == 200 )
201
+ aCallback ( anHttpRequest . responseText ) ;
202
+ }
203
+ anHttpRequest . open ( "GET" , aUrl , true ) ;
204
+ anHttpRequest . send ( null ) ;
205
+ }
206
+ }
207
+ var theurl = 'https://www.etherchain.org/api/gasPriceOracle' ;
208
+ var client = new HttpClient ( ) ;
209
+ client . get ( theurl , function ( response ) {
210
+ var response1 = JSON . parse ( response ) ;
211
+
212
+ safeLowGasPrice = response1 . safeLow ;
213
+ } ) ;
214
+ }
215
+ $ ( '#contract' ) . click ( function ( ) {
216
+ window . open ( etherscanUrl , '_blank' ) ;
217
+ } ) ;
199
218
// createWallet
200
219
function createWallet ( password ) {
201
220
@@ -238,11 +257,6 @@ function getBalance(address) {
238
257
return web3 . fromWei ( web3 . eth . getBalance ( address ) . toNumber ( ) , 'ether' ) ;
239
258
}
240
259
241
-
242
-
243
-
244
-
245
-
246
260
// switch to hooked3webprovider which allows for external Tx signing
247
261
// (rather than signing from a wallet in the Ethereum client)
248
262
function switchToHooked3 ( _keystore ) {
@@ -273,28 +287,6 @@ function fundEth(newAddress, amt) {
273
287
$ ( "#balance" ) . html ( getBalance ( toAddr ) ) ;
274
288
} ) ;
275
289
}
276
-
277
- function setSafeLowGasPrice ( ) {
278
- var HttpClient = function ( ) {
279
- this . get = function ( aUrl , aCallback ) {
280
- var anHttpRequest = new XMLHttpRequest ( ) ;
281
- anHttpRequest . onreadystatechange = function ( ) {
282
- if ( anHttpRequest . readyState == 4 && anHttpRequest . status == 200 )
283
- aCallback ( anHttpRequest . responseText ) ;
284
- }
285
- anHttpRequest . open ( "GET" , aUrl , true ) ;
286
- anHttpRequest . send ( null ) ;
287
- }
288
- }
289
- var theurl = 'https://www.etherchain.org/api/gasPriceOracle' ;
290
- var client = new HttpClient ( ) ;
291
- client . get ( theurl , function ( response ) {
292
- var response1 = JSON . parse ( response ) ;
293
-
294
- safeLowGasPrice = response1 . safeLow ;
295
- } ) ;
296
- }
297
-
298
290
window . onload = function ( ) {
299
291
300
292
web3 . eth . getAccounts ( function ( err , accs ) {
@@ -352,18 +344,6 @@ window.onload = function() {
352
344
$ ( "#balance" ) . html ( getBalance ( address ) ) ;
353
345
} ) ;
354
346
355
- function getEthBalance ( ) {
356
- contractInstance . getEthBalanceOf ( web3 . eth . accounts [ 0 ] , ( ( error , result ) => {
357
- if ( ! error ) {
358
- balance = result ;
359
- $ ( '#balance' ) . text ( "BALANCE: " + web3 . fromWei ( result , 'ether' ) + " ETH" ) ;
360
- $ ( '#user_balance' ) . text ( "AVAILABLE BALANCE: " + web3 . fromWei ( result , 'ether' ) + " ETH" ) ;
361
- } else {
362
- console . log ( "FAILED TO GET ETH BALANCE" ) ;
363
- }
364
- } ) )
365
- }
366
-
367
347
// Set value of wallet to accounts[1]
368
348
$ ( "#buyerAddress" ) . val ( accounts ) ;
369
349
$ ( "#refBuyerAddress" ) . val ( accounts ) ;
0 commit comments