nucypher / nucypher-monitor

NuCypher network intelligence crawler and web dashboard
7 stars 15 forks source link

Add supply information endpoint to status monitor #81

Closed derekpierre closed 4 years ago

derekpierre commented 4 years ago

Fixes #80 .

codecov-io commented 4 years ago

Codecov Report

Merging #81 into master will increase coverage by 3.88%. The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
+ Coverage   47.28%   51.16%   +3.88%     
==========================================
  Files          10       11       +1     
  Lines         977     1069      +92     
==========================================
+ Hits          462      547      +85     
- Misses        515      522       +7     
Impacted Files Coverage Δ
monitor/dashboard.py 19.69% <57.14%> (+0.34%) :arrow_up:
monitor/supply.py 98.80% <98.80%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 627dc2d...881d47b. Read the comment docs.

derekpierre commented 4 years ago

@mswilkison, current output:

{
"current_total_supply": "1008524647.83 NU",
"est_circulating_supply": "389000000 NU",
    "internal_allocations": {
    "company": "200000000 NU",
    "saft": "399000000 NU",
    "team": "106000000 NU",
    "worklock": "225000000 NU"
},
"max_supply": "3885390081.75 NU",
"staking_rewards_supply": "2876865433.91 NU"
}
mswilkison commented 4 years ago

T> @mswilkison, current output:

{
"current_total_supply": "1008524647.83 NU",
"est_circulating_supply": "389000000 NU",
    "internal_allocations": {
    "company": "200000000 NU",
    "saft": "399000000 NU",
    "team": "106000000 NU",
    "worklock": "225000000 NU"
},
"max_supply": "3885390081.75 NU",
"staking_rewards_supply": "2876865433.91 NU"
}

Looks good - since we're nesting internal_allocations under est_circulating_supply maybe it makes sense to only show saft2 there? Since it's essentially the vested/locked allocations. That way the est_circulating_supply + internal_allocations sums to initial_supply, which is more intuitive of a presentation

mswilkison commented 4 years ago

Actually thinking some more, maybe a buildup like the below makes the most sense?

{
"initial_supply": "1000000000 NU",
"inflation_rewards": "8524647.83 NU",
"current_total_supply": "1008524647.83 NU",
"staking_rewards_supply": "2876865433.91 NU",
"max_supply": "3885390081.75 NU",
"est_circulating_supply": "389000000 NU",
    "internal_locked_allocations": {
    "company": "200000000 NU",
    "saft2": "80000000 NU",
    "team": "106000000 NU",
    "worklock": "225000000 NU"
}
}
derekpierre commented 4 years ago

since we're nesting internal_allocations under est_circulating_supply

@mswilkison that was a formatting error, we aren't nesting internal allocations in est_circulating_supply. It was supposed to be (output from before)

{
   "current_total_supply": "1008524647.83 NU",
   "est_circulating_supply": "389000000 NU",
   "internal_allocations": {
       "company": "200000000 NU",
       "saft": "399000000 NU",
       "team": "106000000 NU",
       "worklock": "225000000 NU"
   },
   "max_supply": "3885390081.75 NU",
   "staking_rewards_supply": "2876865433.91 NU"
}

Looks good - since we're nesting internal_allocations under est_circulating_supply maybe it makes sense to only show saft2 there? Since it's essentially the vested/locked allocations. That way the est_circulating_supply + internal_allocations sums to initial_supply, which is more intuitive of a presentation

For the build-up, what do you think about something like the following, assuming I can get the ordering to be maintained:

{
   "initial_supply": {
        "total_allocated": "1000000000 NU",
        "locked_allocations": {    <---- (values will adjust based on vesting)
             "company": "200000000 NU",
             "saft2": "80000000 NU",
             "team": "106000000 NU",
             "worklock": "225000000 NU" 
         }
         "unlocked": <total - (sum of internal_locked_allocations)>,
    }
    "staking_rewards_supply": {
         "total_allocated": <staking_rewards_issued + remaining remaining_staking_rewards_supply> (below)
         "staking_rewards_issued": "8524647.83 NU",
         "staking_rewards_remaining": "2876865433.91 NU",
    }

    "max_supply": "3885390081.75 NU",    <--- should equal ['initial_supply']['total_alloacated'] + ['staking_rewards_supply']['total_allocated']
    "est_circulating_supply":  <----- equals ['initial_supply']['unlocked']
}

wdyt?

derekpierre commented 4 years ago

Side note - what do we count issued rewards as...? Those can be unlocked if not restaked

mswilkison commented 4 years ago

wdyt?

Looking pretty good. Just for consistency, ease of reading maybe /s/unlocked/"unlocked_allocations" and have it be a dict with both "saft1" and "casi" broken out separately

Side note - what do we count issued rewards as...? Those can be unlocked if not restaked

Maybe we just include them est_circulating_supply (except for the ones earned by NuCo nodes)

mswilkison commented 4 years ago

