1use array_const_fn_init::array_const_fn_init;
2use const_crypto::ed25519;
3use solana_program::{
4 pubkey,
5 pubkey::Pubkey,
6 native_token::LAMPORTS_PER_SOL
7};
8
9pub const INITIALIZER_ADDRESS: Pubkey = pubkey!("FJka1yJHn1SWux2X1o8VqHC8uaAWGv6CbNQvPWLJQufq");
11
12pub const INITIAL_BASE_COAL_REWARD_RATE: u64 = BASE_COAL_REWARD_RATE_MIN_THRESHOLD;
14pub const INITIAL_BASE_WOOD_REWARD_RATE: u64 = BASE_WOOD_REWARD_RATE_MIN_THRESHOLD;
15
16pub const BASE_COAL_REWARD_RATE_MIN_THRESHOLD: u64 = 2u64.pow(5);
18
19pub const BASE_COAL_REWARD_RATE_MAX_THRESHOLD: u64 = 2u64.pow(8) * COAL_EXTRACTION_MULTIPLIER;
21
22pub const BASE_WOOD_REWARD_RATE_MIN_THRESHOLD: u64 = 2u64.pow(5) * WOOD_EXTRACTION_MULTIPLIER;
24
25pub const BASE_WOOD_REWARD_RATE_MAX_THRESHOLD: u64 = 2u64.pow(8) * WOOD_EXTRACTION_MULTIPLIER;
27
28pub const TOLERANCE: i64 = 5;
30
31pub const REPROCESS_TARGET_SLOT: u64 = 20;
32pub const REPROCESS_SLOT_BUFFER: u64 = 6;
33pub const REPROCESS_MAX_MULTIPLIER: u64 = 100;
34pub const REPROCESS_FEE: u64 = LAMPORTS_PER_SOL / 200;
35
36pub const WOOD_LIVENESS_TOLERANCE: i64 = 65;
38
39pub const INITIAL_MIN_DIFFICULTY: u32 = 1;
41
42pub const TOKEN_DECIMALS: u8 = 11;
45
46pub const ONE_COAL: u64 = 10u64.pow(TOKEN_DECIMALS as u32);
48
49pub const ONE_WOOD: u64 = 10u64.pow(TOKEN_DECIMALS as u32);
51
52pub const ONE_MINUTE: i64 = 60;
54
55pub const COAL_EPOCH_MINUTES: i64 = 2;
57pub const WOOD_EPOCH_MINUTES: i64 = 5;
58
59pub const COAL_EPOCH_DURATION: i64 = ONE_MINUTE * COAL_EPOCH_MINUTES;
61pub const WOOD_EPOCH_DURATION: i64 = ONE_MINUTE * WOOD_EPOCH_MINUTES;
62pub const MAX_COAL_SUPPLY: u64 = ONE_COAL * 21_000_000;
64
65pub const COAL_EXTRACTION_MULTIPLIER: u64 = 1000;
67pub const WOOD_EXTRACTION_MULTIPLIER: u64 = 10;
68
69pub const TARGET_COAL_EPOCH_REWARDS: u64 = ONE_COAL * COAL_EXTRACTION_MULTIPLIER * COAL_EPOCH_MINUTES as u64;
71
72pub const INITIAL_WOOD_EPOCH_REWARDS: u64 = ONE_WOOD * 1000;
74
75pub const MIN_WOOD_EPOCH_REWARDS: u64 = ONE_WOOD / 10;
77pub const MAX_WOOD_EPOCH_REWARDS: u64 = ONE_WOOD * 4000;
79
80pub const WOOD_PROPOGATION_RATE: u64 = 20;
83
84pub const MAX_COAL_EPOCH_REWARDS: u64 = TARGET_COAL_EPOCH_REWARDS * BUS_COUNT as u64;
87
88pub const BUS_COAL_EPOCH_REWARDS: u64 = MAX_COAL_EPOCH_REWARDS / BUS_COUNT as u64;
90
91pub const BUS_COUNT: usize = 8;
93
94pub const SMOOTHING_FACTOR: u64 = 2;
97pub const WOOD_DECREMENTAL_SMOOTHING_FACTOR: u64 = 10;
99
100static_assertions::const_assert!(
102 (MAX_COAL_EPOCH_REWARDS / BUS_COUNT as u64) * BUS_COUNT as u64 == MAX_COAL_EPOCH_REWARDS
103);
104
105pub const COAL_BUS: &[u8] = b"bus";
107pub const WOOD_BUS: &[u8] = b"wood_bus";
108
109pub const COAL_CONFIG: &[u8] = b"config";
111pub const WOOD_CONFIG: &[u8] = b"wood_config";
112
113pub const METADATA: &[u8] = b"metadata";
115
116pub const COAL_MINT: &[u8] = b"mint";
118pub const WOOD_MINT: &[u8] = b"wood_mint";
119pub const CHROMIUM_MINT: &[u8] = b"chromium_mint";
120
121pub const COAL_PROOF: &[u8] = b"proof";
123pub const WOOD_PROOF: &[u8] = b"wood_proof";
124
125pub const COAL_MAIN_HAND_TOOL: &[u8] = b"coal_main_hand_tool";
127pub const WOOD_MAIN_HAND_TOOL: &[u8] = b"wood_main_hand_tool";
128
129pub const TREASURY: &[u8] = b"treasury";
131
132pub const PLUGIN_UPDATE_AUTHORITY: &[u8] = b"update_authority";
134
135pub const REPROCESSOR: &[u8] = b"reprocessor";
137
138pub const MINT_NOISE: [u8; 16] = [
140 89, 157, 88, 232, 243, 249, 197, 132, 199, 49, 19, 234, 91, 94, 150, 41,
141];
142
143pub const COAL_METADATA_NAME: &str = "coal";
145pub const WOOD_METADATA_NAME: &str = "wood";
146pub const CHROMIUM_METADATA_NAME: &str = "chromium";
147
148pub const COAL_METADATA_SYMBOL: &str = "COAL";
150pub const WOOD_METADATA_SYMBOL: &str = "WOOD";
151pub const CHROMIUM_METADATA_SYMBOL: &str = "CHROMIUM";
152
153pub const COAL_METADATA_URI: &str = "https://coal.digital/metadata.json";
155pub const WOOD_METADATA_URI: &str = "https://coal.digital/metadata.wood.json";
156pub const CHROMIUM_METADATA_URI: &str = "https://coal.digital/metadata.chromium.json";
157
158const PROGRAM_ID: [u8; 32] = unsafe { *(&crate::id() as *const Pubkey as *const [u8; 32]) };
160
161pub const ORE_PROGRAM_ID: Pubkey = pubkey!("oreV2ZymfyeXgNgBdqMkumTqqAprVqgBWQfoYkrtKWQ");
163pub const ORE_PROGRAM_ID_BYTES: [u8; 32] = unsafe { *(&ORE_PROGRAM_ID as *const Pubkey as *const [u8; 32]) };
164
165pub const FORGE_PICKAXE_COLLECTION: Pubkey = pubkey!("CuaLHUJA1dyQ6AYcTcMZrCoBqssSJbqkY7VfEEFdxzCk");
167
168pub const COAL_BUS_ADDRESSES: [Pubkey; BUS_COUNT] = array_const_fn_init![const_coal_bus_address; 8];
170pub const WOOD_BUS_ADDRESSES: [Pubkey; BUS_COUNT] = array_const_fn_init![const_wood_bus_address; 8];
171
172const fn const_coal_bus_address(i: usize) -> Pubkey {
174 Pubkey::new_from_array(ed25519::derive_program_address(&[COAL_BUS, &[i as u8]], &PROGRAM_ID).0)
175}
176
177const fn const_wood_bus_address(i: usize) -> Pubkey {
178 Pubkey::new_from_array(ed25519::derive_program_address(&[WOOD_BUS, &[i as u8]], &PROGRAM_ID).0)
179}
180
181pub const COAL_CONFIG_ADDRESS: Pubkey =
183 Pubkey::new_from_array(ed25519::derive_program_address(&[COAL_CONFIG], &PROGRAM_ID).0);
184pub const WOOD_CONFIG_ADDRESS: Pubkey =
185 Pubkey::new_from_array(ed25519::derive_program_address(&[WOOD_CONFIG], &PROGRAM_ID).0);
186
187pub const COAL_METADATA_ADDRESS: Pubkey = Pubkey::new_from_array(
189 ed25519::derive_program_address(
190 &[
191 METADATA,
192 unsafe { &*(&mpl_token_metadata::ID as *const Pubkey as *const [u8; 32]) },
193 unsafe { &*(&COAL_MINT_ADDRESS as *const Pubkey as *const [u8; 32]) },
194 ],
195 unsafe { &*(&mpl_token_metadata::ID as *const Pubkey as *const [u8; 32]) },
196 )
197 .0,
198);
199pub const WOOD_METADATA_ADDRESS: Pubkey = Pubkey::new_from_array(
200 ed25519::derive_program_address(
201 &[
202 METADATA,
203 unsafe { &*(&mpl_token_metadata::ID as *const Pubkey as *const [u8; 32]) },
204 unsafe { &*(&WOOD_MINT_ADDRESS as *const Pubkey as *const [u8; 32]) },
205 ],
206 unsafe { &*(&mpl_token_metadata::ID as *const Pubkey as *const [u8; 32]) },
207 )
208 .0,
209);
210
211pub const COAL_MINT_ADDRESS: Pubkey =
213 Pubkey::new_from_array(ed25519::derive_program_address(&[COAL_MINT, &MINT_NOISE], &PROGRAM_ID).0);
214
215pub const WOOD_MINT_ADDRESS: Pubkey =
217 Pubkey::new_from_array(ed25519::derive_program_address(&[WOOD_MINT, &MINT_NOISE], &PROGRAM_ID).0);
218
219pub const CHROMIUM_MINT_ADDRESS: Pubkey =
221 Pubkey::new_from_array(ed25519::derive_program_address(&[CHROMIUM_MINT, &MINT_NOISE], &PROGRAM_ID).0);
222
223pub const TREASURY_ADDRESS: Pubkey =
225 Pubkey::new_from_array(ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).0);
226
227pub const TREASURY_BUMP: u8 = ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).1;
229
230pub const COAL_TREASURY_TOKENS_ADDRESS: Pubkey = Pubkey::new_from_array(
232 ed25519::derive_program_address(
233 &[
234 unsafe { &*(&TREASURY_ADDRESS as *const Pubkey as *const [u8; 32]) },
235 unsafe { &*(&spl_token::id() as *const Pubkey as *const [u8; 32]) },
236 unsafe { &*(&COAL_MINT_ADDRESS as *const Pubkey as *const [u8; 32]) },
237 ],
238 unsafe { &*(&spl_associated_token_account::id() as *const Pubkey as *const [u8; 32]) },
239 )
240 .0,
241);
242
243pub const WOOD_TREASURY_TOKENS_ADDRESS: Pubkey = Pubkey::new_from_array(
245 ed25519::derive_program_address(
246 &[
247 unsafe { &*(&TREASURY_ADDRESS as *const Pubkey as *const [u8; 32]) },
248 unsafe { &*(&spl_token::id() as *const Pubkey as *const [u8; 32]) },
249 unsafe { &*(&WOOD_MINT_ADDRESS as *const Pubkey as *const [u8; 32]) },
250 ],
251 unsafe { &*(&spl_associated_token_account::id() as *const Pubkey as *const [u8; 32]) },
252 )
253 .0,
254);
255
256pub const COAL_MAIN_HAND_TOOL_ADDRESS: Pubkey = Pubkey::new_from_array(ed25519::derive_program_address(&[COAL_MAIN_HAND_TOOL], &PROGRAM_ID).0);
257
258
259pub const NOOP_PROGRAM_ID: Pubkey = pubkey!("noop8ytexvkpCuqbf6FB89BSuNemHtPRqaNC31GWivW");