From 7ba1ce58a485aded6d93982c9e440e2df0ad9ac3 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Mon, 7 Jul 2025 12:16:04 -0700 Subject: [PATCH 1/3] update add_stake_limit --- bittensor_cli/src/commands/stake/add.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bittensor_cli/src/commands/stake/add.py b/bittensor_cli/src/commands/stake/add.py index 18f3517c1..a8d1ecc59 100644 --- a/bittensor_cli/src/commands/stake/add.py +++ b/bittensor_cli/src/commands/stake/add.py @@ -342,14 +342,14 @@ async def stake_extrinsic( # If we are staking safe, add price tolerance if safe_staking: if subnet_info.is_dynamic: - rate = 1 / subnet_info.price.tao or 1 + rate = amount_to_stake.rao / received_amount.rao _rate_with_tolerance = rate * ( 1 + rate_tolerance ) # Rate only for display rate_with_tolerance = f"{_rate_with_tolerance:.4f}" - price_with_tolerance = subnet_info.price.rao * ( - 1 + rate_tolerance - ) # Actual price to pass to extrinsic + price_with_tolerance = Balance.from_tao( + _rate_with_tolerance + ).rao # Actual price to pass to extrinsic else: rate_with_tolerance = "1" price_with_tolerance = Balance.from_rao(1) From 0904784e97168481b4762968ebfae9ab2b53f16d Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Mon, 7 Jul 2025 12:16:14 -0700 Subject: [PATCH 2/3] update_remove_stake_limit --- bittensor_cli/src/commands/stake/remove.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bittensor_cli/src/commands/stake/remove.py b/bittensor_cli/src/commands/stake/remove.py index c7a72ffed..d562c1e1b 100644 --- a/bittensor_cli/src/commands/stake/remove.py +++ b/bittensor_cli/src/commands/stake/remove.py @@ -248,13 +248,13 @@ async def unstake( # Additional fields for safe unstaking if safe_staking: if subnet_info.is_dynamic: - rate = subnet_info.price.tao or 1 + rate = amount_to_unstake_as_balance.rao / received_amount.rao rate_with_tolerance = rate * ( 1 - rate_tolerance ) # Rate only for display - price_with_tolerance = subnet_info.price.rao * ( - 1 - rate_tolerance - ) # Actual price to pass to extrinsic + price_with_tolerance = Balance.from_tao( + rate_with_tolerance + ).rao # Actual price to pass to extrinsic else: rate_with_tolerance = 1 price_with_tolerance = 1 From 4280071b7cb43bfd40826876eb3dd18af1099426 Mon Sep 17 00:00:00 2001 From: Ibraheem <165814940+ibraheem-abe@users.noreply.github.com> Date: Mon, 7 Jul 2025 15:02:17 -0700 Subject: [PATCH 3/3] Update bittensor_cli/src/commands/stake/remove.py Co-authored-by: Cameron Fairchild --- bittensor_cli/src/commands/stake/remove.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor_cli/src/commands/stake/remove.py b/bittensor_cli/src/commands/stake/remove.py index d562c1e1b..b2ef8b608 100644 --- a/bittensor_cli/src/commands/stake/remove.py +++ b/bittensor_cli/src/commands/stake/remove.py @@ -248,7 +248,7 @@ async def unstake( # Additional fields for safe unstaking if safe_staking: if subnet_info.is_dynamic: - rate = amount_to_unstake_as_balance.rao / received_amount.rao + rate = received_amount.rao / amount_to_unstake_as_balance.rao rate_with_tolerance = rate * ( 1 - rate_tolerance ) # Rate only for display