diff --git a/bittensor/cli.py b/bittensor/cli.py
index b0e16f9f75..fae049c34d 100644
--- a/bittensor/cli.py
+++ b/bittensor/cli.py
@@ -77,7 +77,6 @@
"my_delegates": MyDelegatesCommand,
"list_delegates": ListDelegatesCommand,
"nominate": NominateCommand,
- "set_delegate_take": SetDelegateTakeCommand,
},
},
"wallet": {
diff --git a/bittensor/commands/__init__.py b/bittensor/commands/__init__.py
index 1b94b9f8de..71cecd4244 100644
--- a/bittensor/commands/__init__.py
+++ b/bittensor/commands/__init__.py
@@ -77,7 +77,6 @@
DelegateStakeCommand,
DelegateUnstakeCommand,
MyDelegatesCommand,
- SetDelegateTakeCommand,
)
from .wallets import (
NewColdkeyCommand,
diff --git a/bittensor/commands/delegates.py b/bittensor/commands/delegates.py
index 8d817ce005..9209741d29 100644
--- a/bittensor/commands/delegates.py
+++ b/bittensor/commands/delegates.py
@@ -835,101 +835,3 @@ def check_config(config: "bittensor.config"):
):
wallet_name = Prompt.ask("Enter wallet name", default=defaults.wallet.name)
config.wallet.name = str(wallet_name)
-
-
-class SetDelegateTakeCommand:
- """
- Executes the 'set_delegate_take' command, which sets the commission rate (take percentage)
- for a user's delegate on the Bittensor network. This commission is the fraction of rewards
- that the delegate takes from staking operations.
-
- Optional Arguments:
- - wallet.name: The name of the wallet to use for the command.
- - delegate.take: The take percentage to set for the delegate.
-
- The function performs several checks:
- - Ensures the take value is within the valid range (0.0 to 1.0).
- - Verifies that the hotkey associated with the wallet is registered as a delegate.
- - Sets the take percentage on the network if the above conditions are met.
-
- Usage:
- The user is prompted to enter the desired take value, which must be a float between 0 and 1.
- The value is then scaled and cast to an integer ratio before being sent to the network.
-
- Example usage:
- >>> btcli root set_delegate_take --take 0.1
- >>> btcli root set_delegate_take --wallet.name my_wallet --wallet.hotkey my_hotkey --take 0.1
-
- Note:
- This command will result in a change to the blockchain state and may incur transaction fees.
- It is interactive and requires input from the user. This function is intended to be used as
- part of the Bittensor CLI and not as a standalone function within user code.
- """
-
- @staticmethod
- def run(cli):
- r"""Set your delegate's take percentage."""
- wallet = bittensor.wallet(config=cli.config)
- subtensor = bittensor.subtensor(config=cli.config)
-
- # Unlock the wallet.
- wallet.hotkey
- wallet.coldkey
-
- take = float(cli.config.take)
- if take > 1 or take < 0:
- bittensor.__console__.print(
- "Aborting: Invalid take value: {}".format(cli.config.delegate.take)
- )
- return
-
- # Check if the hotkey is already a delegate.
- if not subtensor.is_hotkey_delegate(wallet.hotkey.ss58_address):
- bittensor.__console__.print(
- "Aborting: Hotkey {} isn't a delegate.".format(
- wallet.hotkey.ss58_address
- )
- )
- return
-
- result: bool = subtensor.set_delegate_take(
- wallet, int(take * 65535)
- ) # Cast 0-1 float to u16 ratio for chain
- if not result:
- bittensor.__console__.print(
- "Could not set delegate take on [white]{}[/white]".format(
- subtensor.network
- )
- )
- else:
- bittensor.__console__.print(
- "Successfully set delegate take on [white]{}[/white]".format(
- subtensor.network
- )
- )
-
- @staticmethod
- def add_args(parser: argparse.ArgumentParser):
- set_delegate_take_parser = parser.add_parser(
- "set_delegate_take", help="""Set your delegate's take percentage."""
- )
- set_delegate_take_parser.add_argument(
- "--take", dest="take", type=str, required=False
- )
-
- bittensor.wallet.add_args(set_delegate_take_parser)
- bittensor.subtensor.add_args(set_delegate_take_parser)
-
- @staticmethod
- def check_config(config: "bittensor.config"):
- if not config.is_set("wallet.name") and not config.no_prompt:
- wallet_name = Prompt.ask("Enter wallet name", default=defaults.wallet.name)
- config.wallet.name = str(wallet_name)
-
- if not config.is_set("wallet.hotkey") and not config.no_prompt:
- hotkey = Prompt.ask("Enter hotkey name", default=defaults.wallet.hotkey)
- config.wallet.hotkey = str(hotkey)
-
- if not config.is_set("take") and not config.no_prompt:
- take = Prompt.ask("Enter new delegate take value (0 - 1)")
- config.take = take
diff --git a/bittensor/extrinsics/delegation.py b/bittensor/extrinsics/delegation.py
index d54416c15e..aa61f14fb0 100644
--- a/bittensor/extrinsics/delegation.py
+++ b/bittensor/extrinsics/delegation.py
@@ -95,66 +95,6 @@ def nominate_extrinsic(
return False
-def set_delegate_take_extrinsic(
- subtensor: "bittensor.subtensor",
- wallet: "bittensor.wallet",
- take: int,
- wait_for_finalization: bool = False,
- wait_for_inclusion: bool = True,
-) -> bool:
- r"""Set the delegate take for the provided hotkey.
- Args:
- wallet ( bittensor.wallet ):
- The wallet to become a delegate for.
- take (int):
- The u16 ratio of a delegator's rewards you'll take.
- Returns:
- success (bool):
- True if the transaction was successful.
- """
- # Unlock the coldkey.
- wallet.coldkey
- wallet.hotkey
-
- # Check if the hotkey is already a delegate.
- if not subtensor.is_hotkey_delegate(wallet.hotkey.ss58_address):
- logger.error("Hotkey {} isn't a delegate.".format(wallet.hotkey.ss58_address))
- return False
-
- with bittensor.__console__.status(
- ":satellite: Sending call on [white]{}[/white] ...".format(subtensor.network)
- ):
- try:
- success = subtensor._do_set_delegate_take(
- wallet=wallet,
- take=take,
- wait_for_inclusion=wait_for_inclusion,
- wait_for_finalization=wait_for_finalization,
- )
-
- if success == True:
- bittensor.__console__.print(
- ":white_heavy_check_mark: [green]Finalized[/green]"
- )
- bittensor.logging.success(
- prefix="Set delegate take",
- sufix="Finalized: " + str(success),
- )
-
- # Raises NominationError if False
- return success
-
- except Exception as e:
- bittensor.__console__.print(
- ":cross_mark: [red]Failed[/red]: error:{}".format(e)
- )
- bittensor.logging.warning(
- prefix="Set delegate take", sufix="Failed: " + str(e)
- )
-
- return False
-
-
def delegate_extrinsic(
subtensor: "bittensor.subtensor",
wallet: "bittensor.wallet",
diff --git a/bittensor/subtensor.py b/bittensor/subtensor.py
index c658d9475e..20dc254599 100644
--- a/bittensor/subtensor.py
+++ b/bittensor/subtensor.py
@@ -66,7 +66,6 @@
delegate_extrinsic,
nominate_extrinsic,
undelegate_extrinsic,
- set_delegate_take_extrinsic,
)
from .extrinsics.senate import (
register_senate_extrinsic,
@@ -454,37 +453,6 @@ def undelegate(
prompt=prompt,
)
- def set_delegate_take(
- self,
- wallet: "bittensor.wallet",
- take: int,
- wait_for_finalization: bool = False,
- wait_for_inclusion: bool = True,
- ) -> bool:
- """
- Sets the percentage of incentives that a delegate neuron takes from its delegators. This action adjusts
- the reward distribution mechanism between a delegate and its supporting neurons.
-
- Args:
- wallet (bittensor.wallet): The wallet of the delegate neuron.
- take (int): The percentage (0-100) of incentives to take from delegators.
- wait_for_finalization (bool, optional): Waits for the transaction to be finalized on the blockchain.
- wait_for_inclusion (bool, optional): Waits for the transaction to be included in a block.
-
- Returns:
- bool: True if the setting of delegate take percentage is successful, False otherwise.
-
- This method allows a delegate neuron to specify its share of the incentives generated through delegation,
- aligning with the network's principles of decentralized governance and fair incentive distribution.
- """
- return set_delegate_take_extrinsic(
- subtensor=self,
- wallet=wallet,
- take=take,
- wait_for_finalization=wait_for_finalization,
- wait_for_inclusion=wait_for_inclusion,
- )
-
#####################
#### Set Weights ####
#####################
@@ -1925,7 +1893,7 @@ def make_substrate_call_with_retry():
call = substrate.compose_call(
call_module="SubtensorModule",
call_function="root_register",
- call_params={"hotkey": wallet.hotkey.ss58_address, "take": 11796},
+ call_params={"hotkey": wallet.hotkey.ss58_address},
)
extrinsic = substrate.create_signed_extrinsic(
call=call, keypair=wallet.coldkey
@@ -4005,40 +3973,6 @@ def make_substrate_call_with_retry():
return make_substrate_call_with_retry()
- def _do_set_delegate_take(
- self,
- wallet: "bittensor.wallet",
- take: int,
- wait_for_inclusion: bool = True,
- wait_for_finalization: bool = False,
- ) -> bool:
- @retry(delay=2, tries=3, backoff=2, max_delay=4)
- def make_substrate_call_with_retry():
- with self.substrate as substrate:
- call = substrate.compose_call(
- call_module="SubtensorModule",
- call_function="set_delegate_take",
- call_params={"hotkey": wallet.hotkey.ss58_address, "take": take},
- )
- extrinsic = substrate.create_signed_extrinsic(
- call=call, keypair=wallet.coldkey
- ) # sign with coldkey
- response = substrate.submit_extrinsic(
- extrinsic,
- wait_for_inclusion=wait_for_inclusion,
- wait_for_finalization=wait_for_finalization,
- )
- # We only wait here if we expect finalization.
- if not wait_for_finalization and not wait_for_inclusion:
- return True
- response.process_events()
- if response.is_success:
- return True
- else:
- raise NominationError(response.error_message)
-
- return make_substrate_call_with_retry()
-
################
#### Legacy ####
################