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

# Accounts

> For advanced users, you may need to interact with the Heaven program directly.

## Protocol Configuration

### Version 1: Community Token Configurations

* Protocol Fee - 1% for under 100K MC and 0.25% for over or equal to 100K MC
* Creator Fee - 0.1% for any MC
* Every pool is seeded with 1 Billion tokens and virtual 35 SOL
* USD volume threshold for creator fee claim - \$0
* Migration Market Cap Threshold - 100K

### Version 2: Creator Token Configurations

* Protocol Fee - 1% for under 100K MC and 0.5% for over or equal to 100K MC
* Creator Fee - 1% for any MC
* Every pool is seeded with 1 Billion tokens and virtual 35 SOL
* USD volume threshold for creator fee verification/claim - 100K
* Migration Market Cap Threshold - 100K

### Version 3: Pro Pool Configurations

* Protocol Fee - 0.3% for any MC
* Creator Fee - 0% by default, configurable by pool creator (market cap based brackets)
* LP Fee - 0% by default, configurable by pool creator (market cap based brackets)
* Reflection Fee - 0% by default, configurable by pool creator (market cap based brackets)
* Creator Slot Fee - optionally configurable for sniper resistance (slot-offset based brackets)
* Initial liquidity - custom token and SOL amounts set by creator
* Feature toggles - swap, deposit, withdraw, same-slot trading, sandwich resistance
* No migration threshold (pro pools do not migrate)

## Pool State

You can decode the pool state using the IDL or the SDK. The pool state contains all the information about the pool, including the tokens, reserves, fees, and other parameters.

```rust state.rs icon="rust" wrap expandable theme={null}
pub struct LiquidityPoolState {
    pub info: LiquidityPoolInfo,
    pub market_cap_based_fees: LiquidityPoolMarketCapBasedFees,
    pub reserve: LiquidityPoolReserve,
    pub lp_token: LiquidityPoolLpTokenInfo,

    pub protocol_trading_fees: u64,
    pub creator_trading_fees: u64,
    pub creator_trading_fees_claimed_by_creator: u64,
    pub creator_trading_fees_claimed_by_others: u64,
    pub liquidity_provider_trading_fees: u64,
    pub creator_trading_fee_protocol_fees: u64,
    pub reflection_trading_fees: u64,
    pub created_at_slot: u64,
    pub trading_volume_usd: f64,
    pub creator_trading_fee_trading_volume_threshold: f64,
    pub creator_trading_fee_trading_volume_threshold_reached_unix_timestamp: u64,

    pub token_a_vault: Pubkey,
    pub token_b_vault: Pubkey,
    pub protocol_config: Pubkey,
    pub key: Pubkey,

    pub token_a: LiquidityPoolTokenInfo,
    pub token_b: LiquidityPoolTokenInfo,
    pub permissions: LiquidityPoolPermissions,
    pub feature_flags: LiquidityPoolFeatureFlags,

    pub taxable_side: u8,
    pub taxable_side_type: u8,
    pub creator_trading_fee_distribution: u8,
    pub creator_trading_fee_claim_status: u8,
    pub fee_configuration_mode: u8,

    pub is_migrated: u8,
    _pad: [u8; 13],
    pub slot_offset_based_fees: LiquidityPoolSlotOffsetBasedFees,
    pub creator_trading_fee_receiver: Pubkey,
}
```

### Key Information

* **Fees**
  * `protocol_trading_fees`: Total **Protocol Fee** collected.
  * `creator_trading_fees`: Total **Creator Fee** collected.
  * `creator_trading_fees_claimed_by_creator`: Total **Creator Fee** claimed by the creator.
  * `creator_trading_fees_claimed_by_others`: Total **Creator Fee** claimed by others.
  * `liquidity_provider_trading_fees`: Total liquidity provider trading fees collected.
  * `creator_trading_fee_protocol_fees`: Total **Creator-Protocol Fee** collected.
  * `reflection_trading_fees`: Total **Reflection Fee** collected.
* **Creator Fee Claim Status**
  * `creator_trading_fee_claim_status`: Indicates if the creator fee verification is pending or completed.
    * `0`: Unclaimed - The default state when the pool is created.
    * `1`: Submitted - The creator has submitted an application for verification.
    * `2`: Processed - The application has been processed.
* **Trading Volume**
  * `trading_volume_usd`: The current trading volume (buy/sell) in USD.
  * `creator_trading_fee_trading_volume_threshold`: The threshold for **Creator Fee** claim.
  * `creator_trading_fee_trading_volume_threshold_reached_unix_timestamp`: Timestamp when the threshold was reached.
* **Creator Fee Distribution**
  * `creator_trading_fee_distribution`: Indicates how the **Creator Fee** is to be distributed.
    * `0`: Community - By default, the fee is distributed to the community as additional reflections.
    * `1`: Creator - A creator can submit verification to claim the fee. Once approved, `creator_trading_fee_distribution` is set to `1`.
    * `2`: Blocked - Cannot be claimed by creator.
    * `3`: Shared - The fee is split between the creator and the flywheel.
* **Migration**
  * You can use the `is_migrated` field to check if the pool has surpassed the market cap threshold (e.g. \$100k)
    * `0`: Not migrated
    * `1`: Migrated

## User LP Position (Pro Pools)

Pro pools track each user's liquidity via an on-chain LP position account. The PDA is derived from `[USER_LP_POSITION, pool, user]`.

```rust state.rs icon="rust" wrap theme={null}
pub struct UserLpPosition {
    pub pool: Pubkey,
    pub user: Pubkey,
    pub lp_token_balance: u64,
    pub reward_debt: u64,
    pub pending_fees: u64,
    pub bump: u8,
}
```

### Key Information

* **`lp_token_balance`**: The user's current LP token balance in this pool. Represents their proportional share of the pool's reserves.
* **`reward_debt`**: Internal accounting value used for fee distribution calculations. Updated when depositing, withdrawing, or claiming fees.
* **`pending_fees`**: Accumulated trading fees claimable by this LP position.
* **`pool`** / **`user`**: The pool and user public keys that this position belongs to.
* **`bump`**: The PDA bump seed.

You can query a user's LP position via the [`/data/lp-balance`](/api-reference/data-api/get-lp-balance) endpoint, or deserialize the account directly using the IDL.

***
