abstract_core/native/
ibc_host.rs1use cosmwasm_schema::QueryResponses;
11use cosmwasm_std::Addr;
12
13use crate::{
14 manager,
15 manager::ModuleInstallConfig,
16 objects::{account::AccountId, chain_name::ChainName, AssetEntry},
17};
18
19pub mod state {
20 use cw_storage_plus::{Item, Map};
21
22 use super::*;
23 use crate::objects::{ans_host::AnsHost, version_control::VersionControlContract};
24
25 pub const CHAIN_PROXIES: Map<&ChainName, Addr> = Map::new("ccl");
27 pub const REVERSE_CHAIN_PROXIES: Map<&Addr, ChainName> = Map::new("rev-ccl");
28 pub const CONFIG: Item<Config> = Item::new("cfg");
30
31 pub const TEMP_ACTION_AFTER_CREATION: Item<ActionAfterCreationCache> = Item::new("act");
33
34 #[cosmwasm_schema::cw_serde]
36 pub struct Config {
37 pub ans_host: AnsHost,
39 pub account_factory: Addr,
41 pub version_control: VersionControlContract,
43 }
44
45 #[cosmwasm_schema::cw_serde]
46 pub struct ActionAfterCreationCache {
47 pub client_proxy_address: String,
48 pub account_id: AccountId,
49 pub action: HostAction,
50 pub chain_name: ChainName,
51 }
52}
53#[cosmwasm_schema::cw_serde]
56pub struct InstantiateMsg {
57 pub ans_host_address: String,
59 pub account_factory_address: String,
61 pub version_control_address: String,
63}
64
65#[cosmwasm_schema::cw_serde]
66pub struct MigrateMsg {}
67
68#[cosmwasm_schema::cw_serde]
69#[non_exhaustive]
70pub enum InternalAction {
71 Register {
73 name: String,
74 description: Option<String>,
75 link: Option<String>,
76 base_asset: Option<AssetEntry>,
77 namespace: Option<String>,
78 install_modules: Vec<ModuleInstallConfig>,
79 },
80}
81
82#[cosmwasm_schema::cw_serde]
83#[non_exhaustive]
84pub enum HelperAction {
85 SendAllBack,
87}
88
89#[cosmwasm_schema::cw_serde]
91pub enum HostAction {
92 Dispatch {
93 manager_msg: manager::ExecuteMsg,
94 },
95 Internal(InternalAction),
97 Helpers(HelperAction),
99}
100
101#[cosmwasm_schema::cw_serde]
103#[cfg_attr(feature = "interface", derive(cw_orch::ExecuteFns))]
104pub enum ExecuteMsg {
105 UpdateOwnership(cw_ownable::Action),
106 UpdateConfig {
107 ans_host_address: Option<String>,
108 account_factory_address: Option<String>,
109 version_control_address: Option<String>,
110 },
111 RegisterChainProxy {
114 chain: String,
115 proxy: String,
116 },
117 RemoveChainProxy {
119 chain: String,
120 },
121 #[cfg_attr(feature = "interface", fn_name("ibc_execute"))]
123 Execute {
124 account_id: AccountId,
125 proxy_address: String,
128 action: HostAction,
129 },
130}
131
132#[cosmwasm_schema::cw_serde]
134#[derive(QueryResponses)]
135#[cfg_attr(feature = "interface", derive(cw_orch::QueryFns))]
136pub enum QueryMsg {
137 #[returns(cw_ownable::Ownership<Addr> )]
140 Ownership {},
141 #[returns(ConfigResponse)]
143 Config {},
144 #[returns(ClientProxiesResponse)]
147 ClientProxies {
148 start_after: Option<String>,
149 limit: Option<u32>,
150 },
151 #[returns(ClientProxyResponse)]
154 ClientProxy { chain: String },
155}
156
157#[cosmwasm_schema::cw_serde]
158pub struct ConfigResponse {
159 pub ans_host_address: Addr,
160 pub account_factory_address: Addr,
161 pub version_control_address: Addr,
162}
163
164#[cosmwasm_schema::cw_serde]
165pub struct ClientProxiesResponse {
166 pub chains: Vec<(ChainName, Addr)>,
167}
168
169#[cosmwasm_schema::cw_serde]
170pub struct ClientProxyResponse {
171 pub proxy: Addr,
172}