7.2 Account Structures
Market Account
#[account]
#[derive(InitSpace)]
pub struct Market {
/// Unique market identifier
pub market_id: u64,
/// Market status (BOUNDING, ACTIVE, COMPLETED, RESOLVED, REFUNDED)
pub status: MarketStatus,
/// Market metadata
#[max_len(200)]
pub title: String,
#[max_len(1000)]
pub description: String,
/// Outcome names (e.g., ["YES", "NO"] or ["Team A", "Team B", "Team C"])
#[max_len(10, 50)] // Max 10 outcomes, 50 chars each
pub outcomes: Vec<String>,
pub num_outcomes: u8,
/// Stakeholders
pub creator: Pubkey,
pub platform: Pubkey,
pub oracle: Pubkey,
/// LMSR parameters (phased dynamic)
pub target_b: u64, // Initial target (e.g., 1000)
pub virtual_b: u64, // Current b (equals real_pool in ACTIVE)
pub real_pool: u64, // Actual pool balance
/// LMSR market reference
pub lmsr_market: Pubkey,
/// Timing
pub created_at: i64,
pub end_time: i64,
/// Resolution
pub resolved: bool,
pub winning_outcome: Option<u8>,
/// Tracking for refunds (BOUNDING phase)
pub total_deposited: u64, // Total deposits in BOUNDING
/// Metrics
pub total_volume: u64,
pub creator_fees_earned: u64,
pub platform_fees_earned: u64,
/// Bumps
pub bump: u8,
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone, PartialEq)]
pub enum MarketStatus {
Bounding, // Only buys, building pool
Active, // Full LMSR, both buys/sells
Completed, // Trading stopped, awaiting resolution
Resolved, // Oracle resolved, winners can claim
Refunded, // BOUNDING timeout, all refunded
}Size Calculation:
Fixed fields: ~150 bytes
String fields: ~1250 bytes
Total: ~1400 bytes per market
LMSR Market Account
Platform Account
Last updated

