bittensor.core.extrinsics.asyncex.liquidity#

Functions#

add_liquidity_extrinsic(subtensor, wallet, netuid, ...)

Adds liquidity to the specified price range.

modify_liquidity_extrinsic(subtensor, wallet, netuid, ...)

Modifies liquidity in liquidity position by adding or removing liquidity from it.

remove_liquidity_extrinsic(subtensor, wallet, netuid, ...)

Remove liquidity and credit balances back to wallet's hotkey stake.

toggle_user_liquidity_extrinsic(subtensor, wallet, ...)

Allow to toggle user liquidity for specified subnet.

Module Contents#

async bittensor.core.extrinsics.asyncex.liquidity.add_liquidity_extrinsic(subtensor, wallet, netuid, liquidity, price_low, price_high, hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, period=None)#

Adds liquidity to the specified price range.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – The Subtensor client instance used for blockchain interaction.

  • wallet (bittensor_wallet.Wallet) – The wallet used to sign the extrinsic (must be unlocked).

  • netuid (int) – The UID of the target subnet for which the call is being initiated.

  • liquidity (bittensor.utils.balance.Balance) – The amount of liquidity to be added.

  • price_low (bittensor.utils.balance.Balance) – The lower bound of the price tick range.

  • price_high (bittensor.utils.balance.Balance) – The upper bound of the price tick range.

  • hotkey (Optional[str]) – The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to None.

  • wait_for_inclusion (bool) – Whether to wait for the extrinsic to be included in a block. Defaults to True.

  • wait_for_finalization (bool) – Whether to wait for finalization of the extrinsic. Defaults to False.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

Returns:

  • True and a success message if the extrinsic is successfully submitted or processed.

  • False and an error message if the submission fails or the wallet cannot be unlocked.

Return type:

Tuple[bool, str]

Note: Adding is allowed even when user liquidity is enabled in specified subnet. Call

toggle_user_liquidity_extrinsic to enable/disable user liquidity.

async bittensor.core.extrinsics.asyncex.liquidity.modify_liquidity_extrinsic(subtensor, wallet, netuid, position_id, liquidity_delta, hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, period=None)#

Modifies liquidity in liquidity position by adding or removing liquidity from it.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – The Subtensor client instance used for blockchain interaction.

  • wallet (bittensor_wallet.Wallet) – The wallet used to sign the extrinsic (must be unlocked).

  • netuid (int) – The UID of the target subnet for which the call is being initiated.

  • position_id (int) – The id of the position record in the pool.

  • liquidity_delta (bittensor.utils.balance.Balance) – The amount of liquidity to be added or removed (add if positive or remove if negative).

  • hotkey (Optional[str]) – The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to None.

  • wait_for_inclusion (bool) – Whether to wait for the extrinsic to be included in a block. Defaults to True.

  • wait_for_finalization (bool) – Whether to wait for finalization of the extrinsic. Defaults to False.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

Returns:

  • True and a success message if the extrinsic is successfully submitted or processed.

  • False and an error message if the submission fails or the wallet cannot be unlocked.

Return type:

Tuple[bool, str]

Note: Modifying is allowed even when user liquidity is enabled in specified subnet.

Call toggle_user_liquidity_extrinsic to enable/disable user liquidity.

async bittensor.core.extrinsics.asyncex.liquidity.remove_liquidity_extrinsic(subtensor, wallet, netuid, position_id, hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, period=None)#

Remove liquidity and credit balances back to wallet’s hotkey stake.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – The Subtensor client instance used for blockchain interaction.

  • wallet (bittensor_wallet.Wallet) – The wallet used to sign the extrinsic (must be unlocked).

  • netuid (int) – The UID of the target subnet for which the call is being initiated.

  • position_id (int) – The id of the position record in the pool.

  • hotkey (Optional[str]) – The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to None.

  • wait_for_inclusion (bool) – Whether to wait for the extrinsic to be included in a block. Defaults to True.

  • wait_for_finalization (bool) – Whether to wait for finalization of the extrinsic. Defaults to False.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

Returns:

  • True and a success message if the extrinsic is successfully submitted or processed.

  • False and an error message if the submission fails or the wallet cannot be unlocked.

Return type:

Tuple[bool, str]

Note: Adding is allowed even when user liquidity is enabled in specified subnet.

Call toggle_user_liquidity_extrinsic to enable/disable user liquidity.

async bittensor.core.extrinsics.asyncex.liquidity.toggle_user_liquidity_extrinsic(subtensor, wallet, netuid, enable, wait_for_inclusion=True, wait_for_finalization=False, period=None)#

Allow to toggle user liquidity for specified subnet.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – The Subtensor client instance used for blockchain interaction.

  • wallet (bittensor_wallet.Wallet) – The wallet used to sign the extrinsic (must be unlocked).

  • netuid (int) – The UID of the target subnet for which the call is being initiated.

  • enable (bool) – Boolean indicating whether to enable user liquidity.

  • wait_for_inclusion (bool) – Whether to wait for the extrinsic to be included in a block. Defaults to True.

  • wait_for_finalization (bool) – Whether to wait for finalization of the extrinsic. Defaults to False.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

Returns:

  • True and a success message if the extrinsic is successfully submitted or processed.

  • False and an error message if the submission fails or the wallet cannot be unlocked.

Return type:

Tuple[bool, str]