@@ -85,6 +85,12 @@ def unstake_extrinsic(
85
85
return False
86
86
87
87
try :
88
+ call_params = {
89
+ "hotkey" : hotkey_ss58 ,
90
+ "netuid" : netuid ,
91
+ "amount_unstaked" : unstaking_balance .rao ,
92
+ }
93
+
88
94
if safe_staking :
89
95
pool = subtensor .subnet (netuid = netuid )
90
96
base_price = pool .price .rao
@@ -96,38 +102,34 @@ def unstake_extrinsic(
96
102
97
103
logging .info (
98
104
f":satellite: [magenta]Safe Unstaking from:[/magenta] "
99
- f"[blue]netuid: { netuid } , amount: { unstaking_balance } , tolerance percentage: { rate_threshold * 100 } %, "
100
- f"price limit: { rate_with_tolerance } , original price: { base_rate } , with partial unstake: { allow_partial_stake } "
101
- f"on { subtensor .network } [/blue] [magenta]...[/magenta]"
105
+ f"netuid: [yellow]{ netuid } [/yellow], amount: [green]{ unstaking_balance } [/green], "
106
+ f"tolerance percentage: [yellow]{ rate_threshold * 100 } %[/yellow], "
107
+ f"price limit: [yellow]{ rate_with_tolerance } [/yellow], "
108
+ f"original price: [green]{ base_rate } [/green], "
109
+ f"with partial unstake: [yellow]{ allow_partial_stake } [/yellow] "
110
+ f"on [blue]{ subtensor .network } [/blue][magenta]...[/magenta]"
102
111
)
103
112
104
- call = subtensor .substrate .compose_call (
105
- call_module = "SubtensorModule" ,
106
- call_function = "remove_stake_limit" ,
107
- call_params = {
108
- "hotkey" : hotkey_ss58 ,
109
- "netuid" : netuid ,
110
- "amount_unstaked" : unstaking_balance .rao ,
113
+ call_params .update (
114
+ {
111
115
"limit_price" : price_with_tolerance ,
112
116
"allow_partial" : allow_partial_stake ,
113
- },
117
+ }
114
118
)
119
+ call_function = "remove_stake_limit"
115
120
else :
116
121
logging .info (
117
122
f":satellite: [magenta]Unstaking from:[/magenta] "
118
- f"[blue] netuid: { netuid } , amount: { unstaking_balance } "
119
- f"on { subtensor .network } [/blue] [magenta]...[/magenta]"
123
+ f"netuid: [yellow] { netuid } [/yellow] , amount: [green] { unstaking_balance } [/green] "
124
+ f"on [blue] { subtensor .network } [/blue][magenta]...[/magenta]"
120
125
)
126
+ call_function = "remove_stake"
121
127
122
- call = subtensor .substrate .compose_call (
123
- call_module = "SubtensorModule" ,
124
- call_function = "remove_stake" ,
125
- call_params = {
126
- "hotkey" : hotkey_ss58 ,
127
- "netuid" : netuid ,
128
- "amount_unstaked" : unstaking_balance .rao ,
129
- },
130
- )
128
+ call = subtensor .substrate .compose_call (
129
+ call_module = "SubtensorModule" ,
130
+ call_function = call_function ,
131
+ call_params = call_params ,
132
+ )
131
133
132
134
staking_response , err_msg = subtensor .sign_and_send_extrinsic (
133
135
call ,
0 commit comments