streak-api 0.3.1

API for interacting with the STREAK directional markets protocol on Solana
Documentation
//! On-chain events (`sol_log_data` via Steel `event!` / `.log()`).
//!
//! ## Event contract
//!
//! | Event | Trigger | Observer |
//! |---|---|---|
//! | `Deposited` | `Deposit` ix | Indexer credits user's off-chain USDC balance |
//! | `Paid` | `AdminPayout` ix | Bot confirms payout in DB |
//! | `Initialized` | `Initialize` ix | One-time setup confirmation |
//!
//! Settlement outcome (UP/DOWN) is derived off-chain by the bot via Pyth Hermes.

use steel::*;

/// Emitted by `Initialize`.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Initialized {
    pub admin: Pubkey,
}

/// Emitted by `Deposit`. Indexer credits `user`'s off-chain balance by `amount` µUSDC.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Deposited {
    pub user: Pubkey,
    pub amount: u64,
}

/// Emitted by `AdminRouteFees`. Records DBC / DAMM v2 fee routing into the treasury.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct FeesRouted {
    /// Total µUSDC received from the pool fee claim.
    pub amount: u64,
    /// µUSDC added to `Treasury.daily_jackpot`.
    pub daily_share: u64,
    /// µUSDC added to `Treasury.weekly_jackpot`.
    pub weekly_share: u64,
    /// µUSDC added to `Treasury.buyback`.
    pub buyback_share: u64,
    /// µUSDC forwarded to `FEE_COLLECTOR` (team & ops).
    pub team_share: u64,
}

/// Emitted by `AdminPayout`. Bot confirms the payout was delivered.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Paid {
    pub recipient: Pubkey,
    pub amount: u64,
    pub series_id: u16,
    pub _pad: [u8; 6],
    pub period: u64,
}

event!(Initialized);
event!(Deposited);
event!(FeesRouted);
event!(Paid);