Skip to main content

streak_api/
consts.rs

1use solana_program::{pubkey, pubkey::Pubkey};
2
3/// The authority allowed to invoke [`Initialize`](crate::instruction::Initialize). Replace with your deploy multisig / key before mainnet.
4pub const ADMIN_ADDRESS: Pubkey = pubkey!("6asgn8Vq8KKSQx4wm5zVfEfB76wqGVpEpWxajGkbQ8yr");
5
6/// Must sign executor-gated instructions: [`InitMarket`](crate::instruction::InitMarket), [`AdminInstantSettlement`](crate::instruction::AdminInstantSettlement), [`ExecutorTreasury`](crate::instruction::ExecutorTreasury), [`ClaimPositionFee`](crate::instruction::ClaimPositionFee). Replace before production.
7pub const EXECUTOR_ADDRESS: Pubkey =
8    pubkey!("3B1WXgrV68V6ayymC7C8eVoCMeqeJLR7HWXkxfQxLUeF");
9
10/// Meteora DAMM **cp\_amm** program ID (CPI `claim_position_fee`; local tree `damm-v2/programs/cp-amm`).
11pub const CP_AMM_PROGRAM_ID: Pubkey =
12    pubkey!("cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG");
13
14/// Basis points denominator (100%).
15pub const MAX_BPS: u16 = 10_000;
16
17/// Smallest SPL USDC increment: 10^-6 USD per base unit; ticket purchases and market stakes use whole multiples (1 whole USDC = `TICKET_MICROS` units).
18pub const TICKET_MICROS: u64 = 1_000_000;
19
20/// The seed of the ledger account PDA.
21pub const LEDGER: &[u8] = b"ledger";
22
23/// Maximum supported concurrent **market series** (**`series_id`** ∈ **`0..MAX_MARKET_SERIES`**).
24/// **`Treasury::next_period`** is a **monotonic floor cursor** (`max(period+1)` bookkeeping); **`InitMarket`** and **`PlaceBet`** do **not** require matching it.
25pub const MAX_MARKET_SERIES: usize = 64;
26
27/// PDA seed for **[`crate::state::Market`]**.
28pub const MARKET: &[u8] = b"market";
29
30/// PDA seed for **[`crate::state::Position`]**.
31pub const POSITION: &[u8] = b"position";
32
33/// The seed of the program treasury PDA (owns the protocol USDC ATA).
34pub const TREASURY: &[u8] = b"treasury";
35
36/// **`ExecutorTreasury`** (**`JACKPOT_PAY`** **`pool`**): debit [`crate::state::Treasury::daily_jackpot`].
37pub const EXECUTOR_PAY_DAILY_JACKPOT: u8 = 0;
38
39/// **`ExecutorTreasury`** (**`JACKPOT_PAY`** **`pool`**): debit [`crate::state::Treasury::weekly_jackpot`].
40pub const EXECUTOR_PAY_WEEKLY_JACKPOT: u8 = 1;
41
42/// Ticket revenue split to daily pool (`MAX_BPS` scale).
43pub const TICKET_DAILY_BPS: u16 = 7000;
44
45/// Ticket revenue split to weekly pool (`MAX_BPS` scale).
46pub const TICKET_WEEKLY_BPS: u16 = 1500;
47
48/// Ticket revenue split to buyback reserve (`MAX_BPS` scale).
49pub const TICKET_BUYBACK_BPS: u16 = 1000;
50
51/// Ticket revenue split to team (`MAX_BPS` scale).
52pub const TICKET_TEAM_BPS: u16 = 500;
53
54/// Hook fee routed to weekly pool (`MAX_BPS` scale).
55pub const HOOK_WEEKLY_BPS: u16 = 4000;
56
57/// Hook fee accrued to treasury reserve (`MAX_BPS` scale).
58pub const HOOK_RESERVE_BPS: u16 = 3000;
59
60/// Hook fee to buyback (`MAX_BPS` scale).
61pub const HOOK_BUYBACK_BPS: u16 = 1000;
62
63/// Hook fee to team (`MAX_BPS` scale).
64pub const HOOK_TEAM_BPS: u16 = 2000;
65
66/// Prize-side routing to daily (`MAX_BPS` scale).
67pub const PRIZE_DAILY_BPS: u16 = 7000;
68
69/// Prize-side reserve routed into treasury weekly (`MAX_BPS` scale).
70pub const PRIZE_RESERVE_BPS: u16 = 2000;
71
72/// Prize-side weekly share (`MAX_BPS` scale).
73pub const PRIZE_WEEKLY_BPS: u16 = 1000;
74
75/// SPL USDC mint on Solana **mainnet-beta** (Circle). Token accounts in ix must use this mint (`Initialize` is implicit via consts).
76/// EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v - mainnet
77pub const USDC_MAINNET_MINT: Pubkey = pubkey!("GAmHPNMcgh9BTpe3DWirqMwvYCeDskE2im6fUhZyukJp");
78
79/// Pyth **Receiver** program (Hermes pull feeds) — same address on mainnet-beta and devnet.
80///
81/// Accepts pull-feed `PriceUpdateV2` accounts written by this program.
82pub const PYTH_RECEIVER_PROGRAM: Pubkey = pubkey!("rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ");
83
84/// Pyth **Push Oracle** program — continuously updates price feed accounts on-chain.
85///
86/// The Pyth Data Association sponsors push updates for major feeds (BTC/USD, ETH/USD, …) at a
87/// ~400 ms heartbeat on both mainnet-beta and devnet. Price feed accounts written by this program
88/// have the same `PriceUpdateV2` borsh layout as pull-feed accounts; the only difference is the
89/// account owner. Oracle-gated instructions (`InitMarket` anchor, `AdminInstantSettlement`)
90/// accept accounts owned by **either** this program or `PYTH_RECEIVER_PROGRAM`.
91pub const PYTH_PUSH_ORACLE_PROGRAM: Pubkey =
92    pubkey!("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT");
93
94/// BTC/USD canonical Pyth price feed ID (Hermes / Pythnet).
95///
96/// Stored in `Market::pyth_price_feed` (reusing the 32-byte `Pubkey` field).
97/// Callers must pass a price account whose `price_message.feed_id` matches this.
98pub const PYTH_BTC_USD_FEED_ID: [u8; 32] = [
99    0xe6, 0x2d, 0xf6, 0xc8, 0xb4, 0xa8, 0x5f, 0xe1,
100    0xa6, 0x7d, 0xb4, 0x4d, 0xc1, 0x2d, 0xe5, 0xdb,
101    0x33, 0x0f, 0x7a, 0xc6, 0x6b, 0x72, 0xdc, 0x65,
102    0x8a, 0xfe, 0xdf, 0x0f, 0x4a, 0x41, 0x5b, 0x43,
103];
104
105/// BTC/USD **push feed account** — shard 0, maintained by the Pyth Data Association.
106///
107/// PDA of [`PYTH_PUSH_ORACLE_PROGRAM`] derived from `[shard_id_le_u16, feed_id]` with
108/// `shard_id = 0` and `feed_id = PYTH_BTC_USD_FEED_ID`.
109/// The address is deterministic and **identical on mainnet-beta and devnet**.
110///
111/// Pass this account to oracle-gated instructions instead of a manually posted `PriceUpdateV2`.
112/// No `post_update_atomic` call is required — the Pyth Data Association keeps this account fresh.
113pub const PYTH_BTC_USD_PRICE_FEED_ACCOUNT: Pubkey =
114    pubkey!("4cSM2e6rvbGQUFiJbqytoVMi5GgghSMr8LwVrT9VPSPo");
115
116/// Maximum age in seconds (vs `Clock::unix_timestamp`) that a Pyth Hermes `PriceUpdateV2`
117/// publish_time may lag behind the on-chain clock before it is rejected as stale.
118pub const PYTH_MAX_PRICE_AGE_SECS: u64 = 60;
119
120/// Void threshold in basis points of absolute price move (1 bp = 0.01%).
121///
122/// If `|close – open| / open < 1 bp`, the executor should call `AdminVoidMarket` instead of
123/// `AdminInstantSettlement`. Checked off-chain by the bot; recorded here for documentation.
124pub const BTC_VOID_THRESHOLD_BPS: u64 = 1;
125
126/// **`InitMarket`** (**open-anchor** crank / tail of **`create`**): **`Clock::unix_timestamp`** must satisfy **`∈ [open_ts, min(open_ts + this constant, close_ts))`** so the open tick aligns with bucket start (fixed-bucket oracle anchor).
127pub const MARKET_OPEN_ANCHOR_GRACE_SECS: i64 = 60;
128
129/// SPL USDC recipient for team-fee legs: **`ticket_team_bps`** (`BuyTickets`), **`hook_team_bps`** (`ClaimPositionFee`).
130pub const FEE_COLLECTOR: Pubkey = pubkey!("FEeB92JDVmVuuoaoTjKyfDPPrLTWPGg2EJTrY3TmTx3T");