# close-gamma-deposit (/docs/tx/close-gamma-deposit)

Fails with `GammaDepositNotEmpty` while the deposit holds gamma.

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

## Parameters [#parameters]

| Parameter     | Type    | Required | Description                  |
| ------------- | ------- | -------- | ---------------------------- |
| `netuid`      | integer | yes      | Subnet of the deposit.       |
| `hotkey_ss58` | string  | yes      | Hotkey of the empty deposit. |

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 close-gamma-deposit \
  --netuid <int> \
  --hotkey <ss58|name> --dry-run
btcli tx close-gamma-deposit \
  --netuid <int> \
  --hotkey <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.CloseGammaDeposit(netuid=1, hotkey_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("close_gamma_deposit", {...}, wallet)
```

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

`SubtensorModule.close_gamma_deposit` — [`pallets/subtensor/src/macros/dispatches.rs#L3286`](/code/pallets/subtensor/src/macros/dispatches.rs#L3284-L3292):

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

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

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)).
