Fixed Average Return calculation

release/1.0.1
Alexandre Van de Sande 10 years ago
parent e1bae3771e
commit 671e38fb65
  1. 4
      cmd/mist/assets/qml/views/network-health/205f39107b64acf34cb35d7edb57f47893187a12.js
  2. 2
      cmd/mist/assets/qml/views/network-health/index.html

@ -157,7 +157,7 @@ if(H._super.render.call(this)){for(a&&t.drawCircle(n,n,e.floor(n-a/2),r.get("bor
!function(){"undefined"==typeof web3&&(web3=require("web3"),web3.setProvider(new web3.providers.HttpSyncProvider("http://localhost:8545")))}();
!function(){Template.views_home.created=function(){var e=Blocks.findOne({},{sort:{number:-1}}),t=GeoPattern.generate(e?e.hash:"---");$(".latest-block-info").css("background-image",t.toDataUrl());try{if(void 0!=web3.eth.number)for(currentBlock=web3.eth.number,Blocks.remove({number:{$lt:currentBlock-50}}),i=currentBlock;i>currentBlock-10;i--)Blocks.upsert("block_"+i,{_id:"block_"+i,number:i,gasUsed:web3.eth.block(i).gasUsed,size:web3.eth.block(i).size,time:web3.eth.block(i).time,hash:web3.eth.block(i).hash,miner:web3.eth.block(i).coinbase,uncles:web3.eth.block(i).uncles.Length})}catch(n){console.log("no web3 object")}},Template.views_home.destroyed=function(){},Template.views_home.helpers({blocks:function(){var e=Blocks.find({},{limit:50,sort:{number:-1}}),t=Template.instance();return Tracker.afterFlush(function(){t.view.isRendered&&t.$(".wrapper").css("width",562*e.count()+500+"px")}),e.fetch()},currentBlockPattern:function(){var e=GeoPattern.generate(this.hash);return e?e.toDataUrl():"white"},peerCount:function(){try{return web3.eth.peerCount}catch(e){return"---"}},gasPrice:function(){try{return EthTools.fromWei(web3.eth.gasPrice,"finney")}catch(e){return"---"}},miningSlider:function(){return Miner.mining||0},hashrate:function(){return Miner.hashrate},timeSpent:function(){var e=MiningData.findOne().totalTimeSpent;return e?180>e?Math.round(10*e)/10+"<small> Seconds </small>":10800>e?Math.round(10*e/60)/10+"<small> Minutes </small>":86400>e?Math.round(10*e/3600)/10+"<small> Hours </small>":Math.round(10*e/86400)/10+"<small> Days </small>":"---"},totalRewards:function(){var e=MiningData.findOne().totalRewards;return e&&e>0?1>e?Math.floor(1e5*e)/100+"<small> Finney </small>":e>1e3?Math.floor(e)+"<small> Ether </small>":Math.floor(100*e)/100+"<small> Ether </small>":"---"},averageRewardPerHour:function(){var e=MiningData.findOne().totalRewards,t=MiningData.findOne().totalTimeSpent;if(e&&t>0){var n=3600*e/t;return.001>n?Math.floor(1e5*n)/100+"<small> Finney/h </small>":n>1e3?Math.floor(n)+"<small> Ether/h </small>":Math.floor(100*n)/100+"<small> Ether/h </small>";return reward}return"---"}}),Template.views_home.events({"change input.slider-vertical, input input.slider-vertical":function(e){Miner.mining=Number(e.currentTarget.value)}})}();
!function(){Template.views_home.created=function(){var e=Blocks.findOne({},{sort:{number:-1}}),t=GeoPattern.generate(e?e.hash:"---");$(".latest-block-info").css("background-image",t.toDataUrl());try{if(void 0!=web3.eth.number)for(currentBlock=web3.eth.number,Blocks.remove({number:{$lt:currentBlock-50}}),i=currentBlock;i>currentBlock-10;i--)Blocks.upsert("block_"+i,{_id:"block_"+i,number:i,gasUsed:web3.eth.block(i).gasUsed,size:web3.eth.block(i).size,time:web3.eth.block(i).time,hash:web3.eth.block(i).hash,miner:web3.eth.block(i).coinbase,uncles:web3.eth.block(i).uncles.Length})}catch(n){console.log("no web3 object")}},Template.views_home.destroyed=function(){},Template.views_home.helpers({blocks:function(){var e=Blocks.find({},{limit:50,sort:{number:-1}}),t=Template.instance();return Tracker.afterFlush(function(){t.view.isRendered&&t.$(".wrapper").css("width",562*e.count()+500+"px")}),e.fetch()},currentBlockPattern:function(){var e=GeoPattern.generate(this.hash);return e?e.toDataUrl():"white"},peerCount:function(){try{return web3.eth.peerCount}catch(e){return"---"}},gasPrice:function(){try{return EthTools.fromWei(web3.eth.gasPrice,"finney")}catch(e){return"---"}},miningSlider:function(){return Miner.mining||0},hashrate:function(){return Miner.hashrate},timeSpent:function(){var e=MiningData.findOne().totalTimeSpent;return e?180>e?Math.round(10*e)/10+"<small> Seconds </small>":10800>e?Math.round(10*e/60)/10+"<small> Minutes </small>":86400>e?Math.round(10*e/3600)/10+"<small> Hours </small>":Math.round(10*e/86400)/10+"<small> Days </small>":"---"},totalRewards:function(){var e=MiningData.findOne().totalRewards;return e&&e>0?1e3>e?Math.floor(100*e)/100+"<small> Finney </small>":e>1e6?Math.floor(e/1e3).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+"<small> Ether </small>":Math.floor(e/10)/100+"<small> Ether </small>":"---"},averageRewardPerHour:function(){var e=MiningData.findOne().totalRewards,t=MiningData.findOne().totalTimeSpent;if(e&&t>0){var n=3600*e/t;return 1e3>n?Math.floor(100*n)/100+"<small> Finney/h </small>":n>1e6?Math.floor(n/1e3).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+"<small> Ether/h </small>":Math.floor(n/10)/100+"<small> Ether/h </small>";return reward}return"---"}}),Template.views_home.events({"change input.slider-vertical, input input.slider-vertical":function(e){Miner.mining=Number(e.currentTarget.value)}})}();
!function(){Blocks=new Mongo.Collection("blocks",{connection:null}),new PersistentMinimongo(Blocks),MiningData=new Mongo.Collection("miningdata",{connection:null}),new PersistentMinimongo(MiningData),MiningData.findOne()||MiningData.insert({totalTimeSpent:0,lastCoinbaseBalance:0,totalRewards:0})}();
@ -167,7 +167,7 @@ if(H._super.render.call(this)){for(a&&t.drawCircle(n,n,e.floor(n-a/2),r.get("bor
!function(){Router.configure({layoutTemplate:"layout_main",yieldRegions:{layout_header:{to:"header"}},autoRun:!1,autoRender:!1}),Router.route("/",{template:"views_home",name:"home"}),Router.route("/profile",{template:"views_home",name:"userProfile"})}();
!function(){var e=web3.eth.watch("chain");e.changed(function(e){if(e.number=web3.eth.number,Blocks.upsert("block_"+e.number,{_id:"block_"+e.number,number:e.number,gasUsed:web3.eth.block(e.number).gasUsed,size:web3.eth.block(e.number).size,time:web3.eth.block(e.number).time,hash:web3.eth.block(e.number).hash,miner:web3.eth.block(e.number).coinbase,uncles:web3.eth.block(e.number).uncles.Length}),web3.eth.coinbase==web3.eth.block(e.number).coinbase){var a=MiningData.findOne();lastBalance=a.lastCoinbaseBalance||0,WeiToFin=1e15,currentBalance=Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin,blockReward=currentBalance-lastBalance,console.log("New Block! last balance: "+a.lastCoinbaseBalance+" Reward: "+blockReward),MiningData.update(a._id,{$inc:{totalRewards:blockReward}}),MiningData.update(a._id,{$set:{lastCoinbaseBalance:currentBalance}})}else{WeiToFin=1e15,currentBalance=Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin;var a=MiningData.findOne();MiningData.update(a._id,{lastCoinbaseBalance:currentBalance}),console.log("New Block! last balance: "+a.lastCoinbaseBalance)}})}();
!function(){var e=web3.eth.watch("chain");e.changed(function(e){if(e.number=web3.eth.number,Blocks.upsert("block_"+e.number,{_id:"block_"+e.number,number:e.number,gasUsed:web3.eth.block(e.number).gasUsed,size:web3.eth.block(e.number).size,time:web3.eth.block(e.number).time,hash:web3.eth.block(e.number).hash,miner:web3.eth.block(e.number).coinbase,uncles:web3.eth.block(e.number).uncles.Length}),web3.eth.coinbase==web3.eth.block(e.number).coinbase){var a=MiningData.findOne();WeiToFin=1e15,lastBalance=a.lastCoinbaseBalance||Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin,currentBalance=Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin,blockReward=currentBalance-lastBalance,console.log("New Block! last balance: "+a.lastCoinbaseBalance+" Reward: "+blockReward),MiningData.update(a._id,{$inc:{totalRewards:blockReward}}),MiningData.update(a._id,{$set:{lastCoinbaseBalance:currentBalance}})}else{WeiToFin=1e15,currentBalance=Number(web3.toDecimal(web3.eth.balanceAt(web3.eth.coinbase)))/WeiToFin;var a=MiningData.findOne();MiningData.update(a._id,{lastCoinbaseBalance:currentBalance}),console.log("New Block! last balance: "+a.lastCoinbaseBalance)}})}();
!function(){var n=Package.underscore._,e="project",o="project";"project"!=e&&(o=TAPi18n.packages[e].namespace),TAPi18n._enable({helper_name:"_",supported_languages:null,i18n_files_route:"/tap-i18n",cdn_path:null}),TAPi18n.languages_names.en=["English","English"],translations={},translations[o]={app:{loading:"Loading...",offline:"Can't connect are you offline?",logginIn:"Logging in..."},error:{insufficientRights:"You don't have enough rights for this action."},buttons:{ok:"OK",cancel:"Cancel",save:"Save",edit:"edit",send:"Send",create:"Create",tryToReconnect:"Try to reconnect"},commonWords:{you:"You",send:"Send",or:"or","with":"with",and:"and",on:"on",off:"off",per:"per"}},TAPi18n._loadLangFileObject("en",translations)}();

@ -24,7 +24,7 @@
<script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"METEOR@1.0.3.1","ROOT_URL":"http://localhost:3000/","ROOT_URL_PATH_PREFIX":"","appId":"e350zy16p3kznipbx5o","autoupdateVersion":"df83a37bd2952ddbb9ba6c5f2a59e9caba02642b","autoupdateVersionRefreshable":"81118ed5fac9ef5f8d55835426179e1e058da42b","autoupdateVersionCordova":"none"};</script>
<script type="text/javascript" src="0399904a52b6faf064b55942c70f0bf0add60b77.js"></script>
<script type="text/javascript" src="205f39107b64acf34cb35d7edb57f47893187a12.js"></script>
</body>
</html>
Loading…
Cancel
Save