Skip to content

Commit 4be75cb

Browse files
committed
updates stake list
1 parent ee15a4c commit 4be75cb

File tree

1 file changed

+35
-48
lines changed
  • bittensor_cli/src/commands/stake

1 file changed

+35
-48
lines changed

bittensor_cli/src/commands/stake/list.py

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ def define_table(
111111
style=COLOR_PALETTE["POOLS"]["RATE"],
112112
justify="center",
113113
)
114-
defined_table.add_column(
115-
f"[white]Swap ({Balance.get_unit(1)} -> {Balance.unit})",
116-
footer_style="overline white",
117-
style=COLOR_PALETTE["STAKE"]["STAKE_SWAP"],
118-
justify="right",
119-
footer=f"τ {millify_tao(total_swapped_tao_value_.tao)}"
120-
if not verbose
121-
else f"{total_swapped_tao_value_}",
122-
)
114+
# defined_table.add_column(
115+
# f"[white]Swap ({Balance.get_unit(1)} -> {Balance.unit})",
116+
# footer_style="overline white",
117+
# style=COLOR_PALETTE["STAKE"]["STAKE_SWAP"],
118+
# justify="right",
119+
# footer=f"τ {millify_tao(total_swapped_tao_value_.tao)}"
120+
# if not verbose
121+
# else f"{total_swapped_tao_value_}",
122+
# )
123123
defined_table.add_column(
124124
"[white]Registered",
125125
style=COLOR_PALETTE["STAKE"]["STAKE_ALPHA"],
@@ -168,25 +168,17 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]):
168168
tao_value_ = pool.alpha_to_tao(alpha_value)
169169
total_tao_value_ += tao_value_
170170

171-
# Swapped TAO value and slippage cell
172-
swapped_tao_value_, _, slippage_percentage_ = (
173-
pool.alpha_to_tao_with_slippage(substake_.stake)
174-
)
175-
total_swapped_tao_value_ += swapped_tao_value_
176-
177-
# Slippage percentage cell
178-
if pool.is_dynamic:
179-
slippage_percentage = f"[{COLOR_PALETTE['STAKE']['SLIPPAGE_PERCENT']}]{slippage_percentage_:.3f}%[/{COLOR_PALETTE['STAKE']['SLIPPAGE_PERCENT']}]"
180-
else:
181-
slippage_percentage = f"[{COLOR_PALETTE['STAKE']['SLIPPAGE_PERCENT']}]0.000%[/{COLOR_PALETTE['STAKE']['SLIPPAGE_PERCENT']}]"
171+
# TAO value cell
172+
tao_value_ = pool.alpha_to_tao(substake_.stake)
173+
total_swapped_tao_value_ += tao_value_
182174

