cardinal_scanner/
state.rs1use anchor_lang::prelude::*;
2use std::str::FromStr;
3
4pub const EVENT_SEED_PREFIX: &str = "event";
5pub const EVENT_SIZE: usize = 8 + std::mem::size_of::<Event>() + 16;
6
7pub const EVENT_ENTRY_SEED_PREFIX: &str = "event-entry";
8pub const EVENT_ENTRY_SIZE: usize = 8 + std::mem::size_of::<EventEntry>() + 16;
9
10pub const SCAN_PRICE: u64 = 2_000_000;
11
12#[account]
13pub struct Event {
14 pub bump: u8,
15 pub authority: Pubkey,
16
17 pub scan_count: u32,
18 pub scan_bank: u32,
19
20 pub allow_creators: Vec<Pubkey>,
21 pub allow_collections: Vec<Pubkey>,
22 pub allow_mints: bool,
23 pub allow_addresses: bool,
24
25 pub payment_mint: Option<Pubkey>,
26 pub payment_amount: Option<u64>,
27
28 pub start_time: Option<i64>,
29 pub end_time: Option<i64>,
30
31 pub name: String,
32}
33
34#[account]
35pub struct EventEntry {
36 pub bump: u8,
37 pub event: Pubkey,
38 pub mint: Pubkey,
39 pub user: Pubkey,
40 pub last_used_timestamp: i64,
41 pub delegated: bool,
42}
43
44pub fn assert_collector(key: &Pubkey) -> bool {
45 let allowed_payment_managers = [Pubkey::from_str("crkdpVWjHWdggGgBuSyAqSmZUmAjYLzD435tcLDRLXr").unwrap()];
46 allowed_payment_managers.contains(key)
47}