1use steel::*;
2
3#[repr(u32)]
4#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
5pub enum StreakError {
6 #[error("Invalid instruction data")]
7 InvalidInstruction = 0,
8 #[error("Program already initialized")]
9 AlreadyInitialized = 1,
10 #[error("Signer is not authorized for this ix")]
11 Unauthorized = 2,
12 #[error("Account does not match expected PDA")]
13 BadPda = 3,
14 #[error("Instruction requires an initialized config")]
15 NotInitialized = 4,
16 #[error("Arithmetic overflow")]
17 Overflow = 5,
18 #[error("Mint mismatch")]
19 BadMint = 6,
20 #[error("Treasury balance insufficient")]
21 InsufficientTreasury = 9,
22 #[error("Amount must be a whole-ticket multiple")]
23 BadTicketUnit = 10,
24 #[error("Market is not in the expected state")]
25 BadMarketState = 12,
26 #[error("Betting window is closed or not open yet")]
27 BettingClosed = 13,
28 #[error("Trader already has a position for this period")]
29 DuplicatePosition = 14,
30 #[error("Position already finalized")]
31 PositionAlreadyHandled = 15,
32 #[error("Trader is not on the winning side")]
33 NotAWinner = 16,
34 #[error("Cannot subsidize winners when no winning stake")]
35 EmptyWinningSide = 17,
36 #[error("Unknown treasury pay pool")]
37 InvalidTreasuryPayPool = 18,
38 #[error("Not enough ticket balance for this bet")]
39 InsufficientTickets = 19,
40 #[error("Ledger missing; buy tickets first")]
41 LedgerNotReady = 20,
42 #[error("Price account owner is not the configured Pyth program")]
43 PythBadOwner = 21,
44 #[error("Could not parse Pyth price account")]
45 PythInvalidAccount = 22,
46 #[error("Pyth price is stale for the configured max age")]
47 OraclePriceStale = 23,
48 #[error("Could not normalize oracle prices for comparison")]
49 OracleNormalize = 24,
50 #[error("Oracle open and close prices tie at resolved precision (reserved; ties settle as DOWN)")]
51 OracleParityTie = 25,
52 #[error("Market missing open Pyth anchor; rerun InitMarket in the anchor window after open_ts (matching open_ts / close_ts / pyth feed / rules_hash)")]
53 MarketNotOracleAnchored = 26,
54 #[error("Pyth feed pubkey must be non-default on Market INIT")]
55 InvalidPythPriceFeed = 30,
56 #[error("InitMarket crank before Market::open_ts")]
57 AnchorTooEarly = 31,
58 #[error("InitMarket crank after grace window for this bucket")]
59 AnchorWindowExpired = 32,
60 #[error("PlaceBet requires InitMarket-open anchor before staking")]
61 MarketNotAnchoredYet = 33,
62 #[error("Market open snapshot already recorded (InitMarket crank is idempotent-complete)")]
63 MarketAlreadyAnchored = 34,
64 #[error("ExecutorTreasury instruction kind byte is invalid")]
65 InvalidExecutorTreasuryKind = 35,
66 #[error("ExecutorTreasury DISTRIBUTE branch requires pool=0 and amount=0")]
67 InvalidExecutorTreasuryPayload = 36,
68 #[error("Reserved (legacy sequencing); InitMarket no longer gates create on treasury cursor")]
69 WrongMarketSequenceForCreate = 37,
70 #[error("Reserved (legacy sequencing); PlaceBet no longer gates on treasury cursor")]
71 BetWrongMarketPeriod = 38,
72 #[error("MARKET_LINE_RELEASE: market not settled or line already advanced")]
73 MarketLineReleaseInvalid = 39,
74 #[error("series_id out of range (see MAX_MARKET_SERIES)")]
75 InvalidMarketSeries = 40,
76 #[error("Settlement blocked: outstanding pre-open committed stakes (merge via **`PlaceBet`** live **`ticket_units`** **0**, or **`ExecutorTreasury`** **`EXECUTOR_KIND_MERGE_COMMITTED_POSITION`)")]
77 UnresolvedCommittedStakes = 41,
78 #[error("Executor merge COMMITTED blocked: requires open oracle and (live window OR market past close_ts, still OPEN)")]
79 MergeCommittedBlocked = 42,
80 #[error("PlaceBet ticket_units must be nonzero unless activating a COMMITTED pre-open position in the live window")]
81 PlaceBetNothingToActivate = 43,
82 #[error("Oracle close/open price move is below the void threshold (< 0.01%); call AdminVoidMarket instead")]
83 OracleVoidThreshold = 44,
84 #[error("Market has been voided; no settlement allowed")]
85 MarketVoided = 45,
86 #[error("Position state is not valid for void refund (must be STATE_PENDING or STATE_COMMITTED_PREOPEN)")]
87 VoidPositionInvalidState = 46,
88}
89
90error!(StreakError);