forked from BlockScience/subspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.py
47 lines (30 loc) · 1.22 KB
/
metrics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import logging
from subspace_model.types import SubspaceModelState
def circulating_supply(state: SubspaceModelState):
return (
state["operators_balance"]
+ state["nominators_balance"]
+ state["holders_balance"]
+ state["farmers_balance"]
)
def user_supply(state: SubspaceModelState):
return circulating_supply(state) + state["staking_pool_balance"]
def earned_supply(state: SubspaceModelState):
return user_supply(state) + state["fund_balance"]
def issued_supply(state: SubspaceModelState):
return (
sum_of_stocks(state) - state["burnt_balance"] - state["reward_issuance_balance"]
) # TODO Document the identity
def earned_minus_burned_supply(state: SubspaceModelState):
return earned_supply(state) - state["burnt_balance"]
def total_supply(state: SubspaceModelState):
return issued_supply(state) - state["burnt_balance"]
def sum_of_stocks(state: SubspaceModelState):
return (
earned_supply(state)
+ state["other_issuance_balance"]
+ state["reward_issuance_balance"]
+ state["burnt_balance"]
)
def storage_fee_per_rewards(state: SubspaceModelState):
return state["storage_fee_volume"] / max(1, state["block_reward"])