# set-gamma-deposit-spender (/docs/tx/set-gamma-deposit-spender)

Takes effect at once; a deposit opened by a move inherits it. Set exactly
one of `spender_ss58`, `service_hotkey_ss58` or `default_spender`.

| Signer    | Origin                                 | Pallet          | Wraps                                                                                                       |
| --------- | -------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------- |
| `coldkey` | signed account (pallet role may apply) | SubtensorModule | [`SubtensorModule.set_gamma_deposit_spender`](/code/pallets/subtensor/src/macros/dispatches.rs#L3298-L3307) |

## Parameters [#parameters]

| Parameter             | Type    | Required | Description                                                                                                                                                |
| --------------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `netuid`              | integer | yes      | Subnet of the deposit.                                                                                                                                     |
| `hotkey_ss58`         | string  | yes      | Hotkey of the deposit.                                                                                                                                     |
| `spender_ss58`        | string  | no       | The account that spends the deposit.                                                                                                                       |
| `service_hotkey_ss58` | string  | no       | Hotkey of a service published on the subnet, instead of a spender. The deposit names the spender the service publishes.                                    |
| `default_spender`     | boolean | no       | Name the default spender: the spender of the subnet owner's service, otherwise the subnet owner, or its lease's beneficiary while a lease owns the subnet. |

Address parameters (`--hotkey`, `--coldkey`, `--dest`, ...) accept a raw ss58
address, an address-book or proxy-book name, or a local wallet/hotkey name.

## CLI [#cli]

Preview with `--dry-run` (shows fee, effects, and policy result without
submitting), then submit:

```bash
btcli tx set-gamma-deposit-spender \
  --netuid <int> \
  --hotkey <ss58|name> \
  --spender <ss58|name> --dry-run
btcli tx set-gamma-deposit-spender \
  --netuid <int> \
  --hotkey <ss58|name> \
  --spender <ss58|name> -w my_coldkey
```

## Python [#python]

```python
import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.SetGammaDepositSpender(netuid=1, hotkey_ss58="5F...", spender_ss58="5F...")

sub = bt.Subtensor()
plan = sub.plan(intent, wallet)   # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
    print(result.error.code, result.error.remediation)
```

(`bt.Subtensor` is also the async client — `async with bt.Subtensor() as client:`
— see [The client](/docs/concepts/client).) Or build the intent by op name, as
an agent would:

```python
result = sub.execute_tool("set_gamma_deposit_spender", {...}, wallet)
```

## On-chain implementation [#on-chain-implementation]

`SubtensorModule.set_gamma_deposit_spender` — [`pallets/subtensor/src/macros/dispatches.rs#L3300`](/code/pallets/subtensor/src/macros/dispatches.rs#L3298-L3307):

```rust
#[pallet::call_index(162)]
#[pallet::weight((<T as Config>::WeightInfo::set_gamma_deposit_spender(), DispatchClass::Normal, Pays::Yes))]
pub fn set_gamma_deposit_spender(
    origin: OriginFor<T>,
    hotkey: T::AccountId,
    netuid: NetUid,
    spender: Option<T::AccountId>,
) -> DispatchResult {
    Self::do_set_gamma_deposit_spender(origin, hotkey, netuid, spender)
}
```

Delegates to [`do_set_gamma_deposit_spender`](/code/pallets/subtensor/src/subnets/gamma.rs#L384).

Every file is browsable under [/code](/code) exactly as built into the runtime, or as plain text under `/code/raw/<path>` (index: [`/code/index.json`](/code/index.json)).
