diff --git a/bittensor_cli/src/commands/stake/list.py b/bittensor_cli/src/commands/stake/list.py index 6c2feff6c..8523320ac 100644 --- a/bittensor_cli/src/commands/stake/list.py +++ b/bittensor_cli/src/commands/stake/list.py @@ -1,7 +1,6 @@ import asyncio from typing import TYPE_CHECKING, Optional -from bittensor_cli.src.commands.stake.remove import unstake import typer from bittensor_wallet import Wallet @@ -59,7 +58,6 @@ async def get_stake_data(block_hash: str = None): def define_table( hotkey_name: str, rows: list[list[str]], - total_tao_ownership: Balance, total_tao_value: Balance, total_swapped_tao_value: Balance, live: bool = False, @@ -145,7 +143,6 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]): else hotkey_ ) rows = [] - total_tao_ownership = Balance(0) total_tao_value = Balance(0) total_swapped_tao_value = Balance(0) root_stakes = [s for s in substakes if s.netuid == 0] @@ -161,14 +158,6 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]): netuid = substake_.netuid pool = dynamic_info[netuid] symbol = f"{Balance.get_unit(netuid)}\u200e" - # TODO: what is this price var for? - price = ( - "{:.4f}{}".format( - pool.price.__float__(), f" τ/{Balance.get_unit(netuid)}\u200e" - ) - if pool.is_dynamic - else (f" 1.0000 τ/{symbol} ") - ) # Alpha value cell alpha_value = Balance.from_rao(int(substake_.stake.rao)).set_unit(netuid) @@ -198,31 +187,11 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]): else f"{swapped_tao_value} ({slippage_percentage})" ) - # TAO locked cell - tao_locked = pool.tao_in - - # Issuance cell - issuance = pool.alpha_out if pool.is_dynamic else tao_locked - # Per block emission cell per_block_emission = substake_.emission.tao / (pool.tempo or 1) per_block_tao_emission = substake_.tao_emission.tao / (pool.tempo or 1) # Alpha ownership and TAO ownership cells if alpha_value.tao > 0.00009: - if issuance.tao != 0: - # TODO figure out why this alpha_ownership does nothing - alpha_ownership = "{:.4f}".format( - (alpha_value.tao / issuance.tao) * 100 - ) - tao_ownership = Balance.from_tao( - (alpha_value.tao / issuance.tao) * tao_locked.tao - ) - total_tao_ownership += tao_ownership - else: - # TODO what's this var for? - alpha_ownership = "0.0000" - tao_ownership = Balance.from_tao(0) - stake_value = ( millify_tao(substake_.stake.tao) if not verbose @@ -253,13 +222,11 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]): str(Balance.from_tao(per_block_tao_emission)), ] ) - table = define_table( - name, rows, total_tao_ownership, total_tao_value, total_swapped_tao_value - ) + table = define_table(name, rows, total_tao_value, total_swapped_tao_value) for row in rows: table.add_row(*row) console.print(table) - return total_tao_ownership, total_tao_value + return total_tao_value, total_swapped_tao_value def create_live_table( substakes: list, @@ -271,7 +238,6 @@ def create_live_table( rows = [] current_data = {} - total_tao_ownership = Balance(0) total_tao_value = Balance(0) total_swapped_tao_value = Balance(0) @@ -332,17 +298,6 @@ def format_cell( ) total_swapped_tao_value += swapped_tao_value - # Calculate TAO ownership - tao_locked = pool.tao_in - issuance = pool.alpha_out if pool.is_dynamic else tao_locked - if alpha_value.tao > 0.00009 and issuance.tao != 0: - tao_ownership = Balance.from_tao( - (alpha_value.tao / issuance.tao) * tao_locked.tao - ) - total_tao_ownership += tao_ownership - else: - tao_ownership = Balance.from_tao(0) - # Store current values for future delta tracking current_data[netuid] = { "stake": alpha_value.tao, @@ -350,8 +305,7 @@ def format_cell( "tao_value": tao_value.tao, "swapped_value": swapped_tao_value.tao, "emission": substake.emission.tao / (pool.tempo or 1), - "tao_ownership": tao_ownership.tao, - "tao_emission": substake.tao_emission.tao (pool.tempo or 1), + "tao_emission": substake.tao_emission.tao / (pool.tempo or 1), } # Get previous values for delta tracking @@ -442,7 +396,6 @@ def format_cell( table = define_table( hotkey_name, rows, - total_tao_ownership, total_tao_value, total_swapped_tao_value, live=True, @@ -478,7 +431,7 @@ def format_cell( raise typer.Exit() if live: - # Select one hokkey for live monitoring + # Select one hotkey for live monitoring if len(hotkeys_to_substakes) > 1: console.print( "\n[bold]Multiple hotkeys found. Please select one for live monitoring:[/bold]" @@ -582,27 +535,29 @@ def format_cell( # Iterate over each hotkey and make a table counter = 0 num_hotkeys = len(hotkeys_to_substakes) - all_hotkeys_total_global_tao = Balance(0) - all_hotkeys_total_tao_value = Balance(0) + all_hks_swapped_tao_value = Balance(0) + all_hks_tao_value = Balance(0) for hotkey in hotkeys_to_substakes.keys(): counter += 1 - stake, value = create_table(hotkey, hotkeys_to_substakes[hotkey]) - all_hotkeys_total_global_tao += stake - all_hotkeys_total_tao_value += value + tao_value, swapped_tao_value = create_table( + hotkey, hotkeys_to_substakes[hotkey] + ) + all_hks_tao_value += tao_value + all_hks_swapped_tao_value += swapped_tao_value if num_hotkeys > 1 and counter < num_hotkeys and prompt: console.print("\nPress Enter to continue to the next hotkey...") input() total_tao_value = ( - f"τ {millify_tao(all_hotkeys_total_tao_value.tao)}" + f"τ {millify_tao(all_hks_tao_value.tao)}" if not verbose - else all_hotkeys_total_tao_value + else all_hks_tao_value ) - total_tao_ownership = ( - f"τ {millify_tao(all_hotkeys_total_global_tao.tao)}" + total_swapped_tao_value = ( + f"τ {millify_tao(all_hks_swapped_tao_value.tao)}" if not verbose - else all_hotkeys_total_global_tao + else all_hks_swapped_tao_value ) console.print("\n\n") @@ -610,8 +565,8 @@ def format_cell( f"Wallet:\n" f" Coldkey SS58: [{COLOR_PALETTE['GENERAL']['COLDKEY']}]{coldkey_address}[/{COLOR_PALETTE['GENERAL']['COLDKEY']}]\n" f" Free Balance: [{COLOR_PALETTE['GENERAL']['BALANCE']}]{balance}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]\n" - f" Total TAO ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_tao_ownership}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]\n" - f" Total Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]" + f" Total TAO Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]\n" + f" Total TAO Swapped Value ({Balance.unit}): [{COLOR_PALETTE['GENERAL']['BALANCE']}]{total_swapped_tao_value}[/{COLOR_PALETTE['GENERAL']['BALANCE']}]" ) if not sub_stakes: console.print(