ποΈRocksdb states
1. Token
1.1 Token info
Column family: token
Query key:
t:{mint}
pub struct Token {
pub id: String, // internal identifier for this token (typically equal to mint)
pub program: String, // origin program/launchpad or DEX program
pub signature: String, // creation transaction signature
pub mint: String, // token mint address
pub quote_mint: String, // quote token mint (e.g., WSOL or USD1)
pub bonding_curve: Option<String>,// optional bonding curve id/address (pre-migration)
pub name: String, // token display name
pub symbol: String, // token ticker symbol
pub uri: String, // metadata URI
pub creator: String, // creator address (string)
pub creator_balance: f64, // creator SOL balance
pub creation_time: i64, // unix timestamp when created
pub creation_slot: u64, // slot when created
pub total_supply: f64, // total minted supply (UI units)
pub decimals: u8, // number of decimal places
pub quote_decimals: u8, // decimals for quote token (e.g., 9 for WSOL)
// Prices and liquidities are in QUOTE units; u_* are USD equivalents
pub price: f64, // price per token in quote units
pub u_price: f64, // price per token in USD
pub market_cap: f64, // market cap in quote units
pub u_market_cap: f64, // market cap in USD
pub liquidity: f64, // current liquidity (quote units)
pub u_liquidity: f64, // current liquidity (USD)
pub token_liquidity: f64, // token-side liquidity (token units)
pub u_token_liquidity: f64, // token-side liquidity (USD)
pub ath_liquidity: f64, // ath liquidity (quote units)
pub u_ath_liquidity: f64, // ath liquidity (USD)
pub ath_liq_ts: Option<i64>, // ath liquidity timestamp
pub ath_price: f64, // ath price (quote units)
pub u_ath_price: f64, // ath price (USD)
pub ath_price_ts: Option<i64>, // ath price timestamp
pub bonding_progress: f64, // progress along bonding curve (0β100)
pub curve_type: u8, // encoded bonding curve type id
// Initial reserves at creation (if available)
pub init_liq: f64, // initial quote reserves
pub u_init_liq: f64, // initial quote reserves (USD)
pub init_token_liq: f64, // initial token reserves
pub u_init_token_liq: f64, // initial token reserves (USD)
// Migration
pub migrated: bool, // whether token migrated to DEX pool
pub migrated_at: Option<i64>, // unix timestamp when migration happened
// Pool info
pub pool: Option<PoolInfo>, // pool details after migration
// Holders
pub holders_count: usize, // cached number of unique holders
pub top10_holder_percent: f64, // Top 10 holder % of total supply
pub top100_holder_percent: f64, // Top 100 holder % of total supply
pub top_holders: Vec<(String, String)>, // top holders with classification
// Trades
pub trades: u64, // total number of trades observed
pub large_trades: u64, // large trades (e.g., β₯ threshold)
// Aggregated fees (in SOL)
pub total_fee: f64,
pub priority_fee: f64,
pub tip_fee: f64,
pub trade_fee: f64,
}
pub struct PoolInfo {
pub pool_program: String, // program id of the pool
pub pool_address: String, // pool account address
pub pool_authority: String, // authority account for the pool
pub pool_mint_account: String,// token mint account for pool token
pub pool_quote_account: String,// quote token account for the pool
}1.1.1 Example: Simple
The following request retrieves data for the $TRUMP token:
Token Symbol: $TRUMP
Contract Address: 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
The WASM function returns the following data structure: This is an example response object. Values are illustrative (not live).
1.1.2 Example: Combining event topics and token state
To resolve dynamic keys (like mint) from incoming events and then fetch the corresponding token state from RocksDB, use a two-step state definition: first derive mint from event payload, then interpolate it in the RocksDB key. See Topics specification for event schemas in dsl-system/main-topics.md.
Explanation: This rule triggers only for tokens with bonding_progress > 60 (near/after bonding completion) and a post-window holder count greater than 4. The holder_after state is mapped from the holder-pulse eventβs after field (holder count after the 2-slot window), while bonding_progress is read from token_state in RocksDB.
1.2 Holders
Column family: token
Query key:
h:{mint}
1. Example:
The following request retrieves top holders for the $TRUMP token:
Token Symbol: $TRUMP
Contract Address: 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
The WASM function returns the following data structure: This is an example response object. Values are illustrative (not live).
Example 2: Combining event topics and holders state
Use event payload to derive mint and interpolate it in the RocksDB key. See Topics specification in dsl-system/main-topics.md.
1.3 Stats
Column family: token_stats
Query key:
s:{mint}
Example 1:
The following request retrieves 1m/5m/1h/6h/24h stats for the $TRUMP token:
Token Symbol: $TRUMP
Contract Address: 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
The WASM function returns the following data structure: This is an example response object. Values are illustrative (not live).
Example 2: Combining event topics and trade stats state
Use event payload to derive mint and interpolate it in the RocksDB key. See Topics specification in dsl-system/main-topics.md.
1.4 100 first buy txs
Column family: token
Query key:
eb:{mint}
Example 1:
The following request retrieves up to 100 earliest buy transactions for the $TRUMP token:
Token Symbol: $TRUMP
Contract Address: 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
The WASM function returns the following data structure: This is an example response object. Values are illustrative (not live).
Example 2: Combining event topics and early buyers state
Use event payload to derive mint and interpolate it in the RocksDB key. See Topics specification in dsl-system/main-topics.md.
1.5 Holders Analytics
Column family: holders_analytics
Query key:
ha:{mint}Note: Metrics are computed from the top 20 largest holders (by token balance)
1.5.1 Example: Simple
The following request retrieves holder analytics for the $TRUMP token:
Token Symbol: $TRUMP
Contract Address: 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
The WASM function returns the following data structure: This is an example response object. Values are illustrative (not live).
1.5.2 Example: Combining event topics and holder analytics state
To resolve dynamic keys (like mint) from incoming events and then fetch the corresponding holder analytics from RocksDB, use a two-step state definition: first derive mint from event payload, then interpolate it in the RocksDB key. See Topics specification for event schemas in dsl-system/main-topics.md.
Explanation: This rule triggers only for tokens where whale holders represent more than 5% of total holders and bot holders control less than 30% of the total supply. The whale_percentage and bot_supply_percentage states are derived from the holder_analytics state in RocksDB, while the mint is extracted from the holder-pulse event.
2. Creator / Trader
2.1 Creator
Column family: creator
Query key:
c:{creator}
Example 1:
The following request retrieves aggregated stats for a creator address:
Creator Address: 3f3YEGW9Qyq4h8AxhV24o3t8xPzYz1w6o7wH7kHcCrea
The WASM function returns the following data structure: This is an example response object. Values are illustrative (not live).
Example 2: Combining event topics and creator state
Use event payload to derive pubkey and interpolate it in the RocksDB key. See Topics specification in dsl-system/main-topics.md.
2.2 Trader
Column family: trader
Query key:
t:{trader}
Example 1:
The following request retrieves trader profile and recent activities:
Trader Address: 8h1TrDRP5pTQ1mKq8iXK7H2jvQvRk2m6sDfN9TrAdEr
The WASM function returns the following data structure: This is an example response object. Values are illustrative (not live).
Example 2: Combining event topics and trader state
Use event payload to derive pubkey and interpolate it in the RocksDB key. See Topics specification in dsl-system/main-topics.md.
Last updated