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
8 changes: 4 additions & 4 deletions bittensor_cli/src/commands/stake/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions bittensor_cli/src/commands/stake/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = received_amount.rao / amount_to_unstake_as_balance.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
Expand Down
Loading