Skip to content

Commit

Permalink
Merge pull request #2458 from opentensor/tests/roman/add_unstake_extr…
Browse files Browse the repository at this point in the history
…insic

Tests for subtensor methods related with `stake` and `unstake` extrinsics
  • Loading branch information
roman-opentensor authored Nov 22, 2024
2 parents 7f373a3 + 360f5cd commit 762e593
Show file tree
Hide file tree
Showing 2 changed files with 656 additions and 19 deletions.
37 changes: 18 additions & 19 deletions bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2110,20 +2110,19 @@ def add_stake_multiple(
amounts (list[Union[Balance, float]]): Corresponding amounts of TAO to stake for each hotkey.
wait_for_inclusion (bool): Waits for the transaction to be included in a block.
wait_for_finalization (bool): Waits for the transaction to be finalized on the blockchain.
prompt (bool): If ``True``, prompts for user confirmation before proceeding.
Returns:
bool: ``True`` if the staking is successful for all specified neurons, False otherwise.
This function is essential for managing stakes across multiple neurons, reflecting the dynamic and collaborative nature of the Bittensor network.
"""
return add_stake_multiple_extrinsic(
self,
wallet,
hotkey_ss58s,
amounts,
wait_for_inclusion,
wait_for_finalization,
subtensor=self,
wallet=wallet,
hotkey_ss58s=hotkey_ss58s,
amounts=amounts,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
)

def unstake(
Expand All @@ -2150,12 +2149,12 @@ def unstake(
This function supports flexible stake management, allowing neurons to adjust their network participation and potential reward accruals.
"""
return unstake_extrinsic(
self,
wallet,
hotkey_ss58,
amount,
wait_for_inclusion,
wait_for_finalization,
subtensor=self,
wallet=wallet,
hotkey_ss58=hotkey_ss58,
amount=amount,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
)

def unstake_multiple(
Expand All @@ -2182,10 +2181,10 @@ def unstake_multiple(
This function allows for strategic reallocation or withdrawal of stakes, aligning with the dynamic stake management aspect of the Bittensor network.
"""
return unstake_multiple_extrinsic(
self,
wallet,
hotkey_ss58s,
amounts,
wait_for_inclusion,
wait_for_finalization,
subtensor=self,
wallet=wallet,
hotkey_ss58s=hotkey_ss58s,
amounts=amounts,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
)
Loading

0 comments on commit 762e593

Please sign in to comment.