Skip to content

Commit bcd53df

Browse files
authored
Enabled IBC calls by default on remote accounts (#330)
* Added ibc module default on new remote account * Added ibc enable test * Push IBC client install to APIs instead of in-contract * formatting [skip ci] * Changelog
1 parent 025a52b commit bcd53df

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

framework/contracts/account/manager/src/commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ pub fn update_ibc_status(
933933
.add_message(proxy_callback_msg))
934934
}
935935

936-
fn install_ibc_client(deps: DepsMut, proxy: Addr) -> Result<CosmosMsg, ManagerError> {
936+
pub fn install_ibc_client(deps: DepsMut, proxy: Addr) -> Result<CosmosMsg, ManagerError> {
937937
// retrieve the latest version
938938
let ibc_client_module =
939939
query_module(deps.as_ref(), ModuleInfo::from_id_latest(IBC_CLIENT)?, None)?;

framework/docs/src/releases/v0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- `state.json` now included in binary in release mode, allowing using binaries on a different environment than it's been built.
88
- `module_instantiate2_address_raw` for `AbstractClient`, allowing to install a different version than the dependency version.
99
- Added helper functions `assert_registered` and `is_registered` to the ANS client API.
10+
- Added default IBC-Client installation on remote modules inside Client and Account interfaces
1011

1112
### Changed
1213

framework/packages/abstract-client/src/account.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use abstract_std::{
4040
AccountId, AssetEntry,
4141
},
4242
version_control::NamespaceResponse,
43-
PROXY,
43+
IBC_CLIENT, PROXY,
4444
};
4545
use cosmwasm_std::{to_json_binary, Attribute, Coins, CosmosMsg, Uint128};
4646
use cw_orch::{contract::Contract, environment::MutCwEnv, prelude::*};
@@ -560,8 +560,16 @@ impl<Chain: CwEnv> Account<Chain> {
560560
host_chain: impl Into<String>,
561561
base_asset: Option<AssetEntry>,
562562
namespace: Option<String>,
563-
install_modules: Vec<ModuleInstallConfig>,
563+
mut install_modules: Vec<ModuleInstallConfig>,
564564
) -> AbstractClientResult<<Chain as TxHandler>::Response> {
565+
// We add the IBC Client by default in the modules installed on the remote account
566+
if !install_modules.iter().any(|m| m.module.id() == IBC_CLIENT) {
567+
install_modules.push(ModuleInstallConfig::new(
568+
ModuleInfo::from_id_latest(IBC_CLIENT)?,
569+
None,
570+
));
571+
}
572+
565573
self.abstr_account
566574
.manager
567575
.execute(

framework/packages/abstract-interface/src/account/manager.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use abstract_std::{
99
module::{ModuleInfo, ModuleVersion},
1010
AccountId,
1111
},
12-
MANAGER, PROXY,
12+
IBC_CLIENT, MANAGER, PROXY,
1313
};
1414
use cosmwasm_std::{to_json_binary, Binary};
1515
use cw_orch::{interface, prelude::*};
@@ -205,7 +205,10 @@ impl<Chain: CwEnv> Manager<Chain> {
205205
host_chain: host_chain.into(),
206206
base_asset: None,
207207
namespace: None,
208-
install_modules: vec![],
208+
install_modules: vec![ModuleInstallConfig::new(
209+
ModuleInfo::from_id_latest(IBC_CLIENT)?,
210+
None,
211+
)],
209212
}],
210213
})?,
211214
PROXY.to_string(),

interchain/interchain-tests/src/interchain_accounts.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ mod test {
102102
ModuleAddressesResponse,
103103
},
104104
objects::{gov_type::GovernanceDetails, UncheckedChannelEntry},
105-
ICS20, PROXY,
105+
IBC_CLIENT, ICS20, PROXY,
106106
};
107107
use abstract_testing::prelude::*;
108108
use anyhow::Result as AnyResult;
@@ -536,9 +536,9 @@ mod test {
536536
let (origin_account, remote_account_id) =
537537
create_test_remote_account(&abstr_origin, JUNO, STARGAZE, &mock_interchain, None)?;
538538

539+
// We assert the account was created with the right properties
539540
let remote_abstract_account =
540541
AbstractAccount::new(&abstr_remote, remote_account_id.clone());
541-
542542
let manager_config = remote_abstract_account.manager.config()?;
543543
assert_eq!(
544544
manager_config,
@@ -571,6 +571,12 @@ mod test {
571571
}
572572
}
573573
);
574+
// We make sure the ibc client is installed on the remote account
575+
let installed_remote_modules = remote_abstract_account.manager.module_infos(None, None)?;
576+
assert!(installed_remote_modules
577+
.module_infos
578+
.iter()
579+
.any(|m| m.id == IBC_CLIENT));
574580

575581
// We try to execute a message from the proxy contract (account creation for instance)
576582

0 commit comments

Comments
 (0)