diff --git a/contracts/cosmwasm-vm/cw-mock-ibc-core/src/contract.rs b/contracts/cosmwasm-vm/cw-mock-ibc-core/src/contract.rs index 3fa2919a5..fb43cc5fd 100644 --- a/contracts/cosmwasm-vm/cw-mock-ibc-core/src/contract.rs +++ b/contracts/cosmwasm-vm/cw-mock-ibc-core/src/contract.rs @@ -2,11 +2,12 @@ use common::ibc::core::ics04_channel::timeout::TimeoutHeight; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, IbcEndpoint, IbcPacket, + to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, Event, IbcEndpoint, IbcPacket, IbcPacketReceiveMsg, IbcTimeout, IbcTimeoutBlock, MessageInfo, Reply, Response, StdResult, SubMsg, Timestamp, WasmMsg, }; use cw2::set_contract_version; +use cw_common::hex_string::HexString; use cw_common::ibc_types::IbcHeight; use cw_common::raw_types::channel::RawPacket; use cw_common::ProstMessage; @@ -154,9 +155,17 @@ pub fn execute( .add_attribute("method", "ibc_config") .add_attribute("data", to_binary(&sub_message).unwrap().to_base64())) } + ExecuteMsg::WriteAcknowledgement { + packet: _, + acknowledgement, + } => Ok(Response::new().add_event(event_ack(acknowledgement))), } } +pub fn event_ack(ack: HexString) -> Event { + Event::new("write_acknowledgement").add_attribute("data", hex::encode(ack.to_bytes().unwrap())) +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg { @@ -168,6 +177,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { Ok(to_binary(&state.sequence).unwrap()) } + QueryMsg::GetLatestHeight { client_id: _ } => Ok(to_binary(&100000_u64).unwrap()), _ => Err(cosmwasm_std::StdError::NotFound { kind: "Query Not Found".to_string(), }), diff --git a/contracts/cosmwasm-vm/cw-mock-ibc-core/src/msg.rs b/contracts/cosmwasm-vm/cw-mock-ibc-core/src/msg.rs index 9eb8d789e..081b70d59 100644 --- a/contracts/cosmwasm-vm/cw-mock-ibc-core/src/msg.rs +++ b/contracts/cosmwasm-vm/cw-mock-ibc-core/src/msg.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::Addr; +use cosmwasm_std::{Addr, IbcPacket}; use cw_common::cw_types::CwChannelConnectMsg; use cw_common::hex_string::HexString; @@ -8,8 +8,20 @@ pub struct InstantiateMsg {} #[cw_serde] pub enum ExecuteMsg { - SendPacket { packet: HexString }, - ReceivePacket { message: String }, - RegisterXcall { address: Addr }, - IbcConfig { msg: CwChannelConnectMsg }, + SendPacket { + packet: HexString, + }, + ReceivePacket { + message: String, + }, + RegisterXcall { + address: Addr, + }, + IbcConfig { + msg: CwChannelConnectMsg, + }, + WriteAcknowledgement { + packet: IbcPacket, + acknowledgement: HexString, + }, }