Skip to content

Enabled IBC calls by default on remote accounts #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework/contracts/account/manager/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ pub fn update_ibc_status(
.add_message(proxy_callback_msg))
}

fn install_ibc_client(deps: DepsMut, proxy: Addr) -> Result<CosmosMsg, ManagerError> {
pub fn install_ibc_client(deps: DepsMut, proxy: Addr) -> Result<CosmosMsg, ManagerError> {
// retrieve the latest version
let ibc_client_module =
query_module(deps.as_ref(), ModuleInfo::from_id_latest(IBC_CLIENT)?, None)?;
Expand Down
1 change: 1 addition & 0 deletions framework/docs/src/releases/v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- `state.json` now included in binary in release mode, allowing using binaries on a different environment than it's been built.
- `module_instantiate2_address_raw` for `AbstractClient`, allowing to install a different version than the dependency version.
- Added helper functions `assert_registered` and `is_registered` to the ANS client API.
- Added default IBC-Client installation on remote modules inside Client and Account interfaces

### Changed

Expand Down
12 changes: 10 additions & 2 deletions framework/packages/abstract-client/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use abstract_std::{
AccountId, AssetEntry,
},
version_control::NamespaceResponse,
PROXY,
IBC_CLIENT, PROXY,
};
use cosmwasm_std::{to_json_binary, Attribute, Coins, CosmosMsg, Uint128};
use cw_orch::{contract::Contract, environment::MutCwEnv, prelude::*};
Expand Down Expand Up @@ -560,8 +560,16 @@ impl<Chain: CwEnv> Account<Chain> {
host_chain: impl Into<String>,
base_asset: Option<AssetEntry>,
namespace: Option<String>,
install_modules: Vec<ModuleInstallConfig>,
mut install_modules: Vec<ModuleInstallConfig>,
) -> AbstractClientResult<<Chain as TxHandler>::Response> {
// We add the IBC Client by default in the modules installed on the remote account
if !install_modules.iter().any(|m| m.module.id() == IBC_CLIENT) {
install_modules.push(ModuleInstallConfig::new(
ModuleInfo::from_id_latest(IBC_CLIENT)?,
None,
));
}

self.abstr_account
.manager
.execute(
Expand Down
7 changes: 5 additions & 2 deletions framework/packages/abstract-interface/src/account/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use abstract_std::{
module::{ModuleInfo, ModuleVersion},
AccountId,
},
MANAGER, PROXY,
IBC_CLIENT, MANAGER, PROXY,
};
use cosmwasm_std::{to_json_binary, Binary};
use cw_orch::{interface, prelude::*};
Expand Down Expand Up @@ -205,7 +205,10 @@ impl<Chain: CwEnv> Manager<Chain> {
host_chain: host_chain.into(),
base_asset: None,
namespace: None,
install_modules: vec![],
install_modules: vec![ModuleInstallConfig::new(
ModuleInfo::from_id_latest(IBC_CLIENT)?,
None,
)],
}],
})?,
PROXY.to_string(),
Expand Down
10 changes: 8 additions & 2 deletions interchain/interchain-tests/src/interchain_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mod test {
ModuleAddressesResponse,
},
objects::{gov_type::GovernanceDetails, UncheckedChannelEntry},
ICS20, PROXY,
IBC_CLIENT, ICS20, PROXY,
};
use abstract_testing::prelude::*;
use anyhow::Result as AnyResult;
Expand Down Expand Up @@ -536,9 +536,9 @@ mod test {
let (origin_account, remote_account_id) =
create_test_remote_account(&abstr_origin, JUNO, STARGAZE, &mock_interchain, None)?;

// We assert the account was created with the right properties
let remote_abstract_account =
AbstractAccount::new(&abstr_remote, remote_account_id.clone());

let manager_config = remote_abstract_account.manager.config()?;
assert_eq!(
manager_config,
Expand Down Expand Up @@ -571,6 +571,12 @@ mod test {
}
}
);
// We make sure the ibc client is installed on the remote account
let installed_remote_modules = remote_abstract_account.manager.module_infos(None, None)?;
assert!(installed_remote_modules
.module_infos
.iter()
.any(|m| m.id == IBC_CLIENT));

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

Expand Down