1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Instruction discriminators + payload types.
//!
//! The on-chain program is a thin USDC custody layer.
//! All game logic (bets, balances, pools, leaderboards, settlement) is off-chain.
//! Settlement outcome is derived off-chain via the Pyth Hermes REST API.
use *;
/// One-time setup: creates `Treasury` PDA + treasury USDC ATA. `payer` must be `ADMIN_ADDRESS`.
///
/// **Accounts:** `payer`, `treasury`, `mint`, `treasury_ata`, `system_program`, `token_program`,
/// `ata_program`.
/// User deposits USDC into the treasury. Emits `Deposited { user, amount }` so the indexer can
/// credit the user's off-chain balance.
///
/// **Accounts:** `user` (signer), `user_ata`, `treasury_ata`, `mint`, `token_program`.
/// Route claimed DBC / DAMM v2 trading fees into the treasury and split them on-chain.
///
/// The executor bot claims pool creator/LP fees off-chain via the Meteora SDK, receiving USDC
/// into its own ATA. This instruction then:
/// 1. Transfers `amount` µUSDC from the executor's ATA into the treasury ATA (CPI).
/// 2. Splits the amount according to `TICKET_*_BPS` and updates `Treasury` counters.
/// 3. Forwards the team share (5%) from the treasury ATA to `FEE_COLLECTOR` (CPI).
/// 4. Emits `FeesRouted`.
///
/// This keeps fee accounting on-chain without requiring knowledge of Meteora's internal CPI
/// interfaces — the executor handles the protocol-specific claim, we handle the routing.
///
/// **Accounts:** `executor` (signer), `executor_ata`, `treasury`, `treasury_ata`,
/// `fee_collector_ata`, `mint`, `token_program`.
/// Pay `amount` µUSDC from the treasury ATA to `recipient_ata`. Used for winner payouts, jackpot
/// distributions, and withdrawals. Only `EXECUTOR_ADDRESS` may sign.
///
/// **Accounts:** `executor` (signer), `treasury`, `treasury_ata`, `recipient_ata`, `mint`,
/// `token_program`.
use TryFromPrimitive;
instruction!;
instruction!;
instruction!;
instruction!;