tengu_api/error.rs
1//! Program errors.
2
3use steel::*;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, num_enum::IntoPrimitive)]
6#[repr(u32)]
7pub enum DojosError {
8 InsufficientPayment = 0,
9 DojoAlreadyInitialized = 1,
10 InvalidSlot = 2,
11 SlotOccupied = 3,
12 InsufficientChakra = 4,
13 InsufficientOre = 5,
14 InsufficientShards = 6,
15 BarracksUpgradeCooldown = 7,
16 ForgeUpgradeCooldown = 8,
17 InvalidMerge = 9,
18 InvalidMergeRarity = 10,
19 InvalidPrestigeUpgrade = 11,
20 InvalidLevelUp = 12,
21 EmissionCapReached = 13,
22 InsufficientTreasuryBalance = 14,
23 UnauthorizedKeeper = 15,
24 GenesisNotSet = 16,
25 GameNotLaunched = 17,
26 InvalidEntropyVar = 18,
27 UnauthorizedAdmin = 19,
28 TaskNotCompleted = 20,
29 TaskAlreadyClaimed = 21,
30 ShogunNotAssigned = 22,
31 NoReferralPending = 23,
32 FlashSaleDailyLimitReached = 24,
33 /// Unassign only allowed when replacing with another shogun via replace.
34 UnassignNotAllowed = 25,
35 /// Shogun already seated; use replace_shogun to swap.
36 ShogunAlreadySeated = 26,
37 /// Slot empty; use seat_shogun for empty slots.
38 SlotEmpty = 27,
39 /// Shogun account is full (MAX_SHOGUN_ACCOUNT_SIZE reached).
40 ShogunAccountFull = 28,
41 /// Treasury PDA must be owned by this program (re-initialize if redeployed).
42 TreasuryNotOwnedByProgram = 29,
43 /// Forge upgrade cooldown already ended; nothing to clear.
44 NoForgeCooldownToClear = 30,
45 /// Merge not yet implemented for compression (TODO).
46 MergeNotImplemented = 31,
47 /// Battle: defender owner / dojo mismatch.
48 InvalidBattleTarget = 32,
49 /// Battle: attacker cooldown (30 min).
50 BattleCooldown = 33,
51 /// Battle: defender targeted within immunity window (1h).
52 BattleTargetImmune = 34,
53 /// Battle: max duels per 24h rolling window.
54 BattleDuelLimit = 35,
55 /// Battle: cannot attack your own dojo.
56 BattleSelfTarget = 36,
57 /// PvP champion slot empty or out of range.
58 InvalidChampion = 37,
59 /// Champion change on cooldown (12h between changes after first).
60 ChampionChangeCooldown = 38,
61 /// Cannot change champion until battle-initiation cooldown elapses.
62 ChampionChangeLockedAfterBattle = 39,
63 /// Dine requires Battle PDA (starter pack / init).
64 DineBattleMissing = 40,
65 /// No XP to claim (dojo.xp is zero).
66 NoXpToClaim = 41,
67 /// `xp_reward_pool` is empty.
68 InsufficientXpRewardPool = 42,
69 /// Treasury `total_xp` inconsistent with claim (should not happen).
70 InvalidXpTotals = 43,
71 /// Proportional XP SOL payout rounded to zero; pool too small vs. weight.
72 XpClaimTooSmall = 44,
73 /// Staking XP requires an initialized Dojo (buy starter pack first).
74 DojoNotInitialized = 45,
75 /// S2P: all 8 vesting tranche slots are full; withdraw or wait.
76 StakeVestingFull = 46,
77 /// S2P: withdraw amount exceeds unlocked (vested) DOJO.
78 StakeVestingLocked = 47,
79 /// PvP: attacker champion has 0 chakra — dine to restore (Fren: can’t attack while “unfed”).
80 BattleChakraDepleted = 48,
81 /// Scenes disabled in [`crate::state::Config`] — admin must enable.
82 ScenesDisabled = 49,
83}
84
85error!(DojosError);