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
pub mod state {
use cosmwasm_std::Addr;
use cw_controllers::Admin;
use cw_storage_plus::Map;
use super::Core;
pub const ADMIN: Admin = Admin::new("admin");
pub const FACTORY: Admin = Admin::new("factory");
pub const MODULE_CODE_IDS: Map<(&str, &str), u64> = Map::new("module_code_ids");
pub const API_ADDRESSES: Map<(&str, &str), Addr> = Map::new("api_address");
pub const OS_ADDRESSES: Map<u32, Core> = Map::new("os_core");
}
use cosmwasm_std::{Addr, Uint64};
use cw2::ContractVersion;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::objects::module::ModuleInfo;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct Core {
pub manager: Addr,
pub proxy: Addr,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct InstantiateMsg {}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
AddCodeId {
module: String,
version: String,
code_id: u64,
},
RemoveCodeId { module: String, version: String },
AddApi {
module: String,
version: String,
address: String,
},
RemoveApi { module: String, version: String },
AddOs {
os_id: u32,
manager_address: String,
proxy_address: String,
},
SetAdmin { new_admin: String },
SetFactory { new_factory: String },
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
OsCore { os_id: u32 },
CodeId { module: ModuleInfo },
ApiAddress { module: ModuleInfo },
Config {},
CodeIds {
page_token: Option<ContractVersion>,
page_size: Option<u8>,
},
ApiAddresses {
page_token: Option<ContractVersion>,
page_size: Option<u8>,
},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct QueryOsCoreResponse {
pub os_core: Core,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct QueryCodeIdResponse {
pub code_id: Uint64,
pub info: ContractVersion,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct QueryCodeIdsResponse {
pub module_code_ids: Vec<(ContractVersion, u64)>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct QueryApiAddressResponse {
pub address: Addr,
pub info: ContractVersion,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct QueryApiAddressesResponse {
pub api_addresses: Vec<(ContractVersion, String)>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct QueryConfigResponse {
pub admin: String,
pub factory: String,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct MigrateMsg {}