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(
342342 # If we are staking safe, add price tolerance
343343 if safe_staking :
344344 if subnet_info .is_dynamic :
345- rate = 1 / subnet_info . price . tao or 1
345+ rate = amount_to_stake . rao / received_amount . rao
346346 _rate_with_tolerance = rate * (
347347 1 + rate_tolerance
348348 ) # Rate only for display
349349 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
353353 else :
354354 rate_with_tolerance = "1"
355355 price_with_tolerance = Balance .from_rao (1 )
Original file line number Diff line number Diff line change @@ -248,13 +248,13 @@ async def unstake(
248248 # Additional fields for safe unstaking
249249 if safe_staking :
250250 if subnet_info .is_dynamic :
251- rate = subnet_info . price . tao or 1
251+ rate = received_amount . rao / amount_to_unstake_as_balance . rao
252252 rate_with_tolerance = rate * (
253253 1 - rate_tolerance
254254 ) # 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
258258 else :
259259 rate_with_tolerance = 1
260260 price_with_tolerance = 1
You can’t perform that action at this time.
0 commit comments