sol_cerberus/state/
app.rs

1use anchor_lang::prelude::*;
2
3///  AccountTypes:
4///     0 => Basic  (Apps with default fees)
5///     1 => Free   (Apps with no fees)
6#[repr(u8)]
7pub enum AccountTypes {
8    Basic = 0,
9    Free = 1,
10}
11
12///  CacheUpdated:
13///     0 => Roles (When roles change)
14///     1 => Rules   (When rules change)
15#[repr(u8)]
16pub enum CacheUpdated {
17    Roles = 0,
18    Rules = 1,
19}
20
21#[derive(AnchorSerialize, AnchorDeserialize, Default, Debug)]
22pub struct AppData {
23    pub id: Pubkey,
24    pub recovery: Option<Pubkey>,
25    pub name: String,
26    pub cached: bool,
27}
28
29#[derive(AnchorSerialize, AnchorDeserialize, Default, Debug)]
30pub struct UpdateAppData {
31    pub authority: Pubkey,
32    pub recovery: Option<Pubkey>,
33    pub name: String,
34    pub cached: bool,
35    pub fee: Option<u64>,
36    pub account_type: u8,
37    pub expires_at: Option<i64>,
38}
39
40#[account]
41pub struct App {
42    pub id: Pubkey,
43    pub authority: Pubkey,
44    pub recovery: Option<Pubkey>, // Only recovery or authority accounts can update the App Authority.
45    pub bump: u8,
46    pub name: String,
47    pub roles_updated_at: i64,
48    pub rules_updated_at: i64,
49    pub cached: bool,
50    pub fee: Option<u64>,
51    pub account_type: u8,
52    pub expires_at: Option<i64>,
53}
54
55#[event]
56pub struct AppChanged {
57    pub time: i64,
58    #[index]
59    pub app_id: Pubkey,
60    pub authority: Pubkey,
61}
62
63#[account]
64pub struct Seed {
65    pub initialized: bool,
66}