Feat/pool fee in api (#39)

* Initial poolFee commit

This is defined by the following in the pool_config

```
    "poolFee": 0.2,
    "_comment_poolFee": "This is only used for API purpose to display pool fee percentage",
```

* Added poolFee function

This function looks at the user defined `poolFee` in their pool_config and if it doesn't exist it will calculate it based on `rewardRecipients`

* Fix to show %

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Added poolFee

* Spacing fix

* Changing gears -- instead of providing additional configuration, we're
just going to expose the rewardRecipients. This allows the consuming
client to filter community donation addresses, etc. as needed.

In addition, I've replaced all tabs in libs/stats.js with spaces.
This commit is contained in:
zzzpotato 2018-10-31 16:47:01 -05:00 committed by Nate Smith
parent d7826dcad7
commit 250377de5a
1 changed files with 269 additions and 266 deletions

View File

@ -401,6 +401,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
callback(err);
}
else{
for(var i = 0; i < replies.length; i += commandsPerCoin){
var coinName = client.coins[i / commandsPerCoin | 0];
var marketStats = {};
@ -409,10 +410,12 @@ module.exports = function(logger, portalConfig, poolConfigs){
marketStats = replies[i + 2] ? (JSON.parse(replies[i + 2].coinmarketcap)[0] || 0) : 0;
}
}
var coinStats = {
name: coinName,
symbol: poolConfigs[coinName].coin.symbol.toUpperCase(),
algorithm: poolConfigs[coinName].coin.algorithm,
poolFees: poolConfigs[coinName].rewardRecipients,
hashrates: replies[i + 1],
poolStats: {
validShares: replies[i + 2] ? (replies[i + 2].validShares || 0) : 0,