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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
pub mod state {
use std::collections::HashSet;
pub use crate::objects::core::OS_ID;
use crate::objects::module::ModuleId;
use cosmwasm_std::Addr;
use cw_controllers::Admin;
use cw_storage_plus::{Item, Map};
pub type Subscribed = bool;
#[cosmwasm_schema::cw_serde]
pub struct Config {
pub version_control_address: Addr,
pub module_factory_address: Addr,
pub subscription_address: Option<Addr>,
}
#[cosmwasm_schema::cw_serde]
pub struct OsInfo {
pub name: String,
pub governance_type: String,
pub chain_id: String,
pub description: Option<String>,
pub link: Option<String>,
}
pub const STATUS: Item<Subscribed> = Item::new("\u{0}{6}status");
pub const CONFIG: Item<Config> = Item::new("\u{0}{6}config");
pub const INFO: Item<OsInfo> = Item::new("\u{0}{4}info");
pub const OS_FACTORY: Admin = Admin::new("\u{0}{7}factory");
pub const ROOT: Admin = Admin::new("root");
pub const OS_MODULES: Map<ModuleId, Addr> = Map::new("os_modules");
pub const DEPENDENTS: Map<ModuleId, HashSet<String>> = Map::new("dependents");
}
use self::state::OsInfo;
use crate::objects::{
core::OsId,
module::{Module, ModuleInfo},
};
use cosmwasm_schema::QueryResponses;
use cosmwasm_std::{Binary, Uint64};
use cw2::ContractVersion;
#[cosmwasm_schema::cw_serde]
pub struct MigrateMsg {}
#[cosmwasm_schema::cw_serde]
pub struct InstantiateMsg {
pub os_id: OsId,
pub root_user: String,
pub version_control_address: String,
pub module_factory_address: String,
pub subscription_address: Option<String>,
pub governance_type: String,
pub name: String,
pub description: Option<String>,
pub link: Option<String>,
}
#[cosmwasm_schema::cw_serde]
pub struct CallbackMsg {}
#[cosmwasm_schema::cw_serde]
#[cfg_attr(feature = "boot", derive(boot_core::ExecuteFns))]
pub enum ExecuteMsg {
ExecOnModule {
module_id: String,
exec_msg: Binary,
},
UpdateModuleAddresses {
to_add: Option<Vec<(String, String)>>,
to_remove: Option<Vec<String>>,
},
InstallModule {
module: ModuleInfo,
init_msg: Option<Binary>,
},
RegisterModule {
module_addr: String,
module: Module,
},
RemoveModule {
module_id: String,
},
Upgrade {
modules: Vec<(ModuleInfo, Option<Binary>)>,
},
UpdateInfo {
name: Option<String>,
description: Option<String>,
link: Option<String>,
},
SetRoot {
root: String,
governance_type: Option<String>,
},
SuspendOs {
new_status: bool,
},
EnableIBC {
new_status: bool,
},
Callback(CallbackMsg),
}
#[cosmwasm_schema::cw_serde]
#[derive(QueryResponses)]
#[cfg_attr(feature = "boot", derive(boot_core::QueryFns))]
pub enum QueryMsg {
#[returns(ModuleVersionsResponse)]
ModuleVersions { ids: Vec<String> },
#[returns(ModuleAddressesResponse)]
ModuleAddresses { ids: Vec<String> },
#[returns(ModuleInfosResponse)]
ModuleInfos {
start_after: Option<String>,
limit: Option<u8>,
},
#[returns(ConfigResponse)]
Config {},
#[returns(InfoResponse)]
Info {},
}
#[cosmwasm_schema::cw_serde]
pub struct ModuleVersionsResponse {
pub versions: Vec<ContractVersion>,
}
#[cosmwasm_schema::cw_serde]
pub struct ModuleAddressesResponse {
pub modules: Vec<(String, String)>,
}
#[cosmwasm_schema::cw_serde]
pub struct ConfigResponse {
pub root: String,
pub version_control_address: String,
pub module_factory_address: String,
pub os_id: Uint64,
}
#[cosmwasm_schema::cw_serde]
pub struct InfoResponse {
pub info: OsInfo,
}
#[cosmwasm_schema::cw_serde]
pub struct ManagerModuleInfo {
pub id: String,
pub version: ContractVersion,
pub address: String,
}
#[cosmwasm_schema::cw_serde]
pub struct ModuleInfosResponse {
pub module_infos: Vec<ManagerModuleInfo>,
}