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
12 changes: 12 additions & 0 deletions bittensor/core/async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3785,6 +3785,7 @@ async def add_liquidity(
liquidity: Balance,
price_low: Balance,
price_high: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -3798,6 +3799,8 @@ async def add_liquidity(
liquidity: The amount of liquidity to be added.
price_low: The lower bound of the price tick range. In TAO.
price_high: The upper bound of the price tick range. In TAO.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to
`None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -3819,6 +3822,7 @@ async def add_liquidity(
liquidity=liquidity,
price_low=price_low,
price_high=price_high,
hotkey=hotkey,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
Expand Down Expand Up @@ -3992,6 +3996,7 @@ async def modify_liquidity(
netuid: int,
position_id: int,
liquidity_delta: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -4003,6 +4008,8 @@ async def modify_liquidity(
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
liquidity_delta: The amount of liquidity to be added or removed (add if positive or remove if negative).
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to
`None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand Down Expand Up @@ -4049,6 +4056,7 @@ async def modify_liquidity(
netuid=netuid,
position_id=position_id,
liquidity_delta=liquidity_delta,
hotkey=hotkey,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
Expand Down Expand Up @@ -4200,6 +4208,7 @@ async def remove_liquidity(
wallet: "Wallet",
netuid: int,
position_id: int,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -4210,6 +4219,8 @@ async def remove_liquidity(
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to
`None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -4231,6 +4242,7 @@ async def remove_liquidity(
wallet=wallet,
netuid=netuid,
position_id=position_id,
hotkey=hotkey,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
Expand Down
12 changes: 9 additions & 3 deletions bittensor/core/extrinsics/asyncex/liquidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async def add_liquidity_extrinsic(
liquidity: Balance,
price_low: Balance,
price_high: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -31,6 +32,7 @@ async def add_liquidity_extrinsic(
liquidity: The amount of liquidity to be added.
price_low: The lower bound of the price tick range.
price_high: The upper bound of the price tick range.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -56,7 +58,7 @@ async def add_liquidity_extrinsic(
call_module="Swap",
call_function="add_liquidity",
call_params={
"hotkey": wallet.hotkey.ss58_address,
"hotkey": hotkey or wallet.hotkey.ss58_address,
"netuid": netuid,
"tick_low": tick_low,
"tick_high": tick_high,
Expand All @@ -80,6 +82,7 @@ async def modify_liquidity_extrinsic(
netuid: int,
position_id: int,
liquidity_delta: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -92,6 +95,7 @@ async def modify_liquidity_extrinsic(
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
liquidity_delta: The amount of liquidity to be added or removed (add if positive or remove if negative).
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -114,7 +118,7 @@ async def modify_liquidity_extrinsic(
call_module="Swap",
call_function="modify_position",
call_params={
"hotkey": wallet.hotkey.ss58_address,
"hotkey": hotkey or wallet.hotkey.ss58_address,
"netuid": netuid,
"position_id": position_id,
"liquidity_delta": liquidity_delta.rao,
Expand All @@ -136,6 +140,7 @@ async def remove_liquidity_extrinsic(
wallet: "Wallet",
netuid: int,
position_id: int,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -147,6 +152,7 @@ async def remove_liquidity_extrinsic(
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -169,7 +175,7 @@ async def remove_liquidity_extrinsic(
call_module="Swap",
call_function="remove_liquidity",
call_params={
"hotkey": wallet.hotkey.ss58_address,
"hotkey": hotkey or wallet.hotkey.ss58_address,
"netuid": netuid,
"position_id": position_id,
},
Expand Down
12 changes: 9 additions & 3 deletions bittensor/core/extrinsics/liquidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def add_liquidity_extrinsic(
liquidity: Balance,
price_low: Balance,
price_high: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -31,6 +32,7 @@ def add_liquidity_extrinsic(
liquidity: The amount of liquidity to be added.
price_low: The lower bound of the price tick range.
price_high: The upper bound of the price tick range.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -56,7 +58,7 @@ def add_liquidity_extrinsic(
call_module="Swap",
call_function="add_liquidity",
call_params={
"hotkey": wallet.hotkey.ss58_address,
"hotkey": hotkey or wallet.hotkey.ss58_address,
"netuid": netuid,
"tick_low": tick_low,
"tick_high": tick_high,
Expand All @@ -80,6 +82,7 @@ def modify_liquidity_extrinsic(
netuid: int,
position_id: int,
liquidity_delta: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -92,6 +95,7 @@ def modify_liquidity_extrinsic(
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
liquidity_delta: The amount of liquidity to be added or removed (add if positive or remove if negative).
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -114,7 +118,7 @@ def modify_liquidity_extrinsic(
call_module="Swap",
call_function="modify_position",
call_params={
"hotkey": wallet.hotkey.ss58_address,
"hotkey": hotkey or wallet.hotkey.ss58_address,
"netuid": netuid,
"position_id": position_id,
"liquidity_delta": liquidity_delta.rao,
Expand All @@ -136,6 +140,7 @@ def remove_liquidity_extrinsic(
wallet: "Wallet",
netuid: int,
position_id: int,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -147,6 +152,7 @@ def remove_liquidity_extrinsic(
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -169,7 +175,7 @@ def remove_liquidity_extrinsic(
call_module="Swap",
call_function="remove_liquidity",
call_params={
"hotkey": wallet.hotkey.ss58_address,
"hotkey": hotkey or wallet.hotkey.ss58_address,
"netuid": netuid,
"position_id": position_id,
},
Expand Down
12 changes: 12 additions & 0 deletions bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3002,6 +3002,7 @@ def add_liquidity(
liquidity: Balance,
price_low: Balance,
price_high: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -3015,6 +3016,8 @@ def add_liquidity(
liquidity: The amount of liquidity to be added.
price_low: The lower bound of the price tick range. In TAO.
price_high: The upper bound of the price tick range. In TAO.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to
`None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -3036,6 +3039,7 @@ def add_liquidity(
liquidity=liquidity,
price_low=price_low,
price_high=price_high,
hotkey=hotkey,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
Expand Down Expand Up @@ -3214,6 +3218,7 @@ def modify_liquidity(
netuid: int,
position_id: int,
liquidity_delta: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -3225,6 +3230,8 @@ def modify_liquidity(
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
liquidity_delta: The amount of liquidity to be added or removed (add if positive or remove if negative).
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to
`None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand Down Expand Up @@ -3271,6 +3278,7 @@ def modify_liquidity(
netuid=netuid,
position_id=position_id,
liquidity_delta=liquidity_delta,
hotkey=hotkey,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
Expand Down Expand Up @@ -3421,6 +3429,7 @@ def remove_liquidity(
wallet: "Wallet",
netuid: int,
position_id: int,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
Expand All @@ -3431,6 +3440,8 @@ def remove_liquidity(
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to
`None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
Expand All @@ -3452,6 +3463,7 @@ def remove_liquidity(
wallet=wallet,
netuid=netuid,
position_id=position_id,
hotkey=hotkey,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
Expand Down
3 changes: 3 additions & 0 deletions tests/unit_tests/test_async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3713,6 +3713,7 @@ async def test_add_liquidity(subtensor, fake_wallet, mocker):
liquidity=Balance.from_tao(150),
price_low=Balance.from_tao(180).rao,
price_high=Balance.from_tao(130).rao,
hotkey=None,
wait_for_inclusion=True,
wait_for_finalization=False,
period=None,
Expand Down Expand Up @@ -3745,6 +3746,7 @@ async def test_modify_liquidity(subtensor, fake_wallet, mocker):
netuid=netuid,
position_id=position_id,
liquidity_delta=Balance.from_tao(150),
hotkey=None,
wait_for_inclusion=True,
wait_for_finalization=False,
period=None,
Expand Down Expand Up @@ -3775,6 +3777,7 @@ async def test_remove_liquidity(subtensor, fake_wallet, mocker):
wallet=fake_wallet,
netuid=netuid,
position_id=position_id,
hotkey=None,
wait_for_inclusion=True,
wait_for_finalization=False,
period=None,
Expand Down
3 changes: 3 additions & 0 deletions tests/unit_tests/test_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4043,6 +4043,7 @@ def test_add_liquidity(subtensor, fake_wallet, mocker):
liquidity=Balance.from_tao(150),
price_low=Balance.from_tao(180).rao,
price_high=Balance.from_tao(130).rao,
hotkey=None,
wait_for_inclusion=True,
wait_for_finalization=False,
period=None,
Expand Down Expand Up @@ -4074,6 +4075,7 @@ def test_modify_liquidity(subtensor, fake_wallet, mocker):
netuid=netuid,
position_id=position_id,
liquidity_delta=Balance.from_tao(150),
hotkey=None,
wait_for_inclusion=True,
wait_for_finalization=False,
period=None,
Expand Down Expand Up @@ -4103,6 +4105,7 @@ def test_remove_liquidity(subtensor, fake_wallet, mocker):
wallet=fake_wallet,
netuid=netuid,
position_id=position_id,
hotkey=None,
wait_for_inclusion=True,
wait_for_finalization=False,
period=None,
Expand Down
Loading