> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/drift-labs/protocol-v2/llms.txt
> Use this file to discover all available pages before exploring further.

# State Account

> Global state account in Drift Protocol

The State account stores global protocol configuration and parameters.

## Account Structure

The State account is defined in `programs/drift/src/state/state.rs`.

### Key Fields

<ResponseField name="admin" type="Pubkey">
  Protocol admin public key
</ResponseField>

<ResponseField name="exchangeStatus" type="ExchangeStatus">
  Global exchange status (active, paused, etc.)
</ResponseField>

<ResponseField name="oracleGuardRails" type="OracleGuardRails">
  Oracle validation parameters

  <Expandable title="Oracle Guard Rails">
    * `slotsBeforeStaleForAmm`: Slots before oracle is stale
    * `confidenceIntervalMaxPercentDivergence`: Max confidence as % of price
    * `priceDivergence`: Mark/oracle divergence limits
  </Expandable>
</ResponseField>

<ResponseField name="numberOfAuthorities" type="u64">
  Number of users with accounts
</ResponseField>

<ResponseField name="numberOfSubAccounts" type="u64">
  Total number of sub-accounts
</ResponseField>

<ResponseField name="perpFeeStructure" type="FeeStructure">
  Perpetual market fee configuration
</ResponseField>

<ResponseField name="spotFeeStructure" type="FeeStructure">
  Spot market fee configuration
</ResponseField>

<ResponseField name="maxInitializeUserFee" type="u32">
  Maximum fee for initializing a user account
</ResponseField>

## Fee Structure

```rust theme={null}
pub struct FeeStructure {
    pub fee_tiers: [FeeTier; 10],
    pub filler_reward_structure: OrderFillerRewardStructure,
    pub referrer_reward_epoch_upper_bound: u64,
    pub flat_filler_fee: u64,
}
```

Fee tiers are based on 30-day trading volume.

## Access via SDK

```typescript theme={null}
import { DriftClient } from '@drift-labs/sdk';

const state = driftClient.getStateAccount();
console.log('Exchange status:', state.exchangeStatus);
console.log('Oracle guard rails:', state.oracleGuardRails);
```

<CardGroup cols={2}>
  <Card title="DriftClient API" href="/api/drift-client">
    Access state via SDK
  </Card>

  <Card title="Program Architecture" href="/program/architecture">
    Architecture overview
  </Card>
</CardGroup>
