Guest User

Npip4 reward model v2

a guest
Aug 20th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var networkWeightStart = networkWeight = 20000000
  2.  
  3. var balance1Start = balance1 = 1000000
  4. var balance2Start = balance2 = 100000
  5. var balance3Start = balance3 = 10000
  6. var balance4Start = balance4 = 1000
  7.  
  8. var blockReward = 2
  9.  
  10. var blocktime = 30 //seconds
  11.  
  12. var blocksYear = 60 / blocktime * 60 * 24 * 365
  13.  
  14. for (var i=0; i<blocksYear; i++) {
  15.  
  16.   networkWeight += 2
  17.  
  18.   if (i % (networkWeight/balance1) < 1) balance1 += 2
  19.   else if (i % (networkWeight/balance2) < 1) balance2 += 2
  20.   else if (i % (networkWeight/balance3) < 1) balance3 += 2
  21.   else if (i % (networkWeight/balance4) < 1) balance4 += 2
  22.  
  23. }
  24.  
  25. console.log('|--------------------------------------------------------------|')
  26. console.log('| Staker          |', 'Balance Start |', 'Balance End |', 'Percent Gain |')
  27. console.log('|--------------------------------------------------------------|')
  28. console.log('| balance1        |', balance1Start + '       |', balance1 + '     |', Math.round((balance1/balance1Start-1)*10000)/100 + '%       |')
  29. console.log('| balance2        |', balance2Start + '        |', balance2 + '      |', Math.round((balance2/balance2Start-1)*10000)/100 + '%       |')
  30. console.log('| balance3        |', balance3Start + '         |', balance3 + '       |', Math.round((balance3/balance3Start-1)*10000)/100 + '%       |')
  31. console.log('| balance4        |', balance4Start + '          |', balance4 + '        |', Math.round((balance4/balance4Start-1)*10000)/100 + '%        |')
  32. console.log('| network weight  |', networkWeightStart + '      |', networkWeight + '    |', Math.round((networkWeight/networkWeightStart-1)*10000)/100 + '%       |')
  33. console.log('|--------------------------------------------------------------|')
Advertisement
Add Comment
Please, Sign In to add comment