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
pub type ModuleMapEntry = (ModuleInfo, ModuleReference);
pub mod state {
use cw_controllers::Admin;
use cw_storage_plus::Map;
use crate::objects::{
common_namespace::ADMIN_NAMESPACE, core::OsId, module::ModuleInfo,
module_reference::ModuleReference,
};
use super::Core;
pub const ADMIN: Admin = Admin::new(ADMIN_NAMESPACE);
pub const FACTORY: Admin = Admin::new("factory");
pub const MODULE_LIBRARY: Map<&ModuleInfo, ModuleReference> = Map::new("module_lib");
pub const OS_ADDRESSES: Map<OsId, Core> = Map::new("os_core");
}
use crate::objects::{
core::OsId,
module::{Module, ModuleInfo},
module_reference::ModuleReference,
};
use cosmwasm_schema::QueryResponses;
use cosmwasm_std::Addr;
#[cosmwasm_schema::cw_serde]
pub struct Core {
pub manager: Addr,
pub proxy: Addr,
}
#[cosmwasm_schema::cw_serde]
pub struct InstantiateMsg {}
#[cosmwasm_schema::cw_serde]
#[cfg_attr(feature = "boot", derive(boot_core::ExecuteFns))]
pub enum ExecuteMsg {
RemoveModule { module: ModuleInfo },
AddModules { modules: Vec<ModuleMapEntry> },
AddOs { os_id: OsId, core: Core },
SetAdmin { new_admin: String },
SetFactory { new_factory: String },
}
#[derive(Default)]
#[cosmwasm_schema::cw_serde]
pub struct ModuleFilter {
pub provider: Option<String>,
pub name: Option<String>,
pub version: Option<String>,
}
#[cosmwasm_schema::cw_serde]
#[derive(QueryResponses)]
#[cfg_attr(feature = "boot", derive(boot_core::QueryFns))]
pub enum QueryMsg {
#[returns(OsCoreResponse)]
OsCore { os_id: OsId },
#[returns(ModulesResponse)]
Modules { infos: Vec<ModuleInfo> },
#[returns(ConfigResponse)]
Config {},
#[returns(ModulesListResponse)]
ModuleList {
filter: Option<ModuleFilter>,
start_after: Option<ModuleInfo>,
limit: Option<u8>,
},
}
#[cosmwasm_schema::cw_serde]
pub struct OsCoreResponse {
pub os_core: Core,
}
#[cosmwasm_schema::cw_serde]
pub struct ModulesResponse {
pub modules: Vec<Module>,
}
#[cosmwasm_schema::cw_serde]
pub struct ModulesListResponse {
pub modules: Vec<Module>,
}
#[cosmwasm_schema::cw_serde]
pub struct ConfigResponse {
pub admin: String,
pub factory: String,
}
#[cosmwasm_schema::cw_serde]
pub struct MigrateMsg {}