Skip to main content

tengu_api/
consts.rs

1//! PDA seeds and constants.
2
3use solana_program::pubkey::Pubkey;
4use solana_program::pubkey;
5
6pub const ADMIN_ADDRESS: Pubkey = pubkey!("DEvGq2WVuA3qkSCtwwuMYThY4onkJunEHSAxU5cieph8");
7pub const FEE_COLLECTOR: Pubkey = pubkey!("FEEjHM2DoFu6UifSBmrxTQ6X2KkWQ1dbPXASCtdLUdnx");
8/// SOL payment split: treasury gets this share (basis points). 9000 = 90%.
9pub const SOL_SPLIT_TREASURY_BPS: u64 = 9000;
10/// SOL payment split: fee collector gets this share (basis points). 1000 = 10%.
11pub const SOL_SPLIT_FEE_BPS: u64 = 1000;
12
13pub const TASK_VERIFIER: Pubkey = pubkey!("tASK7746ambmkkTvqtyCehd3F56X4VJpr9GCPh4bUmu");
14/// $DOJO SPL token mint. Matches ui constants.ts DOJO_MINT.
15pub const DOJO_MINT: Pubkey = pubkey!("ShardMNKCZTxGVpnsJEL6tapMhf7DCM7WMqW7kADwQ8");
16
17pub const CONFIG: &[u8] = b"config";
18pub const GAME: &[u8] = b"game";
19pub const DOJO: &[u8] = b"dojo";
20pub const SHOGUN: &[u8] = b"shogun";
21pub const BARRACKS: &[u8] = b"barracks";
22pub const FORGE: &[u8] = b"forge";
23pub const TASKS: &[u8] = b"tasks";
24pub const TREASURY: &[u8] = b"treasury";
25pub const REFERRAL: &[u8] = b"referral";
26pub const PRESTIGE: &[u8] = b"prestige";
27/// Seeker: one account per SGT mint that has claimed the Seeker task (anti-Sybil).
28pub const SEEKER: &[u8] = b"seeker";
29/// Prestige levels for fodder (1–6). Index = collection_index * PRESTIGE_LEVELS + (prestige - 1).
30pub const PRESTIGE_LEVELS: usize = 6;
31
32pub const ED25519_SIGNATURE_OFFSETS_START: usize = 2;
33pub const ED25519_SIGNATURE_OFFSETS_SIZE: usize = 14;
34pub const ED25519_DATA_START: usize = ED25519_SIGNATURE_OFFSETS_START + ED25519_SIGNATURE_OFFSETS_SIZE;
35pub const ED25519_PUBKEY_SIZE: usize = 32;
36pub const ED25519_SIGNATURE_SIZE: usize = 64;
37
38/// Solana: ~0.4s per slot. Ore/chakra/cooldowns use Solana slots.
39pub const SECONDS_PER_SLOT: f64 = 0.4;
40/// Slots in 24h (86400 / 0.4 ≈ 216000).
41pub const ONE_DAY_SLOTS: u64 = 216_000;
42pub const CHAKRA_MAX: u64 = ONE_DAY_SLOTS;
43/// Chakra granted per dine tier: 24h, 48h, 72h.
44pub const CHAKRA_24H: u64 = ONE_DAY_SLOTS;
45pub const CHAKRA_48H: u64 = 2 * ONE_DAY_SLOTS;
46pub const CHAKRA_72H: u64 = 3 * ONE_DAY_SLOTS;
47/// Ore = (spirit_power * slots_elapsed) / ORE_DIVISOR. 200 = 0.5x vs Ninja (Solana 2x faster).
48pub const ORE_DIVISOR: u64 = 200;
49/// Pool-split: raw $DOJO emission per slot (6 decimals). Hyper Ninja: 1000/block × 8640 blocks/day = 8.64M/day; Solana 216k slots/day → 40/slot.
50pub const EMISSION_RAW_PER_SLOT_BASE: u64 = 40_000_000;
51pub const DOJO_DECIMALS: u8 = 6;
52/// One $DOJO token, denominated in raw units (6 decimals).
53pub const ONE_DOJO: u64 = 10u64.pow(DOJO_DECIMALS as u32);
54
55pub const SLOTS_PER_LEVEL: u64 = 3;
56pub const MAX_BARRACKS_SLOTS: usize = 12;
57/// Max total fodder (sum of fodder_counts) before recruit. Must reforge to free space.
58pub const MAX_FODDER_TOTAL: u64 = 200;
59
60pub const STARTER_TICKET_PRICE: u64 = 1_000_000_000;
61pub const RECRUIT_SOL_PRICE: u64 = 100_000_000;
62
63/// Base cost (first dine for this shogun). 150/300/450 shards.
64pub const DINE_COST_24H: u64 = 150_000_000;
65pub const DINE_COST_48H: u64 = 300_000_000;
66pub const DINE_COST_72H: u64 = 450_000_000;
67
68/// Escalated cost (second+ dine for this shogun). 195/390/585 shards.
69pub const DINE_COST_24H_ESCALATED: u64 = 195_000_000;
70pub const DINE_COST_48H_ESCALATED: u64 = 390_000_000;
71pub const DINE_COST_72H_ESCALATED: u64 = 585_000_000;
72
73pub const BARRACKS_COST_1_2_SHARDS: u64 = 50_000_000;
74pub const BARRACKS_COST_1_2_SOL: u64 = 10_000_000;
75pub const BARRACKS_COST_2_3_SHARDS: u64 = 300_000_000;
76pub const BARRACKS_COST_2_3_SOL: u64 = 100_000_000;
77pub const BARRACKS_COST_3_4: u64 = 8_000_000_000;
78
79/// 1→2: 0.1 SOL.
80pub const FORGE_COST_1_2: u64 = 100_000_000;
81/// 2→3: 1 SOL.
82pub const FORGE_COST_2_3: u64 = 1_000_000_000;
83/// 3→4: 2 SOL.
84pub const FORGE_COST_3_4: u64 = 2_000_000_000;
85/// 4→5: 5 SOL.
86pub const FORGE_COST_4_5: u64 = 5_000_000_000;
87/// 5→6: 12 SOL.
88pub const FORGE_COST_5_6: u64 = 12_000_000_000;
89/// 6→7: 21 SOL (max level).
90pub const FORGE_COST_6_7: u64 = 21_000_000_000;
91
92/// 1→2: no cooldown (unused; we use _2_3 for level 2).
93pub const FORGE_COOLDOWN_1_2: u64 = 0;
94/// 2→3: no cooldown after 1→2; 30 min after 2→3 (level 3 uses _3_4).
95pub const FORGE_COOLDOWN_2_3: u64 = 0;
96/// 3→4: 30 min in slots (1800s / 0.4 = 4500). Cooldown after 2→3.
97pub const FORGE_COOLDOWN_3_4: u64 = 4_500;
98/// 4→5: 90 min in slots (5400s / 0.4 = 13500). Cooldown after 3→4.
99pub const FORGE_COOLDOWN_4_5: u64 = 13_500;
100/// 5→6: 180 min in slots (10800s / 0.4 = 27000). Cooldown after 4→5.
101pub const FORGE_COOLDOWN_5_6: u64 = 27_000;
102/// 6→7: 300 min in slots (18000s / 0.4 = 45000). Cooldown after 5→6 (max level).
103pub const FORGE_COOLDOWN_6_7: u64 = 45_000;
104
105/// Same as ONE_DOJO. Speed-up forge: cost per minute = remaining minutes (Ninja decay).
106pub const SHARDS_RAW_PER_UNIT: u64 = ONE_DOJO;
107
108// Leveling: cost = 200 + 800*(level-1). Capped at 100.
109pub const LEVEL_UP_COST_BASE: u64 = 200_000_000;   // 200 shards raw
110pub const LEVEL_UP_COST_INCREMENT: u64 = 800_000_000; // 800 shards raw per level
111pub const MAX_SHOGUN_LEVEL: u64 = 100;
112
113pub const SP_N: u64 = 10;   // 1x
114pub const SP_R: u64 = 20;   // 2x
115pub const SP_SR: u64 = 80;  // 8x
116pub const SP_SSR: u64 = 200; // 20x
117pub const SP_UR: u64 = 600; // 60x
118
119pub const DROP_N: u64 = 541;
120pub const DROP_R: u64 = 324;
121pub const DROP_SR: u64 = 108;
122pub const DROP_SSR: u64 = 22;
123pub const DROP_UR: u64 = 5;
124
125pub const RECRUITMENT_TICKET_REWARD_1: u64 = 1;
126pub const RECRUITMENT_TICKET_REWARD_2: u64 = 2;
127pub const RECRUITMENT_TICKET_REWARD_3: u64 = 3;
128pub const RECRUITMENT_TICKET_REWARD_4: u64 = 4;
129pub const RECRUITMENT_TICKET_REWARD_5: u64 = 5;
130pub const RECRUITMENT_TICKET_REWARD_6: u64 = 6;
131pub const RECRUITMENT_TICKET_REWARD_7: u64 = 7;
132pub const RECRUITMENT_TICKET_REWARD_8: u64 = 8;
133pub const RECRUITMENT_TICKET_REWARD_9: u64 = 9;
134pub const RECRUITMENT_TICKET_REWARD_10: u64 = 10;
135pub const RECRUITMENT_TICKET_REWARD_11: u64 = 11;
136pub const RECRUITMENT_TICKET_REWARD_12: u64 = 12;
137pub const RECRUITMENT_TICKET_REWARD_13: u64 = 13;
138pub const RECRUITMENT_TICKET_REWARD_15: u64 = 15;
139
140pub const ELEMENT_RARITY_REWARD_N: u64 = 1;
141pub const ELEMENT_RARITY_REWARD_R: u64 = 1;
142pub const ELEMENT_RARITY_REWARD_SR: u64 = 2;
143pub const ELEMENT_RARITY_REWARD_SSR: u64 = 5;
144pub const ELEMENT_RARITY_REWARD_UR: u64 = 20;
145
146pub const DAILY_TASK_START: u64 = 17;
147
148pub const CLAIM_TASK_PREFIX: &[u8] = b"dojos:claim_task:";
149pub const ELEMENT_RARITY_SET_SIZE: usize = 3;
150
151// Task ID layout:
152// 0–7: On-chain tasks (recruit, dine, forge Lv.2)
153// 8: Collection rewards (3 ninjas same element+rarity; 25 combos)
154// 9–16: Off-chain tasks (signature required)
155// 17–24: Daily resettable tasks (signature, bits reset daily)
156// 33–35: Forge Lv.3, Lv.4, Lv.5
157pub const TASK_FORGE_3: u64 = 33;
158pub const TASK_FORGE_4: u64 = 34;
159pub const TASK_FORGE_5: u64 = 35;
160pub const FORGE_3_REWARD: u64 = 2;
161pub const FORGE_4_REWARD: u64 = 5;
162pub const FORGE_5_REWARD: u64 = 10;
163pub const FORGE_6_REWARD: u64 = 15;
164pub const FORGE_7_REWARD: u64 = 20;
165
166pub const MAX_SUPPLY: u64 = ONE_DOJO * 1_000_000_000;
167
168// Scene collection
169pub const SCENES: &[u8] = b"scenes";
170pub const SCENE_DEFAULT_ID: u64 = 0;
171pub const SCENE_SECTIONS_PER_SCENE: usize = 12;
172pub const SCENE_COUNT_MAX: usize = 9;
173pub const SCENE_COUNT: u64 = 8;
174/// Scenes in roll pool (1–5). Excludes scene 0 (Green Mountain) and buyable scenes 6–8.
175pub const SCENE_ROLL_COUNT: u64 = 5;
176pub const SCENE_ROLL_SHARD_COUNT: u64 = 10;
177/// Scenes 6–8 can be bought with Amethyst (unlock entire scene).
178pub const SCENE_BUY_START: u64 = 6;
179
180// Scene bonuses for claim_shards (ore = (spirit_power * chakra) / divisor; bonuses apply after sum).
181/// Scene 0 (Green Mountain): no bonus.
182/// Scenes 1, 6, 7, 8: flat +50_000 Spirit Power.
183pub const SCENE_BONUS_FLAT_50K: u64 = 50_000;
184/// Scene 2: flat +100_000 Spirit Power.
185pub const SCENE_BONUS_FLAT_100K: u64 = 100_000;
186/// Scene 3: +2% multiplier (basis points).
187pub const SCENE_BONUS_PCT_2: u64 = 200;
188/// Scene 4: +3% multiplier (basis points).
189pub const SCENE_BONUS_PCT_3: u64 = 300;
190/// Scene 5: +5% multiplier (basis points).
191pub const SCENE_BONUS_PCT_5: u64 = 500;