abstract_cw_plus_interface/
cw20_ics20.rs

1use cosmwasm_std::{DepsMut, Env, Ibc3ChannelOpenResponse, IbcChannelOpenMsg};
2use cw_orch::interface;
3
4pub use abstract_cw20_ics20::msg::{ExecuteMsg, InitMsg, MigrateMsg, QueryMsg};
5
6use abstract_cw20_ics20::{
7    contract,
8    ibc::{
9        ibc_channel_close, ibc_channel_connect, ibc_channel_open, ibc_packet_ack,
10        ibc_packet_receive, ibc_packet_timeout,
11    },
12};
13
14#[interface(InitMsg, ExecuteMsg, QueryMsg, MigrateMsg)]
15pub struct Cw20Ics20;
16
17#[cfg(not(target_arch = "wasm32"))]
18use cw_orch::prelude::*;
19
20#[cfg(not(target_arch = "wasm32"))]
21impl<Chain: CwEnv> Uploadable for Cw20Ics20<Chain> {
22    // Return the path to the wasm file
23    fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
24        artifacts_dir_from_workspace!()
25            .find_wasm_path("cw20_ics20")
26            .unwrap()
27    }
28    // Return a CosmWasm contract wrapper
29    fn wrapper() -> Box<dyn MockContract<Empty>> {
30        Box::new(
31            ContractWrapper::new_with_empty(
32                contract::execute,
33                contract::instantiate,
34                contract::query,
35            )
36            .with_migrate(contract::migrate)
37            .with_ibc(
38                ibc_channel_open_fix,
39                ibc_channel_connect,
40                ibc_channel_close,
41                ibc_packet_receive,
42                ibc_packet_ack,
43                ibc_packet_timeout,
44            ),
45        )
46    }
47}
48
49/// Temporary fix until the cw20_ics20 implementation follows the IBC3 standard
50pub fn ibc_channel_open_fix(
51    deps: DepsMut,
52    env: Env,
53    msg: IbcChannelOpenMsg,
54) -> Result<Option<Ibc3ChannelOpenResponse>, abstract_cw20_ics20::ContractError> {
55    ibc_channel_open(deps, env, msg)?;
56    Ok(None)
57}