streak-api 0.3.2

API for interacting with the STREAK directional markets protocol on Solana
Documentation
//! Per-user account — one PDA per wallet.
//!
//! Created by the first `BuyTicket` call; `total_purchased` accumulates on
//! each subsequent call. This is the on-chain proof of lifetime ticket revenue.
//!
//! The *spendable* balance (credits available for bets) is tracked off-chain
//! by the indexer in `user_balances`. Bets are debited server-side.
//!
//! PDA seeds: `[USER_TICKET, user_pubkey]`

use steel::*;

use super::{user_pda, StreakAccount};

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct User {
    /// Wallet that owns this account.
    pub user: Pubkey,
    /// Cumulative µUSDC spent on tickets (never decreases).
    pub total_purchased: u64,
}

impl User {
    pub fn pda(user: &Pubkey) -> (Pubkey, u8) {
        user_pda(user)
    }
}

account!(StreakAccount, User);