File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
bittensor_cli/src/commands/stake Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -342,14 +342,14 @@ async def stake_extrinsic(
342
342
# If we are staking safe, add price tolerance
343
343
if safe_staking :
344
344
if subnet_info .is_dynamic :
345
- rate = 1 / subnet_info . price . tao or 1
345
+ rate = amount_to_stake . rao / received_amount . rao
346
346
_rate_with_tolerance = rate * (
347
347
1 + rate_tolerance
348
348
) # Rate only for display
349
349
rate_with_tolerance = f"{ _rate_with_tolerance :.4f} "
350
- price_with_tolerance = subnet_info . price . rao * (
351
- 1 + rate_tolerance
352
- ) # Actual price to pass to extrinsic
350
+ price_with_tolerance = Balance . from_tao (
351
+ _rate_with_tolerance
352
+ ). rao # Actual price to pass to extrinsic
353
353
else :
354
354
rate_with_tolerance = "1"
355
355
price_with_tolerance = Balance .from_rao (1 )
Original file line number Diff line number Diff line change @@ -248,13 +248,13 @@ async def unstake(
248
248
# Additional fields for safe unstaking
249
249
if safe_staking :
250
250
if subnet_info .is_dynamic :
251
- rate = subnet_info . price . tao or 1
251
+ rate = received_amount . rao / amount_to_unstake_as_balance . rao
252
252
rate_with_tolerance = rate * (
253
253
1 - rate_tolerance
254
254
) # Rate only for display
255
- price_with_tolerance = subnet_info . price . rao * (
256
- 1 - rate_tolerance
257
- ) # Actual price to pass to extrinsic
255
+ price_with_tolerance = Balance . from_tao (
256
+ rate_with_tolerance
257
+ ). rao # Actual price to pass to extrinsic
258
258
else :
259
259
rate_with_tolerance = 1
260
260
price_with_tolerance = 1
You can’t perform that action at this time.
0 commit comments