1use array_const_fn_init::array_const_fn_init;
2use const_crypto::ed25519;
3use solana_program::{pubkey, pubkey::Pubkey};
4
5pub const INITIALIZER_ADDRESS: Pubkey = pubkey!("HBUh9g46wk2X89CvaNN15UmsznP59rh6od1h8JwYAopk");
7
8pub const INITIAL_BASE_REWARD_RATE: u64 = BASE_REWARD_RATE_MIN_THRESHOLD;
10
11pub const BASE_REWARD_RATE_MIN_THRESHOLD: u64 = 2u64.pow(5);
13
14pub const BASE_REWARD_RATE_MAX_THRESHOLD: u64 = 2u64.pow(8);
16
17pub const TOLERANCE: i64 = 5;
19
20pub const INITIAL_MIN_DIFFICULTY: u32 = 1;
22
23pub const TOKEN_DECIMALS: u8 = 11;
26
27pub const TOKEN_DECIMALS_V1: u8 = 9;
29
30pub const ONE_ORE: u64 = 10u64.pow(TOKEN_DECIMALS as u32);
32
33pub const ONE_MINUTE: i64 = 60;
35
36pub const EPOCH_MINUTES: i64 = 15;
38
39pub const EPOCH_DURATION: i64 = ONE_MINUTE * EPOCH_MINUTES;
41
42pub const MAX_SUPPLY: u64 = ONE_ORE * 5_000_000;
44
45pub const BUS_COUNT: usize = 8;
47
48pub const SMOOTHING_FACTOR: u64 = 2;
51
52pub const BUS: &[u8] = b"bus";
54
55pub const CONFIG: &[u8] = b"config";
57
58pub const METADATA: &[u8] = b"metadata";
60
61pub const MINT: &[u8] = b"mint";
63
64pub const PROOF: &[u8] = b"proof";
66
67pub const TREASURY: &[u8] = b"treasury";
69
70pub const MINT_NOISE: [u8; 16] = [
72 89, 157, 88, 232, 243, 249, 197, 132, 199, 49, 19, 234, 91, 94, 150, 41,
73];
74
75pub const METADATA_NAME: &str = "ORE";
77
78pub const METADATA_SYMBOL: &str = "ORE";
80
81pub const METADATA_URI: &str = "https://ore.supply/assets/metadata.json";
83
84const PROGRAM_ID: [u8; 32] = unsafe { *(&crate::id() as *const Pubkey as *const [u8; 32]) };
86
87pub const BUS_ADDRESSES: [Pubkey; BUS_COUNT] = array_const_fn_init![const_bus_address; 8];
89
90const fn const_bus_address(i: usize) -> Pubkey {
92 Pubkey::new_from_array(ed25519::derive_program_address(&[BUS, &[i as u8]], &PROGRAM_ID).0)
93}
94
95pub const CONFIG_ADDRESS: Pubkey =
97 Pubkey::new_from_array(ed25519::derive_program_address(&[CONFIG], &PROGRAM_ID).0);
98
99pub const METADATA_ADDRESS: Pubkey = Pubkey::new_from_array(
101 ed25519::derive_program_address(
102 &[
103 METADATA,
104 unsafe { &*(&mpl_token_metadata::ID as *const Pubkey as *const [u8; 32]) },
105 unsafe { &*(&MINT_ADDRESS as *const Pubkey as *const [u8; 32]) },
106 ],
107 unsafe { &*(&mpl_token_metadata::ID as *const Pubkey as *const [u8; 32]) },
108 )
109 .0,
110);
111
112pub const MINT_ADDRESS: Pubkey =
114 Pubkey::new_from_array(ed25519::derive_program_address(&[MINT, &MINT_NOISE], &PROGRAM_ID).0);
115
116pub const MINT_BUMP: u8 = ed25519::derive_program_address(&[MINT, &MINT_NOISE], &PROGRAM_ID).1;
118
119pub const TREASURY_ADDRESS: Pubkey =
121 Pubkey::new_from_array(ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).0);
122
123pub const TREASURY_BUMP: u8 = ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).1;
125
126pub const TREASURY_TOKENS_ADDRESS: Pubkey = Pubkey::new_from_array(
128 ed25519::derive_program_address(
129 &[
130 unsafe { &*(&TREASURY_ADDRESS as *const Pubkey as *const [u8; 32]) },
131 unsafe { &*(&spl_token::id() as *const Pubkey as *const [u8; 32]) },
132 unsafe { &*(&MINT_ADDRESS as *const Pubkey as *const [u8; 32]) },
133 ],
134 unsafe { &*(&spl_associated_token_account::id() as *const Pubkey as *const [u8; 32]) },
135 )
136 .0,
137);
138
139pub const NOOP_PROGRAM_ID: Pubkey = pubkey!("noop8ytexvkpCuqbf6FB89BSuNemHtPRqaNC31GWivW");