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
pub mod assertions;
pub mod constants;
pub mod errors;
pub mod instructions;
pub mod state;
use {anchor_lang::prelude::*, instructions::*};
declare_id!("3KrAiNERPdbvrsqeQ23ntFXbKo1ChHkVhqNUFAssnyAz");
#[program]
pub mod hpl_hive_control {
use super::*;
pub fn create_project(ctx: Context<CreateProject>, args: CreateProjectArgs) -> Result<()> {
instructions::platform_gate(
constants::ACTIONS.project_create,
&ctx.accounts.project.clone(),
ctx.accounts.authority.key(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.vault.to_account_info(),
&None,
ctx.accounts.system_program.to_account_info(),
)?;
instructions::create_project(ctx, args)
}
pub fn add_remove_criteria(
ctx: Context<AddRemoveCriteria>,
args: AddRemoveCriteriaArgs,
) -> Result<()> {
instructions::platform_gate(
constants::ACTIONS.manage_criterias,
&ctx.accounts.project.clone(),
ctx.accounts.authority.key(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.vault.to_account_info(),
&None,
ctx.accounts.system_program.to_account_info(),
)?;
instructions::add_remove_criteria(ctx, args)
}
pub fn add_remove_service(
ctx: Context<AddRemoveService>,
args: AddRemoveServiceArgs,
) -> Result<()> {
instructions::platform_gate(
if args.remove.unwrap_or(false) {
constants::ACTIONS.remove_service
} else {
constants::ACTIONS.add_service
},
&ctx.accounts.project.clone(),
ctx.accounts.authority.key(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.vault.to_account_info(),
&None,
ctx.accounts.system_program.to_account_info(),
)?;
instructions::add_remove_service(ctx, args)
}
pub fn add_address_container_to_project(
ctx: Context<AddAddressContainerToProject>,
args: AddAddressContainerToProjectArgs,
) -> Result<()> {
instructions::platform_gate(
constants::ACTIONS.manage_indexing,
&ctx.accounts.project.clone(),
ctx.accounts.authority.key(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.vault.to_account_info(),
&None,
ctx.accounts.system_program.to_account_info(),
)?;
instructions::add_address_container_to_project(ctx, args)
}
pub fn add_mint_addresses_to_address_container(
ctx: Context<AddMintAddressesToAddressContainer>,
args: AddMintAddressesToAddressContainerArgs,
) -> Result<()> {
instructions::add_mint_addresses_to_address_container(ctx, args)
}
pub fn create_delegate_authority(
ctx: Context<CreateDelegateAuthority>,
args: CreateDelegateAuthorityArgs,
) -> Result<()> {
instructions::platform_gate(
constants::ACTIONS.manage_delegate_authority,
&ctx.accounts.project.clone(),
ctx.accounts.authority.key(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.vault.to_account_info(),
&None,
ctx.accounts.system_program.to_account_info(),
)?;
instructions::create_delegate_authority(ctx, args)
}
pub fn add_remove_delegation(
ctx: Context<ModifyDelegate>,
args: AddRemoveDelegationArgs,
) -> Result<()> {
instructions::platform_gate(
constants::ACTIONS.manage_delegate_authority,
&ctx.accounts.project.clone(),
ctx.accounts.authority.key(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.vault.to_account_info(),
&None,
ctx.accounts.system_program.to_account_info(),
)?;
instructions::add_remove_delegation(ctx, args)
}
}