183175
if netuid == 0:
184-
swap_value = f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A[/{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}] ({slippage_percentage})"
176+
swap_value = f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A[/{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]"
185177
else:
186178
swap_value = (
187-
f"τ {millify_tao(swapped_tao_value_.tao)} ({slippage_percentage})"
179+
f"τ {millify_tao(tao_value_.tao)}"
188180
if not verbose
189-
else f"{swapped_tao_value_} ({slippage_percentage})"
181+
else f"{tao_value_}"
190182
)
191183

192184
# Per block emission cell
@@ -214,7 +206,7 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]):
214206
else f"{symbol} {stake_value}", # Stake (a)
215207
f"{pool.price.tao:.4f} τ/{symbol}", # Rate (t/a)
216208
# f"τ {millify_tao(tao_ownership.tao)}" if not verbose else f"{tao_ownership}", # TAO equiv
217-
swap_value, # Swap(α) -> τ
209+
# swap_value, # Swap(α) -> τ
218210
"YES"
219211
if substake_.is_registered
220212
else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]NO", # Registered
@@ -232,7 +224,7 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]):
232224
"value": tao_value_.tao,
233225
"stake_value": substake_.stake.tao,
234226
"rate": pool.price.tao,
235-
"swap_value": swap_value,
227+
# "swap_value": swap_value,
236228
"registered": True if substake_.is_registered else False,
237229
"emission": {
238230
"alpha": per_block_emission,
@@ -317,9 +309,7 @@ def format_cell(
317309
alpha_value = Balance.from_rao(int(substake_.stake.rao)).set_unit(netuid)
318310
tao_value_ = pool.alpha_to_tao(alpha_value)
319311
total_tao_value_ += tao_value_
320-
swapped_tao_value_, slippage, slippage_pct = (
321-
pool.alpha_to_tao_with_slippage(substake_.stake)
322-
)
312+
swapped_tao_value_ = pool.alpha_to_tao(substake_.stake)
323313
total_swapped_tao_value_ += swapped_tao_value_
324314

325315
# Store current values for future delta tracking
@@ -364,19 +354,16 @@ def format_cell(
364354
)
365355

366356
if netuid != 0:
367-
swap_cell = (
368-
format_cell(
369-
swapped_tao_value_.tao,
370-
prev.get("swapped_value"),
371-
unit="τ",
372-
unit_first_=True,
373-
precision=4,
374-
millify=True if not verbose else False,
375-
)
376-
+ f" ({slippage_pct:.2f}%)"
357+
swap_cell = format_cell(
358+
swapped_tao_value_.tao,
359+
prev.get("swapped_value"),
360+
unit="τ",
361+
unit_first_=True,
362+
precision=4,
363+
millify=True if not verbose else False,
377364
)
378365
else:
379-
swap_cell = f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A[/{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}] ({slippage_pct}%)"
366+
swap_cell = f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A[/{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]"
380367

381368
emission_value = substake_.emission.tao / (pool.tempo or 1)
382369
emission_cell = format_cell(
@@ -408,7 +395,7 @@ def format_cell(
408395
exchange_cell, # Exchange value
409396
stake_cell, # Stake amount
410397
rate_cell, # Rate
411-
swap_cell, # Swap value with slippage
398+
# swap_cell, # Swap value
412399
"YES"
413400
if substake_.is_registered
414401
else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]NO", # Registration status
@@ -591,12 +578,12 @@ def format_cell(
591578
f"Wallet:\n"
592579
f" Coldkey SS58: [{COLOR_PALETTE['GENERAL']['COLDKEY']}]{coldkey_address}[/{COLOR_PALETTE['GENERAL']['COLDKEY']}]\n"
593580
f" Free Balance: [{COLOR_PALETTE['GENERAL']['BALANCE']}]{balance}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]\n"
594-
f" Total TAO Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]\n"
595-
f" Total TAO Swapped Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_swapped_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]"
581+
f" Total TAO Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]"
582+
# f"\n Total TAO Swapped Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_swapped_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]"
596583
)
597584
dict_output["free_balance"] = balance.tao
598585
dict_output["total_tao_value"] = all_hks_tao_value.tao
599-
dict_output["total_swapped_tao_value"] = all_hks_swapped_tao_value.tao
586+
# dict_output["total_swapped_tao_value"] = all_hks_swapped_tao_value.tao
600587
if json_output:
601588
json_console.print(json.dumps(dict_output))
602589
if not sub_stakes:
@@ -658,12 +645,12 @@ def format_cell(
658645
),
659646
(
660647
"[bold tan]Exchange Value (α x τ/α)[/bold tan]",
661-
"This is the potential τ you will receive, without considering slippage, if you unstake from this hotkey now on this subnet. See Swap(α → τ) column description. Note: The TAO Equiv(τ_in x α/α_out) indicates validator stake weight while this Exchange Value shows τ you will receive if you unstake now. This can change every block. \nFor more, see [blue]https://docs.bittensor.com/dynamic-tao/dtao-guide#exchange-value-%CE%B1-x-%CF%84%CE%B1[/blue].",
662-
),
663-
(
664-
"[bold tan]Swap (α → τ)[/bold tan]",
665-
"This is the actual τ you will receive, after factoring in the slippage charge, if you unstake from this hotkey now on this subnet. The slippage is calculated as 1 - (Swap(α → τ)/Exchange Value(α x τ/α)), and is displayed in brackets. This can change every block. \nFor more, see [blue]https://docs.bittensor.com/dynamic-tao/dtao-guide#swap-%CE%B1--%CF%84[/blue].",
648+
"This is the potential τ you will receive if you unstake from this hotkey now on this subnet. Note: The TAO Equiv(τ_in x α/α_out) indicates validator stake weight while this Exchange Value shows τ you will receive if you unstake now. This can change every block. \nFor more, see [blue]https://docs.bittensor.com/dynamic-tao/dtao-guide#exchange-value-%CE%B1-x-%CF%84%CE%B1[/blue].",
666649
),
650+
# (
651+
# "[bold tan]Swap (α → τ)[/bold tan]",
652+
# "This is the τ you will receive if you unstake from this hotkey now on this subnet. This can change every block. \nFor more, see [blue]https://docs.bittensor.com/dynamic-tao/dtao-guide#swap-%CE%B1--%CF%84[/blue].",
653+
# ),
667654
(
668655
"[bold tan]Registered[/bold tan]",
669656
"Indicates if the hotkey is registered in this subnet or not. \nFor more, see [blue]https://docs.bittensor.com/learn/anatomy-of-incentive-mechanism#tempo[/blue].",

0 commit comments

Comments
 (0)