Fix zen market stats, Add payment page example (#153)

* Update paymentProcessor.js

Fix market stats for zen

* Update paymentProcessor.js

* Update zcash_testnet.json

Undo ZEN changes to zcash file.

* Update zcash.json

Undo ZEN changes to zcash file.

* Update website.js

Add example payments page.

* Create payments.html

* Update payments.html

* Update payments.html
This commit is contained in:
hellcatz 2017-06-03 22:32:41 -07:00 committed by Procrastinator
parent 8fd1d7eceb
commit f6f6f0c712
5 changed files with 33 additions and 7 deletions

View File

@ -5,8 +5,8 @@
"requireShielding": true,
"payFoundersReward": true,
"percentFoundersReward": 20,
"maxFoundersRewardBlockHeight": 839999,
"foundersRewardAddressChangeInterval": 17500,
"maxFoundersRewardBlockHeight": 849999,
"foundersRewardAddressChangeInterval": 17709.3125,
"vFoundersRewardAddress": [
"t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"t3cL9AucCajm3HXDhb5jBnJK2vapVoXsop3",

View File

@ -5,8 +5,8 @@
"requireShielding": true,
"payFoundersReward": true,
"percentFoundersReward": 20,
"maxFoundersRewardBlockHeight": 839999,
"foundersRewardAddressChangeInterval": 17500,
"maxFoundersRewardBlockHeight": 849999,
"foundersRewardAddressChangeInterval": 17709.3125,
"vFoundersRewardAddress": [
"t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi", "t2N9PH9Wk9xjqYg9iin1Ua3aekJqfAtE543", "t2NGQjYMQhFndDHguvUw4wZdNdsssA6K7x2", "t2ENg7hHVqqs9JwU5cgjvSbxnT2a9USNfhy",
"t2BkYdVCHzvTJJUTx4yZB8qeegD8QsPx8bo", "t2J8q1xH1EuigJ52MfExyyjYtN3VgvshKDf", "t2Crq9mydTm37kZokC68HzT6yez3t2FBnFj", "t2EaMPUiQ1kthqcP5UEkF42CAFKJqXCkXC9",

View File

@ -311,7 +311,10 @@ function SetupForPool(logger, poolOptions, setupFinished){
function cacheMarketStats() {
var marketStatsUpdate = [];
var coin = logComponent.replace('_testnet', '');
var coin = logComponent.replace('_testnet', '').toLowerCase();
if (coin == 'zen')
coin = 'zencash';
request('https://api.coinmarketcap.com/v1/ticker/'+coin+'/', function (error, response, body) {
if (error) {
logger.error(logSystem, logComponent, 'Error with http request to https://api.coinmarketcap.com/ ' + JSON.stringify(error));
@ -322,7 +325,7 @@ function SetupForPool(logger, poolOptions, setupFinished){
if (body) {
var data = JSON.parse(body);
if (data.length > 0) {
marketStatsUpdate.push(['hset', coin + ':stats', 'coinmarketcap', JSON.stringify(data)]);
marketStatsUpdate.push(['hset', logComponent + ':stats', 'coinmarketcap', JSON.stringify(data)]);
redisClient.multi(marketStatsUpdate).exec(function(err, results){
if (err){
logger.error(logSystem, logComponent, 'Error with redis during call to cacheMarketStats() ' + JSON.stringify(error));

View File

@ -42,7 +42,8 @@ module.exports = function(logger){
'api.html': 'api',
'admin.html': 'admin',
'mining_key.html': 'mining_key',
'miner_stats.html': 'miner_stats'
'miner_stats.html': 'miner_stats',
'payments.html': 'payments'
};
var pageTemplates = {};

View File

@ -0,0 +1,22 @@
{{ for(var pool in it.stats.pools) { }}
<table>
<thead>
<tr>
<th>Blocks</th>
<th>Time</th>
<th>Miners</th>
<th>Shares</th>
<th>Amount</th>
</tr>
</thead>
{{ for(var p in it.stats.pools[pool].payments) { }}
<tr>
<td>{{=it.stats.pools[pool].payments[p].blocks}}</td>
<td>{{=it.stats.pools[pool].payments[p].time}}</td>
<td>{{=it.stats.pools[pool].payments[p].miners}}</td>
<td>{{=Math.round(it.stats.pools[pool].payments[p].shares)}}</td>
<td>{{=it.stats.pools[pool].payments[p].paid}} {{=it.stats.pools[pool].symbol}}</td>
</tr>
{{ } }}
</table>
{{ } }}