1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
use crate::id;
use anchor_lang::{account, prelude::Pubkey, prelude::*, AnchorDeserialize, AnchorSerialize};
#[derive(AnchorSerialize, AnchorDeserialize, Clone, PartialEq, Debug)]
pub enum RoadmapGovType {
NFT,
SPL,
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone, PartialEq, Debug)]
pub enum RoadmapState {
Draft,
LockedForMint,
Resolution,
StagedForResolution,
Actioning,
Actioned,
Refunding,
Complete,
Canceled,
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone, PartialEq, Debug)]
pub struct RoadmapConfig {
pub usdc_team_withdrawl_account: Pubkey,
pub sol_team_withdrawal_account: Pubkey,
pub minting_account_plugin_program_address: Option<Pubkey>,
pub dev_authority: Pubkey,
}
#[account]
#[derive(Debug)]
pub struct Roadmap {
pub realm: Pubkey,
pub collection: Option<Pubkey>,
pub team_authority: Pubkey,
pub dao_authority: Pubkey,
pub metadata_shadow_drive: Pubkey,
pub governance_program_id: Pubkey,
pub governance_type: RoadmapGovType,
pub state: RoadmapState,
pub config: RoadmapConfig,
pub staged_phase_count: u8,
pub locked_phase_count: u8,
pub resolution_proposal: Option<Pubkey>,
pub locked_total_usdc: u64,
pub locked_total_sol: u64,
pub staged_total_usdc: u64,
pub staged_total_sol: u64,
pub approved_phase_count: u8,
pub phase_count: u8,
pub phases_complete: u8,
pub usdc_roadmap_pool: Pubkey,
pub sol_roadmap_pool: Pubkey,
pub mint_contract_record: Option<Pubkey>,
pub bump: u8,
pub initial_payout_percentage : u16,
pub has_initial_payout_completed : bool,
pub reserved: [u8; 15],
pub name: String,
}
impl Roadmap {
pub fn space(name: &str) -> usize {
8 +
std::mem::size_of::<Pubkey>() + 4 + std::mem::size_of::<Pubkey>() + std::mem::size_of::<Pubkey>() + std::mem::size_of::<Pubkey>() + std::mem::size_of::<Pubkey>() + std::mem::size_of::<Pubkey>() + 1+ 1 + std::mem::size_of::<RoadmapConfig>() +
1 + 1 + 4 + std::mem::size_of::<Pubkey>()+ 16 + 16 + 16 + 16 + 1 + 1 + 1 + std::mem::size_of::<Pubkey>()+ std::mem::size_of::<Pubkey>()+ 4 + std::mem::size_of::<Pubkey>()+ 1 + 16 + 1 + 15 + name.len()
}
}
pub fn get_roadmap_address(realm: &Pubkey, governance_program: &Pubkey) -> Pubkey {
Pubkey::find_program_address(
&[b"roadmap", governance_program.as_ref(), realm.as_ref()],
&id(),
)
.0
}
pub fn get_roadmap_pool_address(roadmap: &Pubkey, mint: &Pubkey) -> Pubkey {
Pubkey::find_program_address(&[b"roadmap_pool", roadmap.as_ref(), mint.as_ref()], &id()).0
}