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
use cosmwasm_schema::QueryResponses;
use cw_asset::{AssetInfo, AssetInfoUnchecked};
use crate::objects::{
asset_entry::AssetEntry,
contract_entry::{ContractEntry, UncheckedContractEntry},
ChannelEntry, UncheckedChannelEntry,
};
pub mod state {
use cosmwasm_std::Addr;
use cw_asset::AssetInfo;
use cw_controllers::Admin;
use cw_storage_plus::Map;
use crate::objects::{asset_entry::AssetEntry, contract_entry::ContractEntry, ChannelEntry};
pub const ADMIN: Admin = Admin::new("admin");
pub const ASSET_ADDRESSES: Map<AssetEntry, AssetInfo> = Map::new("assets");
pub const CONTRACT_ADDRESSES: Map<ContractEntry, Addr> = Map::new("contracts");
pub const CHANNELS: Map<ChannelEntry, String> = Map::new("channels");
}
#[cosmwasm_schema::cw_serde]
pub struct InstantiateMsg {}
#[cosmwasm_schema::cw_serde]
pub enum ExecuteMsg {
UpdateContractAddresses {
to_add: Vec<(UncheckedContractEntry, String)>,
to_remove: Vec<UncheckedContractEntry>,
},
UpdateAssetAddresses {
to_add: Vec<(String, AssetInfoUnchecked)>,
to_remove: Vec<String>,
},
UpdateChannels {
to_add: Vec<(UncheckedChannelEntry, String)>,
to_remove: Vec<UncheckedChannelEntry>,
},
SetAdmin { admin: String },
}
#[cosmwasm_schema::cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(AssetsResponse)]
Assets {
names: Vec<String>,
},
#[returns(AssetListResponse)]
AssetList {
page_token: Option<String>,
page_size: Option<u8>,
},
#[returns(ContractsResponse)]
Contracts {
names: Vec<ContractEntry>,
},
#[returns(ContractListResponse)]
ContractList {
page_token: Option<ContractEntry>,
page_size: Option<u8>,
},
#[returns(ChannelsResponse)]
Channels {
names: Vec<ChannelEntry>,
},
#[returns(ChannelListResponse)]
ChannelList {
page_token: Option<ChannelEntry>,
page_size: Option<u8>,
},
}
#[cosmwasm_schema::cw_serde]
pub struct MigrateMsg {}
#[cosmwasm_schema::cw_serde]
pub struct AssetsResponse {
pub assets: Vec<(AssetEntry, AssetInfo)>,
}
#[cosmwasm_schema::cw_serde]
pub struct AssetListResponse {
pub assets: Vec<(AssetEntry, AssetInfo)>,
}
#[cosmwasm_schema::cw_serde]
pub struct ContractsResponse {
pub contracts: Vec<(ContractEntry, String)>,
}
#[cosmwasm_schema::cw_serde]
pub struct ContractListResponse {
pub contracts: Vec<(ContractEntry, String)>,
}
#[cosmwasm_schema::cw_serde]
pub struct ChannelsResponse {
pub channels: Vec<(ChannelEntry, String)>,
}
#[cosmwasm_schema::cw_serde]
pub struct ChannelListResponse {
pub channels: Vec<(ChannelEntry, String)>,
}