Skip to main content

airdrop_api/
consts.rs

1use const_crypto::ed25519;
2use solana_program::{pubkey, pubkey::Pubkey};
3use steel::*;
4
5// Test initializer (mac::id.json)
6// pub const INITIALIZER_ADDRESS: Pubkey = pubkey!("Ac2ev4ofDx61tuSJCgq9ToSBfVwHD2a1FVJf6p7TAqiB");
7// Test initializer (mac&hp::test-id.json)
8pub const INITIALIZER_ADDRESS: Pubkey = pubkey!("4ALL9EAVHpv7ioJF95ktDLtrHUEJezPuFxTFFMy3fpSy");
9
10/// The authority allowed to initialize the program.
11// pub const INITIALIZER_ADDRESS: Pubkey = pubkey!("staryJacbXodPh4WfwVtgA5jkJhvsMHERtkdttnLEHc");
12
13/// Campaign status codes
14pub const CAMPAIGN_STATUS_ACTIVE: u8 = 0;
15pub const CAMPAIGN_STATUS_PAUSED: u8 = 1;
16pub const CAMPAIGN_STATUS_CLOSED: u8 = 2;
17
18/// Account type discriminators
19#[repr(u8)]
20#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
21pub enum AirdropAccount {
22    Config = 0,
23    Campaign = 1,
24    Allocation = 2,
25}
26
27/// The seed of the config account PDA.
28pub const CONFIG: &[u8] = b"config";
29
30/// The seed of the fee account PDA.
31pub const FEE_ACCOUNT: &[u8] = b"fee_account";
32
33/// The seed of the campaign account PDA.
34pub const CAMPAIGN: &[u8] = b"campaign";
35
36/// The seed of the mint account PDA.
37pub const MINT: &[u8] = b"mint";
38
39/// The seed of the mint authority PDA.
40pub const MINT_AUTHORITY: &[u8] = b"mint_authority";
41
42/// The seed of the campaign treasury PDA.
43pub const TREASURY: &[u8] = b"treasury";
44
45/// The seed of the allocation account PDA.
46pub const ALLOCATION: &[u8] = b"allocation";
47
48/// Program id for const pda derivations
49const PROGRAM_ID: [u8; 32] = unsafe { *(&crate::id() as *const Pubkey as *const [u8; 32]) };
50
51/// The address of the config account.
52pub const CONFIG_ADDRESS: Pubkey =
53    Pubkey::new_from_array(ed25519::derive_program_address(&[CONFIG], &PROGRAM_ID).0);
54
55/// Maximum merkle proof length (prevents DoS attacks)
56/// Supports up to 2^25 = 33M recipients in a single campaign
57pub const MAX_MERKLE_PROOF_LENGTH: u8 = 25;