Skip to content

Commit 7caff80

Browse files
committed
update remove_stake
1 parent 0dc6191 commit 7caff80

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

bittensor/core/extrinsics/unstaking.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ def unstake_extrinsic(
8585
return False
8686

8787
try:
88+
call_params = {
89+
"hotkey": hotkey_ss58,
90+
"netuid": netuid,
91+
"amount_unstaked": unstaking_balance.rao,
92+
}
93+
8894
if safe_staking:
8995
pool = subtensor.subnet(netuid=netuid)
9096
base_price = pool.price.rao
@@ -96,38 +102,34 @@ def unstake_extrinsic(
96102

97103
logging.info(
98104
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]"
102111
)
103112

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+
{
111115
"limit_price": price_with_tolerance,
112116
"allow_partial": allow_partial_stake,
113-
},
117+
}
114118
)
119+
call_function = "remove_stake_limit"
115120
else:
116121
logging.info(
117122
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]"
120125
)
126+
call_function = "remove_stake"
121127

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+
)
131133

132134
staking_response, err_msg = subtensor.sign_and_send_extrinsic(
133135
call,

0 commit comments

Comments
 (0)