File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
bittensor/core/chain_data Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class DynamicInfo(InfoBase):
27
27
alpha_in : Balance
28
28
alpha_out : Balance
29
29
tao_in : Balance
30
- price : Balance
30
+ price : Optional [ Balance ]
31
31
k : float
32
32
is_dynamic : bool
33
33
alpha_out_emission : Balance
@@ -90,6 +90,10 @@ def _from_dict(cls, decoded: dict) -> "DynamicInfo":
90
90
)
91
91
else :
92
92
subnet_identity = None
93
+ price = decoded .get ("price" , None )
94
+
95
+ if price and not isinstance (price , Balance ):
96
+ raise ValueError (f"price must be a Balance object, got { type (price )} ." )
93
97
94
98
return cls (
95
99
netuid = netuid ,
@@ -106,7 +110,7 @@ def _from_dict(cls, decoded: dict) -> "DynamicInfo":
106
110
tao_in = tao_in ,
107
111
k = tao_in .rao * alpha_in .rao ,
108
112
is_dynamic = is_dynamic ,
109
- price = decoded . get ( " price" , None ) ,
113
+ price = price ,
110
114
alpha_out_emission = alpha_out_emission ,
111
115
alpha_in_emission = alpha_in_emission ,
112
116
tao_in_emission = tao_in_emission ,
You can’t perform that action at this time.
0 commit comments