Maybe we just include them est_circulating_supply (except for the ones earned by NuCo nodes)

Actually I'm not sure about this, almost all of them are being restaked... maybe for now we leave out of circulating?

derekpierre commented 4 years ago

and have it be a dict with both "saft1" and "casi" broken out separately

What was the final number for CASI?

Saft1 and CASI alone don't account for the rest of unlocked allocations eg. university staking - so should we add a catch-all entry like "other":

    "unlocked_allocations": {
          "saft1": <>
          "casi": <>
          "other": <>
    }
derekpierre commented 4 years ago

Actually I'm not sure about this, almost all of them are being restaked... maybe for now we leave out of circulating?

Definitely easiest to omit right now - not a simple calculation 😅

mswilkison commented 4 years ago

and have it be a dict with both "saft1" and "casi" broken out separately

What was the final number for CASI?

Saft1 and CASI alone don't account for the rest of unlocked allocations eg. university staking - so should we add a catch-all entry like "other":

    "unlocked_allocations": {
          "saft1": <>
          "casi": <>
          "other": <>
    }

Right, forgot about uni! Those are actually locked (19,500,000 NU), so should go in locked_allocations.

derekpierre commented 4 years ago

Current iteration:

{
    "initial_supply": {
        "total_allocated": "1000000000 NU",
        "locked_allocations": {
            "saft2": "80000000 NU",
            "team": "106000000 NU",
            "company": "200000000 NU",
            "worklock": "225000000 NU",
            "university": "19500000 NU"
        },
        "unlocked_allocations": {
            "saft1": "319000000 NU",
            "casi": "8280000 NU",
            "other": "42220000 NU"
        }
    },
    "staking_rewards_supply": {
        "total_allocated": "2885390081.75 NU",
        "staking_rewards_issued": "9544346.16 NU",
        "staking_rewards_remaining": "2875845735.59 NU"
    },
    "max_supply": "3885390081.75 NU",
    "est_circulating_supply": "369500000 NU"
}

Questions/notes:

  1. What's the vesting schedule for the company (5 years, and presumably a cliff, i.e. no monthly sub-stakes, just one with 5 year duration?)
  2. What's the CASI supply - currently assumed to be 8,280,000 NU.
  3. Used "other" as catchall for unlocked_allocations unaccounted for i.e. (['initial_supply']['total_allocated]' - sum of locked_allocations - saft1 - casi)
  4. Est. circulating supply is the sum of all unlocked_allocations i.e. saft1 + casi + other.
  5. Days / month for vesting calculation uses 30.416 which was used in allocations spreadsheet.
mswilkison commented 4 years ago
1. What's the vesting schedule for the company (5 years, and presumably a cliff, i.e. no monthly sub-stakes, just one with 5 year duration?)

Yes.

2. What's the CASI supply - currently assumed to be 8,280,000 NU.

Let's do 9,000,000M NU which is the amount we've distributed so far for CASI.

3. Used "other" as catchall for `unlocked_allocations` unaccounted for i.e. (['initial_supply']['total_allocated]' - sum of locked_allocations - saft1 - casi)

Maybe call that ecosystem, which is what we've done elsewhere.

4. Est. circulating supply is the sum of all `unlocked_allocations` i.e. saft1 + casi + other.

Makes sense.

derekpierre commented 4 years ago

Latest output:

{
   "initial_supply":{
      "total_allocated":"1000000000 NU",
      "locked_allocations":{
         "saft2":"80000000 NU",
         "team":"106000000 NU",
         "company":"200000000 NU",
         "worklock":"225000000 NU",
         "university":"19500000 NU"
      },
      "unlocked_allocations":{
         "saft1":"319000000 NU",
         "casi":"9000000 NU",
         "ecosystem":"41500000 NU"
      }
   },
   "staking_rewards_supply":{
      "total_allocated":"2885390081.75 NU",
      "staking_rewards_issued":"10383119.52 NU",
      "staking_rewards_remaining":"2875006962.23 NU"
   },
   "max_supply":"3885390081.75 NU",
   "est_circulating_supply":"369500000 NU"
}
derekpierre commented 4 years ago

Current output with vested NU separated in unlocked allocations.

{
   "initial_supply":{
      "total_allocated":"1000000000 NU",
      "locked_allocations":{
         "saft2":"80000000 NU",
         "team":"106000000 NU",
         "company":"200000000 NU",
         "worklock":"225000000 NU",
         "university":"19500000 NU"
      },
      "unlocked_allocations":{
         "saft1":"319000000 NU",
         "casi":"9000000 NU",
         "vested":"0 NU",
         "ecosystem":"41500000 NU"
      }
   },
   "staking_rewards_supply":{
      "total_allocated":"2885390081.75 NU",
      "staking_rewards_issued":"10383138.7 NU",
      "staking_rewards_remaining":"2875006943.05 NU"
   },
   "max_supply":"3885390081.75 NU",
   "est_circulating_supply":"369500000 NU"
}