use crate::ibc_client::ExecuteMsg as IbcClientMsg;
use cosmwasm_schema::QueryResponses;
use cosmwasm_std::{CosmosMsg, Empty, Uint128};
use crate::objects::{
proxy_asset::{ProxyAsset, UncheckedProxyAsset},
AssetEntry,
};
pub mod state {
pub use crate::objects::core::OS_ID;
use cw_controllers::Admin;
use cosmwasm_std::Addr;
use cw_storage_plus::{Item, Map};
use crate::objects::{
ans_host::AnsHost, asset_entry::AssetEntry, common_namespace::ADMIN_NAMESPACE,
proxy_asset::ProxyAsset,
};
#[cosmwasm_schema::cw_serde]
pub struct State {
pub modules: Vec<Addr>,
}
pub const ANS_HOST: Item<AnsHost> = Item::new("\u{0}{6}ans_host");
pub const STATE: Item<State> = Item::new("\u{0}{5}state");
pub const ADMIN: Admin = Admin::new(ADMIN_NAMESPACE);
pub const VAULT_ASSETS: Map<AssetEntry, ProxyAsset> = Map::new("proxy_assets");
}
#[cosmwasm_schema::cw_serde]
pub struct InstantiateMsg {
pub os_id: u32,
pub ans_host_address: String,
}
#[cosmwasm_schema::cw_serde]
pub enum ExecuteMsg {
SetAdmin { admin: String },
ModuleAction { msgs: Vec<CosmosMsg<Empty>> },
IbcAction { msgs: Vec<IbcClientMsg> },
AddModule { module: String },
RemoveModule { module: String },
UpdateAssets {
to_add: Vec<UncheckedProxyAsset>,
to_remove: Vec<String>,
},
}
#[cosmwasm_schema::cw_serde]
pub struct MigrateMsg {}
#[cosmwasm_schema::cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(ConfigResponse)]
Config {},
#[returns(TotalValueResponse)]
TotalValue {},
#[returns(TokenValueResponse)]
TokenValue {
identifier: String,
amount: Option<Uint128>,
},
#[returns(HoldingValueResponse)]
HoldingValue { identifier: String },
#[returns(HoldingAmountResponse)]
HoldingAmount { identifier: String },
#[returns(AssetConfigResponse)]
AssetConfig { identifier: String },
#[returns(AssetsResponse)]
Assets {
page_token: Option<String>,
page_size: Option<u8>,
},
#[returns(ValidityResponse)]
CheckValidity {},
#[returns(BaseAssetResponse)]
BaseAsset {},
}
#[cosmwasm_schema::cw_serde]
pub struct ConfigResponse {
pub modules: Vec<String>,
}
#[cosmwasm_schema::cw_serde]
pub struct TotalValueResponse {
pub value: Uint128,
}
#[cosmwasm_schema::cw_serde]
pub struct TokenValueResponse {
pub value: Uint128,
}
#[cosmwasm_schema::cw_serde]
pub struct HoldingValueResponse {
pub value: Uint128,
}
#[cosmwasm_schema::cw_serde]
pub struct ValidityResponse {
pub unresolvable_assets: Option<Vec<AssetEntry>>,
pub missing_dependencies: Option<Vec<AssetEntry>>,
}
#[cosmwasm_schema::cw_serde]
pub struct BaseAssetResponse {
pub base_asset: ProxyAsset,
}
#[cosmwasm_schema::cw_serde]
pub struct HoldingAmountResponse {
pub amount: Uint128,
}
#[cosmwasm_schema::cw_serde]
pub struct AssetConfigResponse {
pub proxy_asset: ProxyAsset,
}
#[cosmwasm_schema::cw_serde]
pub struct AssetsResponse {
pub assets: Vec<(AssetEntry, ProxyAsset)>,
}
#[cosmwasm_schema::cw_serde]
pub struct ValueQueryMsg {
pub asset: AssetEntry,
pub amount: Uint128,
}
#[cosmwasm_schema::cw_serde]
pub struct ExternalValueResponse {
pub value: Uint128,
}