use cosmwasm_schema::QueryResponses;
use cosmwasm_std::Addr;
use crate::{
manager,
manager::ModuleInstallConfig,
objects::{account::AccountId, chain_name::ChainName, AssetEntry},
};
pub mod state {
use cw_storage_plus::{Item, Map};
use super::*;
use crate::objects::{ans_host::AnsHost, version_control::VersionControlContract};
pub const CHAIN_PROXIES: Map<&ChainName, Addr> = Map::new("ccl");
pub const REVERSE_CHAIN_PROXIES: Map<&Addr, ChainName> = Map::new("rev-ccl");
pub const CONFIG: Item<Config> = Item::new("cfg");
pub const TEMP_ACTION_AFTER_CREATION: Item<ActionAfterCreationCache> = Item::new("act");
#[cosmwasm_schema::cw_serde]
pub struct Config {
pub ans_host: AnsHost,
pub account_factory: Addr,
pub version_control: VersionControlContract,
}
#[cosmwasm_schema::cw_serde]
pub struct ActionAfterCreationCache {
pub client_proxy_address: String,
pub account_id: AccountId,
pub action: HostAction,
pub chain_name: ChainName,
}
}
#[cosmwasm_schema::cw_serde]
pub struct InstantiateMsg {
pub ans_host_address: String,
pub account_factory_address: String,
pub version_control_address: String,
}
#[cosmwasm_schema::cw_serde]
pub struct MigrateMsg {}
#[cosmwasm_schema::cw_serde]
#[non_exhaustive]
pub enum InternalAction {
Register {
name: String,
description: Option<String>,
link: Option<String>,
base_asset: Option<AssetEntry>,
namespace: Option<String>,
install_modules: Vec<ModuleInstallConfig>,
},
}
#[cosmwasm_schema::cw_serde]
#[non_exhaustive]
pub enum HelperAction {
SendAllBack,
}
#[cosmwasm_schema::cw_serde]
pub enum HostAction {
Dispatch {
manager_msg: manager::ExecuteMsg,
},
Internal(InternalAction),
Helpers(HelperAction),
}
#[cosmwasm_schema::cw_serde]
#[cfg_attr(feature = "interface", derive(cw_orch::ExecuteFns))]
pub enum ExecuteMsg {
UpdateOwnership(cw_ownable::Action),
UpdateConfig {
ans_host_address: Option<String>,
account_factory_address: Option<String>,
version_control_address: Option<String>,
},
RegisterChainProxy {
chain: String,
proxy: String,
},
RemoveChainProxy {
chain: String,
},
#[cfg_attr(feature = "interface", fn_name("ibc_execute"))]
Execute {
account_id: AccountId,
proxy_address: String,
action: HostAction,
},
}
#[cosmwasm_schema::cw_serde]
#[derive(QueryResponses)]
#[cfg_attr(feature = "interface", derive(cw_orch::QueryFns))]
pub enum QueryMsg {
#[returns(cw_ownable::Ownership<Addr> )]
Ownership {},
#[returns(ConfigResponse)]
Config {},
#[returns(ClientProxiesResponse)]
ClientProxies {
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(ClientProxyResponse)]
ClientProxy { chain: String },
}
#[cosmwasm_schema::cw_serde]
pub struct ConfigResponse {
pub ans_host_address: Addr,
pub account_factory_address: Addr,
pub version_control_address: Addr,
}
#[cosmwasm_schema::cw_serde]
pub struct ClientProxiesResponse {
pub chains: Vec<(ChainName, Addr)>,
}
#[cosmwasm_schema::cw_serde]
pub struct ClientProxyResponse {
pub proxy: Addr,
}