Skip to main content

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.

setPoolState

Pools are initialised by default as RejectSwaps. This lets you deposit funds before the pool is indexed by aggregators.
use hadron_sdk::types::{SetPoolStateParams, PoolState};

let ix = pool.set_pool_state(&authority, &SetPoolStateParams {
    new_state: PoolState::Initialized,
});
What each state blocks:
StateSwapsDepositsWithdrawals
Initialized
RejectSwaps
WithdrawOnly
Paused
Which authority can make which transition:
From → ToPool AuthorityQuoting AuthorityPauser 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.
use hadron_sdk::types::NominateAuthorityParams;

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

// Step 2: new authority accepts
let ix2 = pool.accept_authority(&new_pk);
ParamTypeDescription
params.new_authorityPubkeyThe wallet being nominated
params.expiry_slotOption<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.
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:
PropertyTypeDescription
pool.pool_addressPubkeyThe pool’s on-chain address
pool.program_idPubkeyProgram ID
pool.addressesPoolAddressesAll derived PDA addresses for this pool
pool.configDecodedConfigDecoded config account data
pool.oracleDecodedMidpriceOracleDecoded oracle data
pool.curve_metaDecodedCurveMetaDecoded curve metadata
pool.curve_prefabs_dataVec<u8>Raw curve prefabs data — decode with get_active_curves()