@abcpros/bitcore-wallet-service
Version:
A service for Mutisig HD Bitcoin Wallets
19 lines • 1.09 kB
JavaScript
var Config = require('../../config');
var ELECTRICITY_RATE = Config.fiatRateServiceOpts.lotusProvider.electricityRate;
var MINER_MARGIN = Config.fiatRateServiceOpts.lotusProvider.minerMargin;
var MINING_EFFICIENCY = Config.fiatRateServiceOpts.lotusProvider.miningEfficiency;
module.exports = {
name: 'LotusExplorer',
url: 'https://explorer.givelotus.org/ext/summary',
parseFn: function (raw) {
var currentDiff = +raw.data[0].difficulty;
var hashRate = +raw.data[0].hashrate;
var currentMinerReward = Math.round((Math.log2(currentDiff / 16) + 1) * 130 * 1000000) / 1000000;
var dailyElectricityCost = (((hashRate / MINING_EFFICIENCY) * 24) / 1000) * ELECTRICITY_RATE;
var lotusCost = (dailyElectricityCost * (1 + MINER_MARGIN)) / currentMinerReward / 30 / 24;
var stabilizationFactor = ELECTRICITY_RATE / 100 / lotusCost;
var lotusPrice = lotusCost * (1 + MINER_MARGIN + stabilizationFactor);
return [{ code: 'USD', value: Math.round(lotusPrice * 1000000) / 1000000 }];
}
};
//# sourceMappingURL=lotusexplorer.js.map