Skip to content

Commit 3b67473

Browse files
authored
Remove ibc callbacks for accounts. (#277)
* Added verifiedsender to ibc-callback * Added test * Removed user initiated callbacks * formatting [skip ci]
1 parent 04ff7fe commit 3b67473

File tree

16 files changed

+52
-633
lines changed

16 files changed

+52
-633
lines changed

framework/contracts/native/ibc-client/src/commands.rs

Lines changed: 9 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
use std::str::FromStr;
22

33
use abstract_sdk::{
4+
feature_objects::{AnsHost, VersionControlContract},
45
features::AccountIdentification,
5-
std::{
6-
ibc_client::state::{ACCOUNTS, CONFIG},
7-
ibc_host::{HostAction, InternalAction},
8-
objects::{ans_host::AnsHost, version_control::VersionControlContract, ChannelEntry},
9-
ICS20,
10-
},
116
Resolve,
127
};
138
use abstract_std::{
14-
ibc::CallbackInfo,
159
ibc_client::{
16-
state::{IbcInfrastructure, IBC_INFRA, REVERSE_POLYTONE_NOTE},
10+
state::{IbcInfrastructure, ACCOUNTS, CONFIG, IBC_INFRA, REVERSE_POLYTONE_NOTE},
1711
IbcClientCallback,
1812
},
19-
ibc_host, manager,
20-
manager::ModuleInstallConfig,
21-
objects::{chain_name::ChainName, AccountId, AssetEntry},
13+
ibc_host::{self, HostAction, InternalAction},
14+
manager::{self, ModuleInstallConfig},
15+
objects::{chain_name::ChainName, AccountId, AssetEntry, ChannelEntry},
2216
version_control::AccountBase,
17+
ICS20,
2318
};
2419
use cosmwasm_std::{
2520
to_json_binary, wasm_execute, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, IbcMsg, MessageInfo,
26-
QueryRequest, Storage,
21+
Storage,
2722
};
2823
use polytone::callbacks::CallbackRequest;
2924

@@ -169,38 +164,14 @@ fn send_remote_host_action(
169164
Ok(note_message.into())
170165
}
171166

172-
/// Perform a ICQ on a remote chain
173-
fn send_remote_host_query(
174-
deps: Deps,
175-
host_chain: ChainName,
176-
queries: Vec<QueryRequest<Empty>>,
177-
callback_request: CallbackRequest,
178-
) -> IbcClientResult<CosmosMsg<Empty>> {
179-
// Send this message via the Polytone infra
180-
let note_contract = IBC_INFRA.load(deps.storage, &host_chain)?.polytone_note;
181-
182-
let note_message = wasm_execute(
183-
note_contract.to_string(),
184-
&polytone_note::msg::ExecuteMsg::Query {
185-
msgs: queries,
186-
callback: callback_request,
187-
timeout_seconds: PACKET_LIFETIME.into(),
188-
},
189-
vec![],
190-
)?;
191-
192-
Ok(note_message.into())
193-
}
194-
195167
/// Sends a packet with an optional callback.
196168
/// This is the top-level function to do IBC related actions.
197169
pub fn execute_send_packet(
198170
deps: DepsMut,
199-
env: Env,
171+
_env: Env,
200172
info: MessageInfo,
201173
host_chain: String,
202174
action: HostAction,
203-
callback_info: Option<CallbackInfo>,
204175
) -> IbcClientResult {
205176
let host_chain = ChainName::from_str(&host_chain)?;
206177

@@ -219,44 +190,18 @@ pub fn execute_send_packet(
219190
return Err(IbcClientError::ForbiddenInternalCall {});
220191
}
221192

222-
let callback_request = callback_info.map(|c| CallbackRequest {
223-
receiver: env.contract.address.to_string(),
224-
msg: to_json_binary(&IbcClientCallback::UserRemoteAction(c)).unwrap(),
225-
});
226-
227193
let note_message = send_remote_host_action(
228194
deps.as_ref(),
229195
account_id,
230196
account_base,
231197
host_chain,
232198
action,
233-
callback_request,
199+
None,
234200
)?;
235201

236202
Ok(IbcClientResponse::action("handle_send_msgs").add_message(note_message))
237203
}
238204

239-
// Top-level function for performing queries.
240-
pub fn execute_send_query(
241-
deps: DepsMut,
242-
env: Env,
243-
host_chain: String,
244-
queries: Vec<QueryRequest<Empty>>,
245-
callback_info: CallbackInfo,
246-
) -> IbcClientResult {
247-
let host_chain = ChainName::from_str(&host_chain)?;
248-
249-
let callback_request = CallbackRequest {
250-
receiver: env.contract.address.to_string(),
251-
msg: to_json_binary(&IbcClientCallback::UserRemoteAction(callback_info)).unwrap(),
252-
};
253-
254-
let note_message =
255-
send_remote_host_query(deps.as_ref(), host_chain, queries, callback_request)?;
256-
257-
Ok(IbcClientResponse::action("handle_send_msgs").add_message(note_message))
258-
}
259-
260205
/// Registers an Abstract Account on a remote chain.
261206
pub fn execute_register_account(
262207
deps: DepsMut,

0 commit comments

Comments
 (0)