use crate::Manager;
pub use abstract_core::proxy::{ExecuteMsgFns as ProxyExecFns, QueryMsgFns as ProxyQueryFns};
use abstract_core::{
objects::{price_source::UncheckedPriceSource, AssetEntry},
proxy::*,
MANAGER, PROXY,
};
use cw_orch::{interface, prelude::*};
#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsg)]
pub struct Proxy<Chain>;
impl<Chain: CwEnv> Uploadable for Proxy<Chain> {
#[cfg(feature = "integration")]
fn wrapper(&self) -> <Mock as ::cw_orch::environment::TxHandler>::ContractSource {
Box::new(
ContractWrapper::new_with_empty(
::proxy::contract::execute,
::proxy::contract::instantiate,
::proxy::contract::query,
)
.with_migrate(::proxy::contract::migrate),
)
}
fn wasm(&self) -> WasmPath {
artifacts_dir_from_workspace!().find_wasm_path("proxy").unwrap()
}
}
impl<Chain: CwEnv> Proxy<Chain> {
pub fn new(name: &str, chain: Chain) -> Self {
Self(cw_orch::contract::Contract::new(name, chain))
}
pub fn set_proxy_asset(
&self,
to_add: Vec<(AssetEntry, UncheckedPriceSource)>,
) -> Result<(), crate::AbstractInterfaceError> {
let manager = Manager::new(MANAGER, self.get_chain().clone());
manager.execute_on_module(
PROXY,
ExecuteMsg::UpdateAssets {
to_add,
to_remove: vec![],
},
)?;
Ok(())
}
}