> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hadron.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Pool Admin Control

## setPoolState

Pools are initialised by default as `RejectSwaps`. This lets you deposit funds before the pool is indexed by aggregators.

```rust theme={null}
use hadron_sdk_v2::types::{SetPoolStateParams, PoolState};

let ix = pool.set_pool_state(&authority, &SetPoolStateParams {
    new_state: PoolState::Initialized,
});
```

What each state blocks:

| **State**     | **Swaps** | **Deposits** | **Withdrawals** |
| ------------- | --------- | ------------ | --------------- |
| `Initialized` | ✅         | ✅            | ✅               |
| `RejectSwaps` | ❌         | ✅            | ✅               |
| `Paused`      | ❌         | ❌            | ❌               |

Which authority can make which transition:

| **From → To**               | **Pool Authority** | **Quoting Authority** | **Pauser Authority** |
| --------------------------- | ------------------ | --------------------- | -------------------- |
| `Initialized → Paused`      | ✅                  | ❌                     | ✅                    |
| `Initialized → RejectSwaps` | ✅                  | ✅                     | ❌                    |
| `Paused → Initialized`      | ✅                  | ❌                     | ❌                    |
| `Paused → RejectSwaps`      | ✅                  | ❌                     | ❌                    |
| `RejectSwaps → Initialized` | ✅                  | ❌                     | ❌                    |
| `RejectSwaps → Paused`      | ✅                  | ❌                     | ✅                    |

***

## nominateAuthority / acceptAuthority

Hadron pools have multiple authorities that can each be delegated to different wallets to split the surface area of control. Authority transfer is a two-step process to prevent accidental lockout.

```rust theme={null}
use hadron_sdk_v2::types::NominateAuthorityParams;

// Step 1: current authority nominates a new one
let ix1 = pool.nominate_authority(&authority, &NominateAuthorityParams {
    new_authority: new_pk,
    expiry_slot: current_slot + 50_000, // nomination expires after ~6 hours
});

// Step 2: new authority accepts
let ix2 = pool.accept_authority(&new_pk);
```

| **Param**              | **Type** | **Description**                                                                                                                        |
| ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `params.new_authority` | `Pubkey` | The wallet being nominated                                                                                                             |
| `params.expiry_slot`   | `u64`    | Slot after which the nomination expires. Set this to a near-future slot — if the new authority doesn't accept in time, nominate again. |

> **Authority types** The pool has three distinct authority roles: **Pool Authority** (full admin — can do everything), **Quoting Authority** (can push oracle updates and switch pool to `RejectSwaps`), and **Pauser Authority** (can pause and unpause the pool). Each can be delegated to a different wallet using `nominate_authority` for the relevant role.

***

## closePool

Closes the pool and reclaims rent. Both vaults must be fully empty before calling this.

```rust theme={null}
let ix = pool.close_pool(&authority);
```

> **Drain vaults first** Call `withdraw` with the full vault balance for both token X and token Y before closing. The transaction will fail with error `VaultsNotEmpty` (code 52) if any balance remains.

***

## Properties

These are available on any `Hadron` instance after creation:

| **Property**              | **Type**                | **Description**                                            |
| ------------------------- | ----------------------- | ---------------------------------------------------------- |
| `pool.pool_address`       | `Pubkey`                | The pool's on-chain address                                |
| `pool.program_id`         | `Pubkey`                | Program ID                                                 |
| `pool.addresses`          | `PoolAddresses`         | All derived PDA addresses for this pool                    |
| `pool.config`             | `DecodedConfig`         | Decoded config account data                                |
| `pool.oracle`             | `DecodedMidpriceOracle` | Decoded oracle data                                        |
| `pool.curve_meta`         | `DecodedCurveMeta`      | Decoded curve metadata                                     |
| `pool.curve_prefabs_data` | `Vec<u8>`               | Raw curve prefabs data — decode with `get_active_curves()` |
