Skip to main content
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

admin
Pubkey
Protocol admin public key
exchangeStatus
ExchangeStatus
Global exchange status (active, paused, etc.)
oracleGuardRails
OracleGuardRails
Oracle validation parameters
numberOfAuthorities
u64
Number of users with accounts
numberOfSubAccounts
u64
Total number of sub-accounts
perpFeeStructure
FeeStructure
Perpetual market fee configuration
spotFeeStructure
FeeStructure
Spot market fee configuration
maxInitializeUserFee
u32
Maximum fee for initializing a user account

Fee Structure

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

import { DriftClient } from '@drift-labs/sdk';

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

DriftClient API

Access state via SDK

Program Architecture

Architecture overview

Build docs developers (and LLMs) love