Skip to content

Commit 1966c2d

Browse files
author
hard-nett
committed
working tests
1 parent 0cff77a commit 1966c2d

File tree

4 files changed

+41
-41
lines changed

4 files changed

+41
-41
lines changed

contracts/usb/src/contract.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
APP_VERSION, USB_ID,
77
};
88

9-
use abstract_app::AppContract;
9+
use abstract_app::AppContract;
1010
use cosmwasm_std::Response;
1111

1212
/// The type of the result returned by your app's entry points.

contracts/usb/src/handlers/execute.rs

+2-31
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub fn execute_handler(
3636
// only admin can run this
3737
// app.admin.assert_admin(deps.as_ref(), &info.sender)?;
3838
match msg {
39-
UsbExecuteMsg::UpdateConfig {} => update_config(deps, info, app),
4039
UsbExecuteMsg::JackalMsgs { msgs } => send_content(deps, info, msgs, app),
4140
}
4241
}
@@ -230,7 +229,7 @@ fn send_content(deps: DepsMut, info: MessageInfo, msgs: Vec<JackalMsg>, mut app:
230229
let send_as_proxy: CosmosMsg = wasm_execute(
231230
app.ibc_client(deps.as_ref()).module_address()?,
232231
&ibc_client::ExecuteMsg::RemoteAction {
233-
host_chain: ChainName::from_string(JUNO[0].to_string())?.to_string(),
232+
host_chain: ChainName::from_string("jackal".to_string())?.to_string(),
234233
action: HostAction::Dispatch {
235234
manager_msgs: vec![manager::ExecuteMsg::ExecOnModule {
236235
module_id: PROXY.to_string(),
@@ -252,32 +251,4 @@ fn send_content(deps: DepsMut, info: MessageInfo, msgs: Vec<JackalMsg>, mut app:
252251
)?;
253252

254253
Ok(app.response("send_content").add_submessage(msg))
255-
}
256-
257-
// pub(crate) fn route_msg(app: Usb, sender: Addr, msg: JackalMsg) -> UsbResult<CosmosMsg> {
258-
259-
// // let current_module_info = ModuleInfo::from_id(app.module_id(), app.version().into())?;
260-
// // // Call IBC client
261-
// // let ibc_client_msg = ibc_client::ExecuteMsg::ModuleIbcAction {
262-
// // host_chain: ChainName::from_string("jackal".to_string())?.to_string(),
263-
// // target_module: current_module_info,
264-
// // msg: to_json_binary(&ServerIbcMessage::RouteMessage { msg, header })?,
265-
// // callback_info: None,
266-
// // };
267-
268-
// // let ibc_client_addr: Addr = app
269-
// // .module_registry(deps.as_ref())?
270-
// // .query_module(ModuleInfo::from_id_latest(IBC_CLIENT)?)?
271-
// // .reference
272-
// // .unwrap_native()?;
273-
274-
// // let msg: CosmosMsg = wasm_execute(ibc_client_addr, &ibc_client_msg, vec![])?.into();
275-
// }
276-
277-
/// Update the configuration of the app
278-
fn update_config(deps: DepsMut, msg_info: MessageInfo, app: Usb) -> UsbResult {
279-
// Only the admin should be able to call this
280-
app.admin.assert_admin(deps.as_ref(), &msg_info.sender)?;
281-
282-
Ok(app.response("update_config"))
283-
}
254+
}

contracts/usb/src/msg.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::contract::Usb;
22

33
use cosmwasm_schema::QueryResponses;
4+
use cosmwasm_std::Addr;
45
use usb::JackalMsg;
56

67
// This is used for type safety and re-exporting the contract endpoint structs.
@@ -15,10 +16,7 @@ pub struct UsbInstantiateMsg {}
1516
#[derive(cw_orch::ExecuteFns)]
1617
#[impl_into(ExecuteMsg)]
1718
pub enum UsbExecuteMsg {
18-
JackalMsgs {
19-
msgs: Vec<JackalMsg>,
20-
},
21-
UpdateConfig {},
19+
JackalMsgs { msgs: Vec<JackalMsg> },
2220
}
2321

2422
#[cosmwasm_schema::cw_serde]

contracts/usb/tests/integration.rs

+36-5
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,50 @@ mod basic_functions {
107107
jkl_env.enable_ibc()?;
108108

109109
// d. Connect Chains To Each Other
110-
ibc_connect_polytone_and_abstract(&interchain, "juno-1", "jackal-1")?;
110+
let ibc_client = ibc_connect_polytone_and_abstract(&interchain, "juno-1", "jackal-1")?;
111111

112112
let bs_client = bs_env.client1;
113113
let jkl_client = jkl_env.client1;
114114

115-
bs_client.account().set_ibc_status(true)?;
116-
117115
let msg = JackalMsg::MakeRoot {
118116
editors: "test".to_string(),
119117
viewers: "test".to_string(),
120118
tracking_number: "test".to_string(),
121119
};
120+
let msg2 = JackalMsg::PostKey {
121+
key: "test".to_string(),
122+
};
123+
let msg3 = JackalMsg::AddViewers {
124+
viewer_ids: "test".to_string(),
125+
viewer_keys: "test".to_string(),
126+
address: "test".to_string(),
127+
owner: "test".to_string(),
128+
};
129+
let msg4 = JackalMsg::BuyStorage {
130+
for_address: "test".to_string(),
131+
duration_days: 30,
132+
bytes: 0,
133+
payment_denom: "uterp".to_string(),
134+
};
135+
let msg5 = JackalMsg::CancelContract {
136+
cid: "test".to_string(),
137+
};
138+
let msg6 = JackalMsg::SignContract {
139+
cid: "test".to_string(),
140+
};
141+
let msg7 = JackalMsg::UpgradeStorage {
142+
for_address: "test".to_string(),
143+
duration_days: 30,
144+
bytes: 0,
145+
payment_denom: "ubtsg".to_string(),
146+
};
147+
let msg9 = JackalMsg::DeleteViewers {
148+
viewer_ids: "test".to_string(),
149+
address: "test".to_string(),
150+
owner: "test".to_string(),
151+
};
122152

123-
bs_client.jackal_msgs(vec![msg])?;
153+
bs_client.jackal_msgs(vec![msg, msg2, msg3, msg4, msg5, msg6, msg7,msg9])?;
124154

125155
Ok(())
126156
}
@@ -148,7 +178,8 @@ pub fn ibc_connect_polytone_and_abstract<Chain: IbcQueryHandler, IBC: Interchain
148178
None, // Unordered channel
149179
)?;
150180
// Create the connection between client and host
151-
abstract_ibc_connection_with(&abstr_origin, interchain, &abstr_remote, &origin_polytone)?;
181+
let addr =
182+
abstract_ibc_connection_with(&abstr_origin, interchain, &abstr_remote, &origin_polytone)?;
152183

153184
Ok(())
154185
}

0 commit comments

Comments
 (0)