Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions bittensor_cli/src/bittensor/chain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class SubnetHyperparameters(InfoBase):
def _fix_decoded(
cls, decoded: Union[dict, "SubnetHyperparameters"]
) -> "SubnetHyperparameters":
return SubnetHyperparameters(
return cls(
rho=decoded.get("rho"),
kappa=decoded.get("kappa"),
immunity_period=decoded.get("immunity_period"),
Expand Down Expand Up @@ -197,6 +197,7 @@ class StakeInfo(InfoBase):
stake: Balance # Stake for the hotkey-coldkey pair
locked: Balance # Stake which is locked.
emission: Balance # Emission for the hotkey-coldkey pair
tao_emission: Balance # TAO emission for the hotkey-coldkey pair
drain: int
is_registered: bool

Expand All @@ -208,11 +209,20 @@ def _fix_decoded(cls, decoded: Any) -> "StakeInfo":
stake = Balance.from_rao(decoded.get("stake")).set_unit(netuid)
locked = Balance.from_rao(decoded.get("locked")).set_unit(netuid)
emission = Balance.from_rao(decoded.get("emission")).set_unit(netuid)
tao_emission = Balance.from_rao(decoded.get("tao_emission"))
drain = int(decoded.get("drain"))
is_registered = bool(decoded.get("is_registered"))

return StakeInfo(
hotkey, coldkey, netuid, stake, locked, emission, drain, is_registered
return cls(
hotkey,
coldkey,
netuid,
stake,
locked,
emission,
tao_emission,
drain,
is_registered,
)


Expand Down Expand Up @@ -293,7 +303,7 @@ def _fix_decoded(cls, decoded: Any) -> "NeuronInfo":
axon_info = decoded.get("axon_info", {})
coldkey = decode_account_id(decoded.get("coldkey"))
hotkey = decode_account_id(decoded.get("hotkey"))
return NeuronInfo(
return cls(
hotkey=hotkey,
coldkey=coldkey,
uid=decoded.get("uid"),
Expand Down Expand Up @@ -555,7 +565,7 @@ class SubnetInfo(InfoBase):

@classmethod
def _fix_decoded(cls, decoded: "SubnetInfo") -> "SubnetInfo":
return SubnetInfo(
return cls(
netuid=decoded.get("netuid"),
rho=decoded.get("rho"),
kappa=decoded.get("kappa"),
Expand Down Expand Up @@ -594,7 +604,7 @@ class SubnetIdentity(InfoBase):

@classmethod
def _fix_decoded(cls, decoded: dict) -> "SubnetIdentity":
return SubnetIdentity(
return cls(
subnet_name=bytes(decoded["subnet_name"]).decode(),
github_repo=bytes(decoded["github_repo"]).decode(),
subnet_contact=bytes(decoded["subnet_contact"]).decode(),
Expand Down Expand Up @@ -828,7 +838,7 @@ class SubnetState(InfoBase):
@classmethod
def _fix_decoded(cls, decoded: Any) -> "SubnetState":
netuid = decoded.get("netuid")
return SubnetState(
return cls(
netuid=netuid,
hotkeys=[decode_account_id(val) for val in decoded.get("hotkeys")],
coldkeys=[decode_account_id(val) for val in decoded.get("coldkeys")],
Expand Down
20 changes: 20 additions & 0 deletions bittensor_cli/src/commands/stake/list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio

from typing import TYPE_CHECKING, Optional
from bittensor_cli.src.commands.stake.remove import unstake
import typer

from bittensor_wallet import Wallet
Expand Down Expand Up @@ -130,6 +131,11 @@ def define_table(
style=COLOR_PALETTE["POOLS"]["EMISSION"],
justify="right",
)
table.add_column(
f"[white]Emission \n({Balance.get_unit(0)}/block)",
style=COLOR_PALETTE["POOLS"]["EMISSION"],
justify="right",
)
return table

def create_table(hotkey_: str, substakes: list[StakeInfo]):
Expand Down Expand Up @@ -200,6 +206,7 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]):

# 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:
Expand Down Expand Up @@ -243,6 +250,7 @@ def create_table(hotkey_: str, substakes: list[StakeInfo]):
# Removing this flag for now, TODO: Confirm correct values are here w.r.t CHKs
# if substake_.is_registered
# else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]N/A", # Emission(α/block)
str(Balance.from_tao(per_block_tao_emission)),
]
)
table = define_table(
Expand Down Expand Up @@ -343,6 +351,7 @@ def format_cell(
"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),
}

# Get previous values for delta tracking
Expand Down Expand Up @@ -408,6 +417,16 @@ def format_cell(
unit_first=unit_first,
precision=4,
)

tao_emission_value = substake.tao_emission.tao / (pool.tempo or 1)
tao_emission_cell = format_cell(
tao_emission_value,
prev.get("tao_emission"),
unit="τ",
unit_first=unit_first,
precision=4,
)

subnet_name_cell = (
f"[{COLOR_PALETTE['GENERAL']['SYMBOL']}]{symbol if netuid != 0 else 'τ'}[/{COLOR_PALETTE['GENERAL']['SYMBOL']}]"
f" {get_subnet_name(dynamic_info[netuid])}"
Expand All @@ -425,6 +444,7 @@ def format_cell(
if substake.is_registered
else f"[{COLOR_PALETTE['STAKE']['NOT_REGISTERED']}]NO", # Registration status
emission_cell, # Emission rate
tao_emission_cell, # TAO emission rate
]
)

Expand Down
Loading