Skip to content

Commit f4a8d6b

Browse files
committed
update
1 parent c908914 commit f4a8d6b

File tree

1 file changed

+23
-43
lines changed
  • amisforum/live/conference

1 file changed

+23
-43
lines changed

amisforum/live/conference/app.js

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ var name = undefined;
5454
var symbol = undefined;
5555
var allowance = undefined;
5656
var safeLowGasPrice = setSafeLowGasPrice();
57-
var numRegistrants = getNumRegistrants();
5857
var quota = getQuota();
5958
var ticketIsValid = true;
6059

6160

6261
setInterval(function() {
63-
getNumRegistrants();
6462
getQuota();
6563
getTickets();
6664
total = quota - numRegistrants;
@@ -194,8 +192,29 @@ function getEthBalance() {
194192
}
195193
}))
196194
}
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+
});
199218
// createWallet
200219
function createWallet(password) {
201220

@@ -238,11 +257,6 @@ function getBalance(address) {
238257
return web3.fromWei(web3.eth.getBalance(address).toNumber(), 'ether');
239258
}
240259

241-
242-
243-
244-
245-
246260
// switch to hooked3webprovider which allows for external Tx signing
247261
// (rather than signing from a wallet in the Ethereum client)
248262
function switchToHooked3(_keystore) {
@@ -273,28 +287,6 @@ function fundEth(newAddress, amt) {
273287
$("#balance").html(getBalance(toAddr));
274288
});
275289
}
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-
298290
window.onload = function() {
299291

300292
web3.eth.getAccounts(function(err, accs) {
@@ -352,18 +344,6 @@ window.onload = function() {
352344
$("#balance").html(getBalance(address));
353345
});
354346

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-
367347
// Set value of wallet to accounts[1]
368348
$("#buyerAddress").val(accounts);
369349
$("#refBuyerAddress").val(accounts);

0 commit comments

Comments
 (0)