From 70fd5f5e5bf6ab08e4c1e3ff4bfb762ded1d95c3 Mon Sep 17 00:00:00 2001 From: Kayanski Date: Mon, 9 Sep 2024 14:33:36 +0000 Subject: [PATCH 01/17] Revert "Revert "Removed proxy and manager frm std and sdk"" This reverts commit 454acd7433e5de5585f33205db623e315ba18983. --- framework/packages/abstract-sdk/README.md | 5 +- .../packages/abstract-sdk/src/apis/adapter.rs | 6 +- .../packages/abstract-sdk/src/apis/app.rs | 4 +- .../packages/abstract-sdk/src/apis/authz.rs | 2 +- .../packages/abstract-sdk/src/apis/bank.rs | 17 +- .../abstract-sdk/src/apis/distribution.rs | 6 +- .../abstract-sdk/src/apis/execution.rs | 32 +- .../abstract-sdk/src/apis/feegrant.rs | 5 +- .../packages/abstract-sdk/src/apis/ibc.rs | 8 +- .../packages/abstract-sdk/src/apis/modules.rs | 6 +- .../packages/abstract-sdk/src/apis/verify.rs | 231 ++------------ .../abstract-sdk/src/apis/version_registry.rs | 4 +- .../src/base/features/executor.rs | 6 +- .../src/base/features/identification.rs | 63 +--- .../abstract-sdk/src/feature_objects.rs | 6 +- .../packages/abstract-sdk/src/mock_module.rs | 8 +- .../packages/abstract-std/src/account/mod.rs | 7 + .../src/{core/account.rs => account/msgs.rs} | 31 +- .../abstract-std/src/account/responses.rs | 67 ++++ .../abstract-std/src/account/state.rs | 57 ++++ .../abstract-std/src/account/types.rs | 43 +++ .../packages/abstract-std/src/core/manager.rs | 286 ------------------ .../packages/abstract-std/src/core/mod.rs | 3 - .../packages/abstract-std/src/core/proxy.rs | 101 ------- framework/packages/abstract-std/src/lib.rs | 3 +- .../src/native/account_factory.rs | 2 +- .../abstract-std/src/native/ibc_client.rs | 15 +- .../abstract-std/src/native/ibc_host.rs | 3 +- .../src/objects/version_control.rs | 12 +- .../packages/abstract-std/src/standalone.rs | 2 - .../src/abstract_mock_querier.rs | 7 +- .../abstract-testing/src/mock_querier.rs | 2 +- 32 files changed, 295 insertions(+), 755 deletions(-) create mode 100644 framework/packages/abstract-std/src/account/mod.rs rename framework/packages/abstract-std/src/{core/account.rs => account/msgs.rs} (88%) create mode 100644 framework/packages/abstract-std/src/account/responses.rs create mode 100644 framework/packages/abstract-std/src/account/state.rs create mode 100644 framework/packages/abstract-std/src/account/types.rs delete mode 100644 framework/packages/abstract-std/src/core/manager.rs delete mode 100644 framework/packages/abstract-std/src/core/mod.rs delete mode 100644 framework/packages/abstract-std/src/core/proxy.rs diff --git a/framework/packages/abstract-sdk/README.md b/framework/packages/abstract-sdk/README.md index 8e668286c7..a23df28041 100644 --- a/framework/packages/abstract-sdk/README.md +++ b/framework/packages/abstract-sdk/README.md @@ -89,12 +89,13 @@ The API can then be used by any contract that implements its required traits, in # use cosmwasm_std::{StdResult, Deps, MessageInfo, CosmosMsg, Addr}; # use abstract_sdk::feature_objects::AnsHost; # use abstract_sdk::{AbstractSdkResult, AccountAction}; + # use abstract_std::version_control::Account; # pub struct MyContract { # # } # impl AccountIdentification for MyContract { - # fn proxy_address(&self, _deps: Deps) -> AbstractSdkResult { - # Ok(Addr::unchecked("just_an_example")) + # fn account(&self, _deps: Deps) -> AbstractSdkResult { + # Ok(Account::new(Addr::unchecked("just_an_example"))) # } # } # impl ModuleIdentification for MyContract { diff --git a/framework/packages/abstract-sdk/src/apis/adapter.rs b/framework/packages/abstract-sdk/src/apis/adapter.rs index 5cdc8c3e78..9d6316b613 100644 --- a/framework/packages/abstract-sdk/src/apis/adapter.rs +++ b/framework/packages/abstract-sdk/src/apis/adapter.rs @@ -19,8 +19,8 @@ pub trait AdapterInterface: ModuleInterface + ModuleIdentification { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let adapters: Adapters = module.adapters(deps.as_ref()); ``` @@ -55,8 +55,8 @@ impl<'a, T: AdapterInterface> ApiIdentification for Adapters<'a, T> { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let adapters: Adapters = module.adapters(deps.as_ref()); ``` @@ -153,7 +153,7 @@ mod tests { let expected_msg: adapter::ExecuteMsg<_> = adapter::ExecuteMsg::Module(AdapterRequestMsg { - account_address: Some(abstr.account.proxy.to_string()), + account_address: Some(abstr.account.addr().to_string()), request: MockModuleExecuteMsg {}, }); diff --git a/framework/packages/abstract-sdk/src/apis/app.rs b/framework/packages/abstract-sdk/src/apis/app.rs index 526a5f1dac..2abdb402ff 100644 --- a/framework/packages/abstract-sdk/src/apis/app.rs +++ b/framework/packages/abstract-sdk/src/apis/app.rs @@ -19,8 +19,8 @@ pub trait AppInterface: ModuleInterface + ModuleIdentification { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let apps: Apps = module.apps(deps.as_ref()); ``` @@ -55,8 +55,8 @@ impl<'a, T: AppInterface> ApiIdentification for Apps<'a, T> { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let apps: Apps = module.apps(deps.as_ref()); ``` diff --git a/framework/packages/abstract-sdk/src/apis/authz.rs b/framework/packages/abstract-sdk/src/apis/authz.rs index 93c5f54dc6..b9276d0fd0 100644 --- a/framework/packages/abstract-sdk/src/apis/authz.rs +++ b/framework/packages/abstract-sdk/src/apis/authz.rs @@ -50,7 +50,7 @@ pub trait AuthZInterface: AccountExecutor { deps: cosmwasm_std::Deps<'a>, granter: Option, ) -> AbstractSdkResult { - let granter = granter.unwrap_or(self.proxy_address(deps)?); + let granter = granter.unwrap_or(self.account(deps)?.addr()); Ok(AuthZ { granter }) } } diff --git a/framework/packages/abstract-sdk/src/apis/bank.rs b/framework/packages/abstract-sdk/src/apis/bank.rs index 342c0ed648..eb72a69ecf 100644 --- a/framework/packages/abstract-sdk/src/apis/bank.rs +++ b/framework/packages/abstract-sdk/src/apis/bank.rs @@ -26,8 +26,8 @@ pub trait TransferInterface: use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let bank: Bank = module.bank(deps.as_ref()); ``` @@ -65,8 +65,8 @@ impl<'a, T: TransferInterface> ApiIdentification for Bank<'a, T> { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let bank: Bank = module.bank(deps.as_ref()); ``` @@ -116,6 +116,7 @@ impl<'a, T: TransferInterface + AccountExecutor> Bank<'a, T> { /// Transfer the provided funds from the Account to the recipient. /// ``` /// # use cosmwasm_std::{Addr, Response, Deps, DepsMut, MessageInfo}; + /// # use abstract_std::version_control::Account; /// # use abstract_std::objects::AnsAsset; /// # use abstract_std::objects::ans_host::AnsHost; /// # use abstract_sdk::{ @@ -124,7 +125,7 @@ impl<'a, T: TransferInterface + AccountExecutor> Bank<'a, T> { /// # }; /// # struct MockModule; /// # impl AccountIdentification for MockModule { - /// # fn proxy_address(&self, _deps: Deps) -> AbstractSdkResult { + /// # fn account(&self, _deps: Deps) -> AbstractSdkResult { /// # unimplemented!("Not needed for this example") /// # } /// # } @@ -274,7 +275,7 @@ mod test { use crate::mock_module::*; mod transfer_coins { - use abstract_std::proxy::ExecuteMsg; + use abstract_std::account::ExecuteMsg; use super::*; use crate::{Execution, Executor, ExecutorMsg}; @@ -300,10 +301,10 @@ mod test { amount: coins, }); - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); assert_that!(response.messages[0].msg).is_equal_to( &wasm_execute( - base.proxy, + account.addr(), &ExecuteMsg::ModuleAction { msgs: vec![expected_msg], }, @@ -337,9 +338,9 @@ mod test { let response: Response = app.response("deposit").add_messages(deposit_msgs); // ANCHOR_END: deposit - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); let bank_msg: CosmosMsg = CosmosMsg::Bank(BankMsg::Send { - to_address: base.proxy.to_string(), + to_address: account.addr().to_string(), amount: coins, }); diff --git a/framework/packages/abstract-sdk/src/apis/distribution.rs b/framework/packages/abstract-sdk/src/apis/distribution.rs index d86d82896a..d5877e44fe 100644 --- a/framework/packages/abstract-sdk/src/apis/distribution.rs +++ b/framework/packages/abstract-sdk/src/apis/distribution.rs @@ -22,7 +22,8 @@ pub trait DistributionInterface: AccountExecutor { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); + # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let distr: Distribution = module.distribution(); ``` @@ -42,7 +43,8 @@ impl DistributionInterface for T where T: AccountExecutor {} use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); + # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let distr: Distribution = module.distribution(); ``` diff --git a/framework/packages/abstract-sdk/src/apis/execution.rs b/framework/packages/abstract-sdk/src/apis/execution.rs index f0cdd15c4c..fc7b266ce4 100644 --- a/framework/packages/abstract-sdk/src/apis/execution.rs +++ b/framework/packages/abstract-sdk/src/apis/execution.rs @@ -3,7 +3,7 @@ //! use abstract_macros::with_abstract_event; -use abstract_std::proxy::ExecuteMsg; +use abstract_std::account::ExecuteMsg; use cosmwasm_std::{Binary, Coin, CosmosMsg, Deps, ReplyOn, Response, SubMsg}; use super::{AbstractApi, ApiIdentification}; @@ -25,8 +25,8 @@ pub trait Execution: AccountExecutor + ModuleIdentification { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let executor: Executor = module.executor(deps.as_ref()); ``` @@ -64,8 +64,8 @@ impl<'a, T: Execution> ApiIdentification for Executor<'a, T> { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let executor: Executor = module.executor(deps.as_ref()); ``` @@ -183,7 +183,7 @@ impl From for CosmosMsg { #[cfg(test)] mod test { #![allow(clippy::needless_borrows_for_generic_args)] - use abstract_std::proxy::ExecuteMsg; + use abstract_std::account::ExecuteMsg; use abstract_testing::prelude::*; use cosmwasm_std::{testing::*, *}; use speculoos::prelude::*; @@ -217,9 +217,9 @@ mod test { let actual_res = executor.execute(messages.clone()); assert_that!(actual_res).is_ok(); - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); let expected = ExecutorMsg(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: base.proxy.to_string(), + contract_addr: account.addr().to_string(), msg: to_json_binary(&ExecuteMsg::ModuleAction { msgs: flatten_actions(messages), }) @@ -241,9 +241,9 @@ mod test { let actual_res = executor.execute(messages.clone()); assert_that!(actual_res).is_ok(); - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); let expected = ExecutorMsg(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: base.proxy.to_string(), + contract_addr: account.addr().to_string(), msg: to_json_binary(&ExecuteMsg::ModuleAction { msgs: flatten_actions(messages), }) @@ -276,11 +276,11 @@ mod test { ); assert_that!(actual_res).is_ok(); - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); let expected = SubMsg { id: expected_reply_id, msg: CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: base.proxy.to_string(), + contract_addr: account.addr().to_string(), msg: to_json_binary(&ExecuteMsg::ModuleAction { msgs: flatten_actions(empty_actions), }) @@ -313,11 +313,11 @@ mod test { ); assert_that!(actual_res).is_ok(); - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); let expected = SubMsg { id: expected_reply_id, msg: CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: base.proxy.to_string(), + contract_addr: account.addr().to_string(), msg: to_json_binary(&ExecuteMsg::ModuleAction { msgs: flatten_actions(action), }) @@ -348,9 +348,9 @@ mod test { let actual_res = executor.execute_with_response(empty_actions.clone(), expected_action); - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); let expected_msg = CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: base.proxy.to_string(), + contract_addr: account.addr().to_string(), msg: to_json_binary(&ExecuteMsg::ModuleAction { msgs: flatten_actions(empty_actions), }) @@ -381,9 +381,9 @@ mod test { let actual_res = executor.execute_with_response(action.clone(), expected_action); - let base = test_account_base(deps.api); + let account = test_account_base(deps.api); let expected_msg = CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: base.proxy.to_string(), + contract_addr: account.addr().to_string(), msg: to_json_binary(&ExecuteMsg::ModuleAction { msgs: flatten_actions(action), }) diff --git a/framework/packages/abstract-sdk/src/apis/feegrant.rs b/framework/packages/abstract-sdk/src/apis/feegrant.rs index 0685d7d470..a739f5cfa9 100644 --- a/framework/packages/abstract-sdk/src/apis/feegrant.rs +++ b/framework/packages/abstract-sdk/src/apis/feegrant.rs @@ -27,8 +27,8 @@ pub trait GrantInterface: AccountExecutor { /// use abstract_sdk::prelude::*; /// # use cosmwasm_std::testing::mock_dependencies; /// # use abstract_sdk::mock_module::MockModule; - /// # let module = MockModule::new(); /// # let deps = mock_dependencies(); + /// # let module = MockModule::new(deps.api); /// let grant: FeeGranter = module.fee_granter(deps.as_ref(), None)?; /// ``` @@ -51,7 +51,8 @@ impl GrantInterface for T where T: AccountExecutor {} /// use abstract_sdk::prelude::*; /// # use cosmwasm_std::testing::mock_dependencies; /// # use abstract_sdk::mock_module::MockModule; -/// # let module = MockModule::new(); +/// # let deps = mock_dependencies(); +/// # let module = MockModule::new(deps.api); /// /// let grant: FeeGranter = module.fee_granter(deps.as_ref(), None)?; /// ``` diff --git a/framework/packages/abstract-sdk/src/apis/ibc.rs b/framework/packages/abstract-sdk/src/apis/ibc.rs index 415f42d0e4..67bacd9b28 100644 --- a/framework/packages/abstract-sdk/src/apis/ibc.rs +++ b/framework/packages/abstract-sdk/src/apis/ibc.rs @@ -3,13 +3,13 @@ //! use abstract_std::{ + account::ExecuteMsg, + account::ModuleInstallConfig, base, ibc::{Callback, ModuleQuery}, ibc_client::{self, ExecuteMsg as IbcClientMsg, InstalledModuleIdentification}, ibc_host::HostAction, - manager::ModuleInstallConfig, objects::{module::ModuleInfo, TruncatedChainId}, - proxy::ExecuteMsg, ABSTRACT_VERSION, IBC_CLIENT, }; use cosmwasm_std::{to_json_binary, wasm_execute, Addr, Coin, CosmosMsg, Deps, QueryRequest}; @@ -33,8 +33,8 @@ pub trait IbcInterface: use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let ibc_client: IbcClient = module.ibc_client(deps.as_ref()); ``` @@ -73,8 +73,8 @@ impl<'a, T: IbcInterface> ApiIdentification for IbcClient<'a, T> { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let ibc_client: IbcClient = module.ibc_client(deps.as_ref()); ``` diff --git a/framework/packages/abstract-sdk/src/apis/modules.rs b/framework/packages/abstract-sdk/src/apis/modules.rs index 4348066bc6..bec2b28fbb 100644 --- a/framework/packages/abstract-sdk/src/apis/modules.rs +++ b/framework/packages/abstract-sdk/src/apis/modules.rs @@ -1,7 +1,7 @@ //! # Module //! The Module interface provides helper functions to execute functions on other modules installed on the Account. -use abstract_std::{manager::state::ACCOUNT_MODULES, objects::module::ModuleId}; +use abstract_std::{account::state::ACCOUNT_MODULES, objects::module::ModuleId}; use cosmwasm_std::{Addr, Deps, QueryRequest, WasmQuery}; use cw2::{ContractVersion, CONTRACT}; @@ -21,8 +21,8 @@ pub trait ModuleInterface: AccountIdentification + Dependencies + ModuleIdentifi use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let modules: Modules = module.modules(deps.as_ref()); ``` @@ -57,8 +57,8 @@ impl<'a, T: ModuleInterface> ApiIdentification for Modules<'a, T> { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let modules: Modules = module.modules(deps.as_ref()); ``` diff --git a/framework/packages/abstract-sdk/src/apis/verify.rs b/framework/packages/abstract-sdk/src/apis/verify.rs index 0245d832f9..4a2ba16e3b 100644 --- a/framework/packages/abstract-sdk/src/apis/verify.rs +++ b/framework/packages/abstract-sdk/src/apis/verify.rs @@ -23,8 +23,8 @@ pub trait AccountVerification: AbstractRegistryAccess + ModuleIdentification { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let acc_registry: AccountRegistry = module.account_registry(deps.as_ref()).unwrap(); ``` @@ -64,8 +64,8 @@ impl<'a, T: AccountVerification> ApiIdentification for AccountRegistry<'a, T> { use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let acc_registry: AccountRegistry = module.account_registry(deps.as_ref()).unwrap(); ``` @@ -78,17 +78,10 @@ pub struct AccountRegistry<'a, T: AccountVerification> { } impl<'a, T: AccountVerification> AccountRegistry<'a, T> { - /// Verify if the provided manager address is indeed a user. - pub fn assert_manager(&self, maybe_manager: &Addr) -> AbstractSdkResult { + /// Verify if the provided address is indeed an Abstract Account. + pub fn assert_account(&self, maybe_account: &Addr) -> AbstractSdkResult { self.vc - .assert_account(maybe_manager, &self.deps.querier) - .map_err(|error| self.wrap_query_error(error)) - } - - /// Verify if the provided proxy address is indeed a user. - pub fn assert_proxy(&self, maybe_proxy: &Addr) -> AbstractSdkResult { - self.vc - .assert_account(maybe_proxy, &self.deps.querier) + .assert_account(maybe_account, &self.deps.querier) .map_err(|error| self.wrap_query_error(error)) } @@ -99,10 +92,10 @@ impl<'a, T: AccountVerification> AccountRegistry<'a, T> { .map_err(|error| self.wrap_query_error(error)) } - /// Get AccountId for given manager or proxy address. - pub fn account_id(&self, maybe_core_contract_addr: &Addr) -> AbstractSdkResult { + /// Get AccountId for given address. + pub fn account_id(&self, maybe_account_contract_addr: &Addr) -> AbstractSdkResult { self.vc - .account_id(maybe_core_contract_addr, &self.deps.querier) + .account_id(maybe_account_contract_addr, &self.deps.querier) .map_err(|error| self.wrap_query_error(error)) } @@ -121,8 +114,8 @@ mod test { use crate::AbstractSdkError; use abstract_std::{ + account::state::ACCOUNT_ID, objects::{account::AccountTrace, module::ModuleId, version_control::VersionControlError}, - proxy::state::ACCOUNT_ID, version_control::state::ACCOUNT_ADDRESSES, }; use abstract_testing::prelude::*; @@ -148,26 +141,23 @@ mod test { pub const SECOND_TEST_ACCOUNT_ID: AccountId = AccountId::const_new(2, AccountTrace::Local); - mod assert_proxy { + mod assert_account { use super::*; #[test] - fn not_proxy_fails() { + fn not_account_fails() { let mut deps = mock_dependencies(); - let not_base = Account { - manager: deps.api.addr_make("not_manager"), - proxy: deps.api.addr_make("not_proxy"), - }; + let not_account = Account::new(deps.api.addr_make("not_account")); let base = test_account_base(deps.api); deps.querier = AbstractMockQuerierBuilder::new(deps.api) // Setup the addresses as if the Account was registered - .account(¬_base, TEST_ACCOUNT_ID) + .account(¬_account, TEST_ACCOUNT_ID) // update the proxy to be proxy of a different Account .account(&base, SECOND_TEST_ACCOUNT_ID) .builder() - .with_contract_item(¬_base.proxy, ACCOUNT_ID, &SECOND_TEST_ACCOUNT_ID) + .with_contract_item(not_account.addr(), ACCOUNT_ID, &SECOND_TEST_ACCOUNT_ID) .build(); let binding = MockBinding { mock_api: deps.api }; @@ -175,143 +165,17 @@ mod test { let res = binding .account_registry(deps.as_ref()) .unwrap() - .assert_proxy(¬_base.proxy); + .assert_account(not_account.addr()); let expected_err = AbstractSdkError::ApiQuery { api: AccountRegistry::::api_id(), module_id: binding.module_id().to_owned(), error: Box::new( - VersionControlError::NotProxy(not_base.proxy, SECOND_TEST_ACCOUNT_ID).into(), - ), - }; - assert_eq!(res.unwrap_err(), expected_err); - } - - #[test] - fn inactive_account_fails() { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - - deps.querier = MockQuerierBuilder::default() - .with_contract_item(&abstr.account.proxy, ACCOUNT_ID, &TEST_ACCOUNT_ID) - .with_contract_map_key(&abstr.version_control, ACCOUNT_ADDRESSES, &TEST_ACCOUNT_ID) - .build(); - - let binding = MockBinding { mock_api: deps.api }; - - let res = binding - .account_registry(deps.as_ref()) - .unwrap() - .assert_proxy(&abstr.account.proxy); - - assert_that!(res) - .is_err() - .matches(|e| matches!(e, AbstractSdkError::ApiQuery { .. })) - .matches(|e| { - e.to_string().contains( - &VersionControlError::UnknownAccountId { - account_id: TEST_ACCOUNT_ID, - registry_addr: abstr.version_control.clone(), - } - .to_string(), + VersionControlError::NotAccount( + not_account.addr().clone(), + SECOND_TEST_ACCOUNT_ID, ) - }); - } - - #[test] - fn returns_core() { - let mut deps = mock_dependencies(); - let base = test_account_base(deps.api); - let abstr = AbstractMockAddrs::new(deps.api); - - deps.querier = MockQuerierBuilder::default() - .with_contract_item(&base.proxy, ACCOUNT_ID, &TEST_ACCOUNT_ID) - .with_contract_map_entry( - &abstr.version_control, - ACCOUNT_ADDRESSES, - (&TEST_ACCOUNT_ID, base.clone()), - ) - .build(); - - let binding = MockBinding { mock_api: deps.api }; - - let res = binding - .account_registry(deps.as_ref()) - .unwrap() - .assert_proxy(&base.proxy); - - assert_that!(res).is_ok().is_equal_to(base); - } - - #[test] - fn errors_when_not_manager_of_returned_os() { - let mut deps = mock_dependencies(); - let base = test_account_base(deps.api); - let abstr = AbstractMockAddrs::new(deps.api); - - deps.querier = MockQuerierBuilder::default() - .with_contract_item(&base.proxy, ACCOUNT_ID, &TEST_ACCOUNT_ID) - .with_contract_map_entry( - &abstr.version_control, - ACCOUNT_ADDRESSES, - ( - &TEST_ACCOUNT_ID, - Account { - manager: base.manager, - proxy: deps.api.addr_make("not_proxy"), - }, - ), - ) - .build(); - - let binding = MockBinding { mock_api: deps.api }; - - let res = binding - .account_registry(deps.as_ref()) - .unwrap() - .assert_proxy(&base.proxy); - - assert_that!(res) - .is_err() - // .matches(|e| matches!(e, AbstractSdkError::Std(StdError::GenericErr { .. }))) - .matches(|e| e.to_string().contains("not the Proxy")); - } - } - - mod assert_manager { - use super::*; - - #[test] - fn not_manager_fails() { - let mut deps = mock_dependencies(); - let not_base = Account { - manager: deps.api.addr_make("not_manager"), - proxy: deps.api.addr_make("not_proxy"), - }; - let base = test_account_base(deps.api); - - deps.querier = AbstractMockQuerierBuilder::new(deps.api) - // Setup the addresses as if the Account was registered - .account(¬_base, TEST_ACCOUNT_ID) - // update the proxy to be proxy of a different Account - .account(&base, SECOND_TEST_ACCOUNT_ID) - .builder() - .with_contract_item(¬_base.manager, ACCOUNT_ID, &SECOND_TEST_ACCOUNT_ID) - .build(); - - let binding = MockBinding { mock_api: deps.api }; - - let res = binding - .account_registry(deps.as_ref()) - .unwrap() - .assert_manager(¬_base.manager); - - let expected_err = AbstractSdkError::ApiQuery { - api: AccountRegistry::::api_id(), - module_id: binding.module_id().to_owned(), - error: Box::new( - VersionControlError::NotManager(not_base.manager, SECOND_TEST_ACCOUNT_ID) - .into(), + .into(), ), }; assert_eq!(res.unwrap_err(), expected_err); @@ -320,11 +184,10 @@ mod test { #[test] fn inactive_account_fails() { let mut deps = mock_dependencies(); - let base = test_account_base(deps.api); let abstr = AbstractMockAddrs::new(deps.api); deps.querier = MockQuerierBuilder::default() - .with_contract_item(&base.manager, ACCOUNT_ID, &TEST_ACCOUNT_ID) + .with_contract_item(abstr.account.addr(), ACCOUNT_ID, &TEST_ACCOUNT_ID) .with_contract_map_key(&abstr.version_control, ACCOUNT_ADDRESSES, &TEST_ACCOUNT_ID) .build(); @@ -333,7 +196,7 @@ mod test { let res = binding .account_registry(deps.as_ref()) .unwrap() - .assert_manager(&base.manager); + .assert_account(abstr.account.addr()); assert_that!(res) .is_err() @@ -350,16 +213,17 @@ mod test { } #[test] - fn returns_core() { + fn returns_account() { let mut deps = mock_dependencies(); + let account = test_account_base(deps.api); let abstr = AbstractMockAddrs::new(deps.api); deps.querier = MockQuerierBuilder::default() - .with_contract_item(&abstr.account.manager, ACCOUNT_ID, &TEST_ACCOUNT_ID) + .with_contract_item(account.addr(), ACCOUNT_ID, &TEST_ACCOUNT_ID) .with_contract_map_entry( &abstr.version_control, ACCOUNT_ADDRESSES, - (&TEST_ACCOUNT_ID, abstr.account.clone()), + (&TEST_ACCOUNT_ID, account.clone()), ) .build(); @@ -368,50 +232,9 @@ mod test { let res = binding .account_registry(deps.as_ref()) .unwrap() - .assert_manager(&abstr.account.manager); - - assert_that!(res).is_ok().is_equal_to(abstr.account); - } + .assert_account(account.addr()); - #[test] - fn errors_when_not_manager_of_returned_os() { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - - deps.querier = MockQuerierBuilder::default() - .with_contract_item(&abstr.account.manager, ACCOUNT_ID, &TEST_ACCOUNT_ID) - .with_contract_map_entry( - &abstr.version_control, - ACCOUNT_ADDRESSES, - ( - &TEST_ACCOUNT_ID, - Account { - manager: deps.api.addr_make("not_manager"), - proxy: abstr.account.proxy, - }, - ), - ) - .build(); - - let binding = MockBinding { mock_api: deps.api }; - - let res = binding - .account_registry(deps.as_ref()) - .unwrap() - .assert_manager(&abstr.account.manager); - - assert_that!(res) - .is_err() - .matches(|e| matches!(e, AbstractSdkError::ApiQuery { .. })) - .matches(|e| { - e.to_string().contains( - &VersionControlError::NotManager( - abstr.account.manager.clone(), - TEST_ACCOUNT_ID, - ) - .to_string(), - ) - }); + assert_that!(res).is_ok().is_equal_to(account); } } } diff --git a/framework/packages/abstract-sdk/src/apis/version_registry.rs b/framework/packages/abstract-sdk/src/apis/version_registry.rs index d775a53cea..387eb31e4d 100644 --- a/framework/packages/abstract-sdk/src/apis/version_registry.rs +++ b/framework/packages/abstract-sdk/src/apis/version_registry.rs @@ -28,8 +28,8 @@ pub trait ModuleRegistryInterface: AbstractRegistryAccess + ModuleIdentification use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let mod_registry: ModuleRegistry = module.module_registry(deps.as_ref()).unwrap(); ``` @@ -70,8 +70,8 @@ impl<'a, T: ModuleRegistryInterface> ApiIdentification for ModuleRegistry<'a, T> use abstract_sdk::prelude::*; # use cosmwasm_std::testing::mock_dependencies; # use abstract_sdk::mock_module::MockModule; - # let module = MockModule::new(); # let deps = mock_dependencies(); + # let module = MockModule::new(deps.api); let mod_registry: ModuleRegistry = module.module_registry(deps.as_ref()).unwrap(); ``` diff --git a/framework/packages/abstract-sdk/src/base/features/executor.rs b/framework/packages/abstract-sdk/src/base/features/executor.rs index 8f55b1161a..f3a7cf9f66 100644 --- a/framework/packages/abstract-sdk/src/base/features/executor.rs +++ b/framework/packages/abstract-sdk/src/base/features/executor.rs @@ -1,4 +1,4 @@ -use abstract_std::proxy; +use abstract_std::account; use cosmwasm_std::{wasm_execute, Coin, CosmosMsg, Deps}; use crate::AbstractSdkResult; @@ -11,7 +11,7 @@ pub trait AccountExecutor: AccountIdentification { fn execute_on_account( &self, deps: Deps, - msg: &proxy::ExecuteMsg, + msg: &account::ExecuteMsg, funds: Vec, ) -> AbstractSdkResult { let account_address = self.account(deps)?; @@ -20,3 +20,5 @@ pub trait AccountExecutor: AccountIdentification { .map_err(Into::into) } } + +impl AccountExecutor for T where T: AccountIdentification {} diff --git a/framework/packages/abstract-sdk/src/base/features/identification.rs b/framework/packages/abstract-sdk/src/base/features/identification.rs index 3bc61ce1ae..085160b5bc 100644 --- a/framework/packages/abstract-sdk/src/base/features/identification.rs +++ b/framework/packages/abstract-sdk/src/base/features/identification.rs @@ -1,19 +1,14 @@ -use abstract_std::{ - objects::common_namespace::ADMIN_NAMESPACE, proxy::state::ACCOUNT_ID, version_control::Account, -}; -use cosmwasm_std::{Addr, Deps}; -use cw_storage_plus::Item; +use abstract_std::{account::state::ACCOUNT_ID, version_control::Account}; +use cosmwasm_std::Deps; use crate::std::objects::AccountId; // see std::proxy::state::ADMIN -use crate::{AbstractSdkError, AbstractSdkResult}; - -const MANAGER: Item> = Item::new(ADMIN_NAMESPACE); +use crate::AbstractSdkResult; /// Retrieve identifying information about an Account. /// This includes the manager, proxy, core and account_id. pub trait AccountIdentification: Sized { - /// Get the proxy address for the current account. + /// Get the account address fn account(&self, deps: Deps) -> AbstractSdkResult; /// Get the Account id for the current account. @@ -38,9 +33,9 @@ mod test { } impl AccountIdentification for MockBinding { - fn proxy_address(&self, _deps: Deps) -> AbstractSdkResult { + fn account(&self, _deps: Deps) -> AbstractSdkResult { let account_base = test_account_base(self.mock_api); - Ok(account_base.proxy) + Ok(account_base) } } @@ -50,52 +45,14 @@ mod test { use super::*; #[test] - fn test_proxy_address() { + fn test_account_address() { let deps = mock_dependencies(); let binding = MockBinding { mock_api: deps.api }; let account_base = test_account_base(deps.api); - let res = binding.proxy_address(deps.as_ref()); - assert_that!(res).is_ok().is_equal_to(account_base.proxy); - } - - #[test] - fn test_manager_address() { - let mut deps = mock_dependencies(); - let binding = MockBinding { mock_api: deps.api }; - let account_base = test_account_base(deps.api); - - deps.querier = MockQuerierBuilder::default() - .with_contract_item( - &account_base.proxy, - MANAGER, - &Some(account_base.manager.clone()), - ) - .build(); - - assert_that!(binding.manager_address(deps.as_ref())) - .is_ok() - .is_equal_to(account_base.manager); - } - - #[test] - fn test_account() { - let mut deps = mock_dependencies(); - let expected_account_base = test_account_base(deps.api); - - deps.querier = MockQuerierBuilder::default() - .with_contract_item( - &expected_account_base.proxy, - MANAGER, - &Some(expected_account_base.manager.clone()), - ) - .build(); - - let binding = MockBinding { mock_api: deps.api }; - assert_that!(binding.account_base(deps.as_ref())) - .is_ok() - .is_equal_to(expected_account_base); + let res = binding.account(deps.as_ref()); + assert_that!(res).is_ok().is_equal_to(account_base); } #[test] @@ -104,7 +61,7 @@ mod test { let account_base = test_account_base(deps.api); deps.querier = MockQuerierBuilder::default() - .with_contract_item(&account_base.proxy, ACCOUNT_ID, &TEST_ACCOUNT_ID) + .with_contract_item(account_base.addr(), ACCOUNT_ID, &TEST_ACCOUNT_ID) .build(); let binding = MockBinding { mock_api: deps.api }; diff --git a/framework/packages/abstract-sdk/src/feature_objects.rs b/framework/packages/abstract-sdk/src/feature_objects.rs index 6a864a833e..ad8a971f98 100644 --- a/framework/packages/abstract-sdk/src/feature_objects.rs +++ b/framework/packages/abstract-sdk/src/feature_objects.rs @@ -6,7 +6,7 @@ pub use abstract_std::objects::{ans_host::AnsHost, version_control::VersionControlContract}; use abstract_std::{version_control::Account, VERSION_CONTROL}; -use cosmwasm_std::{Addr, Deps}; +use cosmwasm_std::Deps; use crate::{ features::{AccountIdentification, ModuleIdentification}, @@ -53,7 +53,7 @@ mod tests { use super::*; mod version_control { - use cosmwasm_std::testing::mock_dependencies; + use cosmwasm_std::{testing::mock_dependencies, Addr}; use super::*; use crate::features::AbstractRegistryAccess; @@ -72,7 +72,7 @@ mod tests { } mod account { - use cosmwasm_std::testing::mock_dependencies; + use cosmwasm_std::{testing::mock_dependencies, Addr}; use super::*; diff --git a/framework/packages/abstract-sdk/src/mock_module.rs b/framework/packages/abstract-sdk/src/mock_module.rs index 9eaf4c25f9..e9e90f1438 100644 --- a/framework/packages/abstract-sdk/src/mock_module.rs +++ b/framework/packages/abstract-sdk/src/mock_module.rs @@ -7,12 +7,12 @@ use abstract_std::{ version_control::Account, }; use abstract_testing::prelude::*; -use cosmwasm_std::{testing::MockApi, Addr, Deps}; +use cosmwasm_std::{testing::MockApi, Deps}; use crate::{ features::{ - AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, - Dependencies, ModuleIdentification, + AbstractNameService, AbstractRegistryAccess, AccountIdentification, Dependencies, + ModuleIdentification, }, std::objects::module::ModuleId, AbstractSdkResult, @@ -26,8 +26,6 @@ impl AccountIdentification for MockModule { } } -impl AccountExecutor for MockModule {} - impl ModuleIdentification for MockModule { fn module_id(&self) -> &'static str { "mock_module" diff --git a/framework/packages/abstract-std/src/account/mod.rs b/framework/packages/abstract-std/src/account/mod.rs new file mode 100644 index 0000000000..f85d1f7b8f --- /dev/null +++ b/framework/packages/abstract-std/src/account/mod.rs @@ -0,0 +1,7 @@ +pub mod msgs; +pub mod responses; +pub mod state; +pub mod types; + +pub use types::ModuleInstallConfig; +pub use msgs::{ExecuteMsg, ExecuteMsgFns, InstantiateMsg, MigrateMsg, QueryMsg, QueryMsgFns}; diff --git a/framework/packages/abstract-std/src/core/account.rs b/framework/packages/abstract-std/src/account/msgs.rs similarity index 88% rename from framework/packages/abstract-std/src/core/account.rs rename to framework/packages/abstract-std/src/account/msgs.rs index e3620f0050..2d373de1d2 100644 --- a/framework/packages/abstract-std/src/core/account.rs +++ b/framework/packages/abstract-std/src/account/msgs.rs @@ -1,10 +1,10 @@ -use cosmwasm_schema::QueryResponses; -use cosmwasm_std::{Addr, Binary, CosmosMsg, Empty}; -pub use manager::{ - InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, ModuleInstallConfig, - ModuleVersionsResponse, SubAccountIdsResponse, UpdateSubAccountAction, +pub use super::responses::{ + ConfigResponse, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, + ModuleVersionsResponse, SubAccountIdsResponse, }; -use state::SuspensionStatus; +use super::types::{ModuleInstallConfig, UpdateSubAccountAction}; +use cosmwasm_schema::QueryResponses; +use cosmwasm_std::{Binary, CosmosMsg, Empty}; use crate::objects::{ gov_type::{GovAction, GovernanceDetails, TopLevelOwnerResponse}, @@ -13,16 +13,6 @@ use crate::objects::{ AccountId, }; -use super::*; - -// TODO: Move manager and proxy state here -pub mod state { - use super::*; - - pub use manager::state::{SuspensionStatus, ACCOUNT_ID, ACCOUNT_MODULES}; - pub use proxy::state::{State, ADMIN, STATE}; -} - #[cosmwasm_schema::cw_serde] pub struct MigrateMsg {} @@ -161,12 +151,3 @@ pub enum QueryMsg { #[returns(Ownership)] Ownership {}, } - -#[cosmwasm_schema::cw_serde] -pub struct ConfigResponse { - pub modules: Vec, - pub account_id: AccountId, - pub is_suspended: SuspensionStatus, - pub version_control_address: Addr, - pub module_factory_address: Addr, -} diff --git a/framework/packages/abstract-std/src/account/responses.rs b/framework/packages/abstract-std/src/account/responses.rs new file mode 100644 index 0000000000..37164b3a32 --- /dev/null +++ b/framework/packages/abstract-std/src/account/responses.rs @@ -0,0 +1,67 @@ +//! # Account Manager +//! +//! `abstract_std::manager` implements the contract interface and state lay-out. +//! +//! ## Description +//! +//! The Account manager is part of the Core Abstract Account contracts along with the `abstract_std::proxy` contract. +//! This contract is responsible for: +//! - Managing modules instantiation and migrations. +//! - Managing permissions. +//! - Upgrading the Account and its modules. +//! - Providing module name to address resolution. +//! +//! **The manager should be set as the contract/CosmWasm admin by default on your modules.** +//! ## Migration +//! Migrating this contract is done by calling `ExecuteMsg::Upgrade` with `abstract::manager` as module. + +use cosmwasm_std::Addr; +use cw2::ContractVersion; + +use super::state::AccountInfo; +use crate::{account::state::SuspensionStatus, objects::account::AccountId}; + +/// Callback message to set the dependencies after module upgrades. +#[cosmwasm_schema::cw_serde] +pub struct CallbackMsg {} + +#[cosmwasm_schema::cw_serde] +pub struct ModuleVersionsResponse { + pub versions: Vec, +} + +#[cosmwasm_schema::cw_serde] +pub struct ModuleAddressesResponse { + pub modules: Vec<(String, Addr)>, +} + +#[cosmwasm_schema::cw_serde] +pub struct InfoResponse { + pub info: AccountInfo, +} + +#[cosmwasm_schema::cw_serde] +pub struct ManagerModuleInfo { + pub id: String, + pub version: ContractVersion, + pub address: Addr, +} + +#[cosmwasm_schema::cw_serde] +pub struct ModuleInfosResponse { + pub module_infos: Vec, +} + +#[cosmwasm_schema::cw_serde] +pub struct SubAccountIdsResponse { + pub sub_accounts: Vec, +} + +#[cosmwasm_schema::cw_serde] +pub struct ConfigResponse { + pub modules: Vec, + pub account_id: AccountId, + pub is_suspended: SuspensionStatus, + pub version_control_address: Addr, + pub module_factory_address: Addr, +} diff --git a/framework/packages/abstract-std/src/account/state.rs b/framework/packages/abstract-std/src/account/state.rs new file mode 100644 index 0000000000..c43de71f5a --- /dev/null +++ b/framework/packages/abstract-std/src/account/state.rs @@ -0,0 +1,57 @@ +use std::collections::HashSet; + +use cosmwasm_std::Addr; +use cw_controllers::Admin; +use cw_storage_plus::{Item, Map}; + +pub use crate::objects::account::ACCOUNT_ID; +use crate::objects::{common_namespace::ADMIN_NAMESPACE, module::ModuleId}; + +pub type SuspensionStatus = bool; + +/// Manager configuration +#[cosmwasm_schema::cw_serde] +pub struct Config { + pub version_control_address: Addr, + pub module_factory_address: Addr, +} + +/// Abstract Account details. +#[cosmwasm_schema::cw_serde] +pub struct AccountInfo { + pub name: String, + pub description: Option, + pub link: Option, +} + +pub mod namespace { + pub const SUSPENSION_STATUS: &str = "a"; + pub const CONFIG: &str = "b"; + pub const INFO: &str = "c"; + pub const ACCOUNT_MODULES: &str = "d"; + pub const DEPENDENTS: &str = "e"; + pub const SUB_ACCOUNTS: &str = "f"; +} + +pub const STATE: Item = Item::new("a"); +pub const ADMIN: Admin = Admin::new(ADMIN_NAMESPACE); + +/// Suspension status +pub const SUSPENSION_STATUS: Item = Item::new(namespace::SUSPENSION_STATUS); +/// Configuration +pub const CONFIG: Item = Item::new(namespace::CONFIG); +/// Info about the Account +pub const INFO: Item = Item::new(namespace::INFO); +/// Enabled Abstract modules +pub const ACCOUNT_MODULES: Map = Map::new(namespace::ACCOUNT_MODULES); +/// Stores the dependency relationship between modules +/// map module -> modules that depend on module. +pub const DEPENDENTS: Map> = Map::new(namespace::DEPENDENTS); +/// List of sub-accounts +pub const SUB_ACCOUNTS: Map = Map::new(namespace::SUB_ACCOUNTS); +// Additional states, not listed here: cw_gov_ownable::GovOwnership + +#[cosmwasm_schema::cw_serde] +pub struct State { + pub modules: Vec, +} diff --git a/framework/packages/abstract-std/src/account/types.rs b/framework/packages/abstract-std/src/account/types.rs new file mode 100644 index 0000000000..809cf27c73 --- /dev/null +++ b/framework/packages/abstract-std/src/account/types.rs @@ -0,0 +1,43 @@ +use cosmwasm_std::Binary; + +use crate::objects::module::ModuleInfo; + +/// Module info and init message +#[non_exhaustive] +#[cosmwasm_schema::cw_serde] +pub struct ModuleInstallConfig { + pub module: ModuleInfo, + pub init_msg: Option, +} + +impl ModuleInstallConfig { + pub fn new(module: ModuleInfo, init_msg: Option) -> Self { + Self { module, init_msg } + } +} + +/// Internal configuration actions accessible from the [`ExecuteMsg::UpdateInternalConfig`] message. +#[cosmwasm_schema::cw_serde] +#[non_exhaustive] +pub enum InternalConfigAction { + /// Updates the [`state::ACCOUNT_MODULES`] map + /// Only callable by account factory or owner. + UpdateModuleAddresses { + to_add: Option>, + to_remove: Option>, + }, +} + +#[cosmwasm_schema::cw_serde] +#[non_exhaustive] +pub enum UpdateSubAccountAction { + /// Unregister sub-account + /// It will unregister sub-account from the state + /// Could be called only by the sub-account itself + UnregisterSubAccount { id: u32 }, + /// Register sub-account + /// It will register new sub-account into the state + /// Could be called by the sub-account manager + /// Note: since it happens after the claim by this manager state won't have spam accounts + RegisterSubAccount { id: u32 }, +} diff --git a/framework/packages/abstract-std/src/core/manager.rs b/framework/packages/abstract-std/src/core/manager.rs deleted file mode 100644 index a921b1c56f..0000000000 --- a/framework/packages/abstract-std/src/core/manager.rs +++ /dev/null @@ -1,286 +0,0 @@ -//! # Account Manager -//! -//! `abstract_std::manager` implements the contract interface and state lay-out. -//! -//! ## Description -//! -//! The Account manager is part of the Core Abstract Account contracts along with the `abstract_std::proxy` contract. -//! This contract is responsible for: -//! - Managing modules instantiation and migrations. -//! - Managing permissions. -//! - Upgrading the Account and its modules. -//! - Providing module name to address resolution. -//! -//! **The manager should be set as the contract/CosmWasm admin by default on your modules.** -//! ## Migration -//! Migrating this contract is done by calling `ExecuteMsg::Upgrade` with `abstract::manager` as module. -pub mod state { - use std::collections::HashSet; - - use cosmwasm_std::Addr; - use cw_storage_plus::{Item, Map}; - - pub use crate::objects::account::ACCOUNT_ID; - use crate::objects::module::ModuleId; - - pub type SuspensionStatus = bool; - - /// Manager configuration - #[cosmwasm_schema::cw_serde] - pub struct Config { - pub version_control_address: Addr, - pub module_factory_address: Addr, - } - - /// Abstract Account details. - #[cosmwasm_schema::cw_serde] - pub struct AccountInfo { - pub name: String, - pub description: Option, - pub link: Option, - } - - pub mod namespace { - pub const SUSPENSION_STATUS: &str = "a"; - pub const CONFIG: &str = "b"; - pub const INFO: &str = "c"; - pub const ACCOUNT_MODULES: &str = "d"; - pub const DEPENDENTS: &str = "e"; - pub const SUB_ACCOUNTS: &str = "f"; - } - - /// Suspension status - pub const SUSPENSION_STATUS: Item = Item::new(namespace::SUSPENSION_STATUS); - /// Configuration - pub const CONFIG: Item = Item::new(namespace::CONFIG); - /// Info about the Account - pub const INFO: Item = Item::new(namespace::INFO); - /// Enabled Abstract modules - pub const ACCOUNT_MODULES: Map = Map::new(namespace::ACCOUNT_MODULES); - /// Stores the dependency relationship between modules - /// map module -> modules that depend on module. - pub const DEPENDENTS: Map> = Map::new(namespace::DEPENDENTS); - /// List of sub-accounts - pub const SUB_ACCOUNTS: Map = Map::new(namespace::SUB_ACCOUNTS); - // Additional states, not listed here: cw_gov_ownable::GovOwnership -} - -use cosmwasm_schema::QueryResponses; -use cosmwasm_std::{Addr, Binary}; -use cw2::ContractVersion; - -use self::state::AccountInfo; -use crate::{ - manager::state::SuspensionStatus, - objects::{ - account::AccountId, - gov_type::{GovAction, GovernanceDetails, TopLevelOwnerResponse}, - module::ModuleInfo, - ownership::Ownership, - }, -}; - -/// Manager Migrate Msg -#[cosmwasm_schema::cw_serde] -pub struct MigrateMsg {} - -/// Manager Instantiate Msg -#[cosmwasm_schema::cw_serde] -pub struct InstantiateMsg { - pub account_id: AccountId, - pub owner: GovernanceDetails, - pub proxy_addr: String, - pub version_control_address: String, - pub module_factory_address: String, - pub name: String, - pub description: Option, - pub link: Option, - // Optionally modules can be provided. They will be installed after account registration. - pub install_modules: Vec, -} - -/// Callback message to set the dependencies after module upgrades. -#[cosmwasm_schema::cw_serde] -pub struct CallbackMsg {} - -/// Internal configuration actions accessible from the [`ExecuteMsg::UpdateInternalConfig`] message. -#[cosmwasm_schema::cw_serde] -#[non_exhaustive] -pub enum InternalConfigAction { - /// Updates the [`state::ACCOUNT_MODULES`] map - /// Only callable by account factory or owner. - UpdateModuleAddresses { - to_add: Option>, - to_remove: Option>, - }, -} - -#[cosmwasm_schema::cw_serde] -#[non_exhaustive] -pub enum UpdateSubAccountAction { - /// Unregister sub-account - /// It will unregister sub-account from the state - /// Could be called only by the sub-account itself - UnregisterSubAccount { id: u32 }, - /// Register sub-account - /// It will register new sub-account into the state - /// Could be called by the sub-account manager - /// Note: since it happens after the claim by this manager state won't have spam accounts - RegisterSubAccount { id: u32 }, -} - -/// Module info and init message -#[non_exhaustive] -#[cosmwasm_schema::cw_serde] -pub struct ModuleInstallConfig { - pub module: ModuleInfo, - pub init_msg: Option, -} - -impl ModuleInstallConfig { - pub fn new(module: ModuleInfo, init_msg: Option) -> Self { - Self { module, init_msg } - } -} - -/// Manager execute messages -#[cosmwasm_schema::cw_serde] -#[derive(cw_orch::ExecuteFns)] -pub enum ExecuteMsg { - /// Forward execution message to module - #[cw_orch(payable)] - ExecOnModule { module_id: String, exec_msg: Binary }, - /// Update Abstract-specific configuration of the module. - /// Only callable by the account factory or owner. - UpdateInternalConfig(Binary), - /// Install module using module factory, callable by Owner - #[cw_orch(payable)] - InstallModules { - // Module information and Instantiate message to instantiate the contract - modules: Vec, - }, - /// Uninstall a module given its ID. - UninstallModule { module_id: String }, - /// Upgrade the module to a new version - /// If module is `abstract::manager` then the contract will do a self-migration. - Upgrade { - modules: Vec<(ModuleInfo, Option)>, - }, - /// Creates a sub-account on the account - #[cw_orch(payable)] - CreateSubAccount { - // Name of the sub-account - name: String, - // Description of the account - description: Option, - // URL linked to the account - link: Option, - // optionally specify a namespace for the sub-account - namespace: Option, - // Provide list of module to install after sub-account creation - install_modules: Vec, - /// If `None`, will create a new local account without asserting account-id. - /// - /// When provided sequence in 0..2147483648 range: The tx will error - /// When provided sequence in 2147483648..u32::MAX range: Signals use of unclaimed Account Id in this range. The tx will error if this account-id already claimed. Useful for instantiate2 address prediction. - account_id: Option, - }, - /// Update info - UpdateInfo { - name: Option, - description: Option, - link: Option, - }, - /// Update account statuses - UpdateStatus { is_suspended: Option }, - /// Actions called by internal or external sub-accounts - UpdateSubAccount(UpdateSubAccountAction), - /// Callback endpoint - Callback(CallbackMsg), - /// Update the contract's ownership. The `action` - /// can propose transferring ownership to an account, - /// accept a pending ownership transfer, or renounce the ownership - /// of the account permanently. - UpdateOwnership(GovAction), -} - -/// Manager query messages -#[cosmwasm_schema::cw_serde] -#[derive(QueryResponses, cw_orch::QueryFns)] -pub enum QueryMsg { - /// Query the versions of modules installed on the account given their `ids`. - /// Returns [`ModuleVersionsResponse`] - #[returns(ModuleVersionsResponse)] - ModuleVersions { ids: Vec }, - /// Query the addresses of modules installed on the account given their `ids`. - /// Returns [`ModuleAddressesResponse`] - #[returns(ModuleAddressesResponse)] - ModuleAddresses { ids: Vec }, - /// Query information of all modules installed on the account. - /// Returns [`ModuleInfosResponse`] - #[returns(ModuleInfosResponse)] - ModuleInfos { - start_after: Option, - limit: Option, - }, - /// Query the manager's config. - /// Returns [`ConfigResponse`] - #[returns(ConfigResponse)] - Config {}, - /// Query the Account info. - /// Returns [`InfoResponse`] - #[returns(InfoResponse)] - Info {}, - /// Returns [`SubAccountIdsResponse`] - #[returns(SubAccountIdsResponse)] - SubAccountIds { - start_after: Option, - limit: Option, - }, - /// Returns [`TopLevelOwnerResponse`] - #[returns(TopLevelOwnerResponse)] - TopLevelOwner {}, - /// Query the contract's ownership information - #[returns(Ownership)] - Ownership {}, -} - -#[cosmwasm_schema::cw_serde] -pub struct ModuleVersionsResponse { - pub versions: Vec, -} - -#[cosmwasm_schema::cw_serde] -pub struct ModuleAddressesResponse { - pub modules: Vec<(String, Addr)>, -} - -#[cosmwasm_schema::cw_serde] -pub struct ConfigResponse { - pub account_id: AccountId, - pub is_suspended: SuspensionStatus, - pub version_control_address: Addr, - pub module_factory_address: Addr, -} - -#[cosmwasm_schema::cw_serde] -pub struct InfoResponse { - pub info: AccountInfo, -} - -#[cosmwasm_schema::cw_serde] -pub struct ManagerModuleInfo { - pub id: String, - pub version: ContractVersion, - pub address: Addr, -} - -#[cosmwasm_schema::cw_serde] -pub struct ModuleInfosResponse { - pub module_infos: Vec, -} - -#[cosmwasm_schema::cw_serde] -pub struct SubAccountIdsResponse { - pub sub_accounts: Vec, -} diff --git a/framework/packages/abstract-std/src/core/mod.rs b/framework/packages/abstract-std/src/core/mod.rs deleted file mode 100644 index b908be60d4..0000000000 --- a/framework/packages/abstract-std/src/core/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod account; -pub mod manager; -pub mod proxy; diff --git a/framework/packages/abstract-std/src/core/proxy.rs b/framework/packages/abstract-std/src/core/proxy.rs deleted file mode 100644 index fcb9a2aed3..0000000000 --- a/framework/packages/abstract-std/src/core/proxy.rs +++ /dev/null @@ -1,101 +0,0 @@ -//! # Account Proxy -//! -//! `abstract_std::proxy` hold all the assets associated with the Account instance. It accepts Cosmos messages from whitelisted addresses and executes them. -//! -//! ## Description -//! The proxy is part of the Core Account contracts along with the [`crate::manager`] contract. -//! This contract is responsible for executing Cosmos messages and calculating the value of its internal assets. -//! -//! ## Price Sources -//! [price sources](crate::objects::price_source) are what allow the proxy contract to provide value queries for its assets. It needs to be configured using the [`ExecuteMsg::UpdateAssets`] endpoint. -//! After configuring the price sources [`QueryMsg::TotalValue`] can be called to get the total holding value. - -use cosmwasm_schema::QueryResponses; -use cosmwasm_std::{Binary, CosmosMsg, Empty, Uint128}; -use cw_asset::{Asset, AssetInfo}; - -#[allow(unused_imports)] -use crate::{ibc_client::ExecuteMsg as IbcClientMsg, objects::account::AccountId}; - -pub mod state { - use cosmwasm_std::Addr; - use cw_controllers::Admin; - use cw_storage_plus::Item; - - pub use crate::objects::account::ACCOUNT_ID; - use crate::objects::common_namespace::ADMIN_NAMESPACE; - #[cosmwasm_schema::cw_serde] - pub struct State { - pub modules: Vec, - } - pub const STATE: Item = Item::new("a"); - pub const ADMIN: Admin = Admin::new(ADMIN_NAMESPACE); -} - -#[cosmwasm_schema::cw_serde] -pub struct InstantiateMsg { - pub account_id: AccountId, - pub ans_host_address: String, - pub manager_addr: String, -} - -#[cosmwasm_schema::cw_serde] -#[derive(cw_orch::ExecuteFns)] -pub enum ExecuteMsg { - /// Sets the admin - SetAdmin { admin: String }, - /// Executes the provided messages if sender is whitelisted - ModuleAction { msgs: Vec> }, - /// Execute a message and forward the Response data - ModuleActionWithData { msg: CosmosMsg }, - /// Execute IBC action on Client - IbcAction { msg: IbcClientMsg }, - /// Queries the Abstract Ica Client with the provided action query. - /// Provides access to different ICA implementations for different ecosystems. - IcaAction { - /// Query of type `abstract-ica-client::msg::QueryMsg` - action_query_msg: Binary, - }, - /// Adds the provided address to whitelisted dapps - AddModules { modules: Vec }, - /// Removes the provided address from the whitelisted dapps - RemoveModule { module: String }, -} -#[cosmwasm_schema::cw_serde] -pub struct MigrateMsg {} - -#[cosmwasm_schema::cw_serde] -#[derive(QueryResponses, cw_orch::QueryFns)] -pub enum QueryMsg { - /// Contains the enabled modules - /// Returns [`ConfigResponse`] - #[returns(ConfigResponse)] - Config {}, -} - -#[cosmwasm_schema::cw_serde] -pub struct ConfigResponse { - pub modules: Vec, -} - -#[cosmwasm_schema::cw_serde] -pub struct TokenValueResponse { - pub value: Uint128, -} - -#[cosmwasm_schema::cw_serde] -pub struct BaseAssetResponse { - pub base_asset: AssetInfo, -} - -/// Query message to external contract to get asset value -#[cosmwasm_schema::cw_serde] -pub struct ValueQueryMsg { - pub asset: AssetInfo, - pub amount: Uint128, -} -/// External contract value response -#[cosmwasm_schema::cw_serde] -pub struct ExternalValueResponse { - pub value: Asset, -} diff --git a/framework/packages/abstract-std/src/lib.rs b/framework/packages/abstract-std/src/lib.rs index 5c010dce3a..1242c09b10 100644 --- a/framework/packages/abstract-std/src/lib.rs +++ b/framework/packages/abstract-std/src/lib.rs @@ -54,8 +54,7 @@ pub mod standalone; mod error; pub use error::AbstractError; -mod core; -pub use crate::core::*; +pub mod account; mod native; pub use crate::native::*; diff --git a/framework/packages/abstract-std/src/native/account_factory.rs b/framework/packages/abstract-std/src/native/account_factory.rs index 239012de9b..8726ee4cfd 100644 --- a/framework/packages/abstract-std/src/native/account_factory.rs +++ b/framework/packages/abstract-std/src/native/account_factory.rs @@ -46,7 +46,7 @@ use cosmwasm_schema::QueryResponses; use cosmwasm_std::Addr; use crate::{ - manager::ModuleInstallConfig, + account::ModuleInstallConfig, objects::{ account::{AccountId, AccountSequence, AccountTrace}, gov_type::GovernanceDetails, diff --git a/framework/packages/abstract-std/src/native/ibc_client.rs b/framework/packages/abstract-std/src/native/ibc_client.rs index d2329e071a..96abde3fb0 100644 --- a/framework/packages/abstract-std/src/native/ibc_client.rs +++ b/framework/packages/abstract-std/src/native/ibc_client.rs @@ -4,9 +4,9 @@ use polytone::callbacks::CallbackMessage; use self::state::IbcInfrastructure; use crate::{ + account::{self, ModuleInstallConfig}, ibc::{Callback, ModuleQuery}, ibc_host::HostAction, - manager::{self, ModuleInstallConfig}, objects::{ account::AccountId, module::ModuleInfo, module_reference::ModuleReference, version_control::VersionControlContract, TruncatedChainId, @@ -220,12 +220,13 @@ impl InstalledModuleIdentification { let target_account_id = self.account_id.clone().ok_or(no_account_id_error)?; let account_base = vc.account(&target_account_id, &deps.querier)?; - let module_info: manager::ModuleAddressesResponse = deps.querier.query_wasm_smart( - account_base.into_addr(), - &manager::QueryMsg::ModuleAddresses { - ids: vec![self.module_info.id()], - }, - )?; + let module_info: account::responses::ModuleAddressesResponse = + deps.querier.query_wasm_smart( + account_base.into_addr(), + &account::QueryMsg::ModuleAddresses { + ids: vec![self.module_info.id()], + }, + )?; module_info .modules .first() diff --git a/framework/packages/abstract-std/src/native/ibc_host.rs b/framework/packages/abstract-std/src/native/ibc_host.rs index 929216dba4..d04ac5ce5b 100644 --- a/framework/packages/abstract-std/src/native/ibc_host.rs +++ b/framework/packages/abstract-std/src/native/ibc_host.rs @@ -11,9 +11,8 @@ use cosmwasm_schema::QueryResponses; use cosmwasm_std::{Addr, Binary}; use crate::{ - account, + account::{self, ModuleInstallConfig}, ibc_client::InstalledModuleIdentification, - manager::{self, ModuleInstallConfig}, objects::{account::AccountId, module::ModuleInfo, TruncatedChainId}, }; diff --git a/framework/packages/abstract-std/src/objects/version_control.rs b/framework/packages/abstract-std/src/objects/version_control.rs index f8a372ee6a..f5aff0b1dc 100644 --- a/framework/packages/abstract-std/src/objects/version_control.rs +++ b/framework/packages/abstract-std/src/objects/version_control.rs @@ -35,13 +35,9 @@ pub enum VersionControlError { registry_addr: Addr, }, - // caller not Manager error - #[error("Address {0} is not the Manager of Account {1}.")] - NotManager(Addr, AccountId), - - // caller not Proxy error - #[error("Address {0} is not the Proxy of Account {1}.")] - NotProxy(Addr, AccountId), + // Caller is not a valid account + #[error("Address {0} is not the valid account address of {1}.")] + NotAccount(Addr, AccountId), // Query method failed #[error("Query during '{method_name}' failed: {error}")] @@ -286,7 +282,7 @@ impl VersionControlContract { let account_id = self.unchecked_account_id(maybe_account, querier)?; let account_base = self.account(&account_id, querier)?; if account_base.addr().ne(maybe_account) { - Err(VersionControlError::NotManager( + Err(VersionControlError::NotAccount( maybe_account.clone(), account_id, )) diff --git a/framework/packages/abstract-std/src/standalone.rs b/framework/packages/abstract-std/src/standalone.rs index 817d654e8f..ab6875128a 100644 --- a/framework/packages/abstract-std/src/standalone.rs +++ b/framework/packages/abstract-std/src/standalone.rs @@ -9,8 +9,6 @@ use crate::{ version_control::Account, }; -use cosmwasm_std::Addr; - /// Data required for the `StandaloneContract::instantiate` function. #[cosmwasm_schema::cw_serde] pub struct StandaloneInstantiateMsg { diff --git a/framework/packages/abstract-testing/src/abstract_mock_querier.rs b/framework/packages/abstract-testing/src/abstract_mock_querier.rs index bdf46034b6..457ba5fd14 100644 --- a/framework/packages/abstract-testing/src/abstract_mock_querier.rs +++ b/framework/packages/abstract-testing/src/abstract_mock_querier.rs @@ -1,11 +1,8 @@ use abstract_std::{ ans_host::state::{ASSET_ADDRESSES, CHANNELS, CONTRACT_ADDRESSES}, objects::{ - account::ACCOUNT_ID, - common_namespace::{ADMIN_NAMESPACE, OWNERSHIP_STORAGE_KEY}, - gov_type::GovernanceDetails, - ownership::Ownership, - AccountId, AssetEntry, ChannelEntry, ContractEntry, + account::ACCOUNT_ID, common_namespace::OWNERSHIP_STORAGE_KEY, gov_type::GovernanceDetails, + ownership::Ownership, AccountId, AssetEntry, ChannelEntry, ContractEntry, }, version_control::{state::ACCOUNT_ADDRESSES, Account}, }; diff --git a/framework/packages/abstract-testing/src/mock_querier.rs b/framework/packages/abstract-testing/src/mock_querier.rs index 3e6260685b..dded6ba8ed 100644 --- a/framework/packages/abstract-testing/src/mock_querier.rs +++ b/framework/packages/abstract-testing/src/mock_querier.rs @@ -1,7 +1,7 @@ use std::{collections::HashMap, ops::Deref}; use abstract_std::{ - manager::state::{ACCOUNT_ID, ACCOUNT_MODULES}, + account::state::{ACCOUNT_ID, ACCOUNT_MODULES}, objects::{ common_namespace::OWNERSHIP_STORAGE_KEY, gov_type::GovernanceDetails, ownership::Ownership, }, From 9efe4eedc68c975b8af56a14ef634d08d2418bba Mon Sep 17 00:00:00 2001 From: Kayanski Date: Mon, 9 Sep 2024 14:34:17 +0000 Subject: [PATCH 02/17] formatting [skip ci] --- .../contracts/account/account/src/modules.rs | 227 ++++++++++++++++++ .../packages/abstract-std/src/account/mod.rs | 2 +- 2 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 framework/contracts/account/account/src/modules.rs diff --git a/framework/contracts/account/account/src/modules.rs b/framework/contracts/account/account/src/modules.rs new file mode 100644 index 0000000000..a71b681fc7 --- /dev/null +++ b/framework/contracts/account/account/src/modules.rs @@ -0,0 +1,227 @@ +use abstract_macros::abstract_response; +use abstract_sdk::cw_helpers::AbstractAttributes; +use abstract_std::{ + account::{ + state::{ + AccountInfo, SuspensionStatus, ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, DEPENDENTS, INFO, + SUB_ACCOUNTS, SUSPENSION_STATUS, + }, + ExecuteMsg, ModuleInstallConfig, + }, + adapter::{ + AdapterBaseMsg, AuthorizedAddressesResponse, BaseExecuteMsg, BaseQueryMsg, + ExecuteMsg as AdapterExecMsg, QueryMsg as AdapterQuery, + }, + module_factory::{ExecuteMsg as ModuleFactoryMsg, FactoryModuleInstallConfig}, + objects::{ + dependency::Dependency, + gov_type::GovernanceDetails, + module::{assert_module_data_validity, Module, ModuleInfo, ModuleVersion}, + module_reference::ModuleReference, + ownership::{self, GovOwnershipError}, + salt::generate_instantiate_salt, + validation::{validate_description, validate_link, validate_name}, + version_control::VersionControlContract, + AccountId, + }, + version_control::ModuleResponse, + ACCOUNT, +}; +use cosmwasm_std::{ + ensure, from_json, to_json_binary, wasm_execute, Addr, Attribute, Binary, Coin, CosmosMsg, + Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Storage, SubMsg, + SubMsgResult, WasmMsg, +}; +use cw2::{get_contract_version, ContractVersion}; +use cw_storage_plus::Item; +use semver::Version; + +use crate::{ + contract::{AccountResponse, AccountResult}, + error::AccountError, +}; + +pub const REGISTER_MODULES_DEPENDENCIES: u64 = 1; +pub(crate) const INSTALL_MODULES_CONTEXT: Item)>> = Item::new("icontext"); + +/// Attempts to install a new module through the Module Factory Contract +pub fn install_modules( + mut deps: DepsMut, + info: MessageInfo, + modules: Vec, +) -> AccountResult { + // only owner can call this method + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + let config = CONFIG.load(deps.storage)?; + + let (install_msgs, install_attribute) = _install_modules( + deps.branch(), + modules, + config.module_factory_address, + config.version_control_address, + info.funds, // We forward all the funds to the module_factory address for them to use in the install + )?; + let response = AccountResponse::new("install_modules", std::iter::once(install_attribute)) + .add_submessages(install_msgs); + + Ok(response) +} + +/// Generate message and attribute for installing module +/// Adds the modules to the internal store for reference and adds them to the proxy allowlist if applicable. +pub fn _install_modules( + mut deps: DepsMut, + modules: Vec, + module_factory_address: Addr, + version_control_address: Addr, + funds: Vec, +) -> AccountResult<(Vec, Attribute)> { + let mut installed_modules = Vec::with_capacity(modules.len()); + let mut manager_modules = Vec::with_capacity(modules.len()); + let account_id = ACCOUNT_ID.load(deps.storage)?; + let version_control = VersionControlContract::new(version_control_address); + + let canonical_module_factory = deps + .api + .addr_canonicalize(module_factory_address.as_str())?; + + let (infos, init_msgs): (Vec<_>, Vec<_>) = + modules.into_iter().map(|m| (m.module, m.init_msg)).unzip(); + let modules = version_control + .query_modules_configs(infos, &deps.querier) + .map_err(|error| AccountError::QueryModulesFailed { error })?; + + let mut install_context = Vec::with_capacity(modules.len()); + let mut add_to_proxy = Vec::with_capacity(modules.len()); + let mut add_to_manager = Vec::with_capacity(modules.len()); + + let salt: Binary = generate_instantiate_salt(&account_id); + for (ModuleResponse { module, .. }, init_msg) in modules.into_iter().zip(init_msgs) { + // Check if module is already enabled. + if ACCOUNT_MODULES + .may_load(deps.storage, &module.info.id())? + .is_some() + { + return Err(AccountError::ModuleAlreadyInstalled(module.info.id())); + } + installed_modules.push(module.info.id_with_version()); + + let init_msg_salt = match &module.reference { + ModuleReference::Adapter(module_address) + | ModuleReference::Native(module_address) + | ModuleReference::Service(module_address) => { + if module.should_be_whitelisted() { + add_to_proxy.push(module_address.to_string()); + } + add_to_manager.push((module.info.id(), module_address.to_string())); + install_context.push((module.clone(), None)); + None + } + ModuleReference::App(code_id) | ModuleReference::Standalone(code_id) => { + let checksum = deps.querier.query_wasm_code_info(*code_id)?.checksum; + let module_address = cosmwasm_std::instantiate2_address( + checksum.as_slice(), + &canonical_module_factory, + &salt, + )?; + let module_address = deps.api.addr_humanize(&module_address)?; + ensure!( + deps.querier + .query_wasm_contract_info(module_address.to_string()) + .is_err(), + AccountError::ProhibitedReinstall {} + ); + if module.should_be_whitelisted() { + add_to_proxy.push(module_address.to_string()); + } + add_to_manager.push((module.info.id(), module_address.to_string())); + install_context.push((module.clone(), Some(module_address))); + + Some(init_msg.unwrap()) + } + _ => return Err(AccountError::ModuleNotInstallable(module.info.to_string())), + }; + manager_modules.push(FactoryModuleInstallConfig::new(module.info, init_msg_salt)); + } + + INSTALL_MODULES_CONTEXT.save(deps.storage, &install_context)?; + + let mut messages = vec![]; + + // Add modules to proxy + let proxy_addr = ACCOUNT_MODULES.load(deps.storage, ACCOUNT)?; + if !add_to_proxy.is_empty() { + messages.push(SubMsg::new(add_modules_to_proxy( + proxy_addr.into_string(), + add_to_proxy, + )?)); + }; + + // Update module addrs + update_module_addresses(deps.branch(), Some(add_to_manager), None)?; + + // Install modules message + messages.push(SubMsg::reply_on_success( + wasm_execute( + module_factory_address, + &ModuleFactoryMsg::InstallModules { + modules: manager_modules, + salt, + }, + funds, + )?, + REGISTER_MODULES_DEPENDENCIES, + )); + + Ok(( + messages, + Attribute::new("installed_modules", format!("{installed_modules:?}")), + )) +} + +/// Adds, updates or removes provided addresses. +/// Should only be called by contract that adds/removes modules. +/// Factory is admin on init +pub fn update_module_addresses( + deps: DepsMut, + to_add: Option>, + to_remove: Option>, +) -> AccountResult { + if let Some(modules_to_add) = to_add { + for (id, new_address) in modules_to_add.into_iter() { + if id.is_empty() { + return Err(AccountError::InvalidModuleName {}); + }; + // validate addr + ACCOUNT_MODULES.save( + deps.storage, + id.as_str(), + &deps.api.addr_validate(&new_address)?, + )?; + } + } + + if let Some(modules_to_remove) = to_remove { + for id in modules_to_remove.into_iter() { + validation::validate_not_proxy(&id)?; + ACCOUNT_MODULES.remove(deps.storage, id.as_str()); + } + } + + Ok(AccountResponse::action("update_module_addresses")) +} + +fn add_modules_to_proxy( + proxy_address: String, + module_addresses: Vec, +) -> StdResult> { + Ok(wasm_execute( + proxy_address, + &ProxyMsg::AddModules { + modules: module_addresses, + }, + vec![], + )? + .into()) +} diff --git a/framework/packages/abstract-std/src/account/mod.rs b/framework/packages/abstract-std/src/account/mod.rs index f85d1f7b8f..a99aa12c8f 100644 --- a/framework/packages/abstract-std/src/account/mod.rs +++ b/framework/packages/abstract-std/src/account/mod.rs @@ -3,5 +3,5 @@ pub mod responses; pub mod state; pub mod types; -pub use types::ModuleInstallConfig; pub use msgs::{ExecuteMsg, ExecuteMsgFns, InstantiateMsg, MigrateMsg, QueryMsg, QueryMsgFns}; +pub use types::ModuleInstallConfig; From 75bba1891390e47530a64ab551bec6b92298bcdb Mon Sep 17 00:00:00 2001 From: Kayanski Date: Mon, 9 Sep 2024 16:02:14 +0000 Subject: [PATCH 03/17] Execution and replies ok for account contract --- framework/Cargo.lock | 7 +- .../contracts/account/account/Cargo.toml | 5 +- .../contracts/account/account/src/actions.rs | 109 +++++++ .../contracts/account/account/src/config.rs | 150 +++++++++ .../contracts/account/account/src/contract.rs | 74 +++-- .../contracts/account/account/src/error.rs | 85 ++++- .../contracts/account/account/src/lib.rs | 7 + .../contracts/account/account/src/modules.rs | 277 ++++++++++++++--- .../account/account/src/modules/migration.rs | 292 ++++++++++++++++++ .../contracts/account/account/src/queries.rs | 197 ++++++++++++ .../contracts/account/account/src/reply.rs | 71 +++++ .../account/account/src/sub_account.rs | 170 ++++++++++ .../account/account/src/versioning.rs | 281 +++++++++++++++++ .../contracts/account/manager/src/commands.rs | 171 +--------- .../contracts/account/manager/src/contract.rs | 11 +- .../packages/abstract-std/src/account/msgs.rs | 7 + .../abstract-std/src/account/responses.rs | 4 - .../abstract-std/src/account/state.rs | 7 +- 18 files changed, 1659 insertions(+), 266 deletions(-) create mode 100644 framework/contracts/account/account/src/actions.rs create mode 100644 framework/contracts/account/account/src/config.rs create mode 100644 framework/contracts/account/account/src/modules/migration.rs create mode 100644 framework/contracts/account/account/src/queries.rs create mode 100644 framework/contracts/account/account/src/reply.rs create mode 100644 framework/contracts/account/account/src/sub_account.rs create mode 100644 framework/contracts/account/account/src/versioning.rs diff --git a/framework/Cargo.lock b/framework/Cargo.lock index 54e96f0b8e..170924b201 100644 --- a/framework/Cargo.lock +++ b/framework/Cargo.lock @@ -10,11 +10,10 @@ dependencies = [ "abstract-adapter", "abstract-ans-host", "abstract-app", + "abstract-ica", "abstract-interface", "abstract-macros", - "abstract-manager", "abstract-module-factory", - "abstract-proxy", "abstract-sdk", "abstract-standalone", "abstract-std", @@ -4106,9 +4105,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", diff --git a/framework/contracts/account/account/Cargo.toml b/framework/contracts/account/account/Cargo.toml index 199621f626..347ed8c5ac 100644 --- a/framework/contracts/account/account/Cargo.toml +++ b/framework/contracts/account/account/Cargo.toml @@ -35,9 +35,7 @@ abstract-std = { workspace = true } semver = { workspace = true } abstract-macros = { workspace = true } workspace-hack = { version = "0.1", path = "../../../workspace-hack" } - -proxy = { workspace = true } -manager ={ workspace = true } +abstract-ica = { workspace = true } [dev-dependencies] cw20 = { workspace = true } @@ -49,7 +47,6 @@ anyhow = { workspace = true } account-factory = { workspace = true } ans-host = { workspace = true } version-control = { workspace = true } -proxy = { workspace = true } module-factory = { workspace = true } rstest = { workspace = true } speculoos = { workspace = true } diff --git a/framework/contracts/account/account/src/actions.rs b/framework/contracts/account/account/src/actions.rs new file mode 100644 index 0000000000..52fa400ce2 --- /dev/null +++ b/framework/contracts/account/account/src/actions.rs @@ -0,0 +1,109 @@ +use abstract_sdk::std::{ + account::state::{ADMIN, WHITELISTED_MODULES}, + ibc_client::ExecuteMsg as IbcClientMsg, + IBC_CLIENT, +}; +use abstract_std::ICA_CLIENT; +use cosmwasm_std::{ + wasm_execute, Binary, CosmosMsg, DepsMut, Empty, MessageInfo, StdError, SubMsg, WasmQuery, +}; + +use crate::{ + contract::{AccountResponse, AccountResult, RESPONSE_REPLY_ID}, + error::AccountError, +}; + +/// Executes `CosmosMsg` on the proxy and forwards its response. +/// Permission: Module +pub fn execute_module_action_response( + deps: DepsMut, + msg_info: MessageInfo, + msg: CosmosMsg, +) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); + } + + let submsg = SubMsg::reply_on_success(msg, RESPONSE_REPLY_ID); + + Ok(AccountResponse::action("execute_module_action_response").add_submessage(submsg)) +} + +/// Executes `Vec` on the proxy. +/// Permission: Module +pub fn execute_module_action( + deps: DepsMut, + msg_info: MessageInfo, + msgs: Vec>, +) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); + } + + Ok(AccountResponse::action("execute_module_action").add_messages(msgs)) +} + +/// Executes IBC actions on the IBC client. +/// Permission: Module +pub fn execute_ibc_action( + deps: DepsMut, + msg_info: MessageInfo, + msg: IbcClientMsg, +) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); + } + let manager_address = ADMIN.get(deps.as_ref())?.unwrap(); + let ibc_client_address = abstract_sdk::std::account::state::ACCOUNT_MODULES + .query(&deps.querier, manager_address, IBC_CLIENT)? + .ok_or_else(|| { + StdError::generic_err(format!( + "ibc_client not found on manager. Add it under the {IBC_CLIENT} name." + )) + })?; + + let funds_to_send = if let IbcClientMsg::SendFunds { funds, .. } = &msg { + funds.clone() + } else { + vec![] + }; + let client_msg = wasm_execute(ibc_client_address, &msg, funds_to_send)?; + + Ok(AccountResponse::action("execute_ibc_action").add_message(client_msg)) +} + +/// Execute an action on an ICA. +/// Permission: Module +/// +/// This function queries the `abstract:ica-client` contract from the account's manager. +/// It then fires a smart-query on that address of type [`QueryMsg::IcaAction`](abstract_ica::msg::QueryMsg). +/// +/// The resulting `Vec` are then executed on the proxy contract. +pub fn ica_action(deps: DepsMut, msg_info: MessageInfo, action_query: Binary) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); + } + + let manager_address = ADMIN.get(deps.as_ref())?.unwrap(); + let ica_client_address = abstract_sdk::std::account::state::ACCOUNT_MODULES + .query(&deps.querier, manager_address, ICA_CLIENT)? + .ok_or_else(|| { + StdError::generic_err(format!( + "ica_client not found on manager. Add it under the {ICA_CLIENT} name." + )) + })?; + + let res: abstract_ica::msg::IcaActionResult = deps.querier.query( + &WasmQuery::Smart { + contract_addr: ica_client_address.into(), + msg: action_query, + } + .into(), + )?; + + Ok(AccountResponse::action("ica_action").add_messages(res.msgs)) +} diff --git a/framework/contracts/account/account/src/config.rs b/framework/contracts/account/account/src/config.rs new file mode 100644 index 0000000000..61418b890f --- /dev/null +++ b/framework/contracts/account/account/src/config.rs @@ -0,0 +1,150 @@ +use crate::{ + contract::{AccountResponse, AccountResult}, + error::AccountError, + modules::update_module_addresses, +}; +use abstract_sdk::{cw_helpers::AbstractAttributes, feature_objects::VersionControlContract}; +use abstract_std::{ + account::{ + state::{ + AccountInfo, SuspensionStatus, ACCOUNT_ID, CONFIG, INFO, SUB_ACCOUNTS, + SUSPENSION_STATUS, + }, + types::{InternalConfigAction, UpdateSubAccountAction}, ExecuteMsg, + }, + objects::{ + gov_type::GovernanceDetails, + ownership, + validation::{validate_description, validate_link, validate_name}, + }, +}; +use cosmwasm_std::{ + ensure, from_json, wasm_execute, Binary, CosmosMsg, DepsMut, MessageInfo, Response, StdError, +}; + +pub fn update_account_status( + deps: DepsMut, + info: MessageInfo, + suspension_status: Option, +) -> Result { + let mut response = AccountResponse::action("update_status"); + + if let Some(suspension_status) = suspension_status { + response = update_suspension_status(deps, info, suspension_status, response)?; + } else { + return Err(AccountError::NoUpdates {}); + } + + Ok(response) +} + +pub fn update_suspension_status( + deps: DepsMut, + info: MessageInfo, + is_suspended: SuspensionStatus, + response: Response, +) -> AccountResult { + // only owner can update suspension status + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + SUSPENSION_STATUS.save(deps.storage, &is_suspended)?; + + Ok(response.add_abstract_attributes(vec![("is_suspended", is_suspended.to_string())])) +} + +/// Allows the owner to manually update the internal configuration of the account. +/// This can be used to unblock the account and its modules in case of a bug/lock on the account. +pub fn update_internal_config(deps: DepsMut, info: MessageInfo, config: Binary) -> AccountResult { + // deserialize the config action + let action: InternalConfigAction = + from_json(config).map_err(|error| AccountError::InvalidConfigAction { error })?; + + let (add, remove) = match action { + InternalConfigAction::UpdateModuleAddresses { to_add, to_remove } => (to_add, to_remove), + _ => { + return Err(AccountError::InvalidConfigAction { + error: StdError::generic_err("Unknown config action"), + }) + } + }; + + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + update_module_addresses(deps, add, remove) +} + +/// Update the Account information +pub fn update_info( + deps: DepsMut, + info: MessageInfo, + name: Option, + description: Option, + link: Option, +) -> AccountResult { + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + let mut info: AccountInfo = INFO.load(deps.storage)?; + if let Some(name) = name { + validate_name(&name)?; + info.name = name; + } + validate_description(description.as_deref())?; + info.description = description; + validate_link(link.as_deref())?; + info.link = link; + INFO.save(deps.storage, &info)?; + + Ok(AccountResponse::action("update_info")) +} + +/// Renounce ownership of this account \ +/// **WARNING**: This will lock the account, making it unusable. +pub fn remove_account_from_contracts(deps: DepsMut) -> AccountResult> { + let mut msgs = vec![]; + + let account_id = ACCOUNT_ID.load(deps.storage)?; + // Check for any sub accounts + let sub_account = SUB_ACCOUNTS + .keys(deps.storage, None, None, cosmwasm_std::Order::Ascending) + .next() + .transpose()?; + ensure!( + sub_account.is_none(), + AccountError::RenounceWithSubAccount {} + ); + + let ownership = ownership::get_ownership(deps.storage)?; + if let GovernanceDetails::SubAccount { account } = ownership.owner { + // Unregister itself (sub-account) from the owning account. + msgs.push( + wasm_execute( + account, + &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::UnregisterSubAccount { + id: account_id.seq(), + }), + vec![], + )? + .into(), + ); + } + + let config = CONFIG.load(deps.storage)?; + let vc = VersionControlContract::new(config.version_control_address); + let mut namespaces = vc + .query_namespaces(vec![account_id], &deps.querier)? + .namespaces; + let namespace = namespaces.pop(); + if let Some((namespace, _)) = namespace { + // Remove the namespace that this account holds. + msgs.push( + wasm_execute( + vc.address, + &abstract_std::version_control::ExecuteMsg::RemoveNamespaces { + namespaces: vec![namespace.to_string()], + }, + vec![], + )? + .into(), + ) + }; + Ok(msgs) +} diff --git a/framework/contracts/account/account/src/contract.rs b/framework/contracts/account/account/src/contract.rs index 01b3ead37b..624d39f374 100644 --- a/framework/contracts/account/account/src/contract.rs +++ b/framework/contracts/account/account/src/contract.rs @@ -1,29 +1,44 @@ use abstract_macros::abstract_response; use abstract_sdk::std::{ + account::state::ACCOUNT_ID, objects::validation::{validate_description, validate_link, validate_name}, - proxy::state::ACCOUNT_ID, ACCOUNT, }; use abstract_std::{ - account::{ExecuteMsg, InstantiateMsg, QueryMsg}, - manager::{ - state::{AccountInfo, Config, ACCOUNT_MODULES, CONFIG, INFO, SUSPENSION_STATUS}, - UpdateSubAccountAction, + account::{ + state::{ + AccountInfo, Config, WhitelistedModules, ACCOUNT_MODULES, CONFIG, INFO, + SUSPENSION_STATUS, WHITELISTED_MODULES, + }, + types::UpdateSubAccountAction, + ExecuteMsg, InstantiateMsg, QueryMsg, }, objects::{gov_type::GovernanceDetails, ownership, AccountId}, - proxy::state::STATE, version_control::Account, }; use cosmwasm_std::{ ensure_eq, wasm_execute, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, - StdResult, + StdResult, SubMsgResult, }; use cw2::set_contract_version; -use manager::commands::*; -use proxy::commands::*; - -use crate::error::AccountError; +use crate::{ + actions::{ + execute_ibc_action, execute_module_action, execute_module_action_response, ica_action, + }, + config::{ + remove_account_from_contracts, update_account_status, update_info, update_internal_config, + }, + error::AccountError, + modules::{ + _install_modules, exec_on_module, install_modules, migration::upgrade_modules, + uninstall_module, MIGRATE_CONTEXT, + }, + reply::{forward_response_data, register_dependencies}, + sub_account::{ + create_sub_account, handle_sub_account_action, maybe_update_sub_account_governance, + }, +}; #[abstract_response(ACCOUNT)] pub struct AccountResponse; @@ -32,6 +47,9 @@ pub type AccountResult = Result; pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const RESPONSE_REPLY_ID: u64 = 1; +pub const REGISTER_MODULES_DEPENDENCIES_REPLY_ID: u64 = 2; + #[cfg_attr(feature = "export", cosmwasm_std::entry_point)] pub fn instantiate( mut deps: DepsMut, @@ -58,12 +76,9 @@ pub fn instantiate( account_id.unwrap_or_else(|| /* TODO: Query VC for Sequence*/ AccountId::local(0)); ACCOUNT_ID.save(deps.storage, &account_id)?; - STATE.save( - deps.storage, - &abstract_std::proxy::state::State { modules: vec![] }, - )?; + WHITELISTED_MODULES.save(deps.storage, &WhitelistedModules(vec![]))?; - // ## Manage ## + // ## Account ## let module_factory_address = deps.api.addr_validate(&module_factory_address)?; let version_control_address = deps.api.addr_validate(&version_control_address)?; @@ -72,7 +87,7 @@ pub fn instantiate( version_control_address: version_control_address.clone(), module_factory_address: module_factory_address.clone(), }; - abstract_std::manager::state::CONFIG.save(deps.storage, &config)?; + abstract_std::account::state::CONFIG.save(deps.storage, &config)?; // Verify info validate_description(description.as_deref())?; @@ -98,7 +113,7 @@ pub fn instantiate( SUSPENSION_STATUS.save(deps.storage, &false)?; - let mut response = ManagerResponse::new( + let mut response = AccountResponse::new( "instantiate", vec![ ("account_id".to_owned(), account_id.to_string()), @@ -249,6 +264,23 @@ pub fn execute(mut deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) Ok(Response::new()) } +#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] +pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> AccountResult { + match msg { + Reply { + id: RESPONSE_REPLY_ID, + result: SubMsgResult::Ok(_), + .. + } => forward_response_data(msg), + Reply { + id: REGISTER_MODULES_DEPENDENCIES_REPLY_ID, + result: SubMsgResult::Ok(_), + .. + } => register_dependencies(deps), + _ => Err(AccountError::UnexpectedReply {}), + } +} + #[cfg_attr(feature = "export", cosmwasm_std::entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { @@ -291,7 +323,7 @@ mod tests { assert_that!(res) .is_err() - .is_equal_to(ManagerError::Abstract( + .is_equal_to(AccountError::Abstract( AbstractError::CannotDowngradeContract { contract: ACCOUNT.to_string(), from: version.clone(), @@ -316,7 +348,7 @@ mod tests { assert_that!(res) .is_err() - .is_equal_to(ManagerError::Abstract( + .is_equal_to(AccountError::Abstract( AbstractError::CannotDowngradeContract { contract: ACCOUNT.to_string(), from: big_version.parse().unwrap(), @@ -340,7 +372,7 @@ mod tests { assert_that!(res) .is_err() - .is_equal_to(ManagerError::Abstract( + .is_equal_to(AccountError::Abstract( AbstractError::ContractNameMismatch { from: old_name.parse().unwrap(), to: ACCOUNT.parse().unwrap(), diff --git a/framework/contracts/account/account/src/error.rs b/framework/contracts/account/account/src/error.rs index 0887a4790d..48256d3dd8 100644 --- a/framework/contracts/account/account/src/error.rs +++ b/framework/contracts/account/account/src/error.rs @@ -3,7 +3,7 @@ use abstract_std::{ objects::{validation::ValidationError, version_control::VersionControlError}, AbstractError, }; -use cosmwasm_std::{Instantiate2AddressError, StdError}; +use cosmwasm_std::{Instantiate2AddressError, Response, StdError}; use thiserror::Error; #[derive(Error, Debug, PartialEq)] @@ -29,12 +29,83 @@ pub enum AccountError { #[error("{0}")] VersionControlError(#[from] VersionControlError), - #[error("{0}")] - Manager(#[from] manager::error::ManagerError), - - #[error("{0}")] - Proxy(#[from] proxy::error::ProxyError), - #[error("Your account is currently suspended")] AccountSuspended {}, + + // ** Modules Error ** // + #[error("Failed to query modules to install: {error}")] + QueryModulesFailed { error: VersionControlError }, + + #[error("Module with id: {0} is already installed")] + ModuleAlreadyInstalled(String), + + #[error("Reinstalls of same version of app or standalone are not allowed")] + ProhibitedReinstall {}, + + #[error("The provided module {0} can't be installed on an Abstract account")] + ModuleNotInstallable(String), + + #[error("The name of the proposed module can not have length 0.")] + InvalidModuleName {}, + + #[error("The provided module {0} was not found")] + ModuleNotFound(String), + + #[error("Cannot migrate {} twice", module_id)] + DuplicateModuleMigration { module_id: String }, + + #[error("{0} not upgradable")] + NotUpgradeable(ModuleInfo), + + #[error("Cannot remove module because {0:?} depend(s) on it.")] + ModuleHasDependents(Vec), + + #[error("Module {module_id} with version {version} does not fit requirement {comp}, post_migration: {post_migration}")] + VersionRequirementNotMet { + module_id: String, + version: String, + comp: String, + post_migration: bool, + }, + + #[error("module {0} is a dependency of {1} and is not installed.")] + DependencyNotMet(String, String), + + #[error("The provided module {0} has an invalid module reference.")] + InvalidReference(ModuleInfo), + + #[error("Max amount of modules registered")] + ModuleLimitReached, + + #[error("Module with address {0} is already whitelisted")] + AlreadyWhitelisted(String), + + #[error("Module with address {0} not found in whitelist")] + NotWhitelisted(String), + + // ** Sub Account ** // + #[error("Removing sub account failed")] + SubAccountRemovalFailed {}, + + #[error("Register of sub account failed")] + SubAccountRegisterFailed {}, + + #[error("Can't renounce account, with active sub account")] + RenounceWithSubAccount {}, + + // ** Other Errors TODO: sort ? ** // + #[error("No updates were included")] + NoUpdates {}, + + #[error("invalid configuration action, {}", error)] + InvalidConfigAction { error: StdError }, + + #[error("The provided contract version {0} is lower than the current version {1}")] + OlderVersion(String, String), + + #[error("Sender is not whitelisted")] + SenderNotWhitelisted {}, + + #[error("Contract got an unexpected Reply")] + UnexpectedReply(), } diff --git a/framework/contracts/account/account/src/lib.rs b/framework/contracts/account/account/src/lib.rs index ed72987554..18dc6c96cd 100644 --- a/framework/contracts/account/account/src/lib.rs +++ b/framework/contracts/account/account/src/lib.rs @@ -1,2 +1,9 @@ +pub mod actions; +pub mod config; pub mod contract; pub mod error; +pub mod modules; +pub mod queries; +pub mod reply; +pub mod sub_account; +pub mod versioning; diff --git a/framework/contracts/account/account/src/modules.rs b/framework/contracts/account/account/src/modules.rs index a71b681fc7..fa8e56187e 100644 --- a/framework/contracts/account/account/src/modules.rs +++ b/framework/contracts/account/account/src/modules.rs @@ -1,49 +1,41 @@ -use abstract_macros::abstract_response; -use abstract_sdk::cw_helpers::AbstractAttributes; use abstract_std::{ account::{ - state::{ - AccountInfo, SuspensionStatus, ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, DEPENDENTS, INFO, - SUB_ACCOUNTS, SUSPENSION_STATUS, - }, - ExecuteMsg, ModuleInstallConfig, - }, - adapter::{ - AdapterBaseMsg, AuthorizedAddressesResponse, BaseExecuteMsg, BaseQueryMsg, - ExecuteMsg as AdapterExecMsg, QueryMsg as AdapterQuery, + state::{ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, DEPENDENTS, WHITELISTED_MODULES}, + ModuleInstallConfig, }, + adapter::{AdapterBaseMsg, BaseExecuteMsg, ExecuteMsg as AdapterExecMsg}, module_factory::{ExecuteMsg as ModuleFactoryMsg, FactoryModuleInstallConfig}, objects::{ - dependency::Dependency, - gov_type::GovernanceDetails, module::{assert_module_data_validity, Module, ModuleInfo, ModuleVersion}, module_reference::ModuleReference, - ownership::{self, GovOwnershipError}, + ownership::{self}, salt::generate_instantiate_salt, - validation::{validate_description, validate_link, validate_name}, version_control::VersionControlContract, - AccountId, }, version_control::ModuleResponse, - ACCOUNT, }; use cosmwasm_std::{ - ensure, from_json, to_json_binary, wasm_execute, Addr, Attribute, Binary, Coin, CosmosMsg, - Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Storage, SubMsg, - SubMsgResult, WasmMsg, + ensure, wasm_execute, Addr, Attribute, Binary, Coin, CosmosMsg, Deps, DepsMut, MessageInfo, + Response, StdResult, Storage, SubMsg, SubMsgResult, WasmMsg, }; -use cw2::{get_contract_version, ContractVersion}; +use cw2::ContractVersion; use cw_storage_plus::Item; +use migration::{build_module_migrate_msg, handle_adapter_migration, handle_app_migration}; use semver::Version; use crate::{ - contract::{AccountResponse, AccountResult}, + contract::{AccountResponse, AccountResult, REGISTER_MODULES_DEPENDENCIES_REPLY_ID}, error::AccountError, + queries::query_module_version, }; -pub const REGISTER_MODULES_DEPENDENCIES: u64 = 1; +pub use migration::MIGRATE_CONTEXT; pub(crate) const INSTALL_MODULES_CONTEXT: Item)>> = Item::new("icontext"); +pub mod migration; + +const LIST_SIZE_LIMIT: usize = 15; + /// Attempts to install a new module through the Module Factory Contract pub fn install_modules( mut deps: DepsMut, @@ -93,7 +85,7 @@ pub fn _install_modules( .map_err(|error| AccountError::QueryModulesFailed { error })?; let mut install_context = Vec::with_capacity(modules.len()); - let mut add_to_proxy = Vec::with_capacity(modules.len()); + let mut add_to_whitelist = Vec::with_capacity(modules.len()); let mut add_to_manager = Vec::with_capacity(modules.len()); let salt: Binary = generate_instantiate_salt(&account_id); @@ -112,7 +104,7 @@ pub fn _install_modules( | ModuleReference::Native(module_address) | ModuleReference::Service(module_address) => { if module.should_be_whitelisted() { - add_to_proxy.push(module_address.to_string()); + add_to_whitelist.push(module_address.to_string()); } add_to_manager.push((module.info.id(), module_address.to_string())); install_context.push((module.clone(), None)); @@ -133,7 +125,7 @@ pub fn _install_modules( AccountError::ProhibitedReinstall {} ); if module.should_be_whitelisted() { - add_to_proxy.push(module_address.to_string()); + add_to_whitelist.push(module_address.to_string()); } add_to_manager.push((module.info.id(), module_address.to_string())); install_context.push((module.clone(), Some(module_address))); @@ -144,20 +136,12 @@ pub fn _install_modules( }; manager_modules.push(FactoryModuleInstallConfig::new(module.info, init_msg_salt)); } + _whitelist_modules(deps.branch(), add_to_whitelist)?; INSTALL_MODULES_CONTEXT.save(deps.storage, &install_context)?; let mut messages = vec![]; - // Add modules to proxy - let proxy_addr = ACCOUNT_MODULES.load(deps.storage, ACCOUNT)?; - if !add_to_proxy.is_empty() { - messages.push(SubMsg::new(add_modules_to_proxy( - proxy_addr.into_string(), - add_to_proxy, - )?)); - }; - // Update module addrs update_module_addresses(deps.branch(), Some(add_to_manager), None)?; @@ -171,7 +155,7 @@ pub fn _install_modules( }, funds, )?, - REGISTER_MODULES_DEPENDENCIES, + REGISTER_MODULES_DEPENDENCIES_REPLY_ID, )); Ok(( @@ -204,7 +188,6 @@ pub fn update_module_addresses( if let Some(modules_to_remove) = to_remove { for id in modules_to_remove.into_iter() { - validation::validate_not_proxy(&id)?; ACCOUNT_MODULES.remove(deps.storage, id.as_str()); } } @@ -212,16 +195,214 @@ pub fn update_module_addresses( Ok(AccountResponse::action("update_module_addresses")) } -fn add_modules_to_proxy( - proxy_address: String, - module_addresses: Vec, -) -> StdResult> { - Ok(wasm_execute( - proxy_address, - &ProxyMsg::AddModules { - modules: module_addresses, +pub(crate) fn set_migrate_msgs_and_context( + deps: DepsMut, + module_info: ModuleInfo, + migrate_msg: Option, + msgs: &mut Vec, +) -> Result<(), AccountError> { + let config = CONFIG.load(deps.storage)?; + let version_control = VersionControlContract::new(config.version_control_address); + + let old_module_addr = load_module_addr(deps.storage, &module_info.id())?; + let old_module_cw2 = + query_module_version(deps.as_ref(), old_module_addr.clone(), &version_control)?; + let requested_module = query_module(deps.as_ref(), module_info.clone(), Some(old_module_cw2))?; + + let migrate_msgs = match requested_module.module.reference { + // upgrading an adapter is done by moving the authorized addresses to the new contract address and updating the permissions on the proxy. + ModuleReference::Adapter(new_adapter_addr) => handle_adapter_migration( + deps, + requested_module.module.info, + old_module_addr, + new_adapter_addr, + )?, + ModuleReference::App(code_id) => handle_app_migration( + deps, + migrate_msg, + old_module_addr, + requested_module.module.info, + code_id, + )?, + ModuleReference::AccountBase(code_id) | ModuleReference::Standalone(code_id) => { + vec![build_module_migrate_msg( + old_module_addr, + code_id, + migrate_msg.unwrap(), + )] + } + + _ => return Err(AccountError::NotUpgradeable(module_info)), + }; + msgs.extend(migrate_msgs); + Ok(()) +} + +/// Uninstall the module with the ID [`module_id`] +pub fn uninstall_module(mut deps: DepsMut, info: MessageInfo, module_id: String) -> AccountResult { + // only owner can uninstall modules + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + // module can only be uninstalled if there are no dependencies on it + let dependents = DEPENDENTS.may_load(deps.storage, &module_id)?; + if let Some(dependents) = dependents { + if !dependents.is_empty() { + return Err(AccountError::ModuleHasDependents(Vec::from_iter( + dependents, + ))); + } + // Remove the module from the dependents list + DEPENDENTS.remove(deps.storage, &module_id); + } + + // Remove module as dependant from its dependencies. + let module_data = crate::versioning::load_module_data(deps.as_ref(), &module_id)?; + let module_dependencies = module_data.dependencies; + crate::versioning::remove_as_dependent(deps.storage, &module_id, module_dependencies)?; + + // Remove for proxy if needed + let config = CONFIG.load(deps.storage)?; + let vc = VersionControlContract::new(config.version_control_address); + + let module = vc.query_module( + ModuleInfo::from_id(&module_data.module, module_data.version.into())?, + &deps.querier, + )?; + + // Remove module from whitelist if it supposed to be removed + if module.should_be_whitelisted() { + _remove_whitelist_module(deps.branch(), module_id.clone())?; + } + ACCOUNT_MODULES.remove(deps.storage, &module_id); + + let response = AccountResponse::new("uninstall_module", vec![("module", &module_id)]); + Ok(response) +} + +/// Execute the [`exec_msg`] on the provided [`module_id`], +pub fn exec_on_module( + deps: DepsMut, + info: MessageInfo, + module_id: String, + exec_msg: Binary, +) -> AccountResult { + // only owner can forward messages to modules + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + let module_addr = load_module_addr(deps.storage, &module_id)?; + + let response = AccountResponse::new("exec_on_module", vec![("module", module_id)]).add_message( + CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: module_addr.into(), + msg: exec_msg, + funds: info.funds, + }), + ); + + Ok(response) +} + +/// Checked load of a module address +pub fn load_module_addr(storage: &dyn Storage, module_id: &String) -> AccountResult { + ACCOUNT_MODULES + .may_load(storage, module_id)? + .ok_or_else(|| AccountError::ModuleNotFound(module_id.clone())) +} + +/// Query Version Control for the [`Module`] given the provided [`ContractVersion`] +pub fn query_module( + deps: Deps, + module_info: ModuleInfo, + old_contract_version: Option, +) -> Result { + let config = CONFIG.load(deps.storage)?; + // Construct feature object to access registry functions + let version_control = VersionControlContract::new(config.version_control_address); + + let module = match &module_info.version { + ModuleVersion::Version(new_version) => { + let old_contract = old_contract_version.unwrap(); + + let new_version = new_version.parse::().unwrap(); + let old_version = old_contract.version.parse::().unwrap(); + + if new_version < old_version { + return Err(AccountError::OlderVersion( + new_version.to_string(), + old_version.to_string(), + )); + } + Module { + info: module_info.clone(), + reference: version_control + .query_module_reference_raw(&module_info, &deps.querier)?, + } + } + ModuleVersion::Latest => { + // Query latest version of contract + version_control.query_module(module_info.clone(), &deps.querier)? + } + }; + + Ok(ModuleResponse { + module: Module { + info: module.info, + reference: module.reference, }, - vec![], - )? - .into()) + config: version_control.query_config(module_info, &deps.querier)?, + }) +} + +#[inline(always)] +fn configure_adapter( + adapter_address: impl Into, + message: AdapterBaseMsg, +) -> StdResult { + let adapter_msg: AdapterExecMsg = BaseExecuteMsg { + proxy_address: None, + msg: message, + } + .into(); + Ok(wasm_execute(adapter_address, &adapter_msg, vec![])?.into()) +} + +/// Add a contract to the whitelist +fn _whitelist_modules(deps: DepsMut, modules: Vec) -> AccountResult<()> { + let mut whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + + // This is a limit to prevent potentially running out of gas when doing lookups on the modules list + if whitelisted_modules.0.len() >= LIST_SIZE_LIMIT { + return Err(AccountError::ModuleLimitReached {}); + } + + for module in modules.iter() { + let module_addr = deps.api.addr_validate(module)?; + + if whitelisted_modules.0.contains(&module_addr) { + return Err(AccountError::AlreadyWhitelisted(module.clone())); + } + + // Add contract to whitelist. + whitelisted_modules.0.push(module_addr); + } + + WHITELISTED_MODULES.save(deps.storage, &whitelisted_modules)?; + + Ok(()) +} + +/// Remove a contract from the whitelist +fn _remove_whitelist_module(deps: DepsMut, module: String) -> AccountResult<()> { + WHITELISTED_MODULES.update(deps.storage, |mut whitelisted_modules| { + let module_address = deps.api.addr_validate(&module)?; + + if !whitelisted_modules.0.contains(&module_address) { + return Err(AccountError::NotWhitelisted(module.clone())); + } + // Remove contract from whitelist. + whitelisted_modules.0.retain(|addr| *addr != module_address); + Ok(whitelisted_modules) + })?; + + Ok(()) } diff --git a/framework/contracts/account/account/src/modules/migration.rs b/framework/contracts/account/account/src/modules/migration.rs new file mode 100644 index 0000000000..f6629b3ad3 --- /dev/null +++ b/framework/contracts/account/account/src/modules/migration.rs @@ -0,0 +1,292 @@ +use abstract_std::{ + account::{ + msgs::CallbackMsg, + state::{ACCOUNT_MODULES, CONFIG}, + ExecuteMsg, + }, + adapter::{ + AdapterBaseMsg, AuthorizedAddressesResponse, BaseQueryMsg, QueryMsg as AdapterQuery, + }, + objects::{ + dependency::Dependency, + module::ModuleInfo, + module_reference::ModuleReference, + ownership::{self}, + version_control::VersionControlContract, + }, + ACCOUNT, +}; +use cosmwasm_std::{ + ensure, to_json_binary, wasm_execute, Addr, Binary, CosmosMsg, DepsMut, Empty, Env, + MessageInfo, StdResult, Storage, WasmMsg, +}; +use cw2::get_contract_version; +use cw_storage_plus::Item; + +use super::{ + _remove_whitelist_module, _whitelist_modules, configure_adapter, load_module_addr, + query_module, update_module_addresses, +}; +use crate::{ + contract::{AccountResponse, AccountResult}, + error::AccountError, + queries::query_module_version, +}; + +pub const MIGRATE_CONTEXT: Item)>> = Item::new("context"); + +/// Migrate modules through address updates or contract migrations +/// The dependency store is updated during migration +/// A reply message is called after performing all the migrations which ensures version compatibility of the new state. +/// Migrations are performed in-order and should be done in a top-down approach. +pub fn upgrade_modules( + mut deps: DepsMut, + env: Env, + info: MessageInfo, + modules: Vec<(ModuleInfo, Option)>, +) -> AccountResult { + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + ensure!(!modules.is_empty(), AccountError::NoUpdates {}); + + let mut upgrade_msgs = vec![]; + + let mut manager_migrate_info = None; + + let mut upgraded_module_ids = Vec::new(); + + // Set the migrate messages for each module that's not the manager and update the dependency store + for (module_info, migrate_msg) in modules { + let module_id = module_info.id(); + + // Check for duplicates + if upgraded_module_ids.contains(&module_id) { + return Err(AccountError::DuplicateModuleMigration { module_id }); + } else { + upgraded_module_ids.push(module_id.clone()); + } + + if module_id == ACCOUNT { + manager_migrate_info = Some((module_info, migrate_msg)); + } else { + set_migrate_msgs_and_context( + deps.branch(), + module_info, + migrate_msg, + &mut upgrade_msgs, + )?; + } + } + + // Upgrade the manager last + if let Some((manager_info, manager_migrate_msg)) = manager_migrate_info { + upgrade_msgs.push(self_upgrade_msg( + deps.branch(), + &env.contract.address, + manager_info, + manager_migrate_msg.unwrap_or_default(), + )?); + } + + let callback_msg = wasm_execute( + env.contract.address, + &ExecuteMsg::Callback(CallbackMsg {}), + vec![], + )?; + + Ok(AccountResponse::new( + "upgrade_modules", + vec![("upgraded_modules", upgraded_module_ids.join(","))], + ) + .add_messages(upgrade_msgs) + .add_message(callback_msg)) +} +pub fn set_migrate_msgs_and_context( + deps: DepsMut, + module_info: ModuleInfo, + migrate_msg: Option, + msgs: &mut Vec, +) -> Result<(), AccountError> { + let config = CONFIG.load(deps.storage)?; + let version_control = VersionControlContract::new(config.version_control_address); + + let old_module_addr = load_module_addr(deps.storage, &module_info.id())?; + let old_module_cw2 = + query_module_version(deps.as_ref(), old_module_addr.clone(), &version_control)?; + let requested_module = query_module(deps.as_ref(), module_info.clone(), Some(old_module_cw2))?; + + let migrate_msgs = match requested_module.module.reference { + // upgrading an adapter is done by moving the authorized addresses to the new contract address and updating the permissions on the proxy. + ModuleReference::Adapter(new_adapter_addr) => handle_adapter_migration( + deps, + requested_module.module.info, + old_module_addr, + new_adapter_addr, + )?, + ModuleReference::App(code_id) => handle_app_migration( + deps, + migrate_msg, + old_module_addr, + requested_module.module.info, + code_id, + )?, + ModuleReference::AccountBase(code_id) | ModuleReference::Standalone(code_id) => { + vec![build_module_migrate_msg( + old_module_addr, + code_id, + migrate_msg.unwrap(), + )] + } + + _ => return Err(AccountError::NotUpgradeable(module_info)), + }; + msgs.extend(migrate_msgs); + Ok(()) +} + +/// Handle Adapter module migration and return the migration messages +pub fn handle_adapter_migration( + mut deps: DepsMut, + module_info: ModuleInfo, + old_adapter_addr: Addr, + new_adapter_addr: Addr, +) -> AccountResult> { + let module_id = module_info.id(); + crate::versioning::assert_migrate_requirements( + deps.as_ref(), + &module_id, + module_info.version.try_into()?, + )?; + let old_deps = crate::versioning::load_module_dependencies(deps.as_ref(), &module_id)?; + // Update the address of the adapter internally + update_module_addresses( + deps.branch(), + Some(vec![(module_id.clone(), new_adapter_addr.to_string())]), + None, + )?; + + add_module_upgrade_to_context(deps.storage, &module_id, old_deps)?; + + replace_adapter(deps, new_adapter_addr, old_adapter_addr) +} + +/// Handle app module migration and return the migration messages +pub fn handle_app_migration( + deps: DepsMut, + migrate_msg: Option, + old_module_addr: Addr, + module_info: ModuleInfo, + code_id: u64, +) -> AccountResult> { + let module_id = module_info.id(); + crate::versioning::assert_migrate_requirements( + deps.as_ref(), + &module_id, + module_info.version.try_into()?, + )?; + let old_deps = crate::versioning::load_module_dependencies(deps.as_ref(), &module_id)?; + + // Add module upgrade to reply context + add_module_upgrade_to_context(deps.storage, &module_id, old_deps)?; + + Ok(vec![build_module_migrate_msg( + old_module_addr, + code_id, + migrate_msg.unwrap_or_else(|| to_json_binary(&Empty {}).unwrap()), + )]) +} + +/// Add the module upgrade to the migration context and check for duplicates +fn add_module_upgrade_to_context( + storage: &mut dyn Storage, + module_id: &str, + module_deps: Vec, +) -> Result<(), AccountError> { + // Add module upgrade to reply context + let update_context = |mut upgraded_modules: Vec<(String, Vec)>| -> StdResult)>> { + upgraded_modules.push((module_id.to_string(), module_deps)); + Ok(upgraded_modules) + }; + MIGRATE_CONTEXT.update(storage, update_context)?; + + Ok(()) +} + +// migrates the module to a new version +pub(crate) fn build_module_migrate_msg( + module_addr: Addr, + new_code_id: u64, + migrate_msg: Binary, +) -> CosmosMsg { + let migration_msg: CosmosMsg = CosmosMsg::Wasm(WasmMsg::Migrate { + contract_addr: module_addr.into_string(), + new_code_id, + msg: migrate_msg, + }); + migration_msg +} + +/// Replaces the current adapter with a different version +/// Also moves all the authorized address permissions to the new contract and removes them from the old +pub fn replace_adapter( + mut deps: DepsMut, + new_adapter_addr: Addr, + old_adapter_addr: Addr, +) -> Result, AccountError> { + let mut msgs = vec![]; + // Makes sure we already have the adapter installed + let proxy_addr = ACCOUNT_MODULES.load(deps.storage, ACCOUNT)?; + let AuthorizedAddressesResponse { + addresses: authorized_addresses, + } = deps.querier.query_wasm_smart( + old_adapter_addr.to_string(), + &>::Base(BaseQueryMsg::AuthorizedAddresses { + proxy_address: proxy_addr.to_string(), + }), + )?; + let authorized_to_migrate: Vec = authorized_addresses + .into_iter() + .map(|addr| addr.into_string()) + .collect(); + // Remove authorized addresses + msgs.push(configure_adapter( + &old_adapter_addr, + AdapterBaseMsg::UpdateAuthorizedAddresses { + to_add: vec![], + to_remove: authorized_to_migrate.clone(), + }, + )?); + // Add authorized addresses to new + msgs.push(configure_adapter( + &new_adapter_addr, + AdapterBaseMsg::UpdateAuthorizedAddresses { + to_add: authorized_to_migrate, + to_remove: vec![], + }, + )?); + // Remove adapter permissions from proxy + _remove_whitelist_module(deps.branch(), old_adapter_addr.into_string())?; + // Add new adapter to proxy + _whitelist_modules(deps.branch(), vec![new_adapter_addr.into_string()])?; + + Ok(msgs) +} + +pub(crate) fn self_upgrade_msg( + deps: DepsMut, + self_addr: &Addr, + module_info: ModuleInfo, + migrate_msg: Binary, +) -> AccountResult { + let contract = get_contract_version(deps.storage)?; + let module = query_module(deps.as_ref(), module_info.clone(), Some(contract))?; + if let ModuleReference::AccountBase(manager_code_id) = module.module.reference { + let migration_msg: CosmosMsg = CosmosMsg::Wasm(WasmMsg::Migrate { + contract_addr: self_addr.to_string(), + new_code_id: manager_code_id, + msg: migrate_msg, + }); + Ok(migration_msg) + } else { + Err(AccountError::InvalidReference(module_info)) + } +} diff --git a/framework/contracts/account/account/src/queries.rs b/framework/contracts/account/account/src/queries.rs new file mode 100644 index 0000000000..b7c68a8048 --- /dev/null +++ b/framework/contracts/account/account/src/queries.rs @@ -0,0 +1,197 @@ +use std::collections::BTreeMap; + +use abstract_sdk::feature_objects::VersionControlContract; +use abstract_std::{ + account::{ + responses::{ + ConfigResponse, InfoResponse, ManagerModuleInfo, ModuleAddressesResponse, + ModuleInfosResponse, ModuleVersionsResponse, SubAccountIdsResponse, + }, + state::{AccountInfo, ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, INFO}, + state::{Config, SUB_ACCOUNTS, SUSPENSION_STATUS}, + }, + objects::{ + gov_type::TopLevelOwnerResponse, + module::{self, ModuleInfo}, + ownership::nested_admin::query_top_level_owner_addr, + }, +}; +use cosmwasm_std::{to_json_binary, Addr, Binary, Deps, Env, Order, StdError, StdResult}; +use cw2::ContractVersion; +use cw_storage_plus::Bound; + +const DEFAULT_LIMIT: u8 = 5; +const MAX_LIMIT: u8 = 10; + +pub fn handle_module_address_query(deps: Deps, env: Env, ids: Vec) -> StdResult { + let contracts = query_module_addresses(deps, &env.contract.address, ids)?; + let vector = contracts.into_iter().collect(); + to_json_binary(&ModuleAddressesResponse { modules: vector }) +} + +pub fn handle_contract_versions_query(deps: Deps, env: Env, ids: Vec) -> StdResult { + let response = query_module_versions(deps, &env.contract.address, ids)?; + let versions = response.into_values().collect(); + to_json_binary(&ModuleVersionsResponse { versions }) +} + +pub fn handle_account_info_query(deps: Deps) -> StdResult { + let info: AccountInfo = INFO.load(deps.storage)?; + to_json_binary(&InfoResponse { info }) +} + +pub fn handle_config_query(deps: Deps) -> StdResult { + let account_id = ACCOUNT_ID.load(deps.storage)?; + let Config { + version_control_address, + module_factory_address, + .. + } = CONFIG.load(deps.storage)?; + let is_suspended = SUSPENSION_STATUS.load(deps.storage)?; + to_json_binary(&ConfigResponse { + account_id, + is_suspended, + version_control_address, + module_factory_address, + modules: ACCOUNT_MODULES + .keys(deps.storage, None, None, Order::Ascending) + .collect::>()?, + }) +} + +pub fn handle_module_info_query( + deps: Deps, + last_module_id: Option, + limit: Option, +) -> StdResult { + let limit = limit.unwrap_or(DEFAULT_LIMIT).min(MAX_LIMIT) as usize; + let start_bound = last_module_id.as_deref().map(Bound::exclusive); + + let res: Result, _> = ACCOUNT_MODULES + .range(deps.storage, start_bound, None, Order::Ascending) + .take(limit) + .collect(); + + let ids_and_addr = res?; + + let config = CONFIG.load(deps.storage)?; + let version_control = VersionControlContract::new(config.version_control_address); + + let mut resp_vec: Vec = vec![]; + for (id, address) in ids_and_addr.into_iter() { + let version = query_module_version(deps, address.clone(), &version_control)?; + resp_vec.push(ManagerModuleInfo { + id, + version, + address, + }) + } + + to_json_binary(&ModuleInfosResponse { + module_infos: resp_vec, + }) +} + +pub fn handle_sub_accounts_query( + deps: Deps, + last_account_id: Option, + limit: Option, +) -> StdResult { + let limit = limit.unwrap_or(DEFAULT_LIMIT).min(MAX_LIMIT) as usize; + let start_bound = last_account_id.map(Bound::exclusive); + + let res = SUB_ACCOUNTS + .keys(deps.storage, start_bound, None, Order::Ascending) + .take(limit) + .collect::>>()?; + + to_json_binary(&SubAccountIdsResponse { sub_accounts: res }) +} + +pub fn handle_top_level_owner_query(deps: Deps, env: Env) -> StdResult { + let addr = query_top_level_owner_addr(&deps.querier, env.contract.address)?; + + to_json_binary(&TopLevelOwnerResponse { address: addr }) +} + +/// RawQuery the version of an enabled module +pub fn query_module_version( + deps: Deps, + module_addr: Addr, + version_control: &VersionControlContract, +) -> StdResult { + if let Ok(info) = cw2::query_contract_info(&deps.querier, module_addr.to_string()) { + // Check if it's abstract format and return now + if ModuleInfo::from_id( + &info.contract, + module::ModuleVersion::Version(info.version.clone()), + ) + .is_ok() + { + return Ok(info); + } + } + // Right now we have either + // - failed cw2 query + // - the query succeeded but the cw2 name doesn't adhere to our formatting standards + // + // Which means this contract is a standalone or service contract. Hence we need to get its information from VersionControl. + let module_info = match version_control.query_service_info_raw(&module_addr, &deps.querier) { + // We got service + Ok(module_info) => module_info, + // Didn't got service, let's try to get standalone + Err(_) => { + let code_id = deps + .querier + .query_wasm_contract_info(module_addr.to_string())? + .code_id; + version_control + .query_standalone_info_raw(code_id, &deps.querier) + .map_err(|e| StdError::generic_err(e.to_string()))? + } + }; + let version = + ContractVersion::try_from(module_info).map_err(|e| StdError::generic_err(e.to_string()))?; + Ok(version) +} + +/// RawQuery the module versions of the modules part of the Account +/// Errors if not present +pub fn query_module_versions( + deps: Deps, + manager_addr: &Addr, + module_names: Vec, +) -> StdResult> { + let addresses: BTreeMap = + query_module_addresses(deps, manager_addr, module_names)?; + let mut module_versions: BTreeMap = BTreeMap::new(); + + let config = CONFIG.load(deps.storage)?; + let version_control = VersionControlContract::new(config.version_control_address); + for (name, address) in addresses.into_iter() { + let result = query_module_version(deps, address, &version_control)?; + module_versions.insert(name, result); + } + Ok(module_versions) +} + +/// RawQuery module addresses from manager +/// Errors if not present +pub fn query_module_addresses( + deps: Deps, + manager_addr: &Addr, + module_names: Vec, +) -> StdResult> { + let mut modules: BTreeMap = BTreeMap::new(); + + // Query over + for module in module_names { + // Add to map if present, skip otherwise. Allows version control to check what modules are present. + if let Some(address) = + ACCOUNT_MODULES.query(&deps.querier, manager_addr.clone(), &module)? + { + modules.insert(module, address); + } + } + Ok(modules) +} diff --git a/framework/contracts/account/account/src/reply.rs b/framework/contracts/account/account/src/reply.rs new file mode 100644 index 0000000000..1fe927cf57 --- /dev/null +++ b/framework/contracts/account/account/src/reply.rs @@ -0,0 +1,71 @@ +use crate::{ + contract::{AccountResponse, AccountResult}, + modules::INSTALL_MODULES_CONTEXT, +}; +use abstract_std::objects::{ + module::{assert_module_data_validity, Module}, + module_reference::ModuleReference, +}; +use cosmwasm_std::{DepsMut, Reply, Response, StdError}; + +/// Add the message's data to the response +pub fn forward_response_data(result: Reply) -> AccountResult { + // get the result from the reply + let res = result.result.into_result().map_err(StdError::generic_err)?; + + // log and add data if needed + #[allow(deprecated)] + let resp = if let Some(data) = res.data { + AccountResponse::new( + "forward_response_data_reply", + vec![("response_data", "true")], + ) + .set_data(data) + } else { + AccountResponse::new( + "forward_response_data_reply", + vec![("response_data", "false")], + ) + }; + + Ok(resp) +} + +/// Adds the modules dependencies +pub(crate) fn register_dependencies(deps: DepsMut) -> AccountResult { + let modules = INSTALL_MODULES_CONTEXT.load(deps.storage)?; + + for (module, module_addr) in &modules { + assert_module_data_validity(&deps.querier, module, module_addr.clone())?; + + match module { + Module { + reference: ModuleReference::App(_), + info, + } + | Module { + reference: ModuleReference::Adapter(_), + info, + } => { + let id = info.id(); + // assert version requirements + let dependencies = + crate::versioning::assert_install_requirements(deps.as_ref(), &id)?; + crate::versioning::set_as_dependent(deps.storage, id, dependencies)?; + } + Module { + reference: ModuleReference::Standalone(_), + info, + } => { + let id = info.id(); + // assert version requirements + let dependencies = + crate::versioning::assert_install_requirements_standalone(deps.as_ref(), &id)?; + crate::versioning::set_as_dependent(deps.storage, id, dependencies)?; + } + _ => (), + }; + } + + Ok(Response::new()) +} diff --git a/framework/contracts/account/account/src/sub_account.rs b/framework/contracts/account/account/src/sub_account.rs new file mode 100644 index 0000000000..48a1913001 --- /dev/null +++ b/framework/contracts/account/account/src/sub_account.rs @@ -0,0 +1,170 @@ +use abstract_std::{ + account::{ + state::{ACCOUNT_ID, CONFIG, SUB_ACCOUNTS}, + types::UpdateSubAccountAction, + ExecuteMsg, ModuleInstallConfig, + }, + objects::{ + gov_type::GovernanceDetails, + module::ModuleInfo, + ownership::{self, GovOwnershipError}, + AccountId, + }, +}; +use cosmwasm_std::{wasm_execute, Attribute, CosmosMsg, DepsMut, Empty, Env, MessageInfo}; + +use crate::{ + contract::{AccountResponse, AccountResult}, + error::AccountError, + modules::query_module, +}; +#[allow(clippy::too_many_arguments)] +/// Creates a sub-account for this account, +pub fn create_sub_account( + deps: DepsMut, + info: MessageInfo, + env: Env, + name: String, + description: Option, + link: Option, + namespace: Option, + install_modules: Vec, + account_id: Option, +) -> AccountResult { + // only owner can create a subaccount + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + let create_account_msg = &abstract_std::account_factory::ExecuteMsg::CreateAccount { + // proxy of this manager will be the account owner + governance: GovernanceDetails::SubAccount { + account: env.contract.address.into_string(), + }, + name, + description, + link, + namespace, + install_modules, + account_id: account_id.map(AccountId::local), + }; + + let account_factory_addr = query_module( + deps.as_ref(), + ModuleInfo::from_id_latest(abstract_std::ACCOUNT_FACTORY)?, + None, + )? + .module + .reference + .unwrap_native()?; + + // Call factory and attach all funds that were provided. + let account_creation_message = + wasm_execute(account_factory_addr, create_account_msg, info.funds)?; + + let response = AccountResponse::new::<_, Attribute>("create_sub_account", vec![]) + .add_message(account_creation_message); + + Ok(response) +} + +pub fn handle_sub_account_action( + deps: DepsMut, + info: MessageInfo, + action: UpdateSubAccountAction, +) -> AccountResult { + match action { + UpdateSubAccountAction::UnregisterSubAccount { id } => { + unregister_sub_account(deps, info, id) + } + UpdateSubAccountAction::RegisterSubAccount { id } => register_sub_account(deps, info, id), + _ => unimplemented!(), + } +} + +// Unregister sub-account from the state +fn unregister_sub_account(deps: DepsMut, info: MessageInfo, id: u32) -> AccountResult { + let config = CONFIG.load(deps.storage)?; + + let account = abstract_std::version_control::state::ACCOUNT_ADDRESSES.query( + &deps.querier, + config.version_control_address, + &AccountId::local(id), + )?; + + if account.is_some_and(|a| a.addr() == info.sender) { + SUB_ACCOUNTS.remove(deps.storage, id); + + Ok(AccountResponse::new( + "unregister_sub_account", + vec![("sub_account_removed", id.to_string())], + )) + } else { + Err(AccountError::SubAccountRemovalFailed {}) + } +} + +// Register sub-account to the state +fn register_sub_account(deps: DepsMut, info: MessageInfo, id: u32) -> AccountResult { + let config = CONFIG.load(deps.storage)?; + + let account = abstract_std::version_control::state::ACCOUNT_ADDRESSES.query( + &deps.querier, + config.version_control_address, + &AccountId::local(id), + )?; + + if account.is_some_and(|a| a.addr() == info.sender) { + SUB_ACCOUNTS.save(deps.storage, id, &Empty {})?; + + Ok(AccountResponse::new( + "register_sub_account", + vec![("sub_account_added", id.to_string())], + )) + } else { + Err(AccountError::SubAccountRegisterFailed {}) + } +} + +/// Update governance of sub_accounts account after claim +pub fn maybe_update_sub_account_governance(deps: DepsMut) -> AccountResult> { + let mut msgs = vec![]; + let mut account_id = None; + let ownership = ownership::get_ownership(deps.storage)?; + // Get pending governance + let pending_governance = ownership + .pending_owner + .ok_or(GovOwnershipError::TransferNotFound)?; + + // Clear state for previous manager if it was sub-account + if let GovernanceDetails::SubAccount { account } = ownership.owner { + let id = ACCOUNT_ID.load(deps.storage)?; + let unregister_message = wasm_execute( + account, + &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::UnregisterSubAccount { + id: id.seq(), + }), + vec![], + )?; + // For optimizing the gas we save it, in case new owner is sub-account as well + account_id = Some(id); + msgs.push(unregister_message.into()); + } + + // Update state for new manager if owner will be the sub-account + if let GovernanceDetails::SubAccount { account } = &pending_governance { + let id = if let Some(id) = account_id { + id + } else { + ACCOUNT_ID.load(deps.storage)? + }; + let register_message = wasm_execute( + account, + &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::RegisterSubAccount { + id: id.seq(), + }), + vec![], + )?; + msgs.push(register_message.into()); + } + + Ok(msgs) +} diff --git a/framework/contracts/account/account/src/versioning.rs b/framework/contracts/account/account/src/versioning.rs new file mode 100644 index 0000000000..88cd9f41fd --- /dev/null +++ b/framework/contracts/account/account/src/versioning.rs @@ -0,0 +1,281 @@ +use abstract_std::{ + account::state::{ACCOUNT_MODULES, DEPENDENTS}, + objects::{ + dependency::Dependency, + module_version::{ModuleData, MODULE}, + }, +}; +use cosmwasm_std::{Deps, DepsMut, StdError, Storage}; +use semver::{Comparator, Version}; + +use crate::{contract::AccountResult, error::AccountError, modules::MIGRATE_CONTEXT}; + +/// Assert the dependencies that this app or adapter relies on are installed. +pub fn assert_install_requirements(deps: Deps, module_id: &str) -> AccountResult> { + let module_dependencies = load_module_dependencies(deps, module_id)?; + assert_dependency_requirements(deps, &module_dependencies, module_id)?; + Ok(module_dependencies) +} + +/// Assert the dependencies that this standalone relies on are installed. +pub fn assert_install_requirements_standalone( + deps: Deps, + module_id: &str, +) -> AccountResult> { + // For standalones dependencies in state are optional + let module_dependencies = load_module_dependencies(deps, module_id).unwrap_or_default(); + assert_dependency_requirements(deps, &module_dependencies, module_id)?; + Ok(module_dependencies) +} + +/// Assert that the new version of this app is supported by its dependents. +/// Unless that dependent is also being migrated. +pub fn assert_migrate_requirements( + deps: Deps, + module_id: &str, + new_version: Version, +) -> AccountResult<()> { + // load all the modules that depend on this module + let dependents = DEPENDENTS + .may_load(deps.storage, module_id)? + .unwrap_or_default(); + let migrating = MIGRATE_CONTEXT.load(deps.storage)?; + // for each module that depends on this module, check if it supports the new version. + for dependent_module in dependents { + // if the dependent is also being migrated, skip it. + if migrating.iter().any(|(m, _)| m == &dependent_module) { + continue; + } + let dependent_address = ACCOUNT_MODULES.load(deps.storage, &dependent_module)?; + let module_data = MODULE.query(&deps.querier, dependent_address)?; + // filter the dependencies and assert version comparison when applicable + let mut applicable_bounds = module_data + .dependencies + .iter() + .filter(|dep| dep.id == module_id); + // assert bounds + applicable_bounds.try_for_each(|dep| { + assert_comparators(&dep.version_req, &new_version, module_id, false) + })?; + } + Ok(()) +} + +/// Add module as dependent on its dependencies. +/// For example, Autocompounder depends on dex. +/// Therefore, autocompounder is added as a dependent on dex. +/// dex -> Autocompounder +pub fn set_as_dependent( + store: &mut dyn Storage, + module_id: String, + dependencies: Vec, +) -> AccountResult<()> { + for dep in dependencies { + DEPENDENTS.update(store, &dep.id, |dependents| { + let mut dependents = dependents.unwrap_or_default(); + dependents.insert(module_id.clone()); + Ok::<_, StdError>(dependents) + })?; + } + Ok(()) +} + +/// Remove a module as dependent on its dependencies +/// For example, Autocompounder depends on dex. +/// We are uninstalling autocompounder, so we remove it from the dependents of dex. +pub fn remove_as_dependent( + store: &mut dyn Storage, + module_id: &str, + dependencies: Vec, +) -> AccountResult<()> { + for dep in dependencies { + DEPENDENTS.update(store, &dep.id, |dependents| { + let mut dependents = dependents.unwrap_or_default(); + dependents.remove(module_id); + Ok::<_, StdError>(dependents) + })?; + } + Ok(()) +} + +fn assert_comparators( + bounds: &[Comparator], + version: &Version, + module_id: &str, + post_migration: bool, +) -> AccountResult<()> { + // assert requirements + bounds.iter().try_for_each(|comp: &Comparator| { + if comp.matches(version) { + Ok(()) + } else { + Err(AccountError::VersionRequirementNotMet { + module_id: module_id.to_string(), + version: version.to_string(), + comp: comp.to_string(), + post_migration, + }) + } + })?; + Ok(()) +} + +/// Goes over all the provided dependencies and asserts that: +/// 1. The dependency is installed +/// 2. The dependency version fits the requirements +pub fn assert_dependency_requirements( + deps: Deps, + dependencies: &[Dependency], + dependent: &str, +) -> AccountResult<()> { + for dep in dependencies { + let dep_addr = ACCOUNT_MODULES + .may_load(deps.storage, &dep.id)? + .ok_or_else(|| AccountError::DependencyNotMet(dep.id.clone(), dependent.to_string()))?; + + let dep_version = cw2::CONTRACT.query(&deps.querier, dep_addr)?; + let version: Version = dep_version.version.parse().unwrap(); + // assert requirements + assert_comparators(&dep.version_req, &version, &dep.id, true)?; + } + Ok(()) +} + +pub fn load_module_data(deps: Deps, module_id: &str) -> AccountResult { + let querier = &deps.querier; + let module_addr = ACCOUNT_MODULES.load(deps.storage, module_id)?; + let module_data = MODULE.query(querier, module_addr)?; + Ok(module_data) +} + +pub fn load_module_dependencies(deps: Deps, module_id: &str) -> AccountResult> { + let module_data = load_module_data(deps, module_id)?; + Ok(module_data.dependencies) +} + +pub fn maybe_remove_old_deps( + deps: DepsMut, + module_id: &str, + old_deps: &[Dependency], +) -> AccountResult<()> { + let new_deps = load_module_dependencies(deps.as_ref(), module_id)?; + // find deps that are no longer required. + // ie. the old deps contain a deps that the new deps doesn't. + let removable_deps: Vec<&Dependency> = + old_deps.iter().filter(|d| !new_deps.contains(d)).collect(); + for dep_to_remove in removable_deps { + // Remove module from dependents on the removable dep + DEPENDENTS.update(deps.storage, &dep_to_remove.id, |dependents| { + // Migrating so hashset should be saved and contain the module ID. + let mut dependents = dependents.unwrap(); + dependents.remove(module_id); + Ok::<_, StdError>(dependents) + })?; + } + Ok(()) +} + +pub fn maybe_add_new_deps( + deps: DepsMut, + module_id: &str, + old_deps: &[Dependency], +) -> AccountResult> { + let new_deps = load_module_dependencies(deps.as_ref(), module_id)?; + // find deps that are new. + // the new deps contain deps that were not in the old deps. + let to_be_added_deps: Vec<&Dependency> = + new_deps.iter().filter(|d| !old_deps.contains(d)).collect(); + for dep_to_add in &to_be_added_deps { + // Add module as dependent on the new deps + // Will also run when a version requirement is changed. + DEPENDENTS.update(deps.storage, &dep_to_add.id, |dependents| { + // Adding new dep so might be the first entry, hence default to empty set in that case. + let mut dependents = dependents.unwrap_or_default(); + dependents.insert(module_id.to_string()); + Ok::<_, StdError>(dependents) + })?; + } + Ok(new_deps) +} + +#[cfg(test)] +mod test { + #![allow(clippy::needless_borrows_for_generic_args)] + use std::collections::HashSet; + + use cosmwasm_std::testing::mock_dependencies; + use speculoos::prelude::*; + + use super::*; + + mod set_as_dependent { + use super::*; + + // This should add dependency -> [module] to the map + #[test] + fn add() { + let mut deps = mock_dependencies(); + let new_module_id = "module"; + + let dependency = "dependency"; + let dependencies = vec![Dependency { + id: dependency.to_string(), + // no version requirements + version_req: vec![], + }]; + + set_as_dependent(&mut deps.storage, new_module_id.to_string(), dependencies).unwrap(); + + let dependents = DEPENDENTS.load(&deps.storage, dependency).unwrap(); + + assert_that(&dependents).has_length(1); + assert_that(&dependents).contains(new_module_id.to_string()); + } + } + + mod remove_as_dependent { + use super::*; + + fn initialize_dependents(deps: DepsMut, module_id: &str, dependents: Vec) { + DEPENDENTS + .save(deps.storage, module_id, &HashSet::from_iter(dependents)) + .unwrap(); + } + + // autocompounder depends on dex + // dex -> autocompounder + // to uninstall autocompounder, remove dex + #[test] + fn remove() { + let mut deps = mock_dependencies(); + + let dex_adapter = "dex"; + let autocompounder = "autocompounder"; + + // dex -> autocompounder + initialize_dependents(deps.as_mut(), dex_adapter, vec![autocompounder.to_string()]); + + let actual_dex_dependents = DEPENDENTS.load(&deps.storage, dex_adapter).unwrap(); + assert_that(&actual_dex_dependents).has_length(1); + assert_that(&actual_dex_dependents).contains(autocompounder.to_string()); + + // the autocompounder depends on the dex + let autocompounder_dependencies = vec![Dependency { + id: dex_adapter.to_string(), + // no version requirements + version_req: vec![], + }]; + + let res = remove_as_dependent( + &mut deps.storage, + autocompounder, + autocompounder_dependencies, + ); + + assert_that(&res).is_ok(); + + let remaining_dex_dependents = DEPENDENTS.load(&deps.storage, dex_adapter).unwrap(); + assert_that(&remaining_dex_dependents).is_empty(); + } + } +} diff --git a/framework/contracts/account/manager/src/commands.rs b/framework/contracts/account/manager/src/commands.rs index 71abfb098a..dd2f9be9a3 100644 --- a/framework/contracts/account/manager/src/commands.rs +++ b/framework/contracts/account/manager/src/commands.rs @@ -1,17 +1,18 @@ use abstract_macros::abstract_response; use abstract_sdk::cw_helpers::AbstractAttributes; use abstract_std::{ - adapter::{ - AdapterBaseMsg, AuthorizedAddressesResponse, BaseExecuteMsg, BaseQueryMsg, - ExecuteMsg as AdapterExecMsg, QueryMsg as AdapterQuery, - }, - manager::{ + account::{state::ACCOUNT_ID, ExecuteMsg as ProxyMsg}, + account::{ state::{ AccountInfo, SuspensionStatus, ACCOUNT_MODULES, CONFIG, DEPENDENTS, INFO, SUB_ACCOUNTS, SUSPENSION_STATUS, }, CallbackMsg, ExecuteMsg, InternalConfigAction, ModuleInstallConfig, UpdateSubAccountAction, }, + adapter::{ + AdapterBaseMsg, AuthorizedAddressesResponse, BaseExecuteMsg, BaseQueryMsg, + ExecuteMsg as AdapterExecMsg, QueryMsg as AdapterQuery, + }, module_factory::{ExecuteMsg as ModuleFactoryMsg, FactoryModuleInstallConfig}, objects::{ dependency::Dependency, @@ -24,7 +25,6 @@ use abstract_std::{ version_control::VersionControlContract, AccountId, }, - proxy::{state::ACCOUNT_ID, ExecuteMsg as ProxyMsg}, version_control::ModuleResponse, ACCOUNT, }; @@ -44,9 +44,6 @@ use crate::{ pub const REGISTER_MODULES_DEPENDENCIES: u64 = 1; -#[abstract_response(ACCOUNT)] -pub struct ManagerResponse; - pub const MIGRATE_CONTEXT: Item)>> = Item::new("context"); pub(crate) const INSTALL_MODULES_CONTEXT: Item)>> = Item::new("icontext"); @@ -83,142 +80,6 @@ pub fn update_module_addresses( Ok(ManagerResponse::action("update_module_addresses")) } -/// Attempts to install a new module through the Module Factory Contract -pub fn install_modules( - mut deps: DepsMut, - info: MessageInfo, - modules: Vec, -) -> ManagerResult { - // only owner can call this method - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - let config = CONFIG.load(deps.storage)?; - - let (install_msgs, install_attribute) = _install_modules( - deps.branch(), - modules, - config.module_factory_address, - config.version_control_address, - info.funds, // We forward all the funds to the module_factory address for them to use in the install - )?; - let response = ManagerResponse::new("install_modules", std::iter::once(install_attribute)) - .add_submessages(install_msgs); - - Ok(response) -} - -/// Generate message and attribute for installing module -/// Adds the modules to the internal store for reference and adds them to the proxy allowlist if applicable. -pub fn _install_modules( - mut deps: DepsMut, - modules: Vec, - module_factory_address: Addr, - version_control_address: Addr, - funds: Vec, -) -> ManagerResult<(Vec, Attribute)> { - let mut installed_modules = Vec::with_capacity(modules.len()); - let mut manager_modules = Vec::with_capacity(modules.len()); - let account_id = ACCOUNT_ID.load(deps.storage)?; - let version_control = VersionControlContract::new(version_control_address); - - let canonical_module_factory = deps - .api - .addr_canonicalize(module_factory_address.as_str())?; - - let (infos, init_msgs): (Vec<_>, Vec<_>) = - modules.into_iter().map(|m| (m.module, m.init_msg)).unzip(); - let modules = version_control - .query_modules_configs(infos, &deps.querier) - .map_err(|error| ManagerError::QueryModulesFailed { error })?; - - let mut install_context = Vec::with_capacity(modules.len()); - let mut add_to_proxy = Vec::with_capacity(modules.len()); - let mut add_to_manager = Vec::with_capacity(modules.len()); - - let salt: Binary = generate_instantiate_salt(&account_id); - for (ModuleResponse { module, .. }, init_msg) in modules.into_iter().zip(init_msgs) { - // Check if module is already enabled. - if ACCOUNT_MODULES - .may_load(deps.storage, &module.info.id())? - .is_some() - { - return Err(ManagerError::ModuleAlreadyInstalled(module.info.id())); - } - installed_modules.push(module.info.id_with_version()); - - let init_msg_salt = match &module.reference { - ModuleReference::Adapter(module_address) - | ModuleReference::Native(module_address) - | ModuleReference::Service(module_address) => { - if module.should_be_whitelisted() { - add_to_proxy.push(module_address.to_string()); - } - add_to_manager.push((module.info.id(), module_address.to_string())); - install_context.push((module.clone(), None)); - None - } - ModuleReference::App(code_id) | ModuleReference::Standalone(code_id) => { - let checksum = deps.querier.query_wasm_code_info(*code_id)?.checksum; - let module_address = cosmwasm_std::instantiate2_address( - checksum.as_slice(), - &canonical_module_factory, - &salt, - )?; - let module_address = deps.api.addr_humanize(&module_address)?; - ensure!( - deps.querier - .query_wasm_contract_info(module_address.to_string()) - .is_err(), - ManagerError::ProhibitedReinstall {} - ); - if module.should_be_whitelisted() { - add_to_proxy.push(module_address.to_string()); - } - add_to_manager.push((module.info.id(), module_address.to_string())); - install_context.push((module.clone(), Some(module_address))); - - Some(init_msg.unwrap()) - } - _ => return Err(ManagerError::ModuleNotInstallable(module.info.to_string())), - }; - manager_modules.push(FactoryModuleInstallConfig::new(module.info, init_msg_salt)); - } - - INSTALL_MODULES_CONTEXT.save(deps.storage, &install_context)?; - - let mut messages = vec![]; - - // Add modules to proxy - let proxy_addr = ACCOUNT_MODULES.load(deps.storage, ACCOUNT)?; - if !add_to_proxy.is_empty() { - messages.push(SubMsg::new(add_modules_to_proxy( - proxy_addr.into_string(), - add_to_proxy, - )?)); - }; - - // Update module addrs - update_module_addresses(deps.branch(), Some(add_to_manager), None)?; - - // Install modules message - messages.push(SubMsg::reply_on_success( - wasm_execute( - module_factory_address, - &ModuleFactoryMsg::InstallModules { - modules: manager_modules, - salt, - }, - funds, - )?, - REGISTER_MODULES_DEPENDENCIES, - )); - - Ok(( - messages, - Attribute::new("installed_modules", format!("{installed_modules:?}")), - )) -} - /// Adds the modules dependencies pub(crate) fn register_dependencies(deps: DepsMut, _result: SubMsgResult) -> ManagerResult { let modules = INSTALL_MODULES_CONTEXT.load(deps.storage)?; @@ -936,26 +797,6 @@ pub fn update_account_status( Ok(response) } -/// Allows the owner to manually update the internal configuration of the account. -/// This can be used to unblock the account and its modules in case of a bug/lock on the account. -pub fn update_internal_config(deps: DepsMut, info: MessageInfo, config: Binary) -> ManagerResult { - // deserialize the config action - let action: InternalConfigAction = - from_json(config).map_err(|error| ManagerError::InvalidConfigAction { error })?; - - let (add, remove) = match action { - InternalConfigAction::UpdateModuleAddresses { to_add, to_remove } => (to_add, to_remove), - _ => { - return Err(ManagerError::InvalidConfigAction { - error: StdError::generic_err("Unknown config action"), - }) - } - }; - - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - update_module_addresses(deps, add, remove) -} - #[cfg(test)] mod tests { use super::*; diff --git a/framework/contracts/account/manager/src/contract.rs b/framework/contracts/account/manager/src/contract.rs index 775fd21294..3ec6ec3cd5 100644 --- a/framework/contracts/account/manager/src/contract.rs +++ b/framework/contracts/account/manager/src/contract.rs @@ -22,6 +22,8 @@ use crate::{ queries, versioning, }; +use cr + pub type ManagerResult = Result; pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -239,15 +241,6 @@ pub fn handle_callback(mut deps: DepsMut, env: Env, info: MessageInfo) -> Manage Ok(Response::new()) } -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> ManagerResult { - match msg.id { - commands::REGISTER_MODULES_DEPENDENCIES => { - commands::register_dependencies(deps, msg.result) - } - _ => Err(ManagerError::UnexpectedReply {}), - } -} #[cfg(test)] mod tests { diff --git a/framework/packages/abstract-std/src/account/msgs.rs b/framework/packages/abstract-std/src/account/msgs.rs index 2d373de1d2..25c082c379 100644 --- a/framework/packages/abstract-std/src/account/msgs.rs +++ b/framework/packages/abstract-std/src/account/msgs.rs @@ -36,6 +36,10 @@ pub struct InstantiateMsg { pub ans_host_address: String, } +/// Callback message to set the dependencies after module upgrades. +#[cosmwasm_schema::cw_serde] +pub struct CallbackMsg {} + #[cosmwasm_schema::cw_serde] #[derive(cw_orch::ExecuteFns)] pub enum ExecuteMsg { @@ -107,6 +111,9 @@ pub enum ExecuteMsg { /// accept a pending ownership transfer, or renounce the ownership /// of the account permanently. UpdateOwnership(GovAction), + + /// Callback endpoint + Callback(CallbackMsg), } #[cosmwasm_schema::cw_serde] diff --git a/framework/packages/abstract-std/src/account/responses.rs b/framework/packages/abstract-std/src/account/responses.rs index 37164b3a32..0af6d6155f 100644 --- a/framework/packages/abstract-std/src/account/responses.rs +++ b/framework/packages/abstract-std/src/account/responses.rs @@ -21,10 +21,6 @@ use cw2::ContractVersion; use super::state::AccountInfo; use crate::{account::state::SuspensionStatus, objects::account::AccountId}; -/// Callback message to set the dependencies after module upgrades. -#[cosmwasm_schema::cw_serde] -pub struct CallbackMsg {} - #[cosmwasm_schema::cw_serde] pub struct ModuleVersionsResponse { pub versions: Vec, diff --git a/framework/packages/abstract-std/src/account/state.rs b/framework/packages/abstract-std/src/account/state.rs index c43de71f5a..1758d053f1 100644 --- a/framework/packages/abstract-std/src/account/state.rs +++ b/framework/packages/abstract-std/src/account/state.rs @@ -31,9 +31,10 @@ pub mod namespace { pub const ACCOUNT_MODULES: &str = "d"; pub const DEPENDENTS: &str = "e"; pub const SUB_ACCOUNTS: &str = "f"; + pub const WHITELISTED_MODULES: &str = "g"; } -pub const STATE: Item = Item::new("a"); +pub const WHITELISTED_MODULES: Item = Item::new(namespace::WHITELISTED_MODULES); pub const ADMIN: Admin = Admin::new(ADMIN_NAMESPACE); /// Suspension status @@ -52,6 +53,4 @@ pub const SUB_ACCOUNTS: Map = Map::new(namespace::SUB_ // Additional states, not listed here: cw_gov_ownable::GovOwnership #[cosmwasm_schema::cw_serde] -pub struct State { - pub modules: Vec, -} +pub struct WhitelistedModules(pub Vec); From a07850194a06b94616765b334e3c8e07dba5c1ea Mon Sep 17 00:00:00 2001 From: Kayanski Date: Mon, 9 Sep 2024 16:17:26 +0000 Subject: [PATCH 04/17] Added queries --- .../contracts/account/account/src/contract.rs | 49 ++++++++++++------- .../contracts/account/account/src/error.rs | 2 +- .../contracts/account/account/src/modules.rs | 49 +------------------ .../account/account/src/modules/migration.rs | 26 +++++++++- .../contracts/account/account/src/queries.rs | 17 +++---- 5 files changed, 63 insertions(+), 80 deletions(-) diff --git a/framework/contracts/account/account/src/contract.rs b/framework/contracts/account/account/src/contract.rs index 624d39f374..30556fd5f4 100644 --- a/framework/contracts/account/account/src/contract.rs +++ b/framework/contracts/account/account/src/contract.rs @@ -7,8 +7,8 @@ use abstract_sdk::std::{ use abstract_std::{ account::{ state::{ - AccountInfo, Config, WhitelistedModules, ACCOUNT_MODULES, CONFIG, INFO, - SUSPENSION_STATUS, WHITELISTED_MODULES, + AccountInfo, Config, WhitelistedModules, CONFIG, INFO, SUSPENSION_STATUS, + WHITELISTED_MODULES, }, types::UpdateSubAccountAction, ExecuteMsg, InstantiateMsg, QueryMsg, @@ -17,10 +17,8 @@ use abstract_std::{ version_control::Account, }; use cosmwasm_std::{ - ensure_eq, wasm_execute, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, - StdResult, SubMsgResult, + wasm_execute, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsgResult, }; -use cw2::set_contract_version; use crate::{ actions::{ @@ -31,9 +29,15 @@ use crate::{ }, error::AccountError, modules::{ - _install_modules, exec_on_module, install_modules, migration::upgrade_modules, + _install_modules, exec_on_module, install_modules, + migration::{handle_callback, upgrade_modules}, uninstall_module, MIGRATE_CONTEXT, }, + queries::{ + handle_account_info_query, handle_config_query, handle_module_address_query, + handle_module_info_query, handle_module_versions_query, handle_sub_accounts_query, + handle_top_level_owner_query, + }, reply::{forward_response_data, register_dependencies}, sub_account::{ create_sub_account, handle_sub_account_action, maybe_update_sub_account_governance, @@ -257,11 +261,13 @@ pub fn execute(mut deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) ExecuteMsg::IcaAction { action_query_msg } => { ica_action(deps, info, action_query_msg).map_err(AccountError::from) } - _ => panic!(), + ExecuteMsg::UpdateStatus { is_suspended: _ } => { + unreachable!("Update status case is reached above") + } + ExecuteMsg::Callback(_) => handle_callback(deps, env, info), } } - }; - Ok(Response::new()) + } } #[cfg_attr(feature = "export", cosmwasm_std::entry_point)] @@ -284,17 +290,22 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> AccountResult { #[cfg_attr(feature = "export", cosmwasm_std::entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::Config {} => todo!(), - QueryMsg::ModuleVersions { ids } => todo!(), - QueryMsg::ModuleAddresses { ids } => todo!(), - QueryMsg::ModuleInfos { start_after, limit } => todo!(), - QueryMsg::Info {} => todo!(), - QueryMsg::SubAccountIds { start_after, limit } => todo!(), - QueryMsg::TopLevelOwner {} => todo!(), - QueryMsg::Ownership {} => todo!(), - }; + QueryMsg::Config {} => handle_config_query(deps), + QueryMsg::ModuleVersions { ids } => handle_module_versions_query(deps, ids), + QueryMsg::ModuleAddresses { ids } => handle_module_address_query(deps, ids), + QueryMsg::ModuleInfos { start_after, limit } => { + handle_module_info_query(deps, start_after, limit) + } + QueryMsg::Info {} => handle_account_info_query(deps), + QueryMsg::SubAccountIds { start_after, limit } => { + handle_sub_accounts_query(deps, start_after, limit) + } + QueryMsg::TopLevelOwner {} => handle_top_level_owner_query(deps, env), - Ok(Binary::default()) + QueryMsg::Ownership {} => { + cosmwasm_std::to_json_binary(&ownership::get_ownership(deps.storage)?) + } + } } #[cfg(test)] diff --git a/framework/contracts/account/account/src/error.rs b/framework/contracts/account/account/src/error.rs index 48256d3dd8..b90fa04311 100644 --- a/framework/contracts/account/account/src/error.rs +++ b/framework/contracts/account/account/src/error.rs @@ -3,7 +3,7 @@ use abstract_std::{ objects::{validation::ValidationError, version_control::VersionControlError}, AbstractError, }; -use cosmwasm_std::{Instantiate2AddressError, Response, StdError}; +use cosmwasm_std::{Instantiate2AddressError, StdError}; use thiserror::Error; #[derive(Error, Debug, PartialEq)] diff --git a/framework/contracts/account/account/src/modules.rs b/framework/contracts/account/account/src/modules.rs index fa8e56187e..f0b3391d0e 100644 --- a/framework/contracts/account/account/src/modules.rs +++ b/framework/contracts/account/account/src/modules.rs @@ -6,7 +6,7 @@ use abstract_std::{ adapter::{AdapterBaseMsg, BaseExecuteMsg, ExecuteMsg as AdapterExecMsg}, module_factory::{ExecuteMsg as ModuleFactoryMsg, FactoryModuleInstallConfig}, objects::{ - module::{assert_module_data_validity, Module, ModuleInfo, ModuleVersion}, + module::{Module, ModuleInfo, ModuleVersion}, module_reference::ModuleReference, ownership::{self}, salt::generate_instantiate_salt, @@ -16,17 +16,15 @@ use abstract_std::{ }; use cosmwasm_std::{ ensure, wasm_execute, Addr, Attribute, Binary, Coin, CosmosMsg, Deps, DepsMut, MessageInfo, - Response, StdResult, Storage, SubMsg, SubMsgResult, WasmMsg, + StdResult, Storage, SubMsg, WasmMsg, }; use cw2::ContractVersion; use cw_storage_plus::Item; -use migration::{build_module_migrate_msg, handle_adapter_migration, handle_app_migration}; use semver::Version; use crate::{ contract::{AccountResponse, AccountResult, REGISTER_MODULES_DEPENDENCIES_REPLY_ID}, error::AccountError, - queries::query_module_version, }; pub use migration::MIGRATE_CONTEXT; @@ -195,49 +193,6 @@ pub fn update_module_addresses( Ok(AccountResponse::action("update_module_addresses")) } -pub(crate) fn set_migrate_msgs_and_context( - deps: DepsMut, - module_info: ModuleInfo, - migrate_msg: Option, - msgs: &mut Vec, -) -> Result<(), AccountError> { - let config = CONFIG.load(deps.storage)?; - let version_control = VersionControlContract::new(config.version_control_address); - - let old_module_addr = load_module_addr(deps.storage, &module_info.id())?; - let old_module_cw2 = - query_module_version(deps.as_ref(), old_module_addr.clone(), &version_control)?; - let requested_module = query_module(deps.as_ref(), module_info.clone(), Some(old_module_cw2))?; - - let migrate_msgs = match requested_module.module.reference { - // upgrading an adapter is done by moving the authorized addresses to the new contract address and updating the permissions on the proxy. - ModuleReference::Adapter(new_adapter_addr) => handle_adapter_migration( - deps, - requested_module.module.info, - old_module_addr, - new_adapter_addr, - )?, - ModuleReference::App(code_id) => handle_app_migration( - deps, - migrate_msg, - old_module_addr, - requested_module.module.info, - code_id, - )?, - ModuleReference::AccountBase(code_id) | ModuleReference::Standalone(code_id) => { - vec![build_module_migrate_msg( - old_module_addr, - code_id, - migrate_msg.unwrap(), - )] - } - - _ => return Err(AccountError::NotUpgradeable(module_info)), - }; - msgs.extend(migrate_msgs); - Ok(()) -} - /// Uninstall the module with the ID [`module_id`] pub fn uninstall_module(mut deps: DepsMut, info: MessageInfo, module_id: String) -> AccountResult { // only owner can uninstall modules diff --git a/framework/contracts/account/account/src/modules/migration.rs b/framework/contracts/account/account/src/modules/migration.rs index f6629b3ad3..339cb19282 100644 --- a/framework/contracts/account/account/src/modules/migration.rs +++ b/framework/contracts/account/account/src/modules/migration.rs @@ -17,8 +17,7 @@ use abstract_std::{ ACCOUNT, }; use cosmwasm_std::{ - ensure, to_json_binary, wasm_execute, Addr, Binary, CosmosMsg, DepsMut, Empty, Env, - MessageInfo, StdResult, Storage, WasmMsg, + ensure, ensure_eq, to_json_binary, wasm_execute, Addr, Binary, CosmosMsg, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Storage, WasmMsg }; use cw2::get_contract_version; use cw_storage_plus::Item; @@ -290,3 +289,26 @@ pub(crate) fn self_upgrade_msg( Err(AccountError::InvalidReference(module_info)) } } + +pub fn handle_callback(mut deps: DepsMut, env: Env, info: MessageInfo) -> AccountResult { + ensure_eq!( + info.sender, + env.contract.address, + StdError::generic_err("Callback must be called by contract") + ); + let migrated_modules = MIGRATE_CONTEXT.load(deps.storage)?; + + for (migrated_module_id, old_deps) in migrated_modules { + crate::versioning::maybe_remove_old_deps(deps.branch(), &migrated_module_id, &old_deps)?; + let new_deps = + crate::versioning::maybe_add_new_deps(deps.branch(), &migrated_module_id, &old_deps)?; + crate::versioning::assert_dependency_requirements( + deps.as_ref(), + &new_deps, + &migrated_module_id, + )?; + } + + MIGRATE_CONTEXT.save(deps.storage, &vec![])?; + Ok(Response::new()) +} diff --git a/framework/contracts/account/account/src/queries.rs b/framework/contracts/account/account/src/queries.rs index b7c68a8048..55d187cd53 100644 --- a/framework/contracts/account/account/src/queries.rs +++ b/framework/contracts/account/account/src/queries.rs @@ -23,14 +23,14 @@ use cw_storage_plus::Bound; const DEFAULT_LIMIT: u8 = 5; const MAX_LIMIT: u8 = 10; -pub fn handle_module_address_query(deps: Deps, env: Env, ids: Vec) -> StdResult { - let contracts = query_module_addresses(deps, &env.contract.address, ids)?; +pub fn handle_module_address_query(deps: Deps, ids: Vec) -> StdResult { + let contracts = query_module_addresses(deps, ids)?; let vector = contracts.into_iter().collect(); to_json_binary(&ModuleAddressesResponse { modules: vector }) } -pub fn handle_contract_versions_query(deps: Deps, env: Env, ids: Vec) -> StdResult { - let response = query_module_versions(deps, &env.contract.address, ids)?; +pub fn handle_module_versions_query(deps: Deps, ids: Vec) -> StdResult { + let response = query_module_versions(deps, ids)?; let versions = response.into_values().collect(); to_json_binary(&ModuleVersionsResponse { versions }) } @@ -159,11 +159,9 @@ pub fn query_module_version( /// Errors if not present pub fn query_module_versions( deps: Deps, - manager_addr: &Addr, module_names: Vec, ) -> StdResult> { - let addresses: BTreeMap = - query_module_addresses(deps, manager_addr, module_names)?; + let addresses: BTreeMap = query_module_addresses(deps, module_names)?; let mut module_versions: BTreeMap = BTreeMap::new(); let config = CONFIG.load(deps.storage)?; @@ -179,7 +177,6 @@ pub fn query_module_versions( /// Errors if not present pub fn query_module_addresses( deps: Deps, - manager_addr: &Addr, module_names: Vec, ) -> StdResult> { let mut modules: BTreeMap = BTreeMap::new(); @@ -187,9 +184,7 @@ pub fn query_module_addresses( // Query over for module in module_names { // Add to map if present, skip otherwise. Allows version control to check what modules are present. - if let Some(address) = - ACCOUNT_MODULES.query(&deps.querier, manager_addr.clone(), &module)? - { + if let Some(address) = ACCOUNT_MODULES.may_load(deps.storage, &module)? { modules.insert(module, address); } } From 5d0f25ea43c5d34b03cf58efccb5e9709fa90aca Mon Sep 17 00:00:00 2001 From: Kayanski Date: Wed, 11 Sep 2024 08:40:09 +0000 Subject: [PATCH 05/17] Contracts compile --- framework/Cargo.lock | 68 +- framework/Cargo.toml | 6 +- .../account/{account => }/Cargo.toml | 2 - .../contracts/account/{account => }/README.md | 0 .../account/{account => }/VERSIONING.md | 0 .../contracts/account/account/src/actions.rs | 109 -- .../contracts/account/account/src/config.rs | 150 -- .../contracts/account/account/src/lib.rs | 9 - .../contracts/account/account/src/modules.rs | 363 ---- .../account/{account => }/examples/schema.rs | 0 .../contracts/account/manager/Cargo.toml | 72 - framework/contracts/account/manager/README.md | 1 - .../contracts/account/manager/VERSIONING.md | 52 - .../account/manager/examples/schema.rs | 11 - .../contracts/account/manager/src/commands.rs | 1629 ----------------- .../contracts/account/manager/src/contract.rs | 353 ---- .../contracts/account/manager/src/error.rs | 123 -- .../contracts/account/manager/src/queries.rs | 197 -- .../account/manager/src/validation.rs | 10 - .../account/manager/src/versioning.rs | 281 --- .../contracts/account/manager/tests/README.md | 9 - .../account/manager/tests/adapters.rs | 638 ------- .../contracts/account/manager/tests/apps.rs | 306 ---- .../account/manager/tests/ibc-client.rs | 74 - .../account/manager/tests/install_modules.rs | 128 -- .../contracts/account/manager/tests/proxy.rs | 870 --------- .../adapters__account_install_adapter.snap | 145 -- .../adapters__install_one_adapter.snap | 147 -- ...dapters__install_one_adapter_with_fee.snap | 149 -- ...cific_version_should_install_expected.snap | 147 -- ...einstalling_adapter_should_be_allowed.snap | 147 -- ...ing_new_version_should_install_latest.snap | 147 -- .../snapshots/apps__account_install_app.snap | 147 -- ...pps__execute_on_proxy_through_manager.snap | 128 -- ...dules__adds_module_to_account_modules.snap | 162 -- .../proxy__default_without_response_data.snap | 147 -- .../proxy__exec_through_manager.snap | 128 -- .../snapshots/proxy__instantiate_proxy.snap | 128 -- ...proxy__proxy_install_multiple_modules.snap | 120 -- ...oxy__proxy_install_standalone_modules.snap | 116 -- .../proxy__proxy_with_response_data.snap | 149 -- ...t_move_ownership_to_falsy_sub_account.snap | 186 -- ...account_move_ownership_to_sub_account.snap | 195 -- ...creating_on_subaccount_should_succeed.snap | 132 -- ...n_subaccount_should_succeed-contract1.snap | 1254 ------------- ...updating_on_subaccount_should_succeed.snap | 158 -- ...updating_on_subaccount_should_succeed.snap | 158 -- ...updating_on_subaccount_should_succeed.snap | 188 -- ...ubaccount__sub_account_move_ownership.snap | 156 -- ...account_move_ownership_to_sub_account.snap | 216 --- ...updating_on_subaccount_should_succeed.snap | 158 -- .../account/manager/tests/standalones.rs | 90 - .../account/manager/tests/subaccount.rs | 676 ------- .../account/manager/tests/upgrades.rs | 942 ---------- framework/contracts/account/proxy/Cargo.toml | 58 - framework/contracts/account/proxy/README.md | 1 - .../account/proxy/examples/schema.rs | 11 - .../contracts/account/proxy/src/contract.rs | 200 -- .../contracts/account/proxy/src/error.rs | 64 - framework/contracts/account/proxy/src/lib.rs | 28 - .../contracts/account/proxy/src/queries.rs | 83 - .../contracts/account/proxy/src/reply.rs | 26 - .../{proxy/src/commands.rs => src/actions.rs} | 317 +--- framework/contracts/account/src/config.rs | 680 +++++++ .../account/{account => }/src/contract.rs | 111 ++ .../account/{account => }/src/error.rs | 0 .../account/{manager => }/src/lib.rs | 13 +- .../account/{manager => }/src/migrate.rs | 11 +- framework/contracts/account/src/modules.rs | 852 +++++++++ .../{account => }/src/modules/migration.rs | 1 + .../account/{account => }/src/queries.rs | 74 +- .../account/{account => }/src/reply.rs | 0 .../account/{account => }/src/sub_account.rs | 0 .../account/{account => }/src/versioning.rs | 0 .../account/{account => }/tests/README.md | 0 .../account/{account => }/tests/adapters.rs | 0 .../account/{account => }/tests/apps.rs | 0 .../account/{account => }/tests/ibc-client.rs | 0 .../{account => }/tests/install_modules.rs | 0 .../account/{account => }/tests/proxy.rs | 0 .../adapters__account_install_adapter.snap | 0 .../adapters__install_one_adapter.snap | 0 ...dapters__install_one_adapter_with_fee.snap | 0 ...cific_version_should_install_expected.snap | 0 ...einstalling_adapter_should_be_allowed.snap | 0 ...ing_new_version_should_install_latest.snap | 0 .../snapshots/apps__account_install_app.snap | 0 ...pps__execute_on_proxy_through_manager.snap | 0 ...dules__adds_module_to_account_modules.snap | 0 .../proxy__default_without_response_data.snap | 0 .../proxy__exec_through_manager.snap | 0 .../snapshots/proxy__instantiate_proxy.snap | 0 ...proxy__proxy_install_multiple_modules.snap | 0 ...oxy__proxy_install_standalone_modules.snap | 0 .../proxy__proxy_with_response_data.snap | 0 ...t_move_ownership_to_falsy_sub_account.snap | 0 ...account_move_ownership_to_sub_account.snap | 0 ...creating_on_subaccount_should_succeed.snap | 0 ...n_subaccount_should_succeed-contract1.snap | 0 ...updating_on_subaccount_should_succeed.snap | 0 ...updating_on_subaccount_should_succeed.snap | 0 ...updating_on_subaccount_should_succeed.snap | 0 ...ubaccount__sub_account_move_ownership.snap | 0 ...account_move_ownership_to_sub_account.snap | 0 ...updating_on_subaccount_should_succeed.snap | 0 .../{account => }/tests/standalones.rs | 0 .../account/{account => }/tests/subaccount.rs | 0 .../account/{account => }/tests/upgrades.rs | 0 .../native/account-factory/src/commands.rs | 118 +- .../native/ibc-client/src/commands.rs | 8 +- .../native/ibc-client/src/contract.rs | 4 +- .../native/ibc-host/src/account_commands.rs | 10 +- .../abstract-adapter/src/endpoints/execute.rs | 45 +- .../packages/abstract-adapter/src/features.rs | 5 - .../packages/abstract-app/src/features.rs | 12 - .../packages/abstract-client/src/account.rs | 36 +- .../packages/abstract-client/src/client.rs | 4 +- .../src/interchain/remote_account.rs | 77 +- .../src/interchain/remote_application.rs | 10 +- .../packages/abstract-interface/Cargo.toml | 4 +- .../abstract-interface/src/account/manager.rs | 24 +- .../abstract-interface/src/account/mod.rs | 25 +- .../abstract-interface/src/deployers.rs | 2 +- .../abstract-interface/src/migrate.rs | 15 +- .../src/native/account_factory.rs | 2 +- .../src/native/version_control.rs | 2 +- .../abstract-std/src/account/responses.rs | 4 +- .../packages/abstract-std/src/adapter.rs | 8 +- .../src/native/account_factory.rs | 3 +- 129 files changed, 1932 insertions(+), 13093 deletions(-) rename framework/contracts/account/{account => }/Cargo.toml (93%) rename framework/contracts/account/{account => }/README.md (100%) rename framework/contracts/account/{account => }/VERSIONING.md (100%) delete mode 100644 framework/contracts/account/account/src/actions.rs delete mode 100644 framework/contracts/account/account/src/config.rs delete mode 100644 framework/contracts/account/account/src/lib.rs delete mode 100644 framework/contracts/account/account/src/modules.rs rename framework/contracts/account/{account => }/examples/schema.rs (100%) delete mode 100644 framework/contracts/account/manager/Cargo.toml delete mode 100644 framework/contracts/account/manager/README.md delete mode 100644 framework/contracts/account/manager/VERSIONING.md delete mode 100644 framework/contracts/account/manager/examples/schema.rs delete mode 100644 framework/contracts/account/manager/src/commands.rs delete mode 100644 framework/contracts/account/manager/src/contract.rs delete mode 100644 framework/contracts/account/manager/src/error.rs delete mode 100644 framework/contracts/account/manager/src/queries.rs delete mode 100644 framework/contracts/account/manager/src/validation.rs delete mode 100644 framework/contracts/account/manager/src/versioning.rs delete mode 100644 framework/contracts/account/manager/tests/README.md delete mode 100644 framework/contracts/account/manager/tests/adapters.rs delete mode 100644 framework/contracts/account/manager/tests/apps.rs delete mode 100644 framework/contracts/account/manager/tests/ibc-client.rs delete mode 100644 framework/contracts/account/manager/tests/install_modules.rs delete mode 100644 framework/contracts/account/manager/tests/proxy.rs delete mode 100644 framework/contracts/account/manager/tests/snapshots/adapters__account_install_adapter.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter_with_fee.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/apps__account_install_app.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/apps__execute_on_proxy_through_manager.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/install_modules__adds_module_to_account_modules.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/proxy__default_without_response_data.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/proxy__exec_through_manager.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/proxy__instantiate_proxy.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_multiple_modules.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_standalone_modules.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/proxy__proxy_with_response_data.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap delete mode 100644 framework/contracts/account/manager/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap delete mode 100644 framework/contracts/account/manager/tests/standalones.rs delete mode 100644 framework/contracts/account/manager/tests/subaccount.rs delete mode 100644 framework/contracts/account/manager/tests/upgrades.rs delete mode 100644 framework/contracts/account/proxy/Cargo.toml delete mode 100644 framework/contracts/account/proxy/README.md delete mode 100644 framework/contracts/account/proxy/examples/schema.rs delete mode 100644 framework/contracts/account/proxy/src/contract.rs delete mode 100644 framework/contracts/account/proxy/src/error.rs delete mode 100644 framework/contracts/account/proxy/src/lib.rs delete mode 100644 framework/contracts/account/proxy/src/queries.rs delete mode 100644 framework/contracts/account/proxy/src/reply.rs rename framework/contracts/account/{proxy/src/commands.rs => src/actions.rs} (54%) create mode 100644 framework/contracts/account/src/config.rs rename framework/contracts/account/{account => }/src/contract.rs (81%) rename framework/contracts/account/{account => }/src/error.rs (100%) rename framework/contracts/account/{manager => }/src/lib.rs (90%) rename framework/contracts/account/{manager => }/src/migrate.rs (57%) create mode 100644 framework/contracts/account/src/modules.rs rename framework/contracts/account/{account => }/src/modules/migration.rs (99%) rename framework/contracts/account/{account => }/src/queries.rs (74%) rename framework/contracts/account/{account => }/src/reply.rs (100%) rename framework/contracts/account/{account => }/src/sub_account.rs (100%) rename framework/contracts/account/{account => }/src/versioning.rs (100%) rename framework/contracts/account/{account => }/tests/README.md (100%) rename framework/contracts/account/{account => }/tests/adapters.rs (100%) rename framework/contracts/account/{account => }/tests/apps.rs (100%) rename framework/contracts/account/{account => }/tests/ibc-client.rs (100%) rename framework/contracts/account/{account => }/tests/install_modules.rs (100%) rename framework/contracts/account/{account => }/tests/proxy.rs (100%) rename framework/contracts/account/{account => }/tests/snapshots/adapters__account_install_adapter.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/adapters__install_one_adapter.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/adapters__install_one_adapter_with_fee.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/apps__account_install_app.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/apps__execute_on_proxy_through_manager.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/install_modules__adds_module_to_account_modules.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/proxy__default_without_response_data.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/proxy__exec_through_manager.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/proxy__instantiate_proxy.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/proxy__proxy_install_multiple_modules.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/proxy__proxy_install_standalone_modules.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/proxy__proxy_with_response_data.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__sub_account_move_ownership.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap (100%) rename framework/contracts/account/{account => }/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap (100%) rename framework/contracts/account/{account => }/tests/standalones.rs (100%) rename framework/contracts/account/{account => }/tests/subaccount.rs (100%) rename framework/contracts/account/{account => }/tests/upgrades.rs (100%) diff --git a/framework/Cargo.lock b/framework/Cargo.lock index 170924b201..e8d05f0cd0 100644 --- a/framework/Cargo.lock +++ b/framework/Cargo.lock @@ -36,7 +36,6 @@ dependencies = [ "serde", "speculoos", "thiserror", - "workspace-hack", ] [[package]] @@ -381,15 +380,14 @@ dependencies = [ name = "abstract-interface" version = "0.23.1" dependencies = [ + "abstract-account", "abstract-account-factory", "abstract-ans-host", "abstract-cw-orch-polytone", "abstract-ibc-client", "abstract-ibc-host", - "abstract-manager", "abstract-module-factory", "abstract-polytone", - "abstract-proxy", "abstract-std", "abstract-testing", "abstract-version-control", @@ -414,7 +412,6 @@ dependencies = [ "serde_json", "speculoos", "thiserror", - "workspace-hack", ] [[package]] @@ -428,43 +425,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "abstract-manager" -version = "0.23.0" -dependencies = [ - "abstract-account-factory", - "abstract-adapter", - "abstract-ans-host", - "abstract-app", - "abstract-interface", - "abstract-macros", - "abstract-module-factory", - "abstract-proxy", - "abstract-sdk", - "abstract-standalone", - "abstract-std", - "abstract-testing", - "abstract-version-control", - "anyhow", - "cosmwasm-schema 2.1.3", - "cosmwasm-std 2.1.3", - "cw-asset", - "cw-controllers", - "cw-orch", - "cw-storage-plus 2.0.0", - "cw2 2.0.0", - "cw20", - "cw721 0.18.0", - "cw721-base 0.18.0", - "rstest", - "schemars", - "semver", - "serde", - "speculoos", - "thiserror", - "workspace-hack", -] - [[package]] name = "abstract-module-factory" version = "0.23.0" @@ -569,32 +529,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "abstract-proxy" -version = "0.23.0" -dependencies = [ - "abstract-ica", - "abstract-macros", - "abstract-sdk", - "abstract-std", - "abstract-testing", - "cosmwasm-schema 2.1.3", - "cosmwasm-std 2.1.3", - "cw-asset", - "cw-controllers", - "cw-storage-plus 2.0.0", - "cw-utils 2.0.0", - "cw2 2.0.0", - "cw20", - "rstest", - "schemars", - "semver", - "serde", - "speculoos", - "thiserror", - "workspace-hack", -] - [[package]] name = "abstract-sdk" version = "0.23.0" diff --git a/framework/Cargo.toml b/framework/Cargo.toml index 144b546de3..6bc26090e5 100644 --- a/framework/Cargo.toml +++ b/framework/Cargo.toml @@ -3,7 +3,7 @@ members = [ "packages/abstract-*", "packages/standards/*", "contracts/native/*", - "contracts/account/*", + "contracts/account/", ] # Enable the version 2 feature resolver, which avoids unifying features for targets that are not being built @@ -79,8 +79,8 @@ version-control = { package = "abstract-version-control", path = "contracts/nati ibc-client = { package = "abstract-ibc-client", path = "contracts/native/ibc-client" } ibc-host = { package = "abstract-ibc-host", path = "contracts/native/ibc-host" } -proxy = { package = "abstract-proxy", path = "contracts/account/proxy" , default-features = false} -manager = { package = "abstract-manager", path = "contracts/account/manager" , default-features = false} +proxy = { package = "abstract-proxy", path = "contracts/account/proxy", default-features = false } +manager = { package = "abstract-manager", path = "contracts/account/manager", default-features = false } abstract-ica = { path = "packages/abstract-ica" } abstract-sdk = { version = "0.23.0", path = "packages/abstract-sdk" } diff --git a/framework/contracts/account/account/Cargo.toml b/framework/contracts/account/Cargo.toml similarity index 93% rename from framework/contracts/account/account/Cargo.toml rename to framework/contracts/account/Cargo.toml index 347ed8c5ac..1f069880e4 100644 --- a/framework/contracts/account/account/Cargo.toml +++ b/framework/contracts/account/Cargo.toml @@ -34,7 +34,6 @@ abstract-sdk = { workspace = true } abstract-std = { workspace = true } semver = { workspace = true } abstract-macros = { workspace = true } -workspace-hack = { version = "0.1", path = "../../../workspace-hack" } abstract-ica = { workspace = true } [dev-dependencies] @@ -58,7 +57,6 @@ abstract-testing = { workspace = true } abstract-macros = { workspace = true } # abstract-integration-tests = { workspace = true } -workspace-hack = { version = "0.1", path = "../../../workspace-hack" } [profile.release] rpath = false diff --git a/framework/contracts/account/account/README.md b/framework/contracts/account/README.md similarity index 100% rename from framework/contracts/account/account/README.md rename to framework/contracts/account/README.md diff --git a/framework/contracts/account/account/VERSIONING.md b/framework/contracts/account/VERSIONING.md similarity index 100% rename from framework/contracts/account/account/VERSIONING.md rename to framework/contracts/account/VERSIONING.md diff --git a/framework/contracts/account/account/src/actions.rs b/framework/contracts/account/account/src/actions.rs deleted file mode 100644 index 52fa400ce2..0000000000 --- a/framework/contracts/account/account/src/actions.rs +++ /dev/null @@ -1,109 +0,0 @@ -use abstract_sdk::std::{ - account::state::{ADMIN, WHITELISTED_MODULES}, - ibc_client::ExecuteMsg as IbcClientMsg, - IBC_CLIENT, -}; -use abstract_std::ICA_CLIENT; -use cosmwasm_std::{ - wasm_execute, Binary, CosmosMsg, DepsMut, Empty, MessageInfo, StdError, SubMsg, WasmQuery, -}; - -use crate::{ - contract::{AccountResponse, AccountResult, RESPONSE_REPLY_ID}, - error::AccountError, -}; - -/// Executes `CosmosMsg` on the proxy and forwards its response. -/// Permission: Module -pub fn execute_module_action_response( - deps: DepsMut, - msg_info: MessageInfo, - msg: CosmosMsg, -) -> AccountResult { - let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; - if !whitelisted_modules.0.contains(&msg_info.sender) { - return Err(AccountError::SenderNotWhitelisted {}); - } - - let submsg = SubMsg::reply_on_success(msg, RESPONSE_REPLY_ID); - - Ok(AccountResponse::action("execute_module_action_response").add_submessage(submsg)) -} - -/// Executes `Vec` on the proxy. -/// Permission: Module -pub fn execute_module_action( - deps: DepsMut, - msg_info: MessageInfo, - msgs: Vec>, -) -> AccountResult { - let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; - if !whitelisted_modules.0.contains(&msg_info.sender) { - return Err(AccountError::SenderNotWhitelisted {}); - } - - Ok(AccountResponse::action("execute_module_action").add_messages(msgs)) -} - -/// Executes IBC actions on the IBC client. -/// Permission: Module -pub fn execute_ibc_action( - deps: DepsMut, - msg_info: MessageInfo, - msg: IbcClientMsg, -) -> AccountResult { - let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; - if !whitelisted_modules.0.contains(&msg_info.sender) { - return Err(AccountError::SenderNotWhitelisted {}); - } - let manager_address = ADMIN.get(deps.as_ref())?.unwrap(); - let ibc_client_address = abstract_sdk::std::account::state::ACCOUNT_MODULES - .query(&deps.querier, manager_address, IBC_CLIENT)? - .ok_or_else(|| { - StdError::generic_err(format!( - "ibc_client not found on manager. Add it under the {IBC_CLIENT} name." - )) - })?; - - let funds_to_send = if let IbcClientMsg::SendFunds { funds, .. } = &msg { - funds.clone() - } else { - vec![] - }; - let client_msg = wasm_execute(ibc_client_address, &msg, funds_to_send)?; - - Ok(AccountResponse::action("execute_ibc_action").add_message(client_msg)) -} - -/// Execute an action on an ICA. -/// Permission: Module -/// -/// This function queries the `abstract:ica-client` contract from the account's manager. -/// It then fires a smart-query on that address of type [`QueryMsg::IcaAction`](abstract_ica::msg::QueryMsg). -/// -/// The resulting `Vec` are then executed on the proxy contract. -pub fn ica_action(deps: DepsMut, msg_info: MessageInfo, action_query: Binary) -> AccountResult { - let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; - if !whitelisted_modules.0.contains(&msg_info.sender) { - return Err(AccountError::SenderNotWhitelisted {}); - } - - let manager_address = ADMIN.get(deps.as_ref())?.unwrap(); - let ica_client_address = abstract_sdk::std::account::state::ACCOUNT_MODULES - .query(&deps.querier, manager_address, ICA_CLIENT)? - .ok_or_else(|| { - StdError::generic_err(format!( - "ica_client not found on manager. Add it under the {ICA_CLIENT} name." - )) - })?; - - let res: abstract_ica::msg::IcaActionResult = deps.querier.query( - &WasmQuery::Smart { - contract_addr: ica_client_address.into(), - msg: action_query, - } - .into(), - )?; - - Ok(AccountResponse::action("ica_action").add_messages(res.msgs)) -} diff --git a/framework/contracts/account/account/src/config.rs b/framework/contracts/account/account/src/config.rs deleted file mode 100644 index 61418b890f..0000000000 --- a/framework/contracts/account/account/src/config.rs +++ /dev/null @@ -1,150 +0,0 @@ -use crate::{ - contract::{AccountResponse, AccountResult}, - error::AccountError, - modules::update_module_addresses, -}; -use abstract_sdk::{cw_helpers::AbstractAttributes, feature_objects::VersionControlContract}; -use abstract_std::{ - account::{ - state::{ - AccountInfo, SuspensionStatus, ACCOUNT_ID, CONFIG, INFO, SUB_ACCOUNTS, - SUSPENSION_STATUS, - }, - types::{InternalConfigAction, UpdateSubAccountAction}, ExecuteMsg, - }, - objects::{ - gov_type::GovernanceDetails, - ownership, - validation::{validate_description, validate_link, validate_name}, - }, -}; -use cosmwasm_std::{ - ensure, from_json, wasm_execute, Binary, CosmosMsg, DepsMut, MessageInfo, Response, StdError, -}; - -pub fn update_account_status( - deps: DepsMut, - info: MessageInfo, - suspension_status: Option, -) -> Result { - let mut response = AccountResponse::action("update_status"); - - if let Some(suspension_status) = suspension_status { - response = update_suspension_status(deps, info, suspension_status, response)?; - } else { - return Err(AccountError::NoUpdates {}); - } - - Ok(response) -} - -pub fn update_suspension_status( - deps: DepsMut, - info: MessageInfo, - is_suspended: SuspensionStatus, - response: Response, -) -> AccountResult { - // only owner can update suspension status - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - SUSPENSION_STATUS.save(deps.storage, &is_suspended)?; - - Ok(response.add_abstract_attributes(vec![("is_suspended", is_suspended.to_string())])) -} - -/// Allows the owner to manually update the internal configuration of the account. -/// This can be used to unblock the account and its modules in case of a bug/lock on the account. -pub fn update_internal_config(deps: DepsMut, info: MessageInfo, config: Binary) -> AccountResult { - // deserialize the config action - let action: InternalConfigAction = - from_json(config).map_err(|error| AccountError::InvalidConfigAction { error })?; - - let (add, remove) = match action { - InternalConfigAction::UpdateModuleAddresses { to_add, to_remove } => (to_add, to_remove), - _ => { - return Err(AccountError::InvalidConfigAction { - error: StdError::generic_err("Unknown config action"), - }) - } - }; - - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - update_module_addresses(deps, add, remove) -} - -/// Update the Account information -pub fn update_info( - deps: DepsMut, - info: MessageInfo, - name: Option, - description: Option, - link: Option, -) -> AccountResult { - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - let mut info: AccountInfo = INFO.load(deps.storage)?; - if let Some(name) = name { - validate_name(&name)?; - info.name = name; - } - validate_description(description.as_deref())?; - info.description = description; - validate_link(link.as_deref())?; - info.link = link; - INFO.save(deps.storage, &info)?; - - Ok(AccountResponse::action("update_info")) -} - -/// Renounce ownership of this account \ -/// **WARNING**: This will lock the account, making it unusable. -pub fn remove_account_from_contracts(deps: DepsMut) -> AccountResult> { - let mut msgs = vec![]; - - let account_id = ACCOUNT_ID.load(deps.storage)?; - // Check for any sub accounts - let sub_account = SUB_ACCOUNTS - .keys(deps.storage, None, None, cosmwasm_std::Order::Ascending) - .next() - .transpose()?; - ensure!( - sub_account.is_none(), - AccountError::RenounceWithSubAccount {} - ); - - let ownership = ownership::get_ownership(deps.storage)?; - if let GovernanceDetails::SubAccount { account } = ownership.owner { - // Unregister itself (sub-account) from the owning account. - msgs.push( - wasm_execute( - account, - &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::UnregisterSubAccount { - id: account_id.seq(), - }), - vec![], - )? - .into(), - ); - } - - let config = CONFIG.load(deps.storage)?; - let vc = VersionControlContract::new(config.version_control_address); - let mut namespaces = vc - .query_namespaces(vec![account_id], &deps.querier)? - .namespaces; - let namespace = namespaces.pop(); - if let Some((namespace, _)) = namespace { - // Remove the namespace that this account holds. - msgs.push( - wasm_execute( - vc.address, - &abstract_std::version_control::ExecuteMsg::RemoveNamespaces { - namespaces: vec![namespace.to_string()], - }, - vec![], - )? - .into(), - ) - }; - Ok(msgs) -} diff --git a/framework/contracts/account/account/src/lib.rs b/framework/contracts/account/account/src/lib.rs deleted file mode 100644 index 18dc6c96cd..0000000000 --- a/framework/contracts/account/account/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub mod actions; -pub mod config; -pub mod contract; -pub mod error; -pub mod modules; -pub mod queries; -pub mod reply; -pub mod sub_account; -pub mod versioning; diff --git a/framework/contracts/account/account/src/modules.rs b/framework/contracts/account/account/src/modules.rs deleted file mode 100644 index f0b3391d0e..0000000000 --- a/framework/contracts/account/account/src/modules.rs +++ /dev/null @@ -1,363 +0,0 @@ -use abstract_std::{ - account::{ - state::{ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, DEPENDENTS, WHITELISTED_MODULES}, - ModuleInstallConfig, - }, - adapter::{AdapterBaseMsg, BaseExecuteMsg, ExecuteMsg as AdapterExecMsg}, - module_factory::{ExecuteMsg as ModuleFactoryMsg, FactoryModuleInstallConfig}, - objects::{ - module::{Module, ModuleInfo, ModuleVersion}, - module_reference::ModuleReference, - ownership::{self}, - salt::generate_instantiate_salt, - version_control::VersionControlContract, - }, - version_control::ModuleResponse, -}; -use cosmwasm_std::{ - ensure, wasm_execute, Addr, Attribute, Binary, Coin, CosmosMsg, Deps, DepsMut, MessageInfo, - StdResult, Storage, SubMsg, WasmMsg, -}; -use cw2::ContractVersion; -use cw_storage_plus::Item; -use semver::Version; - -use crate::{ - contract::{AccountResponse, AccountResult, REGISTER_MODULES_DEPENDENCIES_REPLY_ID}, - error::AccountError, -}; - -pub use migration::MIGRATE_CONTEXT; -pub(crate) const INSTALL_MODULES_CONTEXT: Item)>> = Item::new("icontext"); - -pub mod migration; - -const LIST_SIZE_LIMIT: usize = 15; - -/// Attempts to install a new module through the Module Factory Contract -pub fn install_modules( - mut deps: DepsMut, - info: MessageInfo, - modules: Vec, -) -> AccountResult { - // only owner can call this method - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - let config = CONFIG.load(deps.storage)?; - - let (install_msgs, install_attribute) = _install_modules( - deps.branch(), - modules, - config.module_factory_address, - config.version_control_address, - info.funds, // We forward all the funds to the module_factory address for them to use in the install - )?; - let response = AccountResponse::new("install_modules", std::iter::once(install_attribute)) - .add_submessages(install_msgs); - - Ok(response) -} - -/// Generate message and attribute for installing module -/// Adds the modules to the internal store for reference and adds them to the proxy allowlist if applicable. -pub fn _install_modules( - mut deps: DepsMut, - modules: Vec, - module_factory_address: Addr, - version_control_address: Addr, - funds: Vec, -) -> AccountResult<(Vec, Attribute)> { - let mut installed_modules = Vec::with_capacity(modules.len()); - let mut manager_modules = Vec::with_capacity(modules.len()); - let account_id = ACCOUNT_ID.load(deps.storage)?; - let version_control = VersionControlContract::new(version_control_address); - - let canonical_module_factory = deps - .api - .addr_canonicalize(module_factory_address.as_str())?; - - let (infos, init_msgs): (Vec<_>, Vec<_>) = - modules.into_iter().map(|m| (m.module, m.init_msg)).unzip(); - let modules = version_control - .query_modules_configs(infos, &deps.querier) - .map_err(|error| AccountError::QueryModulesFailed { error })?; - - let mut install_context = Vec::with_capacity(modules.len()); - let mut add_to_whitelist = Vec::with_capacity(modules.len()); - let mut add_to_manager = Vec::with_capacity(modules.len()); - - let salt: Binary = generate_instantiate_salt(&account_id); - for (ModuleResponse { module, .. }, init_msg) in modules.into_iter().zip(init_msgs) { - // Check if module is already enabled. - if ACCOUNT_MODULES - .may_load(deps.storage, &module.info.id())? - .is_some() - { - return Err(AccountError::ModuleAlreadyInstalled(module.info.id())); - } - installed_modules.push(module.info.id_with_version()); - - let init_msg_salt = match &module.reference { - ModuleReference::Adapter(module_address) - | ModuleReference::Native(module_address) - | ModuleReference::Service(module_address) => { - if module.should_be_whitelisted() { - add_to_whitelist.push(module_address.to_string()); - } - add_to_manager.push((module.info.id(), module_address.to_string())); - install_context.push((module.clone(), None)); - None - } - ModuleReference::App(code_id) | ModuleReference::Standalone(code_id) => { - let checksum = deps.querier.query_wasm_code_info(*code_id)?.checksum; - let module_address = cosmwasm_std::instantiate2_address( - checksum.as_slice(), - &canonical_module_factory, - &salt, - )?; - let module_address = deps.api.addr_humanize(&module_address)?; - ensure!( - deps.querier - .query_wasm_contract_info(module_address.to_string()) - .is_err(), - AccountError::ProhibitedReinstall {} - ); - if module.should_be_whitelisted() { - add_to_whitelist.push(module_address.to_string()); - } - add_to_manager.push((module.info.id(), module_address.to_string())); - install_context.push((module.clone(), Some(module_address))); - - Some(init_msg.unwrap()) - } - _ => return Err(AccountError::ModuleNotInstallable(module.info.to_string())), - }; - manager_modules.push(FactoryModuleInstallConfig::new(module.info, init_msg_salt)); - } - _whitelist_modules(deps.branch(), add_to_whitelist)?; - - INSTALL_MODULES_CONTEXT.save(deps.storage, &install_context)?; - - let mut messages = vec![]; - - // Update module addrs - update_module_addresses(deps.branch(), Some(add_to_manager), None)?; - - // Install modules message - messages.push(SubMsg::reply_on_success( - wasm_execute( - module_factory_address, - &ModuleFactoryMsg::InstallModules { - modules: manager_modules, - salt, - }, - funds, - )?, - REGISTER_MODULES_DEPENDENCIES_REPLY_ID, - )); - - Ok(( - messages, - Attribute::new("installed_modules", format!("{installed_modules:?}")), - )) -} - -/// Adds, updates or removes provided addresses. -/// Should only be called by contract that adds/removes modules. -/// Factory is admin on init -pub fn update_module_addresses( - deps: DepsMut, - to_add: Option>, - to_remove: Option>, -) -> AccountResult { - if let Some(modules_to_add) = to_add { - for (id, new_address) in modules_to_add.into_iter() { - if id.is_empty() { - return Err(AccountError::InvalidModuleName {}); - }; - // validate addr - ACCOUNT_MODULES.save( - deps.storage, - id.as_str(), - &deps.api.addr_validate(&new_address)?, - )?; - } - } - - if let Some(modules_to_remove) = to_remove { - for id in modules_to_remove.into_iter() { - ACCOUNT_MODULES.remove(deps.storage, id.as_str()); - } - } - - Ok(AccountResponse::action("update_module_addresses")) -} - -/// Uninstall the module with the ID [`module_id`] -pub fn uninstall_module(mut deps: DepsMut, info: MessageInfo, module_id: String) -> AccountResult { - // only owner can uninstall modules - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - // module can only be uninstalled if there are no dependencies on it - let dependents = DEPENDENTS.may_load(deps.storage, &module_id)?; - if let Some(dependents) = dependents { - if !dependents.is_empty() { - return Err(AccountError::ModuleHasDependents(Vec::from_iter( - dependents, - ))); - } - // Remove the module from the dependents list - DEPENDENTS.remove(deps.storage, &module_id); - } - - // Remove module as dependant from its dependencies. - let module_data = crate::versioning::load_module_data(deps.as_ref(), &module_id)?; - let module_dependencies = module_data.dependencies; - crate::versioning::remove_as_dependent(deps.storage, &module_id, module_dependencies)?; - - // Remove for proxy if needed - let config = CONFIG.load(deps.storage)?; - let vc = VersionControlContract::new(config.version_control_address); - - let module = vc.query_module( - ModuleInfo::from_id(&module_data.module, module_data.version.into())?, - &deps.querier, - )?; - - // Remove module from whitelist if it supposed to be removed - if module.should_be_whitelisted() { - _remove_whitelist_module(deps.branch(), module_id.clone())?; - } - ACCOUNT_MODULES.remove(deps.storage, &module_id); - - let response = AccountResponse::new("uninstall_module", vec![("module", &module_id)]); - Ok(response) -} - -/// Execute the [`exec_msg`] on the provided [`module_id`], -pub fn exec_on_module( - deps: DepsMut, - info: MessageInfo, - module_id: String, - exec_msg: Binary, -) -> AccountResult { - // only owner can forward messages to modules - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - let module_addr = load_module_addr(deps.storage, &module_id)?; - - let response = AccountResponse::new("exec_on_module", vec![("module", module_id)]).add_message( - CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: module_addr.into(), - msg: exec_msg, - funds: info.funds, - }), - ); - - Ok(response) -} - -/// Checked load of a module address -pub fn load_module_addr(storage: &dyn Storage, module_id: &String) -> AccountResult { - ACCOUNT_MODULES - .may_load(storage, module_id)? - .ok_or_else(|| AccountError::ModuleNotFound(module_id.clone())) -} - -/// Query Version Control for the [`Module`] given the provided [`ContractVersion`] -pub fn query_module( - deps: Deps, - module_info: ModuleInfo, - old_contract_version: Option, -) -> Result { - let config = CONFIG.load(deps.storage)?; - // Construct feature object to access registry functions - let version_control = VersionControlContract::new(config.version_control_address); - - let module = match &module_info.version { - ModuleVersion::Version(new_version) => { - let old_contract = old_contract_version.unwrap(); - - let new_version = new_version.parse::().unwrap(); - let old_version = old_contract.version.parse::().unwrap(); - - if new_version < old_version { - return Err(AccountError::OlderVersion( - new_version.to_string(), - old_version.to_string(), - )); - } - Module { - info: module_info.clone(), - reference: version_control - .query_module_reference_raw(&module_info, &deps.querier)?, - } - } - ModuleVersion::Latest => { - // Query latest version of contract - version_control.query_module(module_info.clone(), &deps.querier)? - } - }; - - Ok(ModuleResponse { - module: Module { - info: module.info, - reference: module.reference, - }, - config: version_control.query_config(module_info, &deps.querier)?, - }) -} - -#[inline(always)] -fn configure_adapter( - adapter_address: impl Into, - message: AdapterBaseMsg, -) -> StdResult { - let adapter_msg: AdapterExecMsg = BaseExecuteMsg { - proxy_address: None, - msg: message, - } - .into(); - Ok(wasm_execute(adapter_address, &adapter_msg, vec![])?.into()) -} - -/// Add a contract to the whitelist -fn _whitelist_modules(deps: DepsMut, modules: Vec) -> AccountResult<()> { - let mut whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; - - // This is a limit to prevent potentially running out of gas when doing lookups on the modules list - if whitelisted_modules.0.len() >= LIST_SIZE_LIMIT { - return Err(AccountError::ModuleLimitReached {}); - } - - for module in modules.iter() { - let module_addr = deps.api.addr_validate(module)?; - - if whitelisted_modules.0.contains(&module_addr) { - return Err(AccountError::AlreadyWhitelisted(module.clone())); - } - - // Add contract to whitelist. - whitelisted_modules.0.push(module_addr); - } - - WHITELISTED_MODULES.save(deps.storage, &whitelisted_modules)?; - - Ok(()) -} - -/// Remove a contract from the whitelist -fn _remove_whitelist_module(deps: DepsMut, module: String) -> AccountResult<()> { - WHITELISTED_MODULES.update(deps.storage, |mut whitelisted_modules| { - let module_address = deps.api.addr_validate(&module)?; - - if !whitelisted_modules.0.contains(&module_address) { - return Err(AccountError::NotWhitelisted(module.clone())); - } - // Remove contract from whitelist. - whitelisted_modules.0.retain(|addr| *addr != module_address); - Ok(whitelisted_modules) - })?; - - Ok(()) -} diff --git a/framework/contracts/account/account/examples/schema.rs b/framework/contracts/account/examples/schema.rs similarity index 100% rename from framework/contracts/account/account/examples/schema.rs rename to framework/contracts/account/examples/schema.rs diff --git a/framework/contracts/account/manager/Cargo.toml b/framework/contracts/account/manager/Cargo.toml deleted file mode 100644 index 9ca5308110..0000000000 --- a/framework/contracts/account/manager/Cargo.toml +++ /dev/null @@ -1,72 +0,0 @@ -[package] -name = "abstract-manager" -version = { workspace = true } -authors = { workspace = true } -edition = { workspace = true } -description = "Abstract Manager Contract" -license = { workspace = true } -readme = "README.md" -repository = "https://github.com/AbstractSDK/abstract" - -exclude = ["contract.wasm", "hash.txt"] - - -[lib] -crate-type = ["cdylib", "rlib"] - -[features] -default = ["export"] -export = [] - - -[dependencies] -cosmwasm-std = { workspace = true } -cosmwasm-schema = { workspace = true } -cw-controllers = { workspace = true } -cw-storage-plus = { workspace = true } -cw2 = { workspace = true } -cw20 = { workspace = true } -cw-asset = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -thiserror = { workspace = true } -abstract-sdk = { workspace = true } -abstract-std = { workspace = true } -semver = { workspace = true } -abstract-macros = { workspace = true } - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -workspace-hack = { version = "0.1", path = "../../../workspace-hack" } - -[dev-dependencies] -cw20 = { workspace = true } -cw721-base = { version = "0.18.0", features = ["library"] } -cw721 = { version = "0.18.0" } -abstract-interface = { workspace = true } -cw-orch = { workspace = true, features = ["snapshot-testing"] } -anyhow = { workspace = true } -account-factory = { workspace = true } -ans-host = { workspace = true } -version-control = { workspace = true } -proxy = { workspace = true } -module-factory = { workspace = true } -rstest = { workspace = true } -speculoos = { workspace = true } -abstract-sdk = { workspace = true, features = ["test-utils"] } -abstract-adapter = { workspace = true, features = ["test-utils"] } -abstract-app = { workspace = true, features = ["test-utils"] } -abstract-standalone = { workspace = true, features = ["test-utils"] } -abstract-testing = { workspace = true } -abstract-macros = { workspace = true } -# abstract-integration-tests = { workspace = true } - -[profile.release] -rpath = false -lto = true -overflow-checks = true -opt-level = 3 -debug = false -debug-assertions = false -codegen-units = 1 -panic = 'abort' -incremental = false diff --git a/framework/contracts/account/manager/README.md b/framework/contracts/account/manager/README.md deleted file mode 100644 index acffc87c7c..0000000000 --- a/framework/contracts/account/manager/README.md +++ /dev/null @@ -1 +0,0 @@ -# Abstract Manager diff --git a/framework/contracts/account/manager/VERSIONING.md b/framework/contracts/account/manager/VERSIONING.md deleted file mode 100644 index 86818fa8a9..0000000000 --- a/framework/contracts/account/manager/VERSIONING.md +++ /dev/null @@ -1,52 +0,0 @@ -# Abstract Module Versioning - -A document detailing the Abstract module versioning. - -Instead of storing dependencies we store dependents for each module. So if a module A depends on B and C, then B and C will have A as a dependent. - -`DEPENDANTS: Map>` - -## Module version dependencies - -Every module (App/Adapter) has a set of dependencies it can declare. The dependencies ensure a couple things: - -- A module can only be installed when it's dependencies are installed. -- A module can not be un-installed as long as some other module depends on it. (entry for the module in the dependants map is not empty) -- A module can not be upgraded if its (possibly also upgraded) dependents don't support the new version. - -## Version requirements - -Version requirements are stored in the module itself and can be queried. - -## Manager Version-Management Flow - -### Installation - -1. Call module factory to add the module. -2. On factory callback, query module dependencies and assert current state passes requirements. -3. Add dependents to dependency store. - -### Migration - -1. Retrieve new version number of module. (if not provided) -2. Load dependents of the to-be-migrated module and assert new version passes dependent requirements. - - Exclude any modules that are being migrated before. This ensures that the migration is not blocked by a module that is being migrated. -3. Migrate all the modules that have applied for a migration. - -Then for each module that was migrated: - -1. Remove self as a dependent when it no longer applies. I.e. the module depended on a module A but no longer does after the migration. -2. Add self as a dependent when it applies. I.e. the module did not depended on a module B but does after the migration. -now what could happen is that the new version of the module -2. Update dependency version. -3. Add dependencies (there might be a new requirement) - -### Uninstall - -1. Load dependents of module and assert it is empty. -2. Query dependencies and remove self as dependent. -3. Uninstall the module. - -## Notes on major releases - -When a new major version of a module is released all the dependent modules should be upgraded first. diff --git a/framework/contracts/account/manager/examples/schema.rs b/framework/contracts/account/manager/examples/schema.rs deleted file mode 100644 index b8bdbe24e4..0000000000 --- a/framework/contracts/account/manager/examples/schema.rs +++ /dev/null @@ -1,11 +0,0 @@ -use abstract_sdk::std::manager::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; -use cosmwasm_schema::write_api; - -fn main() { - write_api! { - instantiate: InstantiateMsg, - query: QueryMsg, - execute: ExecuteMsg, - migrate: MigrateMsg, - }; -} diff --git a/framework/contracts/account/manager/src/commands.rs b/framework/contracts/account/manager/src/commands.rs deleted file mode 100644 index dd2f9be9a3..0000000000 --- a/framework/contracts/account/manager/src/commands.rs +++ /dev/null @@ -1,1629 +0,0 @@ -use abstract_macros::abstract_response; -use abstract_sdk::cw_helpers::AbstractAttributes; -use abstract_std::{ - account::{state::ACCOUNT_ID, ExecuteMsg as ProxyMsg}, - account::{ - state::{ - AccountInfo, SuspensionStatus, ACCOUNT_MODULES, CONFIG, DEPENDENTS, INFO, SUB_ACCOUNTS, - SUSPENSION_STATUS, - }, - CallbackMsg, ExecuteMsg, InternalConfigAction, ModuleInstallConfig, UpdateSubAccountAction, - }, - adapter::{ - AdapterBaseMsg, AuthorizedAddressesResponse, BaseExecuteMsg, BaseQueryMsg, - ExecuteMsg as AdapterExecMsg, QueryMsg as AdapterQuery, - }, - module_factory::{ExecuteMsg as ModuleFactoryMsg, FactoryModuleInstallConfig}, - objects::{ - dependency::Dependency, - gov_type::GovernanceDetails, - module::{assert_module_data_validity, Module, ModuleInfo, ModuleVersion}, - module_reference::ModuleReference, - ownership::{self, GovOwnershipError}, - salt::generate_instantiate_salt, - validation::{validate_description, validate_link, validate_name}, - version_control::VersionControlContract, - AccountId, - }, - version_control::ModuleResponse, - ACCOUNT, -}; -use cosmwasm_std::{ - ensure, from_json, to_json_binary, wasm_execute, Addr, Attribute, Binary, Coin, CosmosMsg, - Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Storage, SubMsg, - SubMsgResult, WasmMsg, -}; -use cw2::{get_contract_version, ContractVersion}; -use cw_storage_plus::Item; -use semver::Version; - -use crate::{ - contract::ManagerResult, error::ManagerError, queries::query_module_version, validation, - versioning, -}; - -pub const REGISTER_MODULES_DEPENDENCIES: u64 = 1; - -pub const MIGRATE_CONTEXT: Item)>> = Item::new("context"); - -pub(crate) const INSTALL_MODULES_CONTEXT: Item)>> = Item::new("icontext"); - -/// Adds, updates or removes provided addresses. -/// Should only be called by contract that adds/removes modules. -/// Factory is admin on init -pub fn update_module_addresses( - deps: DepsMut, - to_add: Option>, - to_remove: Option>, -) -> ManagerResult { - if let Some(modules_to_add) = to_add { - for (id, new_address) in modules_to_add.into_iter() { - if id.is_empty() { - return Err(ManagerError::InvalidModuleName {}); - }; - // validate addr - ACCOUNT_MODULES.save( - deps.storage, - id.as_str(), - &deps.api.addr_validate(&new_address)?, - )?; - } - } - - if let Some(modules_to_remove) = to_remove { - for id in modules_to_remove.into_iter() { - validation::validate_not_proxy(&id)?; - ACCOUNT_MODULES.remove(deps.storage, id.as_str()); - } - } - - Ok(ManagerResponse::action("update_module_addresses")) -} - -/// Adds the modules dependencies -pub(crate) fn register_dependencies(deps: DepsMut, _result: SubMsgResult) -> ManagerResult { - let modules = INSTALL_MODULES_CONTEXT.load(deps.storage)?; - - for (module, module_addr) in &modules { - assert_module_data_validity(&deps.querier, module, module_addr.clone())?; - - match module { - Module { - reference: ModuleReference::App(_), - info, - } - | Module { - reference: ModuleReference::Adapter(_), - info, - } => { - let id = info.id(); - // assert version requirements - let dependencies = versioning::assert_install_requirements(deps.as_ref(), &id)?; - versioning::set_as_dependent(deps.storage, id, dependencies)?; - } - Module { - reference: ModuleReference::Standalone(_), - info, - } => { - let id = info.id(); - // assert version requirements - let dependencies = - versioning::assert_install_requirements_standalone(deps.as_ref(), &id)?; - versioning::set_as_dependent(deps.storage, id, dependencies)?; - } - _ => (), - }; - } - - Ok(Response::new()) -} - -/// Execute the [`exec_msg`] on the provided [`module_id`], -pub fn exec_on_module( - deps: DepsMut, - info: MessageInfo, - module_id: String, - exec_msg: Binary, -) -> ManagerResult { - // only owner can forward messages to modules - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - let module_addr = load_module_addr(deps.storage, &module_id)?; - - let response = ManagerResponse::new("exec_on_module", vec![("module", module_id)]).add_message( - CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: module_addr.into(), - msg: exec_msg, - funds: info.funds, - }), - ); - - Ok(response) -} - -#[allow(clippy::too_many_arguments)] -/// Creates a sub-account for this account, -pub fn create_sub_account( - deps: DepsMut, - info: MessageInfo, - env: Env, - name: String, - description: Option, - link: Option, - namespace: Option, - install_modules: Vec, - account_id: Option, -) -> ManagerResult { - // only owner can create a subaccount - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - let create_account_msg = &abstract_std::account_factory::ExecuteMsg::CreateAccount { - // proxy of this manager will be the account owner - governance: GovernanceDetails::SubAccount { - account: env.contract.address.into_string(), - }, - name, - description, - link, - namespace, - install_modules, - account_id: account_id.map(AccountId::local), - }; - - let account_factory_addr = query_module( - deps.as_ref(), - ModuleInfo::from_id_latest(abstract_std::ACCOUNT_FACTORY)?, - None, - )? - .module - .reference - .unwrap_native()?; - - // Call factory and attach all funds that were provided. - let account_creation_message = - wasm_execute(account_factory_addr, create_account_msg, info.funds)?; - - let response = ManagerResponse::new::<_, Attribute>("create_sub_account", vec![]) - .add_message(account_creation_message); - - Ok(response) -} - -pub fn handle_sub_account_action( - deps: DepsMut, - info: MessageInfo, - action: UpdateSubAccountAction, -) -> ManagerResult { - match action { - UpdateSubAccountAction::UnregisterSubAccount { id } => { - unregister_sub_account(deps, info, id) - } - UpdateSubAccountAction::RegisterSubAccount { id } => register_sub_account(deps, info, id), - _ => unimplemented!(), - } -} - -// Unregister sub-account from the state -fn unregister_sub_account(deps: DepsMut, info: MessageInfo, id: u32) -> ManagerResult { - let config = CONFIG.load(deps.storage)?; - - let account = abstract_std::version_control::state::ACCOUNT_ADDRESSES.query( - &deps.querier, - config.version_control_address, - &AccountId::local(id), - )?; - - if account.is_some_and(|a| a.addr() == info.sender) { - SUB_ACCOUNTS.remove(deps.storage, id); - - Ok(ManagerResponse::new( - "unregister_sub_account", - vec![("sub_account_removed", id.to_string())], - )) - } else { - Err(ManagerError::SubAccountRemovalFailed {}) - } -} - -// Register sub-account to the state -fn register_sub_account(deps: DepsMut, info: MessageInfo, id: u32) -> ManagerResult { - let config = CONFIG.load(deps.storage)?; - - let account = abstract_std::version_control::state::ACCOUNT_ADDRESSES.query( - &deps.querier, - config.version_control_address, - &AccountId::local(id), - )?; - - if account.is_some_and(|a| a.addr() == info.sender) { - SUB_ACCOUNTS.save(deps.storage, id, &Empty {})?; - - Ok(ManagerResponse::new( - "register_sub_account", - vec![("sub_account_added", id.to_string())], - )) - } else { - Err(ManagerError::SubAccountRegisterFailed {}) - } -} - -/// Checked load of a module address -fn load_module_addr(storage: &dyn Storage, module_id: &String) -> Result { - ACCOUNT_MODULES - .may_load(storage, module_id)? - .ok_or_else(|| ManagerError::ModuleNotFound(module_id.clone())) -} - -/// Uninstall the module with the ID [`module_id`] -pub fn uninstall_module(deps: DepsMut, info: MessageInfo, module_id: String) -> ManagerResult { - // only owner can uninstall modules - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - validation::validate_not_proxy(&module_id)?; - - // module can only be uninstalled if there are no dependencies on it - let dependents = DEPENDENTS.may_load(deps.storage, &module_id)?; - if let Some(dependents) = dependents { - if !dependents.is_empty() { - return Err(ManagerError::ModuleHasDependents(Vec::from_iter( - dependents, - ))); - } - // Remove the module from the dependents list - DEPENDENTS.remove(deps.storage, &module_id); - } - - // Remove module as dependant from its dependencies. - let module_data = versioning::load_module_data(deps.as_ref(), &module_id)?; - let module_dependencies = module_data.dependencies; - versioning::remove_as_dependent(deps.storage, &module_id, module_dependencies)?; - - // Remove for proxy if needed - let config = CONFIG.load(deps.storage)?; - let vc = VersionControlContract::new(config.version_control_address); - - let module = vc.query_module( - ModuleInfo::from_id(&module_data.module, module_data.version.into())?, - &deps.querier, - )?; - - let mut response = ManagerResponse::new("uninstall_module", vec![("module", &module_id)]); - // Remove module from proxy whitelist if it supposed to be removed - if module.should_be_whitelisted() { - let proxy = ACCOUNT_MODULES.load(deps.storage, ACCOUNT)?; - let module_addr = load_module_addr(deps.storage, &module_id)?; - let remove_from_proxy_msg = - remove_module_from_proxy(proxy.into_string(), module_addr.into_string())?; - response = response.add_message(remove_from_proxy_msg); - } - ACCOUNT_MODULES.remove(deps.storage, &module_id); - - Ok(response) -} - -/// Update governance of sub_accounts account after claim -pub fn maybe_update_sub_account_governance(deps: DepsMut) -> ManagerResult> { - let mut msgs = vec![]; - let mut account_id = None; - let ownership = ownership::get_ownership(deps.storage)?; - // Get pending governance - let pending_governance = ownership - .pending_owner - .ok_or(GovOwnershipError::TransferNotFound)?; - - // Clear state for previous manager if it was sub-account - if let GovernanceDetails::SubAccount { account } = ownership.owner { - let id = ACCOUNT_ID.load(deps.storage)?; - let unregister_message = wasm_execute( - account, - &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::UnregisterSubAccount { - id: id.seq(), - }), - vec![], - )?; - // For optimizing the gas we save it, in case new owner is sub-account as well - account_id = Some(id); - msgs.push(unregister_message.into()); - } - - // Update state for new manager if owner will be the sub-account - if let GovernanceDetails::SubAccount { account } = &pending_governance { - let id = if let Some(id) = account_id { - id - } else { - ACCOUNT_ID.load(deps.storage)? - }; - let register_message = wasm_execute( - account, - &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::RegisterSubAccount { - id: id.seq(), - }), - vec![], - )?; - msgs.push(register_message.into()); - } - - Ok(msgs) -} - -/// Renounce ownership of this account \ -/// **WARNING**: This will lock the account, making it unusable. -pub fn remove_account_from_contracts(deps: DepsMut) -> ManagerResult> { - let mut msgs = vec![]; - - let account_id = ACCOUNT_ID.load(deps.storage)?; - // Check for any sub accounts - let sub_account = SUB_ACCOUNTS - .keys(deps.storage, None, None, cosmwasm_std::Order::Ascending) - .next() - .transpose()?; - ensure!( - sub_account.is_none(), - ManagerError::RenounceWithSubAccount {} - ); - - let ownership = ownership::get_ownership(deps.storage)?; - if let GovernanceDetails::SubAccount { account } = ownership.owner { - // Unregister itself (sub-account) from the owning account. - msgs.push( - wasm_execute( - account, - &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::UnregisterSubAccount { - id: account_id.seq(), - }), - vec![], - )? - .into(), - ); - } - - let config = CONFIG.load(deps.storage)?; - let vc = VersionControlContract::new(config.version_control_address); - let mut namespaces = vc - .query_namespaces(vec![account_id], &deps.querier)? - .namespaces; - let namespace = namespaces.pop(); - if let Some((namespace, _)) = namespace { - // Remove the namespace that this account holds. - msgs.push( - wasm_execute( - vc.address, - &abstract_std::version_control::ExecuteMsg::RemoveNamespaces { - namespaces: vec![namespace.to_string()], - }, - vec![], - )? - .into(), - ) - }; - Ok(msgs) -} - -/// Migrate modules through address updates or contract migrations -/// The dependency store is updated during migration -/// A reply message is called after performing all the migrations which ensures version compatibility of the new state. -/// Migrations are performed in-order and should be done in a top-down approach. -pub fn upgrade_modules( - mut deps: DepsMut, - env: Env, - info: MessageInfo, - modules: Vec<(ModuleInfo, Option)>, -) -> ManagerResult { - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - ensure!(!modules.is_empty(), ManagerError::NoUpdates {}); - - let mut upgrade_msgs = vec![]; - - let mut manager_migrate_info = None; - - let mut upgraded_module_ids = Vec::new(); - - // Set the migrate messages for each module that's not the manager and update the dependency store - for (module_info, migrate_msg) in modules { - let module_id = module_info.id(); - - // Check for duplicates - if upgraded_module_ids.contains(&module_id) { - return Err(ManagerError::DuplicateModuleMigration { module_id }); - } else { - upgraded_module_ids.push(module_id.clone()); - } - - if module_id == ACCOUNT { - manager_migrate_info = Some((module_info, migrate_msg)); - } else { - set_migrate_msgs_and_context( - deps.branch(), - module_info, - migrate_msg, - &mut upgrade_msgs, - )?; - } - } - - // Upgrade the manager last - if let Some((manager_info, manager_migrate_msg)) = manager_migrate_info { - upgrade_msgs.push(self_upgrade_msg( - deps.branch(), - &env.contract.address, - manager_info, - manager_migrate_msg.unwrap_or_default(), - )?); - } - - let callback_msg = wasm_execute( - env.contract.address, - &ExecuteMsg::Callback(CallbackMsg {}), - vec![], - )?; - - Ok(ManagerResponse::new( - "upgrade_modules", - vec![("upgraded_modules", upgraded_module_ids.join(","))], - ) - .add_messages(upgrade_msgs) - .add_message(callback_msg)) -} - -pub(crate) fn set_migrate_msgs_and_context( - deps: DepsMut, - module_info: ModuleInfo, - migrate_msg: Option, - msgs: &mut Vec, -) -> Result<(), ManagerError> { - let config = CONFIG.load(deps.storage)?; - let version_control = VersionControlContract::new(config.version_control_address); - - let old_module_addr = load_module_addr(deps.storage, &module_info.id())?; - let old_module_cw2 = - query_module_version(deps.as_ref(), old_module_addr.clone(), &version_control)?; - let requested_module = query_module(deps.as_ref(), module_info.clone(), Some(old_module_cw2))?; - - let migrate_msgs = match requested_module.module.reference { - // upgrading an adapter is done by moving the authorized addresses to the new contract address and updating the permissions on the proxy. - ModuleReference::Adapter(new_adapter_addr) => handle_adapter_migration( - deps, - requested_module.module.info, - old_module_addr, - new_adapter_addr, - )?, - ModuleReference::App(code_id) => handle_app_migration( - deps, - migrate_msg, - old_module_addr, - requested_module.module.info, - code_id, - )?, - ModuleReference::AccountBase(code_id) | ModuleReference::Standalone(code_id) => { - vec![build_module_migrate_msg( - old_module_addr, - code_id, - migrate_msg.unwrap(), - )] - } - - _ => return Err(ManagerError::NotUpgradeable(module_info)), - }; - msgs.extend(migrate_msgs); - Ok(()) -} - -/// Handle Adapter module migration and return the migration messages -fn handle_adapter_migration( - mut deps: DepsMut, - module_info: ModuleInfo, - old_adapter_addr: Addr, - new_adapter_addr: Addr, -) -> ManagerResult> { - let module_id = module_info.id(); - versioning::assert_migrate_requirements( - deps.as_ref(), - &module_id, - module_info.version.try_into()?, - )?; - let old_deps = versioning::load_module_dependencies(deps.as_ref(), &module_id)?; - // Update the address of the adapter internally - update_module_addresses( - deps.branch(), - Some(vec![(module_id.clone(), new_adapter_addr.to_string())]), - None, - )?; - - add_module_upgrade_to_context(deps.storage, &module_id, old_deps)?; - - replace_adapter(deps, new_adapter_addr, old_adapter_addr) -} - -/// Handle app module migration and return the migration messages -fn handle_app_migration( - deps: DepsMut, - migrate_msg: Option, - old_module_addr: Addr, - module_info: ModuleInfo, - code_id: u64, -) -> ManagerResult> { - let module_id = module_info.id(); - versioning::assert_migrate_requirements( - deps.as_ref(), - &module_id, - module_info.version.try_into()?, - )?; - let old_deps = versioning::load_module_dependencies(deps.as_ref(), &module_id)?; - - // Add module upgrade to reply context - add_module_upgrade_to_context(deps.storage, &module_id, old_deps)?; - - Ok(vec![build_module_migrate_msg( - old_module_addr, - code_id, - migrate_msg.unwrap_or_else(|| to_json_binary(&Empty {}).unwrap()), - )]) -} - -/// Add the module upgrade to the migration context and check for duplicates -fn add_module_upgrade_to_context( - storage: &mut dyn Storage, - module_id: &str, - module_deps: Vec, -) -> Result<(), ManagerError> { - // Add module upgrade to reply context - let update_context = |mut upgraded_modules: Vec<(String, Vec)>| -> StdResult)>> { - upgraded_modules.push((module_id.to_string(), module_deps)); - Ok(upgraded_modules) - }; - MIGRATE_CONTEXT.update(storage, update_context)?; - - Ok(()) -} - -// migrates the module to a new version -fn build_module_migrate_msg(module_addr: Addr, new_code_id: u64, migrate_msg: Binary) -> CosmosMsg { - let migration_msg: CosmosMsg = CosmosMsg::Wasm(WasmMsg::Migrate { - contract_addr: module_addr.into_string(), - new_code_id, - msg: migrate_msg, - }); - migration_msg -} - -/// Replaces the current adapter with a different version -/// Also moves all the authorized address permissions to the new contract and removes them from the old -pub fn replace_adapter( - deps: DepsMut, - new_adapter_addr: Addr, - old_adapter_addr: Addr, -) -> Result, ManagerError> { - let mut msgs = vec![]; - // Makes sure we already have the adapter installed - let proxy_addr = ACCOUNT_MODULES.load(deps.storage, ACCOUNT)?; - let AuthorizedAddressesResponse { - addresses: authorized_addresses, - } = deps.querier.query_wasm_smart( - old_adapter_addr.to_string(), - &>::Base(BaseQueryMsg::AuthorizedAddresses { - proxy_address: proxy_addr.to_string(), - }), - )?; - let authorized_to_migrate: Vec = authorized_addresses - .into_iter() - .map(|addr| addr.into_string()) - .collect(); - // Remove authorized addresses - msgs.push(configure_adapter( - &old_adapter_addr, - AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: vec![], - to_remove: authorized_to_migrate.clone(), - }, - )?); - // Add authorized addresses to new - msgs.push(configure_adapter( - &new_adapter_addr, - AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: authorized_to_migrate, - to_remove: vec![], - }, - )?); - // Remove adapter permissions from proxy - msgs.push(remove_module_from_proxy( - proxy_addr.to_string(), - old_adapter_addr.into_string(), - )?); - // Add new adapter to proxy - msgs.push(add_modules_to_proxy( - proxy_addr.into_string(), - vec![new_adapter_addr.into_string()], - )?); - - Ok(msgs) -} - -/// Update the Account information -pub fn update_info( - deps: DepsMut, - info: MessageInfo, - name: Option, - description: Option, - link: Option, -) -> ManagerResult { - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - let mut info: AccountInfo = INFO.load(deps.storage)?; - if let Some(name) = name { - validate_name(&name)?; - info.name = name; - } - validate_description(description.as_deref())?; - info.description = description; - validate_link(link.as_deref())?; - info.link = link; - INFO.save(deps.storage, &info)?; - - Ok(ManagerResponse::action("update_info")) -} - -pub fn update_suspension_status( - deps: DepsMut, - info: MessageInfo, - is_suspended: SuspensionStatus, - response: Response, -) -> ManagerResult { - // only owner can update suspension status - ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; - - SUSPENSION_STATUS.save(deps.storage, &is_suspended)?; - - Ok(response.add_abstract_attributes(vec![("is_suspended", is_suspended.to_string())])) -} - -/// Query Version Control for the [`Module`] given the provided [`ContractVersion`] -fn query_module( - deps: Deps, - module_info: ModuleInfo, - old_contract_version: Option, -) -> Result { - let config = CONFIG.load(deps.storage)?; - // Construct feature object to access registry functions - let version_control = VersionControlContract::new(config.version_control_address); - - let module = match &module_info.version { - ModuleVersion::Version(new_version) => { - let old_contract = old_contract_version.unwrap(); - - let new_version = new_version.parse::().unwrap(); - let old_version = old_contract.version.parse::().unwrap(); - - if new_version < old_version { - return Err(ManagerError::OlderVersion( - new_version.to_string(), - old_version.to_string(), - )); - } - Module { - info: module_info.clone(), - reference: version_control - .query_module_reference_raw(&module_info, &deps.querier)?, - } - } - ModuleVersion::Latest => { - // Query latest version of contract - version_control.query_module(module_info.clone(), &deps.querier)? - } - }; - - Ok(ModuleResponse { - module: Module { - info: module.info, - reference: module.reference, - }, - config: version_control.query_config(module_info, &deps.querier)?, - }) -} - -fn self_upgrade_msg( - deps: DepsMut, - self_addr: &Addr, - module_info: ModuleInfo, - migrate_msg: Binary, -) -> ManagerResult { - let contract = get_contract_version(deps.storage)?; - let module = query_module(deps.as_ref(), module_info.clone(), Some(contract))?; - if let ModuleReference::AccountBase(manager_code_id) = module.module.reference { - let migration_msg: CosmosMsg = CosmosMsg::Wasm(WasmMsg::Migrate { - contract_addr: self_addr.to_string(), - new_code_id: manager_code_id, - msg: migrate_msg, - }); - Ok(migration_msg) - } else { - Err(ManagerError::InvalidReference(module_info)) - } -} - -fn add_modules_to_proxy( - proxy_address: String, - module_addresses: Vec, -) -> StdResult> { - Ok(wasm_execute( - proxy_address, - &ProxyMsg::AddModules { - modules: module_addresses, - }, - vec![], - )? - .into()) -} - -fn remove_module_from_proxy( - proxy_address: String, - dapp_address: String, -) -> StdResult> { - Ok(wasm_execute( - proxy_address, - &ProxyMsg::RemoveModule { - module: dapp_address, - }, - vec![], - )? - .into()) -} - -#[inline(always)] -fn configure_adapter( - adapter_address: impl Into, - message: AdapterBaseMsg, -) -> StdResult { - let adapter_msg: AdapterExecMsg = BaseExecuteMsg { - proxy_address: None, - msg: message, - } - .into(); - Ok(wasm_execute(adapter_address, &adapter_msg, vec![])?.into()) -} - -pub fn update_account_status( - deps: DepsMut, - info: MessageInfo, - suspension_status: Option, -) -> Result { - let mut response = ManagerResponse::action("update_status"); - - if let Some(suspension_status) = suspension_status { - response = update_suspension_status(deps, info, suspension_status, response)?; - } else { - return Err(ManagerError::NoUpdates {}); - } - - Ok(response) -} - -#[cfg(test)] -mod tests { - use super::*; - - use crate::{contract, test_common::mock_init}; - use abstract_testing::prelude::*; - use cosmwasm_std::{ - testing::{message_info, mock_dependencies, mock_env, MockApi, MockQuerier, MockStorage}, - Order, OwnedDeps, StdError, - }; - use speculoos::prelude::*; - - type ManagerTestResult = Result<(), ManagerError>; - - fn mock_installed_proxy(deps: &mut MockDeps) -> StdResult<()> { - let base = test_account_base(deps.api); - ACCOUNT_MODULES.save(deps.as_mut().storage, ACCOUNT, &base.proxy) - } - - fn execute_as(deps: DepsMut, sender: &Addr, msg: ExecuteMsg) -> ManagerResult { - contract::execute(deps, mock_env(), message_info(sender, &[]), msg) - } - - fn init_with_proxy(deps: &mut MockDeps) { - mock_init(deps).unwrap(); - mock_installed_proxy(deps).unwrap(); - } - - fn load_account_modules(storage: &dyn Storage) -> Result, StdError> { - ACCOUNT_MODULES - .range(storage, None, None, Order::Ascending) - .collect() - } - - fn test_only_owner(msg: ExecuteMsg) -> ManagerTestResult { - let mut deps = mock_dependencies(); - let not_owner = deps.api.addr_make("not_owner"); - mock_init(&mut deps)?; - - let res = execute_as(deps.as_mut(), ¬_owner, msg); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::Ownership( - ownership::GovOwnershipError::NotOwner, - )); - - Ok(()) - } - - type MockDeps = OwnedDeps; - - mod set_owner_and_gov_type { - use ownership::GovAction; - - use super::*; - - #[test] - fn only_owner() -> ManagerTestResult { - let deps = mock_dependencies(); - let test_owner = deps.api.addr_make("test_owner"); - - let msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::Monarchy { - monarch: test_owner.to_string(), - }, - expiry: None, - }); - - test_only_owner(msg) - } - - #[test] - fn validates_new_owner_address() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - mock_init(&mut deps)?; - - let msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::Monarchy { - monarch: "INVALID".to_string(), - }, - expiry: None, - }); - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(res).is_err().matches(|err| { - matches!( - err, - ManagerError::Ownership(GovOwnershipError::Abstract( - abstract_std::AbstractError::Std(StdError::GenericErr { .. }) - )) - ) - }); - Ok(()) - } - - #[test] - fn updates_owner() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - let new_owner = deps.api.addr_make("new_owner"); - mock_init(&mut deps)?; - - let set_owner_msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::Monarchy { - monarch: new_owner.to_string(), - }, - expiry: None, - }); - - let res = execute_as(deps.as_mut(), &owner, set_owner_msg); - assert_that!(&res).is_ok(); - - let accept_msg = ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership); - execute_as(deps.as_mut(), &new_owner, accept_msg)?; - - let actual_owner = ownership::get_ownership(&deps.storage)?.owner; - - assert_that!(&actual_owner).is_equal_to(GovernanceDetails::Monarchy { - monarch: Addr::unchecked(new_owner), - }); - - Ok(()) - } - - #[test] - fn updates_governance_type() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - let new_gov = deps.api.addr_make("new_gov"); - - mock_init(&mut deps)?; - - let msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::Monarchy { - monarch: new_gov.to_string(), - }, - expiry: None, - }); - - execute_as(deps.as_mut(), &owner, msg)?; - - let ownership = ownership::get_ownership(deps.as_ref().storage)?; - assert_that!(ownership - .owner - .owner_address(&deps.as_ref().querier) - .unwrap() - .to_string()) - .is_equal_to(owner.to_string()); - - let accept_msg = ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership); - execute_as(deps.as_mut(), &new_gov, accept_msg)?; - - let ownership = ownership::get_ownership(deps.as_ref().storage)?; - assert_that!(ownership - .owner - .owner_address(&deps.as_ref().querier) - .unwrap() - .to_string()) - .is_equal_to(new_gov.to_string()); - - Ok(()) - } - } - - mod update_module_addresses { - use super::*; - - #[test] - fn manual_adds_module_to_account_modules() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let module1_addr = deps.api.addr_make("module1"); - let module2_addr = deps.api.addr_make("module2"); - - mock_init(&mut deps).unwrap(); - - let to_add: Vec<(String, String)> = vec![ - ("test:module1".to_string(), module1_addr.to_string()), - ("test:module2".to_string(), module2_addr.to_string()), - ]; - - let res = update_module_addresses(deps.as_mut(), Some(to_add.clone()), Some(vec![])); - assert_that!(&res).is_ok(); - - let actual_modules = load_account_modules(&deps.storage)?; - - speculoos::prelude::VecAssertions::has_length( - &mut assert_that!(&actual_modules), - // Plus proxy - to_add.len() + 1, - ); - for (module_id, addr) in to_add { - speculoos::iter::ContainingIntoIterAssertions::contains( - &mut assert_that!(&actual_modules), - &(module_id, Addr::unchecked(addr)), - ); - } - - Ok(()) - } - - #[test] - fn missing_id() -> ManagerTestResult { - let mut deps = mock_dependencies(); - - mock_init(&mut deps).unwrap(); - - let to_add: Vec<(String, String)> = vec![("".to_string(), "module1_addr".to_string())]; - - let res = update_module_addresses(deps.as_mut(), Some(to_add), Some(vec![])); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::InvalidModuleName {}); - - Ok(()) - } - - #[test] - fn manual_removes_module_from_account_modules() -> ManagerTestResult { - let mut deps = mock_dependencies(); - mock_init(&mut deps)?; - - // manually add module - ACCOUNT_MODULES.save( - &mut deps.storage, - "test:module", - &Addr::unchecked("test_module_addr"), - )?; - - let to_remove: Vec = vec!["test:module".to_string()]; - - let res = update_module_addresses(deps.as_mut(), Some(vec![]), Some(to_remove)); - assert_that!(&res).is_ok(); - - let actual_modules = load_account_modules(&deps.storage)?; - - // Only proxy left - speculoos::prelude::VecAssertions::has_length(&mut assert_that!(&actual_modules), 1); - - Ok(()) - } - - #[test] - fn disallows_removing_proxy() -> ManagerTestResult { - let mut deps = mock_dependencies(); - init_with_proxy(&mut deps); - - let to_remove: Vec = vec![ACCOUNT.to_string()]; - - let res = update_module_addresses(deps.as_mut(), Some(vec![]), Some(to_remove)); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::CannotRemoveProxy {}); - - Ok(()) - } - - #[test] - fn only_account_owner() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - let not_account_factory = deps.api.addr_make("not_account_factory"); - let module_addr = deps.api.addr_make("module_addr"); - mock_init(&mut deps)?; - - // add some thing - let action_add = InternalConfigAction::UpdateModuleAddresses { - to_add: Some(vec![("module:other".to_string(), module_addr.to_string())]), - to_remove: None, - }; - let msg = ExecuteMsg::UpdateInternalConfig(to_json_binary(&action_add).unwrap()); - - // the factory can not call this - let res = execute_as(deps.as_mut(), &abstr.account_factory, msg.clone()); - assert_that!(&res).is_err(); - - // only the owner can - let res = execute_as(deps.as_mut(), &owner, msg.clone()); - assert_that!(&res).is_ok(); - - let res = execute_as(deps.as_mut(), ¬_account_factory, msg); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::Ownership(GovOwnershipError::NotOwner)); - - Ok(()) - } - } - - // TODO: move those tests to integrations tests, since we can't do query in unit tests - mod install_module { - use super::*; - - #[test] - fn only_account_owner() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let not_owner = deps.api.addr_make("not_owner"); - mock_init(&mut deps)?; - - let msg = ExecuteMsg::InstallModules { - modules: vec![ModuleInstallConfig::new( - ModuleInfo::from_id_latest("test:module")?, - None, - )], - }; - - let res = execute_as(deps.as_mut(), ¬_owner, msg); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::Ownership(GovOwnershipError::NotOwner)); - - Ok(()) - } - } - - mod uninstall_module { - use std::collections::HashSet; - - use super::*; - - #[test] - fn only_owner() -> ManagerTestResult { - let msg = ExecuteMsg::UninstallModule { - module_id: "test:module".to_string(), - }; - - test_only_owner(msg) - } - - #[test] - fn errors_with_existing_dependents() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - init_with_proxy(&mut deps); - - let test_module = "test:module"; - let msg = ExecuteMsg::UninstallModule { - module_id: test_module.to_string(), - }; - - // manually add dependents - let dependents = HashSet::from_iter(vec!["test:dependent".to_string()]); - DEPENDENTS.save(&mut deps.storage, test_module, &dependents)?; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::ModuleHasDependents(Vec::from_iter( - dependents, - ))); - - Ok(()) - } - - #[test] - fn disallows_removing_proxy() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - init_with_proxy(&mut deps); - - let msg = ExecuteMsg::UninstallModule { - module_id: ACCOUNT.to_string(), - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::CannotRemoveProxy {}); - - Ok(()) - } - - // rest should be in integration tests - } - - mod exec_on_module { - use super::*; - - #[test] - fn only_owner() -> ManagerTestResult { - let msg = ExecuteMsg::ExecOnModule { - module_id: "test:module".to_string(), - exec_msg: to_json_binary(&"some msg")?, - }; - - test_only_owner(msg) - } - - #[test] - fn fails_with_nonexistent_module() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - - mock_init(&mut deps)?; - - let missing_module = "test:module".to_string(); - let msg = ExecuteMsg::ExecOnModule { - module_id: missing_module.clone(), - exec_msg: to_json_binary(&"some msg")?, - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::ModuleNotFound(missing_module)); - - Ok(()) - } - - #[test] - fn forwards_exec_to_module() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - - init_with_proxy(&mut deps); - - let exec_msg = "some msg"; - - let msg = ExecuteMsg::ExecOnModule { - module_id: ACCOUNT.to_string(), - exec_msg: to_json_binary(&exec_msg)?, - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res).is_ok(); - - let msgs = res.unwrap().messages; - assert_that!(&msgs).has_length(1); - - let expected_msg: CosmosMsg = - wasm_execute(abstr.account.proxy, &exec_msg, vec![])?.into(); - - let actual_msg = &msgs[0]; - assert_that!(&actual_msg.msg).is_equal_to(&expected_msg); - - Ok(()) - } - } - - mod update_info { - use abstract_std::objects::validation::ValidationError; - - use super::*; - - #[test] - fn only_owner() -> ManagerTestResult { - let msg = ExecuteMsg::UpdateInfo { - name: None, - description: None, - link: None, - }; - - test_only_owner(msg) - } - // integration tests - - #[test] - fn updates() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - init_with_proxy(&mut deps); - - let name = "new name"; - let description = "new description"; - let link = "http://a.be"; - - let msg = ExecuteMsg::UpdateInfo { - name: Some(name.to_string()), - description: Some(description.to_string()), - link: Some(link.to_string()), - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res).is_ok(); - - let info = INFO.load(deps.as_ref().storage)?; - - assert_that!(&info.name).is_equal_to(name.to_string()); - assert_that!(&info.description.unwrap()).is_equal_to(description.to_string()); - assert_that!(&info.link.unwrap()).is_equal_to(link.to_string()); - - Ok(()) - } - - #[test] - fn removals() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - init_with_proxy(&mut deps); - - let prev_name = "name".to_string(); - INFO.save( - deps.as_mut().storage, - &AccountInfo { - name: prev_name.clone(), - chain_id: "".to_string(), - description: Some("description".to_string()), - link: Some("link".to_string()), - }, - )?; - - let msg = ExecuteMsg::UpdateInfo { - name: None, - description: None, - link: None, - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res).is_ok(); - - let info = INFO.load(deps.as_ref().storage)?; - - assert_that!(&info.name).is_equal_to(&prev_name); - assert_that!(&info.description).is_none(); - assert_that!(&info.link).is_none(); - - Ok(()) - } - - #[test] - fn validates_name() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - init_with_proxy(&mut deps); - - let msg = ExecuteMsg::UpdateInfo { - name: Some("".to_string()), - description: None, - link: None, - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res).is_err().matches(|e| { - matches!( - e, - ManagerError::Validation(ValidationError::TitleInvalidShort(_)) - ) - }); - - let msg = ExecuteMsg::UpdateInfo { - name: Some("a".repeat(65)), - description: None, - link: None, - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res).is_err().matches(|e| { - matches!( - e, - ManagerError::Validation(ValidationError::TitleInvalidLong(_)) - ) - }); - - Ok(()) - } - - #[test] - fn validates_link() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - - init_with_proxy(&mut deps); - - let msg = ExecuteMsg::UpdateInfo { - name: None, - description: None, - link: Some("aoeu".to_string()), - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res).is_err().matches(|e| { - matches!( - e, - ManagerError::Validation(ValidationError::LinkInvalidShort(_)) - ) - }); - - let msg = ExecuteMsg::UpdateInfo { - name: None, - description: None, - link: Some("a".repeat(129)), - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&res).is_err().matches(|e| { - matches!( - e, - ManagerError::Validation(ValidationError::LinkInvalidLong(_)) - ) - }); - - Ok(()) - } - } - - mod handle_callback { - use super::*; - - #[test] - fn only_by_contract() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let not_contract = deps.api.addr_make("not_contract"); - mock_init(&mut deps)?; - let callback = CallbackMsg {}; - - let msg = ExecuteMsg::Callback(callback); - - let res = contract::execute( - deps.as_mut(), - mock_env(), - message_info(¬_contract, &[]), - msg, - ); - - assert_that!(&res) - .is_err() - .matches(|err| matches!(err, ManagerError::Std(StdError::GenericErr { .. }))); - - Ok(()) - } - } - - mod update_suspension_status { - use super::*; - - #[test] - fn only_owner() -> ManagerTestResult { - let mut deps = mock_dependencies(); - mock_init(&mut deps)?; - - let msg = ExecuteMsg::UpdateStatus { - is_suspended: Some(true), - }; - - test_only_owner(msg) - } - - #[test] - fn exec_fails_when_suspended() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - mock_init(&mut deps)?; - - let msg = ExecuteMsg::UpdateStatus { - is_suspended: Some(true), - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(res).is_ok(); - let actual_is_suspended = SUSPENSION_STATUS.load(&deps.storage).unwrap(); - assert_that!(&actual_is_suspended).is_true(); - - let update_info_msg = ExecuteMsg::UpdateInfo { - name: Some("asonetuh".to_string()), - description: None, - link: None, - }; - - let res = execute_as(deps.as_mut(), &owner, update_info_msg); - - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::AccountSuspended {}); - - Ok(()) - } - - #[test] - fn suspend_account() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - mock_init(&mut deps)?; - - let msg = ExecuteMsg::UpdateStatus { - is_suspended: Some(true), - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - - assert_that!(&res).is_ok(); - let actual_is_suspended = SUSPENSION_STATUS.load(&deps.storage).unwrap(); - assert_that!(&actual_is_suspended).is_true(); - Ok(()) - } - - #[test] - fn unsuspend_account() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - mock_init(&mut deps)?; - - let msg = ExecuteMsg::UpdateStatus { - is_suspended: Some(false), - }; - - let res = execute_as(deps.as_mut(), &owner, msg); - - assert_that!(&res).is_ok(); - let actual_status = SUSPENSION_STATUS.load(&deps.storage).unwrap(); - assert_that!(&actual_status).is_false(); - Ok(()) - } - } - - mod update_internal_config { - use abstract_std::manager::{InternalConfigAction::UpdateModuleAddresses, QueryMsg}; - - use super::*; - - #[test] - fn only_account_owner() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - - mock_init(&mut deps)?; - - let msg = ExecuteMsg::UpdateInternalConfig( - to_json_binary(&UpdateModuleAddresses { - to_add: None, - to_remove: None, - }) - .unwrap(), - ); - - let bad_sender = deps.api.addr_make("not_account_owner"); - let res = execute_as(deps.as_mut(), &bad_sender, msg.clone()); - - assert_that!(&res) - .is_err() - .is_equal_to(ManagerError::Ownership(GovOwnershipError::NotOwner)); - - let factory_res = execute_as(deps.as_mut(), &abstr.account_factory, msg.clone()); - assert_that!(&factory_res).is_err(); - - let owner_res = execute_as(deps.as_mut(), &owner, msg); - assert_that!(&owner_res).is_ok(); - - Ok(()) - } - - #[test] - fn should_return_err_unrecognized_action() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - mock_init(&mut deps)?; - - let msg = - ExecuteMsg::UpdateInternalConfig(to_json_binary(&QueryMsg::Config {}).unwrap()); - - let res = execute_as(deps.as_mut(), &abstr.account_factory, msg); - - assert_that!(&res) - .is_err() - .matches(|e| matches!(e, ManagerError::InvalidConfigAction { .. })); - - Ok(()) - } - } - - mod add_module_upgrade_to_context { - use super::*; - - #[test] - fn should_allow_migrate_msg() -> ManagerTestResult { - let mut deps = mock_dependencies(); - mock_init(&mut deps)?; - let storage = deps.as_mut().storage; - - let result = add_module_upgrade_to_context(storage, TEST_MODULE_ID, vec![]); - assert_that!(result).is_ok(); - - let upgraded_modules: Vec<(String, Vec)> = - MIGRATE_CONTEXT.load(storage).unwrap(); - - assert_that!(upgraded_modules).has_length(1); - assert_eq!(upgraded_modules[0].0, TEST_MODULE_ID); - - Ok(()) - } - } - - mod update_ownership { - use super::*; - - #[test] - fn allows_ownership_acceptance() -> ManagerTestResult { - let mut deps = mock_dependencies(); - let abstr = AbstractMockAddrs::new(deps.api); - let owner = abstr.owner; - mock_init(&mut deps)?; - - let pending_owner = deps.api.addr_make("not_owner"); - // mock pending owner - Item::new("ownership").save( - deps.as_mut().storage, - &ownership::Ownership { - owner: GovernanceDetails::Monarchy { monarch: owner }, - pending_expiry: None, - pending_owner: Some(GovernanceDetails::Monarchy { - monarch: pending_owner.clone(), - }), - }, - )?; - - let msg = ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership {}); - - execute_as(deps.as_mut(), &pending_owner, msg)?; - - Ok(()) - } - } - - // upgrade_modules tests are in the integration tests `upgrades` -} diff --git a/framework/contracts/account/manager/src/contract.rs b/framework/contracts/account/manager/src/contract.rs deleted file mode 100644 index 3ec6ec3cd5..0000000000 --- a/framework/contracts/account/manager/src/contract.rs +++ /dev/null @@ -1,353 +0,0 @@ -use abstract_sdk::std::{ - manager::{state::ACCOUNT_MODULES, UpdateSubAccountAction}, - manager::{ - state::{AccountInfo, Config, CONFIG, INFO, SUSPENSION_STATUS}, - CallbackMsg, ExecuteMsg, InstantiateMsg, QueryMsg, - }, - objects::validation::{validate_description, validate_link, validate_name}, - objects::{gov_type::GovernanceDetails, ownership}, - proxy::state::ACCOUNT_ID, - ACCOUNT, -}; - -use cosmwasm_std::{ - ensure_eq, wasm_execute, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, - StdResult, -}; -use cw2::set_contract_version; - -use crate::{ - commands::{self, *}, - error::ManagerError, - queries, versioning, -}; - -use cr - -pub type ManagerResult = Result; - -pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); -pub use crate::migrate::migrate; - -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn instantiate( - mut deps: DepsMut, - env: Env, - info: MessageInfo, - msg: InstantiateMsg, -) -> ManagerResult { - set_contract_version(deps.storage, ACCOUNT, CONTRACT_VERSION)?; - let module_factory_address = deps.api.addr_validate(&msg.module_factory_address)?; - let version_control_address = deps.api.addr_validate(&msg.version_control_address)?; - - // Save account id - ACCOUNT_ID.save(deps.storage, &msg.account_id)?; - - // Save config - let config = Config { - version_control_address: version_control_address.clone(), - module_factory_address: module_factory_address.clone(), - }; - CONFIG.save(deps.storage, &config)?; - - // Verify info - validate_description(msg.description.as_deref())?; - validate_link(msg.link.as_deref())?; - validate_name(&msg.name)?; - - let account_info = AccountInfo { - name: msg.name, - description: msg.description, - link: msg.link, - }; - - INFO.save(deps.storage, &account_info)?; - MIGRATE_CONTEXT.save(deps.storage, &vec![])?; - - // Add proxy to modules - ACCOUNT_MODULES.save( - deps.storage, - ACCOUNT, - &deps.api.addr_validate(&msg.proxy_addr)?, - )?; - - // Set owner - let cw_gov_owner = ownership::initialize_owner( - deps.branch(), - msg.owner, - config.version_control_address.clone(), - )?; - - SUSPENSION_STATUS.save(deps.storage, &false)?; - - let mut response = ManagerResponse::new( - "instantiate", - vec![ - ("account_id".to_owned(), msg.account_id.to_string()), - ("owner".to_owned(), cw_gov_owner.owner.to_string()), - ], - ); - - if !msg.install_modules.is_empty() { - // Install modules - let (install_msgs, install_attribute) = _install_modules( - deps.branch(), - msg.install_modules, - config.module_factory_address, - config.version_control_address, - info.funds, - )?; - response = response - .add_submessages(install_msgs) - .add_attribute(install_attribute.key, install_attribute.value); - } - - // Register on manager if it's sub-account - if let GovernanceDetails::SubAccount { account } = cw_gov_owner.owner { - response = response.add_message(wasm_execute( - account, - &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::RegisterSubAccount { - id: ACCOUNT_ID.load(deps.storage)?.seq(), - }), - vec![], - )?); - } - - Ok(response) -} - -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn execute(mut deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> ManagerResult { - match msg { - ExecuteMsg::UpdateStatus { - is_suspended: suspension_status, - } => update_account_status(deps, info, suspension_status), - msg => { - // Block actions if user is not subscribed - let is_suspended = SUSPENSION_STATUS.load(deps.storage)?; - if is_suspended { - return Err(ManagerError::AccountSuspended {}); - } - - match msg { - ExecuteMsg::UpdateInternalConfig(config) => { - update_internal_config(deps, info, config) - } - ExecuteMsg::InstallModules { modules } => install_modules(deps, info, modules), - ExecuteMsg::UninstallModule { module_id } => { - uninstall_module(deps, info, module_id) - } - ExecuteMsg::ExecOnModule { - module_id, - exec_msg, - } => exec_on_module(deps, info, module_id, exec_msg), - ExecuteMsg::CreateSubAccount { - name, - description, - link, - namespace, - install_modules, - account_id, - } => create_sub_account( - deps, - info, - env, - name, - description, - link, - namespace, - install_modules, - account_id, - ), - ExecuteMsg::Upgrade { modules } => upgrade_modules(deps, env, info, modules), - ExecuteMsg::UpdateInfo { - name, - description, - link, - } => update_info(deps, info, name, description, link), - ExecuteMsg::UpdateSubAccount(action) => { - handle_sub_account_action(deps, info, action) - } - ExecuteMsg::Callback(CallbackMsg {}) => handle_callback(deps, env, info), - // Used to claim or renounce an ownership change. - ExecuteMsg::UpdateOwnership(action) => { - // If sub-account related it may require some messages to be constructed beforehand - let msgs = match &action { - ownership::GovAction::TransferOwnership { .. } => vec![], - ownership::GovAction::AcceptOwnership => { - maybe_update_sub_account_governance(deps.branch())? - } - ownership::GovAction::RenounceOwnership => { - remove_account_from_contracts(deps.branch())? - } - }; - - let config = CONFIG.load(deps.storage)?; - let new_owner_attributes = ownership::update_ownership( - deps, - &env.block, - &info.sender, - config.version_control_address, - action, - )? - .into_attributes(); - Ok( - ManagerResponse::new("update_ownership", new_owner_attributes) - .add_messages(msgs), - ) - } - _ => panic!(), - } - } - } -} - -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { - match msg { - QueryMsg::ModuleVersions { ids } => queries::handle_contract_versions_query(deps, env, ids), - QueryMsg::ModuleAddresses { ids } => queries::handle_module_address_query(deps, env, ids), - QueryMsg::ModuleInfos { start_after, limit } => { - queries::handle_module_info_query(deps, start_after, limit) - } - QueryMsg::Info {} => queries::handle_account_info_query(deps), - QueryMsg::Config {} => queries::handle_config_query(deps), - QueryMsg::Ownership {} => { - cosmwasm_std::to_json_binary(&ownership::get_ownership(deps.storage)?) - } - QueryMsg::SubAccountIds { start_after, limit } => { - queries::handle_sub_accounts_query(deps, start_after, limit) - } - QueryMsg::TopLevelOwner {} => queries::handle_top_level_owner_query(deps, env), - } -} - -pub fn handle_callback(mut deps: DepsMut, env: Env, info: MessageInfo) -> ManagerResult { - ensure_eq!( - info.sender, - env.contract.address, - StdError::generic_err("Callback must be called by contract") - ); - let migrated_modules = MIGRATE_CONTEXT.load(deps.storage)?; - - for (migrated_module_id, old_deps) in migrated_modules { - versioning::maybe_remove_old_deps(deps.branch(), &migrated_module_id, &old_deps)?; - let new_deps = - versioning::maybe_add_new_deps(deps.branch(), &migrated_module_id, &old_deps)?; - versioning::assert_dependency_requirements(deps.as_ref(), &new_deps, &migrated_module_id)?; - } - - MIGRATE_CONTEXT.save(deps.storage, &vec![])?; - Ok(Response::new()) -} - - -#[cfg(test)] -mod tests { - use cosmwasm_std::testing::*; - use semver::Version; - use speculoos::prelude::*; - - use super::*; - use crate::{contract, test_common::mock_init}; - - mod migrate { - use abstract_std::{manager::MigrateMsg, AbstractError}; - use cw2::get_contract_version; - - use super::*; - - #[test] - fn disallow_same_version() -> ManagerResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps)?; - - let version: Version = CONTRACT_VERSION.parse().unwrap(); - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); - - assert_that!(res) - .is_err() - .is_equal_to(ManagerError::Abstract( - AbstractError::CannotDowngradeContract { - contract: ACCOUNT.to_string(), - from: version.clone(), - to: version, - }, - )); - - Ok(()) - } - - #[test] - fn disallow_downgrade() -> ManagerResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps)?; - - let big_version = "999.999.999"; - set_contract_version(deps.as_mut().storage, ACCOUNT, big_version)?; - - let version: Version = CONTRACT_VERSION.parse().unwrap(); - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); - - assert_that!(res) - .is_err() - .is_equal_to(ManagerError::Abstract( - AbstractError::CannotDowngradeContract { - contract: ACCOUNT.to_string(), - from: big_version.parse().unwrap(), - to: version, - }, - )); - - Ok(()) - } - - #[test] - fn disallow_name_change() -> ManagerResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps)?; - - let old_version = "0.0.0"; - let old_name = "old:contract"; - set_contract_version(deps.as_mut().storage, old_name, old_version)?; - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); - - assert_that!(res) - .is_err() - .is_equal_to(ManagerError::Abstract( - AbstractError::ContractNameMismatch { - from: old_name.parse().unwrap(), - to: ACCOUNT.parse().unwrap(), - }, - )); - - Ok(()) - } - - #[test] - fn works() -> ManagerResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps)?; - - let version: Version = CONTRACT_VERSION.parse().unwrap(); - - let small_version = Version { - minor: version.minor - 1, - ..version.clone() - } - .to_string(); - - set_contract_version(deps.as_mut().storage, ACCOUNT, small_version)?; - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {})?; - assert_that!(res.messages).has_length(0); - - assert_that!(get_contract_version(&deps.storage)?.version) - .is_equal_to(version.to_string()); - Ok(()) - } - } -} diff --git a/framework/contracts/account/manager/src/error.rs b/framework/contracts/account/manager/src/error.rs deleted file mode 100644 index 5480753083..0000000000 --- a/framework/contracts/account/manager/src/error.rs +++ /dev/null @@ -1,123 +0,0 @@ -use abstract_sdk::{std::objects::module::ModuleInfo, AbstractSdkError}; -use abstract_std::{ - objects::{validation::ValidationError, version_control::VersionControlError}, - AbstractError, -}; -use cosmwasm_std::{Instantiate2AddressError, StdError}; -use thiserror::Error; - -#[derive(Error, Debug, PartialEq)] -pub enum ManagerError { - #[error("{0}")] - Std(#[from] StdError), - - #[error("{0}")] - Abstract(#[from] AbstractError), - - #[error("{0}")] - AbstractSdk(#[from] AbstractSdkError), - - #[error("{0}")] - Validation(#[from] ValidationError), - - #[error("{0}")] - Ownership(#[from] abstract_std::objects::ownership::GovOwnershipError), - - #[error("{0}")] - Instantiate2AddressError(#[from] Instantiate2AddressError), - - #[error("{0}")] - VersionControlError(#[from] VersionControlError), - - #[error("Module with id: {0} is already installed")] - ModuleAlreadyInstalled(String), - - #[error("Cannot remove module because {0:?} depend(s) on it.")] - ModuleHasDependents(Vec), - - #[error("Contract got an unexpected Reply")] - UnexpectedReply(), - - #[error("The name of the proposed module can not have length 0.")] - InvalidModuleName {}, - - #[error("Registering module fails because caller is not module factory")] - CallerNotModuleFactory {}, - - #[error("A migrate msg is required when when migrating this module")] - MsgRequired {}, - - #[error("{0} not upgradable")] - NotUpgradeable(ModuleInfo), - - #[error("Cannot migrate {} twice", module_id)] - DuplicateModuleMigration { module_id: String }, - - #[error("Your account is currently suspended")] - AccountSuspended {}, - - #[error("The provided contract version {0} is lower than the current version {1}")] - OlderVersion(String, String), - - #[error("The provided module {0} was not found")] - ModuleNotFound(String), - - #[error("The provided module {0} can't be installed on an Abstract account")] - ModuleNotInstallable(String), - - #[error("Module {module_id} with version {version} does not fit requirement {comp}, post_migration: {post_migration}")] - VersionRequirementNotMet { - module_id: String, - version: String, - comp: String, - post_migration: bool, - }, - - #[error("module {0} is a dependency of {1} and is not installed.")] - DependencyNotMet(String, String), - - #[error("The provided module {0} has an invalid module reference.")] - InvalidReference(ModuleInfo), - - #[error("Cannot remove proxy")] - CannotRemoveProxy {}, - - #[error("No updates were included")] - NoUpdates {}, - - #[error("invalid configuration action, {}", error)] - InvalidConfigAction { error: StdError }, - - #[error("Must use ProposeOwner to change owner")] - MustUseProposeOwner {}, - - #[error("The address {0} doesn't have an owner, the manager can't determine admin right")] - NoContractOwner(String), - - #[error(" - Checking the admin recursively failed. - You either have the an error in your sub-account configuration or you are not authorized to make this call. - ")] - SubAccountAdminVerification, - - #[error("Removing sub account failed")] - SubAccountRemovalFailed {}, - - #[error("Register of sub account failed")] - SubAccountRegisterFailed {}, - - #[error("Can't renounce account, with active sub account")] - RenounceWithSubAccount {}, - - #[error("Can't propose Renounced governance, use update_ownership instead")] - ProposeRenounced {}, - - #[error("Can't create account with Renounced governance")] - InitRenounced {}, - - #[error("Reinstalls of same version of app or standalone are not allowed")] - ProhibitedReinstall {}, - - #[error("Failed to query modules to install: {error}")] - QueryModulesFailed { error: VersionControlError }, -} diff --git a/framework/contracts/account/manager/src/queries.rs b/framework/contracts/account/manager/src/queries.rs deleted file mode 100644 index 31c1d1c640..0000000000 --- a/framework/contracts/account/manager/src/queries.rs +++ /dev/null @@ -1,197 +0,0 @@ -use std::collections::BTreeMap; - -use abstract_sdk::{ - feature_objects::VersionControlContract, - std::manager::{ - state::{AccountInfo, ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, INFO}, - ConfigResponse, InfoResponse, ManagerModuleInfo, ModuleAddressesResponse, - ModuleInfosResponse, ModuleVersionsResponse, - }, -}; -use abstract_std::{ - manager::{ - state::{Config, SUB_ACCOUNTS, SUSPENSION_STATUS}, - SubAccountIdsResponse, - }, - objects::{ - gov_type::TopLevelOwnerResponse, - module::{self, ModuleInfo}, - ownership::nested_admin::query_top_level_owner_addr, - }, -}; -use cosmwasm_std::{to_json_binary, Addr, Binary, Deps, Env, Order, StdError, StdResult}; -use cw2::ContractVersion; -use cw_storage_plus::Bound; - -const DEFAULT_LIMIT: u8 = 5; -const MAX_LIMIT: u8 = 10; - -pub fn handle_module_address_query(deps: Deps, env: Env, ids: Vec) -> StdResult { - let contracts = query_module_addresses(deps, &env.contract.address, ids)?; - let vector = contracts.into_iter().collect(); - to_json_binary(&ModuleAddressesResponse { modules: vector }) -} - -pub fn handle_contract_versions_query(deps: Deps, env: Env, ids: Vec) -> StdResult { - let response = query_module_versions(deps, &env.contract.address, ids)?; - let versions = response.into_values().collect(); - to_json_binary(&ModuleVersionsResponse { versions }) -} - -pub fn handle_account_info_query(deps: Deps) -> StdResult { - let info: AccountInfo = INFO.load(deps.storage)?; - to_json_binary(&InfoResponse { info }) -} - -pub fn handle_config_query(deps: Deps) -> StdResult { - let account_id = ACCOUNT_ID.load(deps.storage)?; - let Config { - version_control_address, - module_factory_address, - .. - } = CONFIG.load(deps.storage)?; - let is_suspended = SUSPENSION_STATUS.load(deps.storage)?; - to_json_binary(&ConfigResponse { - account_id, - is_suspended, - version_control_address, - module_factory_address, - }) -} - -pub fn handle_module_info_query( - deps: Deps, - last_module_id: Option, - limit: Option, -) -> StdResult { - let limit = limit.unwrap_or(DEFAULT_LIMIT).min(MAX_LIMIT) as usize; - let start_bound = last_module_id.as_deref().map(Bound::exclusive); - - let res: Result, _> = ACCOUNT_MODULES - .range(deps.storage, start_bound, None, Order::Ascending) - .take(limit) - .collect(); - - let ids_and_addr = res?; - - let config = CONFIG.load(deps.storage)?; - let version_control = VersionControlContract::new(config.version_control_address); - - let mut resp_vec: Vec = vec![]; - for (id, address) in ids_and_addr.into_iter() { - let version = query_module_version(deps, address.clone(), &version_control)?; - resp_vec.push(ManagerModuleInfo { - id, - version, - address, - }) - } - - to_json_binary(&ModuleInfosResponse { - module_infos: resp_vec, - }) -} - -pub fn handle_sub_accounts_query( - deps: Deps, - last_account_id: Option, - limit: Option, -) -> StdResult { - let limit = limit.unwrap_or(DEFAULT_LIMIT).min(MAX_LIMIT) as usize; - let start_bound = last_account_id.map(Bound::exclusive); - - let res = SUB_ACCOUNTS - .keys(deps.storage, start_bound, None, Order::Ascending) - .take(limit) - .collect::>>()?; - - to_json_binary(&SubAccountIdsResponse { sub_accounts: res }) -} - -pub fn handle_top_level_owner_query(deps: Deps, env: Env) -> StdResult { - let addr = query_top_level_owner_addr(&deps.querier, env.contract.address)?; - - to_json_binary(&TopLevelOwnerResponse { address: addr }) -} - -/// RawQuery the version of an enabled module -pub fn query_module_version( - deps: Deps, - module_addr: Addr, - version_control: &VersionControlContract, -) -> StdResult { - if let Ok(info) = cw2::query_contract_info(&deps.querier, module_addr.to_string()) { - // Check if it's abstract format and return now - if ModuleInfo::from_id( - &info.contract, - module::ModuleVersion::Version(info.version.clone()), - ) - .is_ok() - { - return Ok(info); - } - } - // Right now we have either - // - failed cw2 query - // - the query succeeded but the cw2 name doesn't adhere to our formatting standards - // - // Which means this contract is a standalone or service contract. Hence we need to get its information from VersionControl. - let module_info = match version_control.query_service_info_raw(&module_addr, &deps.querier) { - // We got service - Ok(module_info) => module_info, - // Didn't got service, let's try to get standalone - Err(_) => { - let code_id = deps - .querier - .query_wasm_contract_info(module_addr.to_string())? - .code_id; - version_control - .query_standalone_info_raw(code_id, &deps.querier) - .map_err(|e| StdError::generic_err(e.to_string()))? - } - }; - let version = - ContractVersion::try_from(module_info).map_err(|e| StdError::generic_err(e.to_string()))?; - Ok(version) -} - -/// RawQuery the module versions of the modules part of the Account -/// Errors if not present -pub fn query_module_versions( - deps: Deps, - manager_addr: &Addr, - module_names: Vec, -) -> StdResult> { - let addresses: BTreeMap = - query_module_addresses(deps, manager_addr, module_names)?; - let mut module_versions: BTreeMap = BTreeMap::new(); - - let config = CONFIG.load(deps.storage)?; - let version_control = VersionControlContract::new(config.version_control_address); - for (name, address) in addresses.into_iter() { - let result = query_module_version(deps, address, &version_control)?; - module_versions.insert(name, result); - } - Ok(module_versions) -} - -/// RawQuery module addresses from manager -/// Errors if not present -pub fn query_module_addresses( - deps: Deps, - manager_addr: &Addr, - module_names: Vec, -) -> StdResult> { - let mut modules: BTreeMap = BTreeMap::new(); - - // Query over - for module in module_names { - // Add to map if present, skip otherwise. Allows version control to check what modules are present. - if let Some(address) = - ACCOUNT_MODULES.query(&deps.querier, manager_addr.clone(), &module)? - { - modules.insert(module, address); - } - } - Ok(modules) -} diff --git a/framework/contracts/account/manager/src/validation.rs b/framework/contracts/account/manager/src/validation.rs deleted file mode 100644 index f56ddcd46a..0000000000 --- a/framework/contracts/account/manager/src/validation.rs +++ /dev/null @@ -1,10 +0,0 @@ -use abstract_sdk::std::ACCOUNT; - -use crate::error::ManagerError; - -pub fn validate_not_proxy(module_id: &str) -> Result<(), ManagerError> { - match module_id { - ACCOUNT => Err(ManagerError::CannotRemoveProxy {}), - _ => Ok(()), - } -} diff --git a/framework/contracts/account/manager/src/versioning.rs b/framework/contracts/account/manager/src/versioning.rs deleted file mode 100644 index f08f5aafb7..0000000000 --- a/framework/contracts/account/manager/src/versioning.rs +++ /dev/null @@ -1,281 +0,0 @@ -use abstract_std::{ - manager::state::{ACCOUNT_MODULES, DEPENDENTS}, - objects::{ - dependency::Dependency, - module_version::{ModuleData, MODULE}, - }, -}; -use cosmwasm_std::{Deps, DepsMut, StdError, Storage}; -use semver::{Comparator, Version}; - -use crate::{commands::MIGRATE_CONTEXT, contract::ManagerResult, error::ManagerError}; - -/// Assert the dependencies that this app or adapter relies on are installed. -pub fn assert_install_requirements(deps: Deps, module_id: &str) -> ManagerResult> { - let module_dependencies = load_module_dependencies(deps, module_id)?; - assert_dependency_requirements(deps, &module_dependencies, module_id)?; - Ok(module_dependencies) -} - -/// Assert the dependencies that this standalone relies on are installed. -pub fn assert_install_requirements_standalone( - deps: Deps, - module_id: &str, -) -> ManagerResult> { - // For standalones dependencies in state are optional - let module_dependencies = load_module_dependencies(deps, module_id).unwrap_or_default(); - assert_dependency_requirements(deps, &module_dependencies, module_id)?; - Ok(module_dependencies) -} - -/// Assert that the new version of this app is supported by its dependents. -/// Unless that dependent is also being migrated. -pub fn assert_migrate_requirements( - deps: Deps, - module_id: &str, - new_version: Version, -) -> ManagerResult<()> { - // load all the modules that depend on this module - let dependents = DEPENDENTS - .may_load(deps.storage, module_id)? - .unwrap_or_default(); - let migrating = MIGRATE_CONTEXT.load(deps.storage)?; - // for each module that depends on this module, check if it supports the new version. - for dependent_module in dependents { - // if the dependent is also being migrated, skip it. - if migrating.iter().any(|(m, _)| m == &dependent_module) { - continue; - } - let dependent_address = ACCOUNT_MODULES.load(deps.storage, &dependent_module)?; - let module_data = MODULE.query(&deps.querier, dependent_address)?; - // filter the dependencies and assert version comparison when applicable - let mut applicable_bounds = module_data - .dependencies - .iter() - .filter(|dep| dep.id == module_id); - // assert bounds - applicable_bounds.try_for_each(|dep| { - assert_comparators(&dep.version_req, &new_version, module_id, false) - })?; - } - Ok(()) -} - -/// Add module as dependent on its dependencies. -/// For example, Autocompounder depends on dex. -/// Therefore, autocompounder is added as a dependent on dex. -/// dex -> Autocompounder -pub fn set_as_dependent( - store: &mut dyn Storage, - module_id: String, - dependencies: Vec, -) -> ManagerResult<()> { - for dep in dependencies { - DEPENDENTS.update(store, &dep.id, |dependents| { - let mut dependents = dependents.unwrap_or_default(); - dependents.insert(module_id.clone()); - Ok::<_, StdError>(dependents) - })?; - } - Ok(()) -} - -/// Remove a module as dependent on its dependencies -/// For example, Autocompounder depends on dex. -/// We are uninstalling autocompounder, so we remove it from the dependents of dex. -pub fn remove_as_dependent( - store: &mut dyn Storage, - module_id: &str, - dependencies: Vec, -) -> ManagerResult<()> { - for dep in dependencies { - DEPENDENTS.update(store, &dep.id, |dependents| { - let mut dependents = dependents.unwrap_or_default(); - dependents.remove(module_id); - Ok::<_, StdError>(dependents) - })?; - } - Ok(()) -} - -fn assert_comparators( - bounds: &[Comparator], - version: &Version, - module_id: &str, - post_migration: bool, -) -> ManagerResult<()> { - // assert requirements - bounds.iter().try_for_each(|comp: &Comparator| { - if comp.matches(version) { - Ok(()) - } else { - Err(ManagerError::VersionRequirementNotMet { - module_id: module_id.to_string(), - version: version.to_string(), - comp: comp.to_string(), - post_migration, - }) - } - })?; - Ok(()) -} - -/// Goes over all the provided dependencies and asserts that: -/// 1. The dependency is installed -/// 2. The dependency version fits the requirements -pub fn assert_dependency_requirements( - deps: Deps, - dependencies: &[Dependency], - dependent: &str, -) -> ManagerResult<()> { - for dep in dependencies { - let dep_addr = ACCOUNT_MODULES - .may_load(deps.storage, &dep.id)? - .ok_or_else(|| ManagerError::DependencyNotMet(dep.id.clone(), dependent.to_string()))?; - - let dep_version = cw2::CONTRACT.query(&deps.querier, dep_addr)?; - let version: Version = dep_version.version.parse().unwrap(); - // assert requirements - assert_comparators(&dep.version_req, &version, &dep.id, true)?; - } - Ok(()) -} - -pub fn load_module_data(deps: Deps, module_id: &str) -> ManagerResult { - let querier = &deps.querier; - let module_addr = ACCOUNT_MODULES.load(deps.storage, module_id)?; - let module_data = MODULE.query(querier, module_addr)?; - Ok(module_data) -} - -pub fn load_module_dependencies(deps: Deps, module_id: &str) -> ManagerResult> { - let module_data = load_module_data(deps, module_id)?; - Ok(module_data.dependencies) -} - -pub fn maybe_remove_old_deps( - deps: DepsMut, - module_id: &str, - old_deps: &[Dependency], -) -> ManagerResult<()> { - let new_deps = load_module_dependencies(deps.as_ref(), module_id)?; - // find deps that are no longer required. - // ie. the old deps contain a deps that the new deps doesn't. - let removable_deps: Vec<&Dependency> = - old_deps.iter().filter(|d| !new_deps.contains(d)).collect(); - for dep_to_remove in removable_deps { - // Remove module from dependents on the removable dep - DEPENDENTS.update(deps.storage, &dep_to_remove.id, |dependents| { - // Migrating so hashset should be saved and contain the module ID. - let mut dependents = dependents.unwrap(); - dependents.remove(module_id); - Ok::<_, StdError>(dependents) - })?; - } - Ok(()) -} - -pub fn maybe_add_new_deps( - deps: DepsMut, - module_id: &str, - old_deps: &[Dependency], -) -> ManagerResult> { - let new_deps = load_module_dependencies(deps.as_ref(), module_id)?; - // find deps that are new. - // the new deps contain deps that were not in the old deps. - let to_be_added_deps: Vec<&Dependency> = - new_deps.iter().filter(|d| !old_deps.contains(d)).collect(); - for dep_to_add in &to_be_added_deps { - // Add module as dependent on the new deps - // Will also run when a version requirement is changed. - DEPENDENTS.update(deps.storage, &dep_to_add.id, |dependents| { - // Adding new dep so might be the first entry, hence default to empty set in that case. - let mut dependents = dependents.unwrap_or_default(); - dependents.insert(module_id.to_string()); - Ok::<_, StdError>(dependents) - })?; - } - Ok(new_deps) -} - -#[cfg(test)] -mod test { - #![allow(clippy::needless_borrows_for_generic_args)] - use std::collections::HashSet; - - use cosmwasm_std::testing::mock_dependencies; - use speculoos::prelude::*; - - use super::*; - - mod set_as_dependent { - use super::*; - - // This should add dependency -> [module] to the map - #[test] - fn add() { - let mut deps = mock_dependencies(); - let new_module_id = "module"; - - let dependency = "dependency"; - let dependencies = vec![Dependency { - id: dependency.to_string(), - // no version requirements - version_req: vec![], - }]; - - set_as_dependent(&mut deps.storage, new_module_id.to_string(), dependencies).unwrap(); - - let dependents = DEPENDENTS.load(&deps.storage, dependency).unwrap(); - - assert_that(&dependents).has_length(1); - assert_that(&dependents).contains(new_module_id.to_string()); - } - } - - mod remove_as_dependent { - use super::*; - - fn initialize_dependents(deps: DepsMut, module_id: &str, dependents: Vec) { - DEPENDENTS - .save(deps.storage, module_id, &HashSet::from_iter(dependents)) - .unwrap(); - } - - // autocompounder depends on dex - // dex -> autocompounder - // to uninstall autocompounder, remove dex - #[test] - fn remove() { - let mut deps = mock_dependencies(); - - let dex_adapter = "dex"; - let autocompounder = "autocompounder"; - - // dex -> autocompounder - initialize_dependents(deps.as_mut(), dex_adapter, vec![autocompounder.to_string()]); - - let actual_dex_dependents = DEPENDENTS.load(&deps.storage, dex_adapter).unwrap(); - assert_that(&actual_dex_dependents).has_length(1); - assert_that(&actual_dex_dependents).contains(autocompounder.to_string()); - - // the autocompounder depends on the dex - let autocompounder_dependencies = vec![Dependency { - id: dex_adapter.to_string(), - // no version requirements - version_req: vec![], - }]; - - let res = remove_as_dependent( - &mut deps.storage, - autocompounder, - autocompounder_dependencies, - ); - - assert_that(&res).is_ok(); - - let remaining_dex_dependents = DEPENDENTS.load(&deps.storage, dex_adapter).unwrap(); - assert_that(&remaining_dex_dependents).is_empty(); - } - } -} diff --git a/framework/contracts/account/manager/tests/README.md b/framework/contracts/account/manager/tests/README.md deleted file mode 100644 index 30d8d81aa6..0000000000 --- a/framework/contracts/account/manager/tests/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Tests covered - -## Unit tests - -## Integration tests - -### Upgrades - -test 0.10.0 to 0.11.0 diff --git a/framework/contracts/account/manager/tests/adapters.rs b/framework/contracts/account/manager/tests/adapters.rs deleted file mode 100644 index 4978ed7a1a..0000000000 --- a/framework/contracts/account/manager/tests/adapters.rs +++ /dev/null @@ -1,638 +0,0 @@ -use abstract_adapter::{ - mock::{self, MockError, MockExecMsg, MockInitMsg}, - AdapterError, -}; -use abstract_integration_tests::{ - add_mock_adapter_install_fee, create_default_account, init_mock_adapter, install_adapter, - install_adapter_with_funds, mock_modules, - mock_modules::adapter_1::{MockAdapterI1V1, MockAdapterI1V2}, - AResult, -}; -use abstract_interface::*; -use abstract_std::{ - adapter::{AdapterBaseMsg, AdapterRequestMsg, BaseExecuteMsg, BaseQueryMsgFns}, - manager::{ManagerModuleInfo, ModuleInstallConfig}, - objects::{ - fee::FixedFee, - module::{ModuleInfo, ModuleVersion, Monetization}, - AccountId, - }, - *, -}; -use abstract_testing::prelude::*; -use cosmwasm_std::{coin, coins}; -use cw_orch::prelude::*; -use mock_modules::{adapter_1, V1, V2}; -use speculoos::{assert_that, result::ResultAssertions, string::StrAssertions}; - -#[test] -fn installing_one_adapter_should_succeed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let staking_adapter = init_mock_adapter(chain.clone(), &deployment, None, account.id()?)?; - install_adapter(&account.account, TEST_MODULE_ID)?; - - let modules = account.expect_modules(vec![staking_adapter.address()?.to_string()])?; - - assert_that(&modules[1]).is_equal_to(&ManagerModuleInfo { - address: staking_adapter.address()?, - id: TEST_MODULE_ID.to_string(), - version: cw2::ContractVersion { - contract: TEST_MODULE_ID.into(), - version: TEST_VERSION.into(), - }, - }); - - // Configuration is correct - let adapter_config = staking_adapter.base_config()?; - assert_that!(adapter_config).is_equal_to(adapter::AdapterConfigResponse { - ans_host_address: deployment.ans_host.address()?, - dependencies: vec![], - version_control_address: deployment.version_control.address()?, - }); - - // no authorized addresses registered - let authorized = staking_adapter.authorized_addresses(account.proxy.addr_str()?)?; - assert_that!(authorized) - .is_equal_to(adapter::AuthorizedAddressesResponse { addresses: vec![] }); - - take_storage_snapshot!(chain, "install_one_adapter"); - - Ok(()) -} - -#[test] -fn installing_one_adapter_without_fee_should_fail() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - chain.set_balance(&sender, coins(12, "ujunox"))?; - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - init_mock_adapter(chain.clone(), &deployment, None, account.id()?)?; - add_mock_adapter_install_fee( - &deployment, - Monetization::InstallFee(FixedFee::new(&coin(45, "ujunox"))), - None, - )?; - // TODO, match the exact error - assert_that!(install_adapter(&account.account, TEST_MODULE_ID)).is_err(); - - // TODO, match the exact error - assert_that!(install_adapter_with_funds( - &account.account, - TEST_MODULE_ID, - &coins(12, "ujunox") - )) - .is_err(); - - Ok(()) -} - -#[test] -fn installing_one_adapter_with_fee_should_succeed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::installing_one_adapter_with_fee_should_succeed( - chain.clone(), - )?; - take_storage_snapshot!(chain, "install_one_adapter_with_fee"); - Ok(()) -} - -#[test] -fn install_non_existent_adapterid_should_fail() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain, sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - let res = install_adapter(&account.account, "lol:no_chance"); - - assert_that!(res).is_err(); - Ok(()) -} - -#[test] -fn install_non_existent_version_should_fail() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - init_mock_adapter(chain, &deployment, None, account.id()?)?; - - let res = account.account.install_module_version( - TEST_MODULE_ID, - ModuleVersion::Version("1.2.3".to_string()), - Some(&Empty {}), - &[], - ); - - // testtodo: check error - assert_that!(res).is_err(); - - Ok(()) -} - -#[test] -fn installation_of_duplicate_adapter_should_fail() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let staking_adapter = init_mock_adapter(chain, &deployment, None, account.id()?)?; - - install_adapter(&account.account, TEST_MODULE_ID)?; - - let modules = account.expect_modules(vec![staking_adapter.address()?.to_string()])?; - - // assert proxy module - // check staking adapter - assert_that(&modules[1]).is_equal_to(&ManagerModuleInfo { - address: staking_adapter.address()?, - id: TEST_MODULE_ID.to_string(), - version: cw2::ContractVersion { - contract: TEST_MODULE_ID.into(), - version: TEST_VERSION.into(), - }, - }); - - // install again - let second_install_res = install_adapter(&account.account, TEST_MODULE_ID); - assert_that!(second_install_res) - .is_err() - .matches(|e| e.to_string().contains("test-module-id")); - - account.expect_modules(vec![staking_adapter.address()?.to_string()])?; - - Ok(()) -} - -#[test] -fn reinstalling_adapter_should_be_allowed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let staking_adapter = init_mock_adapter(chain.clone(), &deployment, None, account.id()?)?; - - install_adapter(&account.account, TEST_MODULE_ID)?; - - let modules = account.expect_modules(vec![staking_adapter.address()?.to_string()])?; - - // check staking adapter - assert_that(&modules[1]).is_equal_to(&ManagerModuleInfo { - address: staking_adapter.address()?, - id: TEST_MODULE_ID.to_string(), - version: cw2::ContractVersion { - contract: TEST_MODULE_ID.into(), - version: TEST_VERSION.into(), - }, - }); - - // uninstall - account - .account - .uninstall_module(TEST_MODULE_ID.to_string())?; - - // None expected - account.expect_modules(vec![])?; - - // reinstall - install_adapter(&account.account, TEST_MODULE_ID)?; - - account.expect_modules(vec![staking_adapter.address()?.to_string()])?; - take_storage_snapshot!(chain, "reinstalling_adapter_should_be_allowed"); - - Ok(()) -} - -/// Reinstalling the Adapter should install the latest version -#[test] -fn reinstalling_new_version_should_install_latest() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_string())?; - - let adapter1 = MockAdapterI1V1::new_test(chain.clone()); - adapter1 - .deploy(V1.parse().unwrap(), MockInitMsg {}, DeployStrategy::Try) - .unwrap(); - - install_adapter(&account.account, &adapter1.id())?; - - let modules = account.expect_modules(vec![adapter1.address()?.to_string()])?; - - // check staking adapter - assert_that(&modules[1]).is_equal_to(&ManagerModuleInfo { - address: adapter1.address()?, - id: adapter1.id(), - version: cw2::ContractVersion { - contract: adapter1.id(), - version: V1.into(), - }, - }); - - // uninstall tendermint staking - account.account.uninstall_module(adapter1.id())?; - - account.expect_modules(vec![])?; - - let old_adapter_addr = adapter1.address()?; - - let adapter2 = MockAdapterI1V2::new_test(chain.clone()); - - adapter2 - .deploy(V2.parse().unwrap(), MockInitMsg {}, DeployStrategy::Try) - .unwrap(); - - // check that the latest staking version is the new one - let latest_staking = deployment - .version_control - .module(ModuleInfo::from_id_latest(&adapter1.id())?)?; - assert_that!(latest_staking.info.version).is_equal_to(ModuleVersion::Version(V2.to_string())); - - // reinstall - install_adapter(&account.account, &adapter2.id())?; - - let modules = account.expect_modules(vec![adapter2.address()?.to_string()])?; - - assert_that!(modules[1]).is_equal_to(&ManagerModuleInfo { - // the address stored for MockAdapterI was updated when we instantiated the new version, so this is the new address - address: adapter2.address()?, - id: adapter2.id(), - version: cw2::ContractVersion { - contract: adapter2.id(), - // IMPORTANT: The version of the contract did not change although the version of the module in version control did. - // Beware of this distinction. The version of the contract is the version that's imbedded into the contract's wasm on compilation. - version: V2.to_string(), - }, - }); - // assert that the new staking adapter has a different address - assert_ne!(old_adapter_addr, adapter2.address()?); - - assert_that!(modules[1].address).is_equal_to(adapter2.as_instance().address()?); - take_storage_snapshot!(chain, "reinstalling_new_version_should_install_latest"); - - Ok(()) -} - -// struct TestModule = AppContract - -#[test] -fn unauthorized_exec() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let unauthorized = chain.addr_make("unauthorized"); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let staking_adapter = init_mock_adapter(chain.clone(), &deployment, None, account.id()?)?; - install_adapter(&account.account, TEST_MODULE_ID)?; - // non-authorized address cannot execute - let res = staking_adapter - .call_as(&unauthorized) - .execute(&MockExecMsg {}.into(), &[]) - .unwrap_err(); - assert_that!(res.root().to_string()).contains(format!( - "Sender: {} of request to tester:test-module-id is not a Manager or Authorized Address", - unauthorized - )); - // neither can the ROOT directly - let res = staking_adapter - .execute(&MockExecMsg {}.into(), &[]) - .unwrap_err(); - assert_that!(&res.root().to_string()).contains(format!( - "Sender: {} of request to tester:test-module-id is not a Manager or Authorized Address", - chain.sender_addr() - )); - Ok(()) -} - -#[test] -fn manager_adapter_exec() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let _staking_adapter_one = init_mock_adapter(chain.clone(), &deployment, None, account.id()?)?; - - install_adapter(&account.account, TEST_MODULE_ID)?; - - chain.set_balance( - &account.proxy.address()?, - vec![Coin::new(100_000_u128, TTOKEN)], - )?; - - account.account.execute_on_module( - TEST_MODULE_ID, - Into::>::into(MockExecMsg {}), - )?; - - Ok(()) -} - -#[test] -fn installing_specific_version_should_install_expected() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_string())?; - - let adapter1 = MockAdapterI1V1::new_test(chain.clone()); - adapter1 - .deploy(V1.parse().unwrap(), MockInitMsg {}, DeployStrategy::Try) - .unwrap(); - - let v1_adapter_addr = adapter1.address()?; - - let adapter2 = MockAdapterI1V2::new_test(chain.clone()); - - adapter2 - .deploy(V2.parse().unwrap(), MockInitMsg {}, DeployStrategy::Try) - .unwrap(); - - let expected_version = "1.0.0".to_string(); - - // install specific version - account.account.install_module_version( - &adapter1.id(), - ModuleVersion::Version(expected_version), - Some(&MockInitMsg {}), - &[], - )?; - - let modules = account.expect_modules(vec![v1_adapter_addr.to_string()])?; - let installed_module: ManagerModuleInfo = modules[1].clone(); - assert_that!(installed_module.id).is_equal_to(adapter1.id()); - take_storage_snapshot!(chain, "installing_specific_version_should_install_expected"); - - Ok(()) -} - -#[test] -fn account_install_adapter() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - - let adapter = MockAdapterI1V1::new_test(chain.clone()); - adapter.deploy(V1.parse().unwrap(), MockInitMsg {}, DeployStrategy::Try)?; - let adapter_addr = account.install_adapter(&adapter, &[])?; - let module_addr = account - .account - .module_info(adapter_1::MOCK_ADAPTER_ID)? - .unwrap() - .address; - assert_that!(adapter_addr).is_equal_to(module_addr); - take_storage_snapshot!(chain, "account_install_adapter"); - Ok(()) -} - -#[test] -fn account_adapter_ownership() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - - let adapter = MockAdapterI1V1::new_test(chain.clone()); - adapter.deploy(V1.parse().unwrap(), MockInitMsg {}, DeployStrategy::Try)?; - account.install_adapter(&adapter, &[])?; - - let proxy_addr = account.proxy.address()?; - - // Checking module requests - - // Can call either by account owner or manager - adapter.call_as(&sender).execute( - &mock::ExecuteMsg::Module(AdapterRequestMsg { - account_address: Some(proxy_addr.to_string()), - request: MockExecMsg {}, - }), - &[], - )?; - adapter.call_as(&account.account.address()?).execute( - &mock::ExecuteMsg::Module(AdapterRequestMsg { - account_address: Some(proxy_addr.to_string()), - request: MockExecMsg {}, - }), - &[], - )?; - - // Not admin or manager - let who = chain.addr_make("who"); - let err: MockError = adapter - .call_as(&who) - .execute( - &mock::ExecuteMsg::Module(AdapterRequestMsg { - account_address: Some(proxy_addr.to_string()), - request: MockExecMsg {}, - }), - &[], - ) - .unwrap_err() - .downcast() - .unwrap(); - assert_eq!( - err, - MockError::Adapter(AdapterError::UnauthorizedAddressAdapterRequest { - adapter: adapter_1::MOCK_ADAPTER_ID.to_owned(), - sender: who.to_string() - }) - ); - - // Checking base requests - - // Can call either by account owner or manager - adapter.call_as(&sender).execute( - &mock::ExecuteMsg::Base(BaseExecuteMsg { - proxy_address: Some(proxy_addr.to_string()), - msg: AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: vec![chain.addr_make("123").to_string()], - to_remove: vec![], - }, - }), - &[], - )?; - adapter.call_as(&account.account.address()?).execute( - &mock::ExecuteMsg::Base(BaseExecuteMsg { - proxy_address: Some(proxy_addr.to_string()), - msg: AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: vec![chain.addr_make("234").to_string()], - to_remove: vec![], - }, - }), - &[], - )?; - - // Not admin or manager - let err: MockError = adapter - .call_as(&who) - .execute( - &mock::ExecuteMsg::Base(BaseExecuteMsg { - proxy_address: Some(proxy_addr.to_string()), - msg: AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: vec![chain.addr_make("345").to_string()], - to_remove: vec![], - }, - }), - &[], - ) - .unwrap_err() - .downcast() - .unwrap(); - assert_eq!( - err, - MockError::Adapter(AdapterError::UnauthorizedAdapterRequest { - adapter: adapter_1::MOCK_ADAPTER_ID.to_owned(), - sender: who.to_string() - }) - ); - - Ok(()) -} - -#[test] -fn subaccount_adapter_ownership() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - - let adapter = MockAdapterI1V1::new_test(chain.clone()); - adapter.deploy(V1.parse().unwrap(), MockInitMsg {}, DeployStrategy::Try)?; - - account.account.create_sub_account( - vec![ModuleInstallConfig::new( - ModuleInfo::from_id_latest(adapter_1::MOCK_ADAPTER_ID).unwrap(), - None, - )], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - let sub_account = AbstractAccount::new(&deployment, AccountId::local(2)); - - let module = sub_account - .account - .module_info(adapter_1::MOCK_ADAPTER_ID)? - .unwrap(); - adapter.set_address(&module.address); - - let proxy_addr = sub_account.proxy.address()?; - - // Checking module requests - - // Can call either by account owner or manager - adapter.call_as(&sender).execute( - &mock::ExecuteMsg::Module(AdapterRequestMsg { - account_address: Some(proxy_addr.to_string()), - request: MockExecMsg {}, - }), - &[], - )?; - adapter.call_as(&sub_account.account.address()?).execute( - &mock::ExecuteMsg::Module(AdapterRequestMsg { - account_address: Some(proxy_addr.to_string()), - request: MockExecMsg {}, - }), - &[], - )?; - - // Not admin or manager - let who = chain.addr_make("who"); - let err: MockError = adapter - .call_as(&who) - .execute( - &mock::ExecuteMsg::Module(AdapterRequestMsg { - account_address: Some(proxy_addr.to_string()), - request: MockExecMsg {}, - }), - &[], - ) - .unwrap_err() - .downcast() - .unwrap(); - assert_eq!( - err, - MockError::Adapter(AdapterError::UnauthorizedAddressAdapterRequest { - adapter: adapter_1::MOCK_ADAPTER_ID.to_owned(), - sender: who.to_string() - }) - ); - - // Checking base requests - - // Can call either by account owner or manager - adapter.call_as(&sender).execute( - &mock::ExecuteMsg::Base(BaseExecuteMsg { - proxy_address: Some(proxy_addr.to_string()), - msg: AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: vec![chain.addr_make("123").to_string()], - to_remove: vec![], - }, - }), - &[], - )?; - adapter.call_as(&sub_account.account.address()?).execute( - &mock::ExecuteMsg::Base(BaseExecuteMsg { - proxy_address: Some(proxy_addr.to_string()), - msg: AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: vec![chain.addr_make("234").to_string()], - to_remove: vec![], - }, - }), - &[], - )?; - - // Not admin or manager - let err: MockError = adapter - .call_as(&who) - .execute( - &mock::ExecuteMsg::Base(BaseExecuteMsg { - proxy_address: Some(proxy_addr.to_string()), - msg: AdapterBaseMsg::UpdateAuthorizedAddresses { - to_add: vec![chain.addr_make("345").to_string()], - to_remove: vec![], - }, - }), - &[], - ) - .unwrap_err() - .downcast() - .unwrap(); - assert_eq!( - err, - MockError::Adapter(AdapterError::UnauthorizedAdapterRequest { - adapter: adapter_1::MOCK_ADAPTER_ID.to_owned(), - sender: who.to_string() - }) - ); - Ok(()) -} diff --git a/framework/contracts/account/manager/tests/apps.rs b/framework/contracts/account/manager/tests/apps.rs deleted file mode 100644 index 6963ab99e2..0000000000 --- a/framework/contracts/account/manager/tests/apps.rs +++ /dev/null @@ -1,306 +0,0 @@ -use abstract_app::{gen_app_mock, mock, mock::MockError}; -use abstract_integration_tests::{create_default_account, AResult}; -use abstract_interface::*; -use abstract_manager::error::ManagerError; -use abstract_std::{ - manager::ModuleInstallConfig, - objects::{ - gov_type::TopLevelOwnerResponse, - module::{ModuleInfo, ModuleStatus, ModuleVersion}, - AccountId, - }, - version_control::ModuleFilter, - ACCOUNT, -}; -use abstract_testing::prelude::*; -use cosmwasm_std::{coin, CosmosMsg}; -use cw_controllers::{AdminError, AdminResponse}; -use cw_orch::prelude::*; -use speculoos::prelude::*; - -const APP_ID: &str = "tester:app"; -const APP_VERSION: &str = "1.0.0"; -gen_app_mock!(MockApp, APP_ID, APP_VERSION, &[]); - -#[test] -fn execute_on_proxy_through_manager() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - // mint coins to proxy address - chain.set_balance( - &account.proxy.address()?, - vec![Coin::new(100_000_u128, TTOKEN)], - )?; - // mint other coins to owner - chain.set_balance(&sender, vec![Coin::new(100u128, "other_coin")])?; - - // burn coins from proxy - let proxy_balance = chain - .app - .borrow() - .wrap() - .query_all_balances(account.proxy.address()?)?; - assert_that!(proxy_balance).is_equal_to(vec![Coin::new(100_000_u128, TTOKEN)]); - - let burn_amount: Vec = vec![Coin::new(10_000_u128, TTOKEN)]; - let forwarded_coin: Coin = coin(100, "other_coin"); - - account.account.exec_on_module( - cosmwasm_std::to_json_binary(&abstract_std::proxy::ExecuteMsg::ModuleAction { - msgs: vec![CosmosMsg::Bank(cosmwasm_std::BankMsg::Burn { - amount: burn_amount, - })], - })?, - ACCOUNT.to_string(), - &[forwarded_coin.clone()], - )?; - - let proxy_balance = chain - .app - .borrow() - .wrap() - .query_all_balances(account.proxy.address()?)?; - assert_that!(proxy_balance).is_equal_to(vec![ - forwarded_coin, - Coin::new(100_000_u128 - 10_000, TTOKEN), - ]); - - take_storage_snapshot!(chain, "execute_on_proxy_through_manager"); - - Ok(()) -} - -#[test] -fn account_install_app() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::account_install_app(chain.clone())?; - take_storage_snapshot!(chain, "account_install_app"); - Ok(()) -} - -#[test] -fn account_app_ownership() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - - let app = MockApp::new_test(chain.clone()); - app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Try)?; - account.install_app(&app, &MockInitMsg {}, &[])?; - - let admin_res: AdminResponse = - app.query(&mock::QueryMsg::Base(app::BaseQueryMsg::BaseAdmin {}))?; - assert_eq!(admin_res.admin.unwrap(), account.account.addr_str()?); - - // Can call either by account owner or manager - app.call_as(&sender).execute( - &mock::ExecuteMsg::Module(MockExecMsg::DoSomethingAdmin {}), - &[], - )?; - app.call_as(&account.account.address()?).execute( - &mock::ExecuteMsg::Module(MockExecMsg::DoSomethingAdmin {}), - &[], - )?; - - // Not admin or manager - let err: MockError = app - .call_as(&Addr::unchecked("who")) - .execute( - &mock::ExecuteMsg::Module(MockExecMsg::DoSomethingAdmin {}), - &[], - ) - .unwrap_err() - .downcast() - .unwrap(); - assert_eq!(err, MockError::Admin(AdminError::NotAdmin {})); - Ok(()) -} - -#[test] -fn subaccount_app_ownership() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - - let app = MockApp::new_test(chain.clone()); - app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Try)?; - - account.account.create_sub_account( - vec![ModuleInstallConfig::new( - ModuleInfo::from_id_latest(APP_ID).unwrap(), - Some(to_json_binary(&MockInitMsg {}).unwrap()), - )], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - let sub_account = AbstractAccount::new(&deployment, AccountId::local(2)); - let module = sub_account.account.module_info(APP_ID)?.unwrap(); - app.set_address(&module.address); - - // Check query gives us right Top Level Owner - let top_level_owner_res: TopLevelOwnerResponse = - app.query(&mock::QueryMsg::Base(app::BaseQueryMsg::TopLevelOwner {}))?; - assert_eq!(top_level_owner_res.address, sender); - - let admin_res: AdminResponse = - app.query(&mock::QueryMsg::Base(app::BaseQueryMsg::BaseAdmin {}))?; - assert_eq!(admin_res.admin.unwrap(), sub_account.account.addr_str()?); - app.call_as(&sender).execute( - &mock::ExecuteMsg::Module(MockExecMsg::DoSomethingAdmin {}), - &[], - )?; - Ok(()) -} - -#[test] -fn cant_reinstall_app_after_uninstall() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - - let app = MockApp::new_test(chain.clone()); - app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Try)?; - account.install_app(&app, &MockInitMsg {}, &[])?; - - // Reinstall - account.account.uninstall_module(APP_ID.to_owned())?; - let Err(AbstractInterfaceError::Orch(err)) = account.install_app(&app, &MockInitMsg {}, &[]) - else { - panic!("Expected error"); - }; - let manager_err: ManagerError = err.downcast().unwrap(); - assert_eq!(manager_err, ManagerError::ProhibitedReinstall {}); - Ok(()) -} - -#[test] -fn deploy_strategy_uploaded() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let _account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - deployment - .version_control - .update_config(None, None, Some(false))?; - - let app = MockApp::new_test(chain.clone()); - app.upload()?; - - // Deploy try - app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Try)?; - let module_list = deployment.version_control.module_list( - Some(ModuleFilter { - status: Some(ModuleStatus::Pending), - ..Default::default() - }), - None, - None, - )?; - assert!(module_list.modules[0].module.info.name == "app"); - - // Clean module - deployment.version_control.approve_or_reject_modules( - vec![], - vec![ModuleInfo::from_id( - APP_ID, - ModuleVersion::Version(APP_VERSION.to_owned()), - )?], - )?; - - // Deploy Error - app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Error)?; - let module_list = deployment.version_control.module_list( - Some(ModuleFilter { - status: Some(ModuleStatus::Pending), - ..Default::default() - }), - None, - None, - )?; - assert!(module_list.modules[0].module.info.name == "app"); - - // Clean module - deployment.version_control.approve_or_reject_modules( - vec![], - vec![ModuleInfo::from_id( - APP_ID, - ModuleVersion::Version(APP_VERSION.to_owned()), - )?], - )?; - - app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Force)?; - let module_list = deployment.version_control.module_list( - Some(ModuleFilter { - status: Some(ModuleStatus::Pending), - ..Default::default() - }), - None, - None, - )?; - assert!(module_list.modules[0].module.info.name == "app"); - - Ok(()) -} - -#[test] -fn deploy_strategy_deployed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let _account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - deployment - .version_control - .update_config(None, None, Some(false))?; - - let app = MockApp::new_test(chain.clone()); - - // deploy (not approved) - app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Try)?; - - // Deploy try - let try_res = app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Try); - assert!(try_res.is_ok()); - - // Deploy Error - let error_res = app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Error); - assert!(error_res.is_err()); - - // Deploy Force - let force_res = app.deploy(APP_VERSION.parse().unwrap(), DeployStrategy::Force); - // App not updatable - assert!(force_res.is_err()); - Ok(()) -} diff --git a/framework/contracts/account/manager/tests/ibc-client.rs b/framework/contracts/account/manager/tests/ibc-client.rs deleted file mode 100644 index cc53fe5645..0000000000 --- a/framework/contracts/account/manager/tests/ibc-client.rs +++ /dev/null @@ -1,74 +0,0 @@ -use abstract_integration_tests::{create_default_account, AResult}; -use abstract_interface::{Abstract, AbstractAccount, Account, ManagerQueryFns}; -use abstract_std::IBC_CLIENT; -use anyhow::bail; -use cw_orch::prelude::*; -use speculoos::{assert_that, result::ResultAssertions}; - -pub fn ibc_client_installed(manager: &Account) -> AResult { - let ibc_addr = manager.module_addresses(vec![IBC_CLIENT.to_string()])?; - if ibc_addr.modules.is_empty() { - bail!("IBC client not installed") - } - Ok(()) -} - -#[test] -fn throws_if_enabling_when_already_enabled() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - - manager.set_ibc_status(true)?; - let res = manager.set_ibc_status(true); - - assert_that!(&res).is_err(); - - Ok(()) -} - -#[test] -fn throws_if_disabling_without_ibc_client_installed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - - let res = manager.set_ibc_status(false); - - assert_that!(&res).is_err(); - - Ok(()) -} - -#[test] -fn can_update_ibc_settings() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - - ibc_client_installed(manager).unwrap_err(); - manager.set_ibc_status(true)?; - ibc_client_installed(manager)?; - manager.set_ibc_status(false)?; - ibc_client_installed(manager).unwrap_err(); - - Ok(()) -} diff --git a/framework/contracts/account/manager/tests/install_modules.rs b/framework/contracts/account/manager/tests/install_modules.rs deleted file mode 100644 index c2e994dff6..0000000000 --- a/framework/contracts/account/manager/tests/install_modules.rs +++ /dev/null @@ -1,128 +0,0 @@ -use abstract_integration_tests::{create_default_account, mock_modules, AResult}; -use abstract_interface::{Abstract, AbstractAccount, VCExecFns}; -use abstract_manager::error::ManagerError; -use abstract_std::{ - manager::{ - ExecuteMsg as ManagerMsg, ModuleAddressesResponse, ModuleInstallConfig, - QueryMsg as ManagerQuery, - }, - objects::{account::TEST_ACCOUNT_ID, module::ModuleInfo}, -}; -use abstract_testing::prelude::TEST_NAMESPACE; -use cw_orch::{prelude::*, take_storage_snapshot}; -use mock_modules::{adapter_1, deploy_modules, V1}; - -#[test] -fn cannot_reinstall_module() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - - abstr - .version_control - .claim_namespace(TEST_ACCOUNT_ID, TEST_NAMESPACE.to_string())?; - - deploy_modules(&chain); - - manager.execute( - &ManagerMsg::InstallModules { - modules: vec![ModuleInstallConfig::new( - ModuleInfo::from_id(adapter_1::MOCK_ADAPTER_ID, V1.into()).unwrap(), - None, - )], - }, - &[], - )?; - - let err = manager - .execute( - &ManagerMsg::InstallModules { - modules: vec![ModuleInstallConfig::new( - ModuleInfo::from_id(adapter_1::MOCK_ADAPTER_ID, V1.into()).unwrap(), - None, - )], - }, - &[], - ) - .unwrap_err(); - let manager_err: ManagerError = err.downcast().unwrap(); - assert_eq!( - manager_err, - ManagerError::ModuleAlreadyInstalled(adapter_1::MOCK_ADAPTER_ID.to_owned()) - ); - Ok(()) -} - -#[test] -fn adds_module_to_account_modules() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - - abstr - .version_control - .claim_namespace(TEST_ACCOUNT_ID, TEST_NAMESPACE.to_string())?; - - deploy_modules(&chain); - - manager.execute( - &ManagerMsg::InstallModules { - modules: vec![ModuleInstallConfig::new( - ModuleInfo::from_id(adapter_1::MOCK_ADAPTER_ID, V1.into()).unwrap(), - None, - )], - }, - &[], - )?; - - let addrs: ModuleAddressesResponse = manager.query(&ManagerQuery::ModuleAddresses { - ids: vec![adapter_1::MOCK_ADAPTER_ID.to_owned()], - })?; - assert_eq!(addrs.modules.len(), 1); - take_storage_snapshot!(chain, "adds_module_to_account_modules"); - Ok(()) -} - -#[test] -fn useful_error_module_not_found() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - - let err = manager - .execute( - &ManagerMsg::InstallModules { - modules: vec![ModuleInstallConfig::new( - ModuleInfo::from_id(adapter_1::MOCK_ADAPTER_ID, V1.into()).unwrap(), - None, - )], - }, - &[], - ) - .unwrap_err(); - - let manager_error: ManagerError = err.downcast().unwrap(); - assert!(matches!( - manager_error, - ManagerError::QueryModulesFailed { .. } - )); - Ok(()) -} diff --git a/framework/contracts/account/manager/tests/proxy.rs b/framework/contracts/account/manager/tests/proxy.rs deleted file mode 100644 index 2816589b88..0000000000 --- a/framework/contracts/account/manager/tests/proxy.rs +++ /dev/null @@ -1,870 +0,0 @@ -use abstract_adapter::mock::{MockExecMsg, MockInitMsg}; -use abstract_integration_tests::*; -use abstract_interface::*; -use abstract_manager::{contract::CONTRACT_VERSION, error::ManagerError}; -use abstract_std::{ - manager::{ManagerModuleInfo, ModuleInstallConfig, ModuleVersionsResponse}, - objects::{ - fee::FixedFee, - gov_type::{GovAction, GovernanceDetails}, - module::{ModuleInfo, ModuleVersion, Monetization}, - module_reference::ModuleReference, - namespace::Namespace, - ownership, AccountId, ABSTRACT_ACCOUNT_ID, - }, - version_control::{NamespaceResponse, UpdateModule}, - ACCOUNT, -}; -use abstract_testing::prelude::*; -use anyhow::Error; -use cosmwasm_std::{coin, CosmosMsg, Uint128}; -use cw721::OwnerOfResponse; -use cw_orch::{ - mock::{cw_multi_test::MockApiBech32, MockBase}, - prelude::*, -}; -use speculoos::prelude::*; - -// cw721 cosmwasm-std -/// Deploys and mints an NFT to *sender*. -// fn deploy_and_mint_nft( -// chain: MockBase, -// sender: Addr, -// ) -> Result<(String, Addr), Error> { -// let token_id = String::from("1"); - -// let cw721_contract = Box::new(ContractWrapper::new( -// cw721_base::entry::execute, -// cw721_base::entry::instantiate, -// cw721_base::entry::query, -// )); -// let cw721_id = chain.app.borrow_mut().store_code(cw721_contract); - -// // instantiate mock collection -// let res = chain.instantiate( -// cw721_id, -// &cw721_base::InstantiateMsg { -// name: "testcollection".to_string(), -// symbol: "TEST".to_string(), -// minter: sender.to_string(), -// }, -// Some("test-account-nft-collection"), -// Some(&sender), -// &[], -// )?; - -// let nft_addr = res.instantiated_contract_address()?; - -// mint_nft(&chain, sender, token_id.clone(), &nft_addr)?; -// Ok((token_id, nft_addr)) -// } - -// fn mint_nft( -// chain: &MockBase, -// owner: impl Into, -// token_id: impl Into, -// nft_addr: &Addr, -// ) -> anyhow::Result<()> { -// chain.execute( -// &cw721_base::ExecuteMsg::, Empty>::Mint { -// token_id: token_id.into(), -// owner: owner.into(), -// token_uri: None, -// extension: None, -// }, -// &[], -// nft_addr, -// )?; -// Ok(()) -// } - -#[test] -fn instantiate() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - let modules = account.account.module_infos(None, None)?.module_infos; - - // assert proxy module - assert_that!(&modules).has_length(1); - assert_that(&modules[0]).is_equal_to(&ManagerModuleInfo { - address: account.proxy.address()?, - id: ACCOUNT.to_string(), - version: cw2::ContractVersion { - contract: ACCOUNT.into(), - version: CONTRACT_VERSION.into(), - }, - }); - - // assert manager config - assert_that!(account.account.config()?).is_equal_to(abstract_std::manager::ConfigResponse { - version_control_address: deployment.version_control.address()?, - module_factory_address: deployment.module_factory.address()?, - account_id: TEST_ACCOUNT_ID, - is_suspended: false, - }); - take_storage_snapshot!(chain, "instantiate_proxy"); - Ok(()) -} - -#[test] -fn exec_through_manager() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - // This testing environments allows you to use simple deploy contraptions: - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - // Mint coins to proxy address - chain.set_balance( - &account.proxy.address()?, - vec![Coin::new(100_000_u128, TTOKEN)], - )?; - - let proxy_balance = chain - .bank_querier() - .balance(&account.proxy.address()?, None)?; - - assert_that!(proxy_balance).is_equal_to(vec![Coin::new(100_000_u128, TTOKEN)]); - - let burn_amount = vec![Coin::new(10_000_u128, TTOKEN)]; - - // Burn coins from proxy - account.account.exec_on_module( - cosmwasm_std::to_json_binary(&abstract_std::proxy::ExecuteMsg::ModuleAction { - msgs: vec![CosmosMsg::Bank(cosmwasm_std::BankMsg::Burn { - amount: burn_amount, - })], - })?, - ACCOUNT.to_string(), - &[], - )?; - - // Assert balance has decreased - let proxy_balance = chain - .bank_querier() - .balance(&account.proxy.address()?, None)?; - assert_that!(proxy_balance).is_equal_to(vec![Coin::new(100_000_u128 - 10_000, TTOKEN)]); - take_storage_snapshot!(chain, "exec_through_manager"); - - Ok(()) -} - -#[test] -fn default_without_response_data() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let _staking_adapter_one = init_mock_adapter(chain.clone(), &deployment, None, account.id()?)?; - - install_adapter(&account.account, TEST_MODULE_ID)?; - - chain.set_balance( - &account.proxy.address()?, - vec![Coin::new(100_000_u128, TTOKEN)], - )?; - - let resp = account.account.execute_on_module( - TEST_MODULE_ID, - Into::>::into(MockExecMsg {}), - )?; - assert_that!(resp.data).is_none(); - take_storage_snapshot!(chain, "default_without_response_data"); - - Ok(()) -} - -#[test] -fn with_response_data() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::with_response_data(chain.clone())?; - take_storage_snapshot!(chain, "proxy_with_response_data"); - - Ok(()) -} - -#[test] -fn install_standalone_modules() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = AbstractAccount::new(&deployment, AccountId::local(0)); - - let standalone1_contract = Box::new(ContractWrapper::new( - mock_modules::standalone_cw2::mock_execute, - mock_modules::standalone_cw2::mock_instantiate, - mock_modules::standalone_cw2::mock_query, - )); - let standalone1_id = chain.app.borrow_mut().store_code(standalone1_contract); - - let standalone2_contract = Box::new(ContractWrapper::new( - mock_modules::standalone_no_cw2::mock_execute, - mock_modules::standalone_no_cw2::mock_instantiate, - mock_modules::standalone_no_cw2::mock_query, - )); - let standalone2_id = chain.app.borrow_mut().store_code(standalone2_contract); - - // install first standalone - deployment.version_control.propose_modules(vec![( - ModuleInfo { - namespace: Namespace::new("abstract")?, - name: "standalone1".to_owned(), - version: ModuleVersion::Version(mock_modules::V1.to_owned()), - }, - ModuleReference::Standalone(standalone1_id), - )])?; - - account.install_module("abstract:standalone1", Some(&MockInitMsg {}), &[])?; - - // install second standalone - deployment.version_control.propose_modules(vec![( - ModuleInfo { - namespace: Namespace::new("abstract")?, - name: "standalone2".to_owned(), - version: ModuleVersion::Version(mock_modules::V1.to_owned()), - }, - ModuleReference::Standalone(standalone2_id), - )])?; - - account.install_module("abstract:standalone2", Some(&MockInitMsg {}), &[])?; - take_storage_snapshot!(chain, "proxy_install_standalone_modules"); - Ok(()) -} - -#[test] -fn install_standalone_versions_not_met() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = AbstractAccount::new(&deployment, AccountId::local(0)); - - let standalone1_contract = Box::new(ContractWrapper::new( - mock_modules::standalone_cw2::mock_execute, - mock_modules::standalone_cw2::mock_instantiate, - mock_modules::standalone_cw2::mock_query, - )); - let standalone1_id = chain.app.borrow_mut().store_code(standalone1_contract); - - // install first standalone - deployment.version_control.propose_modules(vec![( - ModuleInfo { - namespace: Namespace::new("abstract")?, - name: "standalone1".to_owned(), - version: ModuleVersion::Version(mock_modules::V2.to_owned()), - }, - ModuleReference::Standalone(standalone1_id), - )])?; - - let err = account - .install_module("abstract:standalone1", Some(&MockInitMsg {}), &[]) - .unwrap_err(); - - if let AbstractInterfaceError::Orch(err) = err { - let err: ManagerError = err.downcast()?; - assert_eq!( - err, - ManagerError::Abstract(abstract_std::AbstractError::UnequalModuleData { - cw2: mock_modules::V1.to_owned(), - module: mock_modules::V2.to_owned(), - }) - ); - } else { - panic!("wrong error type") - }; - - Ok(()) -} - -#[test] -fn install_multiple_modules() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - chain.add_balance(&sender, vec![coin(86, "token1"), coin(500, "token2")])?; - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = AbstractAccount::new(&deployment, ABSTRACT_ACCOUNT_ID); - - let standalone1_contract = Box::new(ContractWrapper::new( - mock_modules::standalone_cw2::mock_execute, - mock_modules::standalone_cw2::mock_instantiate, - mock_modules::standalone_cw2::mock_query, - )); - let standalone1_id = chain.app.borrow_mut().store_code(standalone1_contract); - - let standalone2_contract = Box::new(ContractWrapper::new( - mock_modules::standalone_no_cw2::mock_execute, - mock_modules::standalone_no_cw2::mock_instantiate, - mock_modules::standalone_no_cw2::mock_query, - )); - let standalone2_id = chain.app.borrow_mut().store_code(standalone2_contract); - - // install both standalone - deployment.version_control.propose_modules(vec![ - ( - ModuleInfo { - namespace: Namespace::new("abstract")?, - name: "standalone1".to_owned(), - version: ModuleVersion::Version(mock_modules::V1.to_owned()), - }, - ModuleReference::Standalone(standalone1_id), - ), - ( - ModuleInfo { - namespace: Namespace::new("abstract")?, - name: "standalone2".to_owned(), - version: ModuleVersion::Version(mock_modules::V1.to_owned()), - }, - ModuleReference::Standalone(standalone2_id), - ), - ])?; - - // add monetization on module1 - let monetization = Monetization::InstallFee(FixedFee::new(&coin(42, "token1"))); - deployment.version_control.update_module_configuration( - "standalone1".to_owned(), - Namespace::new("abstract").unwrap(), - UpdateModule::Versioned { - version: mock_modules::V1.to_owned(), - metadata: None, - monetization: Some(monetization), - instantiation_funds: None, - }, - )?; - - // add init funds on module2 - deployment.version_control.update_module_configuration( - "standalone2".to_owned(), - Namespace::new("abstract").unwrap(), - UpdateModule::Versioned { - version: mock_modules::V1.to_owned(), - metadata: None, - monetization: None, - instantiation_funds: Some(vec![coin(42, "token1"), coin(500, "token2")]), - }, - )?; - - // Don't allow to attach too much funds - let err = account - .install_modules( - vec![ - ModuleInstallConfig::new( - ModuleInfo::from_id_latest("abstract:standalone1")?, - Some(to_json_binary(&MockInitMsg {}).unwrap()), - ), - ModuleInstallConfig::new( - ModuleInfo::from_id_latest("abstract:standalone2")?, - Some(to_json_binary(&MockInitMsg {}).unwrap()), - ), - ], - &[coin(86, "token1"), coin(500, "token2")], - ) - .unwrap_err(); - assert!(err.root().to_string().contains(&format!( - "Expected {:?}, sent {:?}", - vec![coin(84, "token1"), coin(500, "token2")], - vec![coin(86, "token1"), coin(500, "token2")] - ))); - - // successful install - account.install_modules_auto(vec![ - ModuleInstallConfig::new( - ModuleInfo::from_id_latest("abstract:standalone1")?, - Some(to_json_binary(&MockInitMsg {}).unwrap()), - ), - ModuleInstallConfig::new( - ModuleInfo::from_id_latest("abstract:standalone2")?, - Some(to_json_binary(&MockInitMsg {}).unwrap()), - ), - ])?; - - // Make sure all installed - let account_module_versions = account.account.module_versions(vec![ - String::from("abstract:standalone1"), - String::from("abstract:standalone2"), - ])?; - assert_eq!( - account_module_versions, - ModuleVersionsResponse { - versions: vec![ - cw2::ContractVersion { - contract: String::from("abstract:standalone1"), - version: String::from(mock_modules::V1), - }, - // Second doesn't have cw2 - cw2::ContractVersion { - contract: String::from("abstract:standalone2"), - version: String::from(mock_modules::V1), - }, - ] - } - ); - - let account_module_addresses = account.account.module_addresses(vec![ - String::from("abstract:standalone1"), - String::from("abstract:standalone2"), - ])?; - let (standalone_addr1, standalone_addr2) = match &account_module_addresses.modules[..] { - [(_app1, addr1), (_app2, addr2)] => (addr1.clone(), addr2.clone()), - _ => panic!("bad result from module_addresses"), - }; - let s1_balance = chain.query_all_balances(&standalone_addr1)?; - let s2_balance = chain.query_all_balances(&standalone_addr2)?; - - assert!(s1_balance.is_empty()); - assert_eq!(s2_balance, vec![coin(42, "token1"), coin(500, "token2")]); - take_storage_snapshot!(chain, "proxy_install_multiple_modules"); - - Ok(()) -} - -#[test] -fn renounce_cleans_namespace() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let account = deployment.account_factory.create_new_account( - AccountDetails { - name: "foo".to_string(), - description: None, - link: None, - namespace: Some("bar".to_owned()), - install_modules: vec![], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - )?; - - let namespace_result = deployment - .version_control - .namespace(Namespace::unchecked("bar")); - assert!(namespace_result.is_ok()); - - account - .account - .update_ownership(ownership::GovAction::RenounceOwnership)?; - - let namespace_result = deployment - .version_control - .namespace(Namespace::unchecked("bar"))?; - assert_eq!(namespace_result, NamespaceResponse::Unclaimed {}); - - // Governance is in fact renounced - let ownership = account.account.ownership()?; - assert_eq!(ownership.owner, GovernanceDetails::Renounced {}); - - Ok(()) -} - -// #[test] -// fn nft_owner_success() -> Result<(), Error> { -// let chain = MockBech32::new("mock"); -// let sender = chain.sender_addr(); -// let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; -// let (token_id, nft_addr) = deploy_and_mint_nft(chain.clone(), sender.clone())?; - -// let gov = GovernanceDetails::NFT { -// collection_addr: nft_addr.to_string(), -// // token minted to sender -// token_id: token_id.clone(), -// }; - -// // create nft-owned account -// let account = deployment.account_factory.create_new_account( -// AccountDetails { -// name: "foo".to_string(), -// description: None, -// link: None, -// namespace: None, -// install_modules: vec![], -// account_id: None, -// }, -// gov, -// None, -// )?; - -// let start_amnt = 100_000; -// let burn_amnt = 10_000u128; -// let start_balance = vec![Coin::new(start_amnt, TTOKEN)]; -// let burn_amount: Vec = vec![Coin::new(burn_amnt, TTOKEN)]; - -// let first_burn = Uint128::from(start_amnt).checked_sub(burn_amnt.into())?; - -// // fund nft account -// chain.set_balance(&account.proxy.address()?, start_balance.clone())?; - -// // test sending msg as nft account by burning tokens from proxy -// let burn_msg = abstract_std::proxy::ExecuteMsg::ModuleAction { -// msgs: vec![CosmosMsg::Bank(cosmwasm_std::BankMsg::Burn { -// amount: burn_amount, -// })], -// }; - -// // confirm sender (who owns this NFT) can execute on the account through the manager -// account.manager.execute_on_module(PROXY, &burn_msg)?; - -// // confirm tokens were burnt -// let balance = chain.query_balance(&account.proxy.address()?, TTOKEN)?; - -// assert_eq!(balance.clone(), first_burn.clone()); - -// // confirm only token holder can send msg -// let not_nft_holder = chain.addr_make_with_balance("test", vec![])?; - -// let res = account -// .manager -// .call_as(¬_nft_holder) -// .execute_on_module(PROXY, &burn_msg); - -// assert!(&res.is_err()); - -// // Now transfer the NFT -// let new_nft_owner = not_nft_holder; - -// chain.execute( -// &cw721::Cw721ExecuteMsg::TransferNft { -// recipient: new_nft_owner.to_string(), -// token_id: token_id.clone(), -// }, -// &[], -// &Addr::unchecked(nft_addr.clone()), -// )?; - -// // ensure NFT was transferred -// let resp: OwnerOfResponse = chain.wasm_querier().smart_query( -// nft_addr, -// &cw721::Cw721QueryMsg::OwnerOf { -// token_id: token_id.clone(), -// include_expired: None, -// }, -// )?; -// assert_eq!(resp.owner, new_nft_owner); - -// // try to call as the old owner (default sender) -// let res = account.manager.execute_on_module(PROXY, &burn_msg); -// assert!(&res.is_err()); - -// // Now try with new NFT owner -// account -// .manager -// .call_as(&new_nft_owner) -// .execute_on_module(PROXY, burn_msg)?; - -// let balance = chain.query_balance(&account.proxy.address()?, TTOKEN)?; -// assert_eq!(balance, first_burn.checked_sub(burn_amnt.into())?); - -// Ok(()) -// } - -// #[test] -// fn nft_owner_immutable() -> Result<(), Error> { -// let chain = MockBech32::new("mock"); -// let sender = chain.sender_addr(); -// let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; -// let (token_id, nft_addr) = deploy_and_mint_nft(chain.clone(), sender.clone())?; - -// let gov = GovernanceDetails::NFT { -// collection_addr: nft_addr.to_string(), -// // token minted to sender -// token_id: token_id.clone(), -// }; - -// // create nft-owned account -// let account = deployment.account_factory.create_new_account( -// AccountDetails { -// name: "foo".to_string(), -// description: None, -// link: None, -// namespace: None, -// install_modules: vec![], -// account_id: None, -// }, -// gov, -// None, -// )?; - -// let not_nft_owner = chain.addr_make("not_nft_owner"); - -// // NFT owned account governance cannot be transferred -// let err: ManagerError = account -// .manager -// .update_ownership(GovAction::TransferOwnership { -// new_owner: GovernanceDetails::Monarchy { -// monarch: not_nft_owner.to_string(), -// }, -// expiry: None, -// }) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::ChangeOfNftOwned) -// ); - -// // NFT owned account governance cannot be renounced -// let err: ManagerError = account -// .manager -// .update_ownership(ownership::GovAction::RenounceOwnership) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::ChangeOfNftOwned) -// ); - -// // create nft-owned sub-account -// let sub_account = account.create_sub_account( -// AccountDetails { -// name: "sub-foo".to_string(), -// description: None, -// link: None, -// namespace: None, -// install_modules: vec![], -// account_id: None, -// }, -// None, -// )?; - -// // NFT owned sub-account governance cannot be transferred -// let err: ManagerError = sub_account -// .manager -// .update_ownership(GovAction::TransferOwnership { -// new_owner: GovernanceDetails::Monarchy { -// monarch: not_nft_owner.to_string(), -// }, -// expiry: None, -// }) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::ChangeOfNftOwned) -// ); - -// // NFT owned sub-account governance cannot be renounced -// let err: ManagerError = sub_account -// .manager -// .update_ownership(ownership::GovAction::RenounceOwnership) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::ChangeOfNftOwned) -// ); - -// Ok(()) -// } - -// #[test] -// fn nft_pending_owner() -> Result<(), Error> { -// let chain = MockBech32::new("mock"); -// let sender = chain.sender_addr(); -// let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; -// let (token_id, nft_addr) = deploy_and_mint_nft(chain.clone(), sender.clone())?; - -// let gov = GovernanceDetails::NFT { -// collection_addr: nft_addr.to_string(), -// // token minted to sender -// token_id: token_id.clone(), -// }; - -// let account = -// deployment -// .account_factory -// .create_default_account(GovernanceDetails::Monarchy { -// monarch: chain.sender_addr().to_string(), -// })?; -// // Transferring to token id that pending governance don't own act same way as transferring to renounced governance -// let err: ManagerError = account -// .manager -// .update_ownership(GovAction::TransferOwnership { -// new_owner: GovernanceDetails::NFT { -// collection_addr: nft_addr.to_string(), -// token_id: "falsy_token_id".to_owned(), -// }, -// expiry: None, -// }) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::TransferToRenounced) -// ); - -// // Now transfer to correct token id -// account -// .manager -// .update_ownership(GovAction::TransferOwnership { -// new_owner: gov.clone(), -// expiry: None, -// })?; -// // Burn nft, which will make it act like we don't have pending ownership -// chain.execute( -// &cw721_base::ExecuteMsg::, Empty>::Burn { token_id }, -// &[], -// &nft_addr, -// )?; -// // Account have pending NFT governance -// // Note that there is no pending period -// let ownership = account.manager.ownership()?; -// assert_eq!(ownership.pending_owner.unwrap(), gov); - -// let err: ManagerError = account -// .manager -// .update_ownership(GovAction::AcceptOwnership) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::TransferNotFound) -// ); - -// // Mint new NFT, since we burned previous one -// let new_token_id = "2".to_owned(); -// mint_nft(&chain, chain.sender_addr(), &new_token_id, &nft_addr)?; - -// // Propose NFT governance -// account -// .manager -// .update_ownership(GovAction::TransferOwnership { -// new_owner: (GovernanceDetails::NFT { -// collection_addr: nft_addr.to_string(), -// // token minted to sender -// token_id: new_token_id.clone(), -// }), -// expiry: None, -// })?; - -// // Only NFT owner can accept it -// let err: ManagerError = account -// .manager -// .call_as(&chain.addr_make("not_nft_owner")) -// .update_ownership(GovAction::AcceptOwnership) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::NotPendingOwner) -// ); - -// // Now accept without accidents -// account -// .manager -// .update_ownership(GovAction::AcceptOwnership)?; - -// // Burn NFT, to ensure account becomes unusable -// chain.execute( -// &cw721_base::ExecuteMsg::, Empty>::Burn { -// token_id: new_token_id, -// }, -// &[], -// &nft_addr, -// )?; - -// let err: ManagerError = account -// .manager -// .update_info(Some("RIP Account".to_owned()), None, None) -// .unwrap_err() -// .downcast() -// .unwrap(); -// assert_eq!( -// err, -// ManagerError::Ownership(ownership::GovOwnershipError::NoOwner) -// ); -// Ok(()) -// } - -#[test] -fn can_take_any_last_two_billion_accounts() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - deployment.account_factory.create_new_account( - AccountDetails { - name: "foo".to_string(), - description: None, - link: None, - namespace: Some("bar".to_owned()), - install_modules: vec![], - account_id: Some(2147483648), - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - )?; - - let already_exists = deployment.account_factory.create_new_account( - AccountDetails { - name: "foo".to_string(), - description: None, - link: None, - namespace: Some("bar".to_owned()), - install_modules: vec![], - // same id - account_id: Some(2147483648), - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - ); - - assert!(already_exists.is_err()); - Ok(()) -} - -#[test] -fn increment_not_effected_by_claiming() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let next_account_id = deployment.account_factory.config()?.local_account_sequence; - assert_eq!(next_account_id, 1); - - deployment.account_factory.create_new_account( - AccountDetails { - name: "foo".to_string(), - description: None, - link: None, - namespace: Some("bar".to_owned()), - install_modules: vec![], - account_id: Some(2147483648), - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - )?; - - let next_account_id = deployment.account_factory.config()?.local_account_sequence; - assert_eq!(next_account_id, 1); - - // create new account - deployment - .account_factory - .create_default_account(GovernanceDetails::Monarchy { - monarch: sender.to_string(), - })?; - - let next_account_id = deployment.account_factory.config()?.local_account_sequence; - assert_eq!(next_account_id, 2); - - Ok(()) -} diff --git a/framework/contracts/account/manager/tests/snapshots/adapters__account_install_adapter.snap b/framework/contracts/account/manager/tests/snapshots/adapters__account_install_adapter.snap deleted file mode 100644 index 86086039bb..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/adapters__account_install_adapter.snap +++ /dev/null @@ -1,145 +0,0 @@ ---- -source: contracts/account/manager/tests/adapters.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:mock-adapter1" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"mock-adapter1\",\"version\":{\"version\":\"1.0.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter11.0.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:mock-adapter1": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:mock-adapter1\",\"version\":\"1.0.0\"}" - - - module_data - - "{\"module\":\"tester:mock-adapter1\",\"version\":\"1.0.0\",\"dependencies\":[],\"metadata\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter.snap b/framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter.snap deleted file mode 100644 index 07c14f9212..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter.snap +++ /dev/null @@ -1,147 +0,0 @@ ---- -source: contracts/account/manager/tests/adapters.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:test-module-id" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"test-module-id\",\"version\":{\"version\":\"0.23.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\u000etest-module-id0.23.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:test-module-id": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:test-module-id\",\"version\":\"0.23.0\"}" - - - ibc_callback_received - - "false" - - - module_data - - "{\"module\":\"tester:test-module-id\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":\"test_metadata\"}" diff --git a/framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter_with_fee.snap b/framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter_with_fee.snap deleted file mode 100644 index c5f504c56d..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/adapters__install_one_adapter_with_fee.snap +++ /dev/null @@ -1,149 +0,0 @@ ---- -source: contracts/account/manager/tests/adapters.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:test-module-id" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"test-module-id\",\"version\":{\"version\":\"0.23.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003cfg\u0000\u0006tester\u0000\u000etest-module-id0.23.0" - - "{\"monetization\":{\"install_fee\":{\"fee\":{\"denom\":\"ujunox\",\"amount\":\"45\"}}},\"metadata\":null,\"instantiation_funds\":[]}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\u000etest-module-id0.23.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:test-module-id": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:test-module-id\",\"version\":\"0.23.0\"}" - - - ibc_callback_received - - "false" - - - module_data - - "{\"module\":\"tester:test-module-id\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":\"test_metadata\"}" diff --git a/framework/contracts/account/manager/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap b/framework/contracts/account/manager/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap deleted file mode 100644 index 82cf105ec5..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap +++ /dev/null @@ -1,147 +0,0 @@ ---- -source: contracts/account/manager/tests/adapters.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:mock-adapter1" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"mock-adapter1\",\"version\":{\"version\":\"1.0.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter11.0.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter12.0.0" - - "{\"adapter\":\"mock1x22q8lfhz7qcvtzs0dakhgx2th64l79kepjujhhxk5x804taeqlqu2pr45\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:mock-adapter1": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:mock-adapter1\",\"version\":\"2.0.0\"}" - - - module_data - - "{\"module\":\"tester:mock-adapter1\",\"version\":\"2.0.0\",\"dependencies\":[],\"metadata\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap b/framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap deleted file mode 100644 index 07c14f9212..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap +++ /dev/null @@ -1,147 +0,0 @@ ---- -source: contracts/account/manager/tests/adapters.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:test-module-id" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"test-module-id\",\"version\":{\"version\":\"0.23.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\u000etest-module-id0.23.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:test-module-id": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:test-module-id\",\"version\":\"0.23.0\"}" - - - ibc_callback_received - - "false" - - - module_data - - "{\"module\":\"tester:test-module-id\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":\"test_metadata\"}" diff --git a/framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap b/framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap deleted file mode 100644 index 4e42306f6d..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap +++ /dev/null @@ -1,147 +0,0 @@ ---- -source: contracts/account/manager/tests/adapters.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:mock-adapter1" - - "\"mock1x22q8lfhz7qcvtzs0dakhgx2th64l79kepjujhhxk5x804taeqlqu2pr45\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"mock-adapter1\",\"version\":{\"version\":\"2.0.0\"}},\"reference\":{\"adapter\":\"mock1x22q8lfhz7qcvtzs0dakhgx2th64l79kepjujhhxk5x804taeqlqu2pr45\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1x22q8lfhz7qcvtzs0dakhgx2th64l79kepjujhhxk5x804taeqlqu2pr45\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter11.0.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter12.0.0" - - "{\"adapter\":\"mock1x22q8lfhz7qcvtzs0dakhgx2th64l79kepjujhhxk5x804taeqlqu2pr45\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:mock-adapter1": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:mock-adapter1\",\"version\":\"2.0.0\"}" - - - module_data - - "{\"module\":\"tester:mock-adapter1\",\"version\":\"2.0.0\",\"dependencies\":[],\"metadata\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/apps__account_install_app.snap b/framework/contracts/account/manager/tests/snapshots/apps__account_install_app.snap deleted file mode 100644 index 7fc9dedeac..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/apps__account_install_app.snap +++ /dev/null @@ -1,147 +0,0 @@ ---- -source: contracts/account/manager/tests/apps.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:app" - - "\"mock1pvj0q8g3ku6udgqaq7z8x768fjv3qezmjc8l8rk9y84e0pw6u9msg3zwyl\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"app\",\"version\":{\"version\":\"1.0.0\"}},\"reference\":{\"app\":9}},\"mock1pvj0q8g3ku6udgqaq7z8x768fjv3qezmjc8l8rk9y84e0pw6u9msg3zwyl\"]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1pvj0q8g3ku6udgqaq7z8x768fjv3qezmjc8l8rk9y84e0pw6u9msg3zwyl\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\u0003app1.0.0" - - "{\"app\":9}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:app": - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - base_state - - "{\"proxy_address\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\",\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"tester:app\",\"version\":\"1.0.0\"}" - - - module_data - - "{\"module\":\"tester:app\",\"version\":\"1.0.0\",\"dependencies\":[],\"metadata\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/apps__execute_on_proxy_through_manager.snap b/framework/contracts/account/manager/tests/snapshots/apps__execute_on_proxy_through_manager.snap deleted file mode 100644 index a8a57812da..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/apps__execute_on_proxy_through_manager.snap +++ /dev/null @@ -1,128 +0,0 @@ ---- -source: contracts/account/manager/tests/apps.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/install_modules__adds_module_to_account_modules.snap b/framework/contracts/account/manager/tests/snapshots/install_modules__adds_module_to_account_modules.snap deleted file mode 100644 index 80770a740e..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/install_modules__adds_module_to_account_modules.snap +++ /dev/null @@ -1,162 +0,0 @@ ---- -source: contracts/account/manager/tests/install_modules.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:mock-adapter1" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"mock-adapter1\",\"version\":{\"version\":\"1.0.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\tmock-app11.0.0" - - "{\"app\":13}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\tmock-app12.0.0" - - "{\"app\":14}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter11.0.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter12.0.0" - - "{\"adapter\":\"mock1x22q8lfhz7qcvtzs0dakhgx2th64l79kepjujhhxk5x804taeqlqu2pr45\"}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter21.0.0" - - "{\"adapter\":\"mock1fuyxwxlsgjkfjmxfthq8427dm2am3ya3cwcdr8gls29l7jadtazs7kt0c7\"}" - - - "\u0000\u0003lib\u0000\u0006tester\u0000\rmock-adapter22.0.0" - - "{\"adapter\":\"mock1qyygux5t4s3a3l25k8psxjydhtudu5lnt0tk0szm8q4s27xa980sgvgwkw\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:mock-adapter1": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:mock-adapter1\",\"version\":\"2.0.0\"}" - - - module_data - - "{\"module\":\"tester:mock-adapter1\",\"version\":\"2.0.0\",\"dependencies\":[],\"metadata\":null}" -"tester:mock-adapter2": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:mock-adapter2\",\"version\":\"2.0.0\"}" - - - module_data - - "{\"module\":\"tester:mock-adapter2\",\"version\":\"2.0.0\",\"dependencies\":[],\"metadata\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/proxy__default_without_response_data.snap b/framework/contracts/account/manager/tests/snapshots/proxy__default_without_response_data.snap deleted file mode 100644 index d5879437f5..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/proxy__default_without_response_data.snap +++ /dev/null @@ -1,147 +0,0 @@ ---- -source: contracts/account/manager/tests/proxy.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:test-module-id" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"test-module-id\",\"version\":{\"version\":\"0.23.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\u000etest-module-id0.23.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:test-module-id": - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:test-module-id\",\"version\":\"0.23.0\"}" - - - ibc_callback_received - - "false" - - - module_data - - "{\"module\":\"tester:test-module-id\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":\"test_metadata\"}" diff --git a/framework/contracts/account/manager/tests/snapshots/proxy__exec_through_manager.snap b/framework/contracts/account/manager/tests/snapshots/proxy__exec_through_manager.snap deleted file mode 100644 index 9b47020c28..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/proxy__exec_through_manager.snap +++ /dev/null @@ -1,128 +0,0 @@ ---- -source: contracts/account/manager/tests/proxy.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/proxy__instantiate_proxy.snap b/framework/contracts/account/manager/tests/snapshots/proxy__instantiate_proxy.snap deleted file mode 100644 index 9b47020c28..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/proxy__instantiate_proxy.snap +++ /dev/null @@ -1,128 +0,0 @@ ---- -source: contracts/account/manager/tests/proxy.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_multiple_modules.snap b/framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_multiple_modules.snap deleted file mode 100644 index d7126bd3ef..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_multiple_modules.snap +++ /dev/null @@ -1,120 +0,0 @@ ---- -source: contracts/account/manager/tests/proxy.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "1" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000\u0007modulesabstract:standalone1" - - "\"mock140yszardgjx5keqq59krnuwt2h7sxzpwdzevm0v904gws2rp562sejmztn\"" - - - "\u0000\u0007modulesabstract:standalone2" - - "\"mock169wfeuug4rpczvhzkayh53apewph6n5fkuf5j597n9a43krex9sq8mkset\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"abstract\",\"name\":\"standalone1\",\"version\":{\"version\":\"1.0.0\"}},\"reference\":{\"standalone\":9}},\"mock140yszardgjx5keqq59krnuwt2h7sxzpwdzevm0v904gws2rp562sejmztn\"],[{\"info\":{\"namespace\":\"abstract\",\"name\":\"standalone2\",\"version\":{\"version\":\"1.0.0\"}},\"reference\":{\"standalone\":10}},\"mock169wfeuug4rpczvhzkayh53apewph6n5fkuf5j597n9a43krex9sq8mkset\"]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - cur_manager - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003cfg\u0000\babstract\u0000\u000bstandalone11.0.0" - - "{\"monetization\":{\"install_fee\":{\"fee\":{\"denom\":\"token1\",\"amount\":\"42\"}}},\"metadata\":null,\"instantiation_funds\":[]}" - - - "\u0000\u0003cfg\u0000\babstract\u0000\u000bstandalone21.0.0" - - "{\"monetization\":\"none\",\"metadata\":null,\"instantiation_funds\":[{\"denom\":\"token1\",\"amount\":\"42\"},{\"denom\":\"token2\",\"amount\":\"500\"}]}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000bstandalone11.0.0" - - "{\"standalone\":9}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000bstandalone21.0.0" - - "{\"standalone\":10}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004stli\u0000\u0000\u0000\u0000\u0000\u0000\u0000\t" - - "{\"namespace\":\"abstract\",\"name\":\"standalone1\",\"version\":{\"version\":\"1.0.0\"}}" - - - "\u0000\u0004stli\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n" - - "{\"namespace\":\"abstract\",\"name\":\"standalone2\",\"version\":{\"version\":\"1.0.0\"}}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_standalone_modules.snap b/framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_standalone_modules.snap deleted file mode 100644 index 72a8ef5b68..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/proxy__proxy_install_standalone_modules.snap +++ /dev/null @@ -1,116 +0,0 @@ ---- -source: contracts/account/manager/tests/proxy.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "1" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000\u0007modulesabstract:standalone1" - - "\"mock140yszardgjx5keqq59krnuwt2h7sxzpwdzevm0v904gws2rp562sejmztn\"" - - - "\u0000\u0007modulesabstract:standalone2" - - "\"mock169wfeuug4rpczvhzkayh53apewph6n5fkuf5j597n9a43krex9sq8mkset\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"abstract\",\"name\":\"standalone2\",\"version\":{\"version\":\"1.0.0\"}},\"reference\":{\"standalone\":10}},\"mock169wfeuug4rpczvhzkayh53apewph6n5fkuf5j597n9a43krex9sq8mkset\"]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - cur_manager - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000bstandalone11.0.0" - - "{\"standalone\":9}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000bstandalone21.0.0" - - "{\"standalone\":10}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004stli\u0000\u0000\u0000\u0000\u0000\u0000\u0000\t" - - "{\"namespace\":\"abstract\",\"name\":\"standalone1\",\"version\":{\"version\":\"1.0.0\"}}" - - - "\u0000\u0004stli\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n" - - "{\"namespace\":\"abstract\",\"name\":\"standalone2\",\"version\":{\"version\":\"1.0.0\"}}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/proxy__proxy_with_response_data.snap b/framework/contracts/account/manager/tests/snapshots/proxy__proxy_with_response_data.snap deleted file mode 100644 index 76a20dc8f6..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/proxy__proxy_with_response_data.snap +++ /dev/null @@ -1,149 +0,0 @@ ---- -source: contracts/account/manager/tests/proxy.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "2" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\u0007modulestester:test-module-id" - - "\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - icontext - - "[[{\"info\":{\"namespace\":\"tester\",\"name\":\"test-module-id\",\"version\":{\"version\":\"0.23.0\"}},\"reference\":{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}},null]]" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\u0006tester\u0000\u000etest-module-id0.23.0" - - "{\"adapter\":\"mock1g6kht9c5s4jwn4akfjt3zmsfh4nvguewaegjeavpz3f0q9uylrqswspf09\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0005nmspctester" - - "{\"trace\":\"local\",\"seq\":1}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0001tester" - - "6" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"tester:test-module-id": - - - "\u0000\u0014authorized_addressesmock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8" - - "[\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"]" - - - base_state - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"tester:test-module-id\",\"version\":\"0.23.0\"}" - - - ibc_callback_received - - "false" - - - module_data - - "{\"module\":\"tester:test-module-id\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":\"test_metadata\"}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap deleted file mode 100644 index 1f7396bfeb..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap +++ /dev/null @@ -1,186 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "4" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-3": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1vxmzu3y7vmq5h8krlchtq5vnazyk4cfl9rdtt7hmrpd3pr986ntsn58h7z\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-3": - - - "\u0000{5}state" - - "{\"modules\":[\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - admin - - "\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0003" - - "{\"manager\":\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\",\"proxy\":\"mock1vxmzu3y7vmq5h8krlchtq5vnazyk4cfl9rdtt7hmrpd3pr986ntsn58h7z\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap deleted file mode 100644 index ff743d6b8c..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap +++ /dev/null @@ -1,195 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "4" - - - cfg - - "{\"version_control_contract\":\"contract1\",\"ans_host_contract\":\"contract0\",\"module_factory_address\":\"contract2\",\"ibc_host\":\"contract5\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"contract1\"},\"ans_host\":{\"address\":\"contract0\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.19.2\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.19.2\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"contract0\"},\"account_factory\":\"contract3\",\"version_control\":{\"address\":\"contract1\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"v\\u0005 W$ÛÒyø‹<\\\\wÃ\\u0001\\u001Bµg)[3>)¼â\\u001A\\u0002&·ù\\\"m\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{4}info" - - "{\"name\":\"Default Abstract Account\",\"governance_details\":{\"Monarchy\":{\"monarch\":\"owner\"}},\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - "\u0000{6}config" - - "{\"version_control_address\":\"contract1\",\"module_factory_address\":\"contract2\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"؞J\\\\Ì1¬´B´‚ÛWn\\\"‚\\u001B\\u0012`±¿9½\\u0005\\u0002ͺñù¬\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{4}info" - - "{\"name\":\"Default Abstract Account\",\"governance_details\":{\"Monarchy\":{\"monarch\":\"owner\"}},\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - "\u0000{6}config" - - "{\"version_control_address\":\"contract1\",\"module_factory_address\":\"contract2\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\", ƒù\\u0000¾w¢»{\\n€¿O…¶wÄü8c\\u0003CÚ¼\\u000F´KêE\\u001DŸ\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0003" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{4}info" - - "{\"name\":\"My subaccount\",\"governance_details\":{\"SubAccount\":{\"manager\":\"ú€Ãºƒ\\u000F¡f9Ê\\u000E˜/´K}\\u001D)¨\\u00167ÐvNڕ¡ëã}|d\",\"proxy\":\"؞J\\\\Ì1¬´B´‚ÛWn\\\"‚\\u001B\\u0012`±¿9½\\u0005\\u0002ͺñù¬\"}},\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - "\u0000{6}config" - - "{\"version_control_address\":\"contract1\",\"module_factory_address\":\"contract2\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"؞J\\\\Ì1¬´B´‚ÛWn\\\"‚\\u001B\\u0012`±¿9½\\u0005\\u0002ͺñù¬\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-3": - - - "\u0000\u0007modulesabstract:proxy" - - "\"N°v¸§Ý\\u0010EÔ\\u001B÷>iäc/#³|²iÿC\\u0013d[\\\"-x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{4}info" - - "{\"name\":\"Default Abstract Account\",\"governance_details\":{\"SubAccount\":{\"manager\":\"\\u0010Õ&A?ÆÇðæ)áàpä:†^cÒùh•Ú±}³¼¶ê@K\\u0003\",\"proxy\":\", ƒù\\u0000¾w¢»{\\n€¿O…¶wÄü8c\\u0003CÚ¼\\u000F´KêE\\u001DŸ\"}},\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - "\u0000{6}config" - - "{\"version_control_address\":\"contract1\",\"module_factory_address\":\"contract2\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\", ƒù\\u0000¾w¢»{\\n€¿O…¶wÄü8c\\u0003CÚ¼\\u000F´KêE\\u001DŸ\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"contract1\",\"ans_host_address\":\"contract0\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"D?Ê\\u0014¬å[#^,¡†4\\r\\u000E\\r¡éÓ¯:5Z\\u000EÑüF%¾á\\b\"]}" - - - "\u0000{6}ans_host" - - "{\"address\":\"contract0\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"D?Ê\\u0014¬å[#^,¡†4\\r\\u000E\\r¡éÓ¯:5Z\\u000EÑüF%¾á\\b\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.19.2\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"ú€Ãºƒ\\u000F¡f9Ê\\u000E˜/´K}\\u001D)¨\\u00167ÐvNڕ¡ëã}|d\"]}" - - - "\u0000{6}ans_host" - - "{\"address\":\"contract0\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"ú€Ãºƒ\\u000F¡f9Ê\\u000E˜/´K}\\u001D)¨\\u00167ÐvNڕ¡ëã}|d\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.19.2\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"\\u0010Õ&A?ÆÇðæ)áàpä:†^cÒùh•Ú±}³¼¶ê@K\\u0003\",\"mock_module\"]}" - - - "\u0000{6}ans_host" - - "{\"address\":\"contract0\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"\\u0010Õ&A?ÆÇðæ)áàpä:†^cÒùh•Ú±}³¼¶ê@K\\u0003\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.19.2\"}" -"abstract:proxy-local-3": - - - "\u0000{5}state" - - "{\"modules\":[\"‡÷%$\\\"»Ì%÷w-sÃü8¦O0\\u0002”.\\u0003sfD2c…qM\\u0010€\"]}" - - - "\u0000{6}ans_host" - - "{\"address\":\"contract0\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - admin - - "\"‡÷%$\\\"»Ì%÷w-sÃü8¦O0\\u0002”.\\u0003sfD2c…qM\\u0010€\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.19.2\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.19.2" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.19.2" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.19.2" - - "{\"native\":\"contract0\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.19.2" - - "{\"native\":\"contract4\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.19.2" - - "{\"native\":\"contract2\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.19.2" - - "{\"native\":\"contract3\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.19.2" - - "{\"native\":\"contract1\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"D?Ê\\u0014¬å[#^,¡†4\\r\\u000E\\r¡éÓ¯:5Z\\u000EÑüF%¾á\\b\",\"proxy\":\"v\\u0005 W$ÛÒyø‹<\\\\wÃ\\u0001\\u001Bµg)[3>)¼â\\u001A\\u0002&·ù\\\"m\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"ú€Ãºƒ\\u000F¡f9Ê\\u000E˜/´K}\\u001D)¨\\u00167ÐvNڕ¡ëã}|d\",\"proxy\":\"؞J\\\\Ì1¬´B´‚ÛWn\\\"‚\\u001B\\u0012`±¿9½\\u0005\\u0002ͺñù¬\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"\\u0010Õ&A?ÆÇðæ)áàpä:†^cÒùh•Ú±}³¼¶ê@K\\u0003\",\"proxy\":\", ƒù\\u0000¾w¢»{\\n€¿O…¶wÄü8c\\u0003CÚ¼\\u000F´KêE\\u001DŸ\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0003" - - "{\"manager\":\"‡÷%$\\\"»Ì%÷w-sÃü8¦O0\\u0002”.\\u0003sfD2c…qM\\u0010€\",\"proxy\":\"N°v¸§Ý\\u0010EÔ\\u001B÷>iäc/#³|²iÿC\\u0013d[\\\"-x\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - cfg - - "{\"account_factory_address\":\"contract3\",\"allow_direct_module_registration_and_updates\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.19.2\"}" - - - ownership - - "{\"owner\":\"owner\",\"pending_owner\":null,\"pending_expiry\":null}" - diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap deleted file mode 100644 index 9dfe153c7c..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap +++ /dev/null @@ -1,132 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "3" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap deleted file mode 100644 index cb0437f391..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap +++ /dev/null @@ -1,1254 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: chain.app.borrow().dump_wasm_raw(&contract_addr) ---- -- - - 0 - - 3 - - 108 - - 105 - - 98 - - 0 - - 8 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 0 - - 5 - - 112 - - 114 - - 111 - - 120 - - 121 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - - 123 - - 34 - - 97 - - 99 - - 99 - - 111 - - 117 - - 110 - - 116 - - 95 - - 98 - - 97 - - 115 - - 101 - - 34 - - 58 - - 54 - - 125 -- - - 0 - - 3 - - 108 - - 105 - - 98 - - 0 - - 8 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 0 - - 7 - - 109 - - 97 - - 110 - - 97 - - 103 - - 101 - - 114 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - - 123 - - 34 - - 97 - - 99 - - 99 - - 111 - - 117 - - 110 - - 116 - - 95 - - 98 - - 97 - - 115 - - 101 - - 34 - - 58 - - 53 - - 125 -- - - 0 - - 3 - - 108 - - 105 - - 98 - - 0 - - 8 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 0 - - 8 - - 97 - - 110 - - 115 - - 45 - - 104 - - 111 - - 115 - - 116 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - - 123 - - 34 - - 110 - - 97 - - 116 - - 105 - - 118 - - 101 - - 34 - - 58 - - 34 - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 48 - - 34 - - 125 -- - - 0 - - 3 - - 108 - - 105 - - 98 - - 0 - - 8 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 0 - - 10 - - 105 - - 98 - - 99 - - 45 - - 99 - - 108 - - 105 - - 101 - - 110 - - 116 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - - 123 - - 34 - - 110 - - 97 - - 116 - - 105 - - 118 - - 101 - - 34 - - 58 - - 34 - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 52 - - 34 - - 125 -- - - 0 - - 3 - - 108 - - 105 - - 98 - - 0 - - 8 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 0 - - 14 - - 109 - - 111 - - 100 - - 117 - - 108 - - 101 - - 45 - - 102 - - 97 - - 99 - - 116 - - 111 - - 114 - - 121 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - - 123 - - 34 - - 110 - - 97 - - 116 - - 105 - - 118 - - 101 - - 34 - - 58 - - 34 - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 50 - - 34 - - 125 -- - - 0 - - 3 - - 108 - - 105 - - 98 - - 0 - - 8 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 0 - - 15 - - 97 - - 99 - - 99 - - 111 - - 117 - - 110 - - 116 - - 45 - - 102 - - 97 - - 99 - - 116 - - 111 - - 114 - - 121 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - - 123 - - 34 - - 110 - - 97 - - 116 - - 105 - - 118 - - 101 - - 34 - - 58 - - 34 - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 51 - - 34 - - 125 -- - - 0 - - 3 - - 108 - - 105 - - 98 - - 0 - - 8 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 0 - - 15 - - 118 - - 101 - - 114 - - 115 - - 105 - - 111 - - 110 - - 45 - - 99 - - 111 - - 110 - - 116 - - 114 - - 111 - - 108 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - - 123 - - 34 - - 110 - - 97 - - 116 - - 105 - - 118 - - 101 - - 34 - - 58 - - 34 - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 49 - - 34 - - 125 -- - - 0 - - 4 - - 97 - - 99 - - 99 - - 115 - - 0 - - 5 - - 108 - - 111 - - 99 - - 97 - - 108 - - 0 - - 0 - - 0 - - 0 - - - 123 - - 34 - - 109 - - 97 - - 110 - - 97 - - 103 - - 101 - - 114 - - 34 - - 58 - - 34 - - 68 - - 63 - - 195 - - 138 - - 92 - - 117 - - 48 - - 48 - - 49 - - 52 - - 194 - - 172 - - 195 - - 165 - - 91 - - 194 - - 143 - - 35 - - 94 - - 44 - - 194 - - 161 - - 194 - - 134 - - 52 - - 92 - - 114 - - 92 - - 117 - - 48 - - 48 - - 48 - - 69 - - 92 - - 114 - - 194 - - 161 - - 195 - - 169 - - 195 - - 147 - - 194 - - 175 - - 58 - - 53 - - 90 - - 92 - - 117 - - 48 - - 48 - - 48 - - 69 - - 195 - - 145 - - 195 - - 188 - - 70 - - 37 - - 194 - - 190 - - 195 - - 161 - - 92 - - 98 - - 34 - - 44 - - 34 - - 112 - - 114 - - 111 - - 120 - - 121 - - 34 - - 58 - - 34 - - 118 - - 92 - - 117 - - 48 - - 48 - - 48 - - 53 - - 32 - - 87 - - 36 - - 195 - - 155 - - 195 - - 146 - - 121 - - 195 - - 184 - - 194 - - 139 - - 60 - - 92 - - 92 - - 119 - - 195 - - 131 - - 92 - - 117 - - 48 - - 48 - - 48 - - 49 - - 92 - - 117 - - 48 - - 48 - - 49 - - 66 - - 194 - - 181 - - 103 - - 41 - - 91 - - 51 - - 62 - - 41 - - 194 - - 188 - - 195 - - 162 - - 92 - - 117 - - 48 - - 48 - - 49 - - 65 - - 92 - - 117 - - 48 - - 48 - - 48 - - 50 - - 38 - - 194 - - 183 - - 195 - - 185 - - 92 - - 34 - - 109 - - 34 - - 125 -- - - 0 - - 4 - - 97 - - 99 - - 99 - - 115 - - 0 - - 5 - - 108 - - 111 - - 99 - - 97 - - 108 - - 0 - - 0 - - 0 - - 1 - - - 123 - - 34 - - 109 - - 97 - - 110 - - 97 - - 103 - - 101 - - 114 - - 34 - - 58 - - 34 - - 195 - - 186 - - 194 - - 128 - - 195 - - 131 - - 194 - - 186 - - 194 - - 131 - - 92 - - 117 - - 48 - - 48 - - 48 - - 70 - - 194 - - 161 - - 102 - - 57 - - 195 - - 138 - - 92 - - 117 - - 48 - - 48 - - 48 - - 69 - - 194 - - 152 - - 47 - - 194 - - 180 - - 75 - - 125 - - 92 - - 117 - - 48 - - 48 - - 49 - - 68 - - 41 - - 194 - - 168 - - 92 - - 117 - - 48 - - 48 - - 49 - - 54 - - 55 - - 195 - - 144 - - 118 - - 78 - - 195 - - 154 - - 194 - - 149 - - 194 - - 161 - - 195 - - 171 - - 195 - - 163 - - 125 - - 124 - - 100 - - 34 - - 44 - - 34 - - 112 - - 114 - - 111 - - 120 - - 121 - - 34 - - 58 - - 34 - - 195 - - 152 - - 194 - - 158 - - 74 - - 92 - - 92 - - 195 - - 140 - - 49 - - 194 - - 172 - - 194 - - 180 - - 66 - - 194 - - 180 - - 194 - - 130 - - 195 - - 155 - - 87 - - 110 - - 92 - - 34 - - 194 - - 143 - - 194 - - 130 - - 92 - - 117 - - 48 - - 48 - - 49 - - 66 - - 92 - - 117 - - 48 - - 48 - - 49 - - 50 - - 96 - - 194 - - 177 - - 194 - - 143 - - 194 - - 191 - - 57 - - 194 - - 189 - - 92 - - 117 - - 48 - - 48 - - 48 - - 53 - - 92 - - 117 - - 48 - - 48 - - 48 - - 50 - - 195 - - 141 - - 194 - - 186 - - 195 - - 177 - - 195 - - 185 - - 194 - - 172 - - 34 - - 125 -- - - 0 - - 4 - - 97 - - 99 - - 99 - - 115 - - 0 - - 5 - - 108 - - 111 - - 99 - - 97 - - 108 - - 0 - - 0 - - 0 - - 2 - - - 123 - - 34 - - 109 - - 97 - - 110 - - 97 - - 103 - - 101 - - 114 - - 34 - - 58 - - 34 - - 92 - - 117 - - 48 - - 48 - - 49 - - 48 - - 195 - - 149 - - 38 - - 65 - - 63 - - 195 - - 134 - - 195 - - 135 - - 195 - - 176 - - 195 - - 166 - - 41 - - 195 - - 161 - - 195 - - 160 - - 112 - - 195 - - 164 - - 58 - - 194 - - 134 - - 94 - - 99 - - 195 - - 146 - - 195 - - 185 - - 104 - - 194 - - 149 - - 195 - - 154 - - 194 - - 177 - - 125 - - 194 - - 179 - - 194 - - 188 - - 194 - - 182 - - 195 - - 170 - - 64 - - 75 - - 92 - - 117 - - 48 - - 48 - - 48 - - 51 - - 34 - - 44 - - 34 - - 112 - - 114 - - 111 - - 120 - - 121 - - 34 - - 58 - - 34 - - 44 - - 32 - - 194 - - 131 - - 195 - - 185 - - 92 - - 117 - - 48 - - 48 - - 48 - - 48 - - 194 - - 190 - - 119 - - 194 - - 162 - - 194 - - 187 - - 123 - - 92 - - 110 - - 194 - - 128 - - 194 - - 191 - - 79 - - 194 - - 133 - - 194 - - 182 - - 119 - - 195 - - 132 - - 195 - - 188 - - 56 - - 99 - - 92 - - 117 - - 48 - - 48 - - 48 - - 51 - - 67 - - 195 - - 154 - - 194 - - 188 - - 92 - - 117 - - 48 - - 48 - - 48 - - 70 - - 194 - - 180 - - 75 - - 195 - - 170 - - 69 - - 92 - - 117 - - 48 - - 48 - - 49 - - 68 - - 194 - - 159 - - 34 - - 125 -- - - 0 - - 5 - - 110 - - 109 - - 115 - - 112 - - 99 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - - 123 - - 34 - - 116 - - 114 - - 97 - - 99 - - 101 - - 34 - - 58 - - 34 - - 108 - - 111 - - 99 - - 97 - - 108 - - 34 - - 44 - - 34 - - 115 - - 101 - - 113 - - 34 - - 58 - - 48 - - 125 -- - - 0 - - 7 - - 110 - - 109 - - 115 - - 112 - - 99 - - 95 - - 97 - - 0 - - 5 - - 108 - - 111 - - 99 - - 97 - - 108 - - 0 - - 4 - - 0 - - 0 - - 0 - - 0 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - - 56 -- - - 99 - - 102 - - 103 - - - 123 - - 34 - - 97 - - 99 - - 99 - - 111 - - 117 - - 110 - - 116 - - 95 - - 102 - - 97 - - 99 - - 116 - - 111 - - 114 - - 121 - - 95 - - 97 - - 100 - - 100 - - 114 - - 101 - - 115 - - 115 - - 34 - - 58 - - 34 - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 51 - - 34 - - 44 - - 34 - - 97 - - 108 - - 108 - - 111 - - 119 - - 95 - - 100 - - 105 - - 114 - - 101 - - 99 - - 116 - - 95 - - 109 - - 111 - - 100 - - 117 - - 108 - - 101 - - 95 - - 114 - - 101 - - 103 - - 105 - - 115 - - 116 - - 114 - - 97 - - 116 - - 105 - - 111 - - 110 - - 95 - - 97 - - 110 - - 100 - - 95 - - 117 - - 112 - - 100 - - 97 - - 116 - - 101 - - 115 - - 34 - - 58 - - 116 - - 114 - - 117 - - 101 - - 44 - - 34 - - 110 - - 97 - - 109 - - 101 - - 115 - - 112 - - 97 - - 99 - - 101 - - 95 - - 114 - - 101 - - 103 - - 105 - - 115 - - 116 - - 114 - - 97 - - 116 - - 105 - - 111 - - 110 - - 95 - - 102 - - 101 - - 101 - - 34 - - 58 - - 110 - - 117 - - 108 - - 108 - - 125 -- - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 95 - - 105 - - 110 - - 102 - - 111 - - - 123 - - 34 - - 99 - - 111 - - 110 - - 116 - - 114 - - 97 - - 99 - - 116 - - 34 - - 58 - - 34 - - 97 - - 98 - - 115 - - 116 - - 114 - - 97 - - 99 - - 116 - - 58 - - 118 - - 101 - - 114 - - 115 - - 105 - - 111 - - 110 - - 45 - - 99 - - 111 - - 110 - - 116 - - 114 - - 111 - - 108 - - 34 - - 44 - - 34 - - 118 - - 101 - - 114 - - 115 - - 105 - - 111 - - 110 - - 34 - - 58 - - 34 - - 48 - - 46 - - 49 - - 57 - - 46 - - 50 - - 34 - - 125 -- - - 111 - - 119 - - 110 - - 101 - - 114 - - 115 - - 104 - - 105 - - 112 - - - 123 - - 34 - - 111 - - 119 - - 110 - - 101 - - 114 - - 34 - - 58 - - 34 - - 111 - - 119 - - 110 - - 101 - - 114 - - 34 - - 44 - - 34 - - 112 - - 101 - - 110 - - 100 - - 105 - - 110 - - 103 - - 95 - - 111 - - 119 - - 110 - - 101 - - 114 - - 34 - - 58 - - 110 - - 117 - - 108 - - 108 - - 44 - - 34 - - 112 - - 101 - - 110 - - 100 - - 105 - - 110 - - 103 - - 95 - - 101 - - 120 - - 112 - - 105 - - 114 - - 121 - - 34 - - 58 - - 110 - - 117 - - 108 - - 108 - - 125 - diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap deleted file mode 100644 index 1d5e619379..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap +++ /dev/null @@ -1,158 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "3" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":\"new desc\",\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"mock15cnh8a268g6dhlzc4cay9mq7w8vt24hmknafxpngvmev4t7dj0jq607wev\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap deleted file mode 100644 index 580fa8728c..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap +++ /dev/null @@ -1,158 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "3" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":\"new desc\",\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap deleted file mode 100644 index aa1d6f15ea..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap +++ /dev/null @@ -1,188 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "4" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0003" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-3": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1vxmzu3y7vmq5h8krlchtq5vnazyk4cfl9rdtt7hmrpd3pr986ntsn58h7z\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subsubaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":\"new desc\",\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-3": - - - "\u0000{5}state" - - "{\"modules\":[\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - admin - - "\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0003" - - "{\"manager\":\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\",\"proxy\":\"mock1vxmzu3y7vmq5h8krlchtq5vnazyk4cfl9rdtt7hmrpd3pr986ntsn58h7z\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership.snap deleted file mode 100644 index 46c23376da..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership.snap +++ /dev/null @@ -1,156 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "3" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1lk0ans8sykcdtc2u6ep502pjm6m2ep4aqe9qsupg5hwpweg4mxxqjgke6h\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap deleted file mode 100644 index 288e3765d9..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap +++ /dev/null @@ -1,216 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "5" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0004" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-3": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1vxmzu3y7vmq5h8krlchtq5vnazyk4cfl9rdtt7hmrpd3pr986ntsn58h7z\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-4": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock14t3sxn3kv9jp0hfl3pastpp0yxc6t5l73a8n4lcufweyj847tlaqrepra2\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":4}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My second subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"mock1ss2rtya5wf7xft2ktc3gqt5e9c9k9menzr57a37d47e0aq0nckkq3e6zkm\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-3": - - - "\u0000{5}state" - - "{\"modules\":[\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":3}" - - - admin - - "\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-4": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1pk8hn9cmnerpyf3e83spka86ywjq8582f8ut7xcpjks67zayh5vs9rntga\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":4}" - - - admin - - "\"mock1pk8hn9cmnerpyf3e83spka86ywjq8582f8ut7xcpjks67zayh5vs9rntga\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0003" - - "{\"manager\":\"mock19yh6uk2hsnsglg6fyuwv29p7g0s30a70vl9aj5sc90fda9xu4dgsmq42x3\",\"proxy\":\"mock1vxmzu3y7vmq5h8krlchtq5vnazyk4cfl9rdtt7hmrpd3pr986ntsn58h7z\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0004" - - "{\"manager\":\"mock1pk8hn9cmnerpyf3e83spka86ywjq8582f8ut7xcpjks67zayh5vs9rntga\",\"proxy\":\"mock14t3sxn3kv9jp0hfl3pastpp0yxc6t5l73a8n4lcufweyj847tlaqrepra2\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap b/framework/contracts/account/manager/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap deleted file mode 100644 index 580fa8728c..0000000000 --- a/framework/contracts/account/manager/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap +++ /dev/null @@ -1,158 +0,0 @@ ---- -source: contracts/account/manager/tests/subaccount.rs -expression: all_storage ---- -"abstract:account-factory": - - - acseq - - "3" - - - cfg - - "{\"version_control_contract\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_contract\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - contract_info - - "{\"contract\":\"abstract:account-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ans-host": - - - config - - "{\"next_unique_pool_id\":1}" - - - contract_info - - "{\"contract\":\"abstract:ans-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" - - - registered_dexes - - "[]" -"abstract:ibc-client": - - - config - - "{\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"},\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-client\",\"version\":\"0.23.0\"}" - - - module_data - - "{\"module\":\"abstract:ibc-client\",\"version\":\"0.23.0\",\"dependencies\":[],\"metadata\":null}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:ibc-host": - - - cfg - - "{\"ans_host\":{\"address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"},\"account_factory\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"version_control\":{\"address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}}" - - - contract_info - - "{\"contract\":\"abstract:ibc-host\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-0": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-1": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"" - - - "\u0000\bsub_accs\u0000\u0000\u0000\u0002" - - "{}" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"Default Abstract Account\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":null,\"link\":null}" - - - ownership - - "{\"owner\":{\"Monarchy\":{\"monarch\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:manager-local-2": - - - "\u0000\u0007modulesabstract:proxy" - - "\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"" - - - "\u0000{12}is_suspended" - - "false" - - - "\u0000{6}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"module_factory_address\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - context - - "[]" - - - contract_info - - "{\"contract\":\"abstract:manager\",\"version\":\"0.23.0\"}" - - - info - - "{\"name\":\"My subaccount\",\"chain_id\":\"cosmos-testnet-14002\",\"description\":\"new desc\",\"link\":null}" - - - ownership - - "{\"owner\":{\"SubAccount\":{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}},\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:module-factory": - - - "\u0000{5}config" - - "{\"version_control_address\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\",\"ans_host_address\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - contract_info - - "{\"contract\":\"abstract:module-factory\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" -"abstract:proxy-local-0": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":0}" - - - admin - - "\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-1": - - - "\u0000{5}state" - - "{\"modules\":[\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":1}" - - - admin - - "\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:proxy-local-2": - - - "\u0000{5}state" - - "{\"modules\":[\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"]}" - - - acc_id - - "{\"trace\":\"local\",\"seq\":2}" - - - admin - - "\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\"" - - - contract_info - - "{\"contract\":\"abstract:proxy\",\"version\":\"0.23.0\"}" -"abstract:version-control": - - - "\u0000\u0003lib\u0000\babstract\u0000\u0005proxy0.23.0" - - "{\"account_base\":6}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u0007manager0.23.0" - - "{\"account_base\":5}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bans-host0.23.0" - - "{\"native\":\"mock1mzdhwvvh22wrt07w59wxyd58822qavwkx5lcej7aqfkpqqlhaqfsetqc4t\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\bibc-host0.23.0" - - "{\"native\":\"mock14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les6xzvf5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\nibc-client0.23.0" - - "{\"native\":\"mock1aaf9r6s7nxhysuegqrxv0wpm27ypyv4886medd3mrkrw6t4yfcns7ctvz5\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000emodule-factory0.23.0" - - "{\"native\":\"mock1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5wsldye53\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000faccount-factory0.23.0" - - "{\"native\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\"}" - - - "\u0000\u0003lib\u0000\babstract\u0000\u000fversion-control0.23.0" - - "{\"native\":\"mock1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqwm38hv\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0000" - - "{\"manager\":\"mock1lqyzwgew5stjyj9mqf04f98d87yy0chklx25dvq58w4855v4lflqy7ppar\",\"proxy\":\"mock1xsemjm2xzx8nfaj50rt2dn04g24yarrr3mf6uwhqtc4ampff9nsqrc867x\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0001" - - "{\"manager\":\"mock1ps47cz26ugmzp2emuqap8jmvjrkwyzgh4uupechr9et6w0a3ar6sv5ag3c\",\"proxy\":\"mock17krt3hhgtspmv8lqhx8hcfnsz55z7t58gf6j0e6zrv9jq00rm08qyhxeu8\"}" - - - "\u0000\u0004accs\u0000\u0005local\u0000\u0000\u0000\u0002" - - "{\"manager\":\"mock13cahl7h567qy5pal82h4qztgg6yp0dum7h0rx26lkvyednndhh8qcfqqvj\",\"proxy\":\"mock1t28rc44kxw7g0yn4sw7caqyv04d645svse6lu67fyc6hxs6c2ptqyd4ky0\"}" - - - "\u0000\u0005nmspcabstract" - - "{\"trace\":\"local\",\"seq\":0}" - - - "\u0000\u0007nmspc_a\u0000\u0005local\u0000\u0004\u0000\u0000\u0000\u0000abstract" - - "8" - - - config - - "{\"account_factory_address\":\"mock17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgszycl2y\",\"security_disabled\":true,\"namespace_registration_fee\":null}" - - - contract_info - - "{\"contract\":\"abstract:version-control\",\"version\":\"0.23.0\"}" - - - ownership - - "{\"owner\":\"mock1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qwrtv4f\",\"pending_owner\":null,\"pending_expiry\":null}" diff --git a/framework/contracts/account/manager/tests/standalones.rs b/framework/contracts/account/manager/tests/standalones.rs deleted file mode 100644 index 79bc100703..0000000000 --- a/framework/contracts/account/manager/tests/standalones.rs +++ /dev/null @@ -1,90 +0,0 @@ -use abstract_integration_tests::{create_default_account, AResult}; -use abstract_interface::*; -use abstract_manager::error::ManagerError; -use abstract_standalone::{ - gen_standalone_mock, - mock::{MockExecMsgFns, MockQueryMsgFns, MockQueryResponse}, -}; -use abstract_testing::prelude::*; -use cosmwasm_std::Binary; -use cw_orch::prelude::*; - -const STANDALONE_ID: &str = "tester:standalone"; -const STANDALONE_VERSION: &str = "1.0.0"; -gen_standalone_mock!(MockStandalone, STANDALONE_ID, STANDALONE_VERSION); - -#[test] -fn account_install_standalone() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - let standalone = MockStandalone::new(STANDALONE_ID, chain); - standalone.deploy(STANDALONE_VERSION.parse().unwrap(), DeployStrategy::Try)?; - account.install_standalone( - &standalone, - &MockInitMsg { - base: standalone::StandaloneInstantiateMsg { - ans_host_address: deployment.ans_host.addr_str()?, - version_control_address: deployment.version_control.addr_str()?, - }, - random_field: "LMAO".to_owned(), - }, - &[], - )?; - // Check some actions - let r = standalone.do_something()?; - assert_eq!(r.data, Some(Binary::from(b"mock_exec"))); - let something = standalone.get_something()?; - assert_eq!(something, MockQueryResponse {}); - Ok(()) -} - -#[test] -fn cant_reinstall_standalone_after_uninstall() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - deployment - .version_control - .claim_namespace(TEST_ACCOUNT_ID, "tester".to_owned())?; - - let standalone = MockStandalone::new_test(chain.clone()); - standalone.deploy(STANDALONE_VERSION.parse().unwrap(), DeployStrategy::Try)?; - account.install_standalone( - &standalone, - &MockInitMsg { - base: standalone::StandaloneInstantiateMsg { - ans_host_address: deployment.ans_host.addr_str()?, - version_control_address: deployment.version_control.addr_str()?, - }, - random_field: "foo".to_owned(), - }, - &[], - )?; - - // Reinstall - account.account.uninstall_module(STANDALONE_ID.to_owned())?; - let Err(AbstractInterfaceError::Orch(err)) = account.install_standalone( - &standalone, - &MockInitMsg { - base: standalone::StandaloneInstantiateMsg { - ans_host_address: deployment.ans_host.addr_str()?, - version_control_address: deployment.version_control.addr_str()?, - }, - random_field: "foo".to_owned(), - }, - &[], - ) else { - panic!("Expected error"); - }; - let manager_err: ManagerError = err.downcast().unwrap(); - assert_eq!(manager_err, ManagerError::ProhibitedReinstall {}); - Ok(()) -} diff --git a/framework/contracts/account/manager/tests/subaccount.rs b/framework/contracts/account/manager/tests/subaccount.rs deleted file mode 100644 index 233e95826b..0000000000 --- a/framework/contracts/account/manager/tests/subaccount.rs +++ /dev/null @@ -1,676 +0,0 @@ -use abstract_integration_tests::{create_default_account, AResult}; -use abstract_interface::*; -use abstract_manager::error::ManagerError; -use abstract_std::{ - manager::{self, SubAccountIdsResponse}, - objects::{ - gov_type::{GovAction, GovernanceDetails}, - ownership, AccountId, - }, - proxy, ACCOUNT, -}; -use cosmwasm_std::{to_json_binary, wasm_execute, WasmMsg}; -use cw_orch::prelude::*; - -#[test] -fn creating_on_subaccount_should_succeed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - let sub_accounts = account.account.sub_account_ids(None, None)?; - assert_eq!( - sub_accounts, - SubAccountIdsResponse { - // only one sub-account and it should be account_id 2 - sub_accounts: vec![2] - } - ); - take_storage_snapshot!(chain, "creating_on_subaccount_should_succeed"); - Ok(()) -} - -#[test] -fn updating_on_subaccount_should_succeed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - // Subaccount should have id 2 in this test, we try to update the config of this module - let account_contracts = get_account_contracts(&deployment.version_control, AccountId::local(2)); - let new_desc = "new desc"; - account_contracts - .0 - .update_info(Some(new_desc.to_string()), None, None)?; - - assert_eq!( - Some(new_desc.to_string()), - account_contracts.0.info()?.info.description - ); - take_storage_snapshot!(chain, "updating_on_subaccount_should_succeed"); - Ok(()) -} - -#[test] -fn proxy_updating_on_subaccount_should_succeed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let proxy_address = account.proxy.address()?; - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - // Subaccount should have id 2 in this test, we try to update the config of this module - let (sub_manager, _) = get_account_contracts(&deployment.version_control, AccountId::local(2)); - let new_desc = "new desc"; - - // We call as the proxy, it should also be possible - sub_manager - .call_as(&proxy_address) - .update_info(Some(new_desc.to_owned()), None, None)?; - - assert_eq!( - Some(new_desc.to_string()), - sub_manager.info()?.info.description - ); - - take_storage_snapshot!(chain, "proxy_updating_on_subaccount_should_succeed"); - Ok(()) -} - -#[test] -fn recursive_updating_on_subaccount_should_succeed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - // Subaccount should have id 2 in this test, we try to update the config of this module - let account_contracts = get_account_contracts(&deployment.version_control, AccountId::local(2)); - - // We call as the manager, it should also be possible - account_contracts.0.create_sub_account( - vec![], - "My subsubaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - let account_contracts = get_account_contracts(&deployment.version_control, AccountId::local(3)); - let new_desc = "new desc"; - - account_contracts - .0 - .call_as(&sender) - .update_info(Some(new_desc.to_string()), None, None)?; - - assert_eq!( - Some(new_desc.to_string()), - account_contracts.0.info()?.info.description - ); - - take_storage_snapshot!(chain, "recursive_updating_on_subaccount_should_succeed"); - Ok(()) -} - -#[test] -fn installed_app_updating_on_subaccount_should_succeed() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - let first_proxy_addr = account.proxy.address()?; - - let mock_app = chain.addr_make("mock_app"); - account - .proxy - .call_as(&account.account.address()?) - .add_modules(vec![mock_app.to_string()])?; - - let (sub_manager, _sub_proxy) = - get_account_contracts(&deployment.version_control, AccountId::local(2)); - let new_desc = "new desc"; - - // recover address on first proxy - account.proxy.set_address(&first_proxy_addr); - // adding mock_app to whitelist on proxy - - // We call as installed app of the owner-proxy, it should also be possible - account - .proxy - .call_as(&mock_app) - .module_action(vec![wasm_execute( - sub_manager.addr_str()?, - &abstract_std::manager::ExecuteMsg::UpdateInfo { - name: None, - description: Some(new_desc.to_owned()), - link: None, - }, - vec![], - )? - .into()])?; - - assert_eq!( - Some(new_desc.to_string()), - sub_manager.info()?.info.description - ); - take_storage_snapshot!(chain, "installed_app_updating_on_subaccount_should_succeed"); - - Ok(()) -} - -#[test] -fn sub_account_move_ownership() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let new_owner = chain.addr_make("new_owner"); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - // Store manager address, it will be used for querying - let manager_addr = account.account.address()?; - - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - let sub_accounts = account.account.sub_account_ids(None, None)?; - assert_eq!( - sub_accounts, - SubAccountIdsResponse { - // only one sub-account and it should be account_id 2 - sub_accounts: vec![2] - } - ); - - let sub_account = AbstractAccount::new(&deployment, AccountId::local(2)); - sub_account - .account - .update_ownership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::Monarchy { - monarch: new_owner.to_string(), - }, - expiry: None, - })?; - - // Make sure it's not updated until claimed - let sub_accounts: SubAccountIdsResponse = chain.query( - &abstract_std::manager::QueryMsg::SubAccountIds { - start_after: None, - limit: None, - }, - &manager_addr, - )?; - assert_eq!( - sub_accounts, - SubAccountIdsResponse { - sub_accounts: vec![2] - } - ); - - // Claim ownership - sub_account.account.call_as(&new_owner).execute( - &abstract_std::manager::ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership), - &[], - )?; - let account = AbstractAccount::new(&deployment, AccountId::local(1)); - - // After claim it's updated - let sub_accounts = account.account.sub_account_ids(None, None)?; - assert_eq!( - sub_accounts, - SubAccountIdsResponse { - sub_accounts: vec![] - } - ); - take_storage_snapshot!(chain, "sub_account_move_ownership"); - - Ok(()) -} - -#[test] -fn account_move_ownership_to_sub_account() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::account_move_ownership_to_sub_account(chain)?; - Ok(()) -} - -#[test] -fn sub_account_move_ownership_to_sub_account() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - let sub_account = AbstractAccount::new(&deployment, AccountId::local(2)); - let sub_manager_addr = sub_account.account.address()?; - let sub_proxy_addr = sub_account.proxy.address()?; - - let new_account = create_default_account(&deployment.account_factory)?; - new_account.account.create_sub_account( - vec![], - "My second subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - // sub-accounts state updated - let sub_ids = new_account.account.sub_account_ids(None, None)?; - assert_eq!(sub_ids.sub_accounts, vec![4]); - - let new_account_sub_account = AbstractAccount::new(&deployment, AccountId::local(4)); - let new_governance = GovernanceDetails::SubAccount { - manager: sub_manager_addr.to_string(), - proxy: sub_proxy_addr.to_string(), - }; - new_account_sub_account - .account - .update_ownership(GovAction::TransferOwnership { - new_owner: new_governance.clone(), - expiry: None, - })?; - let new_account_sub_account_manager = new_account_sub_account.account.address()?; - - let sub_account = AbstractAccount::new(&deployment, AccountId::local(2)); - let mock_module = chain.addr_make("mock_module"); - sub_account - .proxy - .call_as(&sub_manager_addr) - .add_modules(vec![mock_module.to_string()])?; - sub_account - .proxy - .call_as(&mock_module) - .module_action(vec![wasm_execute( - new_account_sub_account_manager, - &abstract_std::manager::ExecuteMsg::UpdateOwnership( - ownership::GovAction::AcceptOwnership, - ), - vec![], - )? - .into()])?; - - // sub-accounts state updated - let sub_ids = sub_account.account.sub_account_ids(None, None)?; - assert_eq!(sub_ids.sub_accounts, vec![4]); - let new_account = AbstractAccount::new(&deployment, AccountId::local(3)); - // removed from the previous owner as well - let sub_ids = new_account.account.sub_account_ids(None, None)?; - assert_eq!(sub_ids.sub_accounts, Vec::::new()); - - let new_account_sub_account = AbstractAccount::new(&deployment, AccountId::local(4)); - let info = new_account_sub_account.account.ownership()?; - assert_eq!(new_governance, info.owner); - take_storage_snapshot!(chain, "sub_account_move_ownership_to_sub_account"); - - Ok(()) -} - -#[test] -fn account_move_ownership_to_falsy_sub_account() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&deployment.account_factory)?; - let proxy_addr = account.proxy.address()?; - - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - let sub_account = AbstractAccount::new(&deployment, AccountId::local(2)); - let sub_manager_addr = sub_account.account.address()?; - - let new_account = create_default_account(&deployment.account_factory)?; - // proxy and manager of different accounts - let new_governance = GovernanceDetails::SubAccount { - manager: sub_manager_addr.to_string(), - proxy: proxy_addr.to_string(), - }; - let err = new_account - .account - .update_ownership(GovAction::TransferOwnership { - new_owner: new_governance.clone(), - expiry: None, - }) - .unwrap_err(); - let err = err.root().to_string(); - assert!(err.contains("manager and proxy has different account ids")); - take_storage_snapshot!(chain, "account_move_ownership_to_falsy_sub_account"); - Ok(()) -} - -#[test] -fn account_updated_to_subaccount() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - // Creating account1 - let account = create_default_account(&deployment.account_factory)?; - let proxy1_addr = account.proxy.address()?; - let manager1_addr = account.account.address()?; - - // Creating account2 - let account = create_default_account(&deployment.account_factory)?; - let manager2_addr = account.account.address()?; - - // Setting account1 as pending owner of account2 - account - .account - .update_ownership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::SubAccount { - manager: manager1_addr.to_string(), - proxy: proxy1_addr.to_string(), - }, - expiry: None, - })?; - account.account.set_address(&manager1_addr); - account.proxy.set_address(&proxy1_addr); - - // account1 accepting account2 as a sub-account - let accept_msg = - abstract_std::manager::ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership); - account.account.exec_on_module( - to_json_binary(&abstract_std::proxy::ExecuteMsg::ModuleAction { - msgs: vec![wasm_execute(manager2_addr, &accept_msg, vec![])?.into()], - })?, - ACCOUNT.to_owned(), - &[], - )?; - - // Check manager knows about his new sub-account - let ids = account.account.sub_account_ids(None, None)?; - assert_eq!(ids.sub_accounts.len(), 1); - Ok(()) -} - -#[test] -fn account_updated_to_subaccount_recursive() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - // Creating account1 - let account = create_default_account(&deployment.account_factory)?; - let proxy1_addr = account.proxy.address()?; - let manager1_addr = account.account.address()?; - - // Creating account2 - let account = create_default_account(&deployment.account_factory)?; - - // Setting account1 as pending owner of account2 - account - .account - .update_ownership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::SubAccount { - manager: manager1_addr.to_string(), - proxy: proxy1_addr.to_string(), - }, - expiry: None, - })?; - // accepting ownership by sender instead of the manager - account - .account - .update_ownership(ownership::GovAction::AcceptOwnership)?; - - // Check manager knows about his new sub-account - account.account.set_address(&manager1_addr); - let ids = account.account.sub_account_ids(None, None)?; - assert_eq!(ids.sub_accounts.len(), 1); - Ok(()) -} - -#[test] -fn top_level_owner() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let account = create_default_account(&deployment.account_factory)?; - // Creating sub account - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - let response = account.account.sub_account_ids(None, None)?; - let sub_account = AbstractAccount::new(&deployment, AccountId::local(response.sub_accounts[0])); - - let top_level_owner = sub_account.account.top_level_owner()?; - assert_eq!(top_level_owner.address, sender); - Ok(()) -} - -#[test] -fn cant_renounce_with_sub_accounts() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let account = create_default_account(&deployment.account_factory)?; - // Creating sub account - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - let err: ManagerError = account - .account - .update_ownership(ownership::GovAction::RenounceOwnership) - .unwrap_err() - .downcast() - .unwrap(); - assert_eq!(err, ManagerError::RenounceWithSubAccount {}); - Ok(()) -} - -#[test] -fn can_renounce_sub_accounts() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let account = create_default_account(&deployment.account_factory)?; - // Creating sub account - account.account.create_sub_account( - vec![], - "My subaccount".to_string(), - None, - None, - None, - None, - &[], - )?; - - let sub_account_id = account.account.sub_account_ids(None, None)?.sub_accounts[0]; - - let sub_account = AbstractAccount::new(&deployment, AccountId::local(sub_account_id)); - - sub_account - .account - .update_ownership(ownership::GovAction::RenounceOwnership)?; - - account - .account - .update_ownership(ownership::GovAction::RenounceOwnership)?; - - // No owners - // Renounced governance - let account_owner = account.account.ownership()?; - assert_eq!(account_owner.owner, GovernanceDetails::Renounced {}); - let sub_account_owner = sub_account.account.ownership()?; - assert_eq!(sub_account_owner.owner, GovernanceDetails::Renounced {}); - - Ok(()) -} - -#[test] -fn account_updated_to_subaccount_without_recursion() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - // Creating account1 - let account_1 = create_default_account(&deployment.account_factory)?; - - // Creating account2 - let account_2 = create_default_account(&deployment.account_factory)?; - - // Setting account1 as pending owner of account2 - account_2 - .account - .update_ownership(GovAction::TransferOwnership { - new_owner: GovernanceDetails::SubAccount { - manager: account_1.account.addr_str()?, - proxy: account_1.proxy.addr_str()?, - }, - expiry: None, - })?; - - // accepting ownership by sender instead of the manager - account_1.account.execute_on_module( - ACCOUNT, - proxy::ExecuteMsg::ModuleAction { - msgs: vec![WasmMsg::Execute { - contract_addr: account_2.account.addr_str()?, - msg: to_json_binary(&manager::ExecuteMsg::UpdateOwnership( - GovAction::AcceptOwnership, - ))?, - funds: vec![], - } - .into()], - }, - )?; - - // Check manager knows about his new sub-account - let ids = account_1.account.sub_account_ids(None, None)?; - assert_eq!(ids.sub_accounts.len(), 1); - Ok(()) -} - -#[test] -fn sub_account_to_regular_account_without_recursion() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - // Creating account1 - let account = create_default_account(&deployment.account_factory)?; - let sub_account = account.create_sub_account( - AccountDetails { - name: "sub_account".to_owned(), - ..Default::default() - }, - &[], - )?; - - account.account.execute_on_module( - ACCOUNT, - proxy::ExecuteMsg::ModuleAction { - msgs: vec![WasmMsg::Execute { - contract_addr: sub_account.account.addr_str()?, - msg: to_json_binary(&manager::ExecuteMsg::UpdateOwnership( - GovAction::TransferOwnership { - new_owner: GovernanceDetails::Monarchy { - monarch: chain.sender_addr().to_string(), - }, - expiry: None, - }, - ))?, - funds: vec![], - } - .into()], - }, - )?; - - sub_account - .account - .update_ownership(GovAction::AcceptOwnership)?; - let ownership = sub_account.account.ownership()?; - assert_eq!( - ownership.owner, - GovernanceDetails::Monarchy { - monarch: chain.sender_addr().to_string() - } - ); - Ok(()) -} diff --git a/framework/contracts/account/manager/tests/upgrades.rs b/framework/contracts/account/manager/tests/upgrades.rs deleted file mode 100644 index f7990cf933..0000000000 --- a/framework/contracts/account/manager/tests/upgrades.rs +++ /dev/null @@ -1,942 +0,0 @@ -use abstract_app::mock::{MockInitMsg, MockMigrateMsg}; -use abstract_integration_tests::{create_default_account, mock_modules::*, AResult, *}; -use abstract_interface::{ - Abstract, AbstractAccount, AbstractInterfaceError, AccountDetails, MFactoryQueryFns, - ManagerExecFns, ManagerQueryFns, VCExecFns, -}; -use abstract_manager::error::ManagerError; -use abstract_std::{ - app, ibc_client, - manager::{ModuleInstallConfig, ModuleVersionsResponse}, - module_factory::SimulateInstallModulesResponse, - objects::{ - fee::FixedFee, - gov_type::GovernanceDetails, - module::{ModuleInfo, ModuleVersion, Monetization}, - module_reference::ModuleReference, - namespace::Namespace, - AccountId, - }, - version_control::UpdateModule, - AbstractError, IBC_CLIENT, -}; -use abstract_testing::prelude::*; -use cosmwasm_std::coin; -use cw2::ContractVersion; -use cw_orch::prelude::*; -use speculoos::prelude::*; - -#[test] -fn install_app_successful() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - abstr - .version_control - .claim_namespace(TEST_ACCOUNT_ID, TEST_NAMESPACE.to_string())?; - deploy_modules(&chain); - - // dependency for mock_adapter1 not met - let res = install_module_version(manager, app_1::MOCK_APP_ID, V1); - assert_that!(&res).is_err(); - assert_that!(res.unwrap_err().root_cause().to_string()).contains( - // Error from macro - "no address", - ); - - // install adapter 1 - let adapter1 = install_module_version(manager, adapter_1::MOCK_ADAPTER_ID, V1)?; - - // second dependency still not met - let res = install_module_version(manager, app_1::MOCK_APP_ID, V1); - assert_that!(&res).is_err(); - assert_that!(res.unwrap_err().root_cause().to_string()).contains( - "module tester:mock-adapter2 is a dependency of tester:mock-app1 and is not installed.", - ); - - // install adapter 2 - let adapter2 = install_module_version(manager, adapter_2::MOCK_ADAPTER_ID, V1)?; - - // successfully install app 1 - let app1 = install_module_version(manager, app_1::MOCK_APP_ID, V1)?; - - account.expect_modules(vec![adapter1, adapter2, app1])?; - Ok(()) -} - -#[test] -fn install_app_versions_not_met() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - abstr - .version_control - .claim_namespace(TEST_ACCOUNT_ID, TEST_NAMESPACE.to_string())?; - deploy_modules(&chain); - - // install adapter 2 - let _adapter2 = install_module_version(manager, adapter_1::MOCK_ADAPTER_ID, V1)?; - - // successfully install app 1 - let _app1 = install_module_version(manager, adapter_2::MOCK_ADAPTER_ID, V1)?; - - // attempt to install app with version 2 - - let res = install_module_version(manager, app_1::MOCK_APP_ID, V2); - assert_that!(&res).is_err(); - assert_that!(res.unwrap_err().root_cause().to_string()) - .contains("Module tester:mock-adapter1 with version 1.0.0 does not fit requirement ^2.0.0"); - Ok(()) -} - -#[test] -fn upgrade_app() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - abstr - .version_control - .claim_namespace(TEST_ACCOUNT_ID, TEST_NAMESPACE.to_string())?; - deploy_modules(&chain); - - // install adapter 1 - let adapter1 = install_module_version(manager, adapter_1::MOCK_ADAPTER_ID, V1)?; - - // install adapter 2 - let adapter2 = install_module_version(manager, adapter_2::MOCK_ADAPTER_ID, V1)?; - - // successfully install app 1 - let app1 = install_module_version(manager, app_1::MOCK_APP_ID, V1)?; - account.expect_modules(vec![adapter1, adapter2, app1])?; - - // attempt upgrade app 1 to version 2 - let res = manager.upgrade_module( - app_1::MOCK_APP_ID, - &app::MigrateMsg { - base: app::BaseMigrateMsg {}, - module: MockMigrateMsg, - }, - ); - // fails because adapter 1 is not version 2 - assert_that!(res.unwrap_err().root().to_string()).contains( - ManagerError::VersionRequirementNotMet { - module_id: adapter_1::MOCK_ADAPTER_ID.into(), - version: V1.into(), - comp: "^2.0.0".into(), - post_migration: true, - } - .to_string(), - ); - - // upgrade adapter 1 to version 2 - let res = manager.upgrade_module( - adapter_1::MOCK_ADAPTER_ID, - &app::MigrateMsg { - base: app::BaseMigrateMsg {}, - module: Empty {}, - }, - ); - // fails because app v1 is not version 2 and depends on adapter 1 being version 1. - assert_that!(res.unwrap_err().root().to_string()).contains( - ManagerError::VersionRequirementNotMet { - module_id: adapter_1::MOCK_ADAPTER_ID.into(), - version: V2.into(), - comp: "^1.0.0".into(), - post_migration: false, - } - .to_string(), - ); - - // solution: upgrade multiple modules in the same tx - // Important: the order of the modules is important. The hightest-level dependents must be migrated first. - - // attempt to upgrade app 1 to identical version while updating other modules - let res = manager.upgrade(vec![ - ( - ModuleInfo::from_id(app_1::MOCK_APP_ID, ModuleVersion::Version(V1.to_string()))?, - Some(to_json_binary(&app::MigrateMsg { - base: app::BaseMigrateMsg {}, - module: MockMigrateMsg, - })?), - ), - ( - ModuleInfo::from_id_latest(adapter_1::MOCK_ADAPTER_ID)?, - None, - ), - ( - ModuleInfo::from_id_latest(adapter_2::MOCK_ADAPTER_ID)?, - None, - ), - ]); - - // fails because app v1 is depends on adapter 1 being version 1. - assert_that!(res.unwrap_err().root().to_string()).contains( - ManagerError::Abstract(AbstractError::CannotDowngradeContract { - contract: app_1::MOCK_APP_ID.into(), - from: V1.parse().unwrap(), - to: V1.parse().unwrap(), - }) - .to_string(), - ); - - // attempt to upgrade app 1 to version 2 while not updating other modules - let res = manager.upgrade(vec![( - ModuleInfo::from_id(app_1::MOCK_APP_ID, ModuleVersion::Version(V2.to_string()))?, - Some(to_json_binary(&app::MigrateMsg { - base: app::BaseMigrateMsg {}, - module: MockMigrateMsg, - })?), - )]); - - // fails because app v1 is depends on adapter 1 being version 2. - assert_that!(res.unwrap_err().root().to_string()).contains( - ManagerError::VersionRequirementNotMet { - module_id: adapter_1::MOCK_ADAPTER_ID.into(), - version: V1.into(), - comp: "^2.0.0".into(), - post_migration: true, - } - .to_string(), - ); - - // attempt to upgrade app 1 to identical version while updating other modules - let res = manager.upgrade(vec![ - ( - ModuleInfo::from_id(app_1::MOCK_APP_ID, ModuleVersion::Version(V2.to_string()))?, - Some(to_json_binary(&app::MigrateMsg { - base: app::BaseMigrateMsg {}, - module: MockMigrateMsg, - })?), - ), - ( - ModuleInfo::from_id( - adapter_1::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_string()), - )?, - None, - ), - ( - ModuleInfo::from_id( - adapter_2::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_string()), - )?, - None, - ), - ]); - - // fails because app v1 is depends on adapter 1 being version 2. - assert_that!(res.unwrap_err().root().to_string()).contains( - ManagerError::VersionRequirementNotMet { - module_id: adapter_1::MOCK_ADAPTER_ID.into(), - version: V1.into(), - comp: "^2.0.0".into(), - post_migration: true, - } - .to_string(), - ); - - // successfully upgrade all the modules - manager.upgrade(vec![ - ( - ModuleInfo::from_id_latest(app_1::MOCK_APP_ID)?, - Some(to_json_binary(&app::MigrateMsg { - base: app::BaseMigrateMsg {}, - module: MockMigrateMsg, - })?), - ), - ( - ModuleInfo::from_id_latest(adapter_1::MOCK_ADAPTER_ID)?, - None, - ), - ( - ModuleInfo::from_id_latest(adapter_2::MOCK_ADAPTER_ID)?, - None, - ), - ])?; - - Ok(()) -} - -#[test] -fn uninstall_modules() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::uninstall_modules(chain) -} - -#[test] -fn update_adapter_with_authorized_addrs() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::update_adapter_with_authorized_addrs( - chain.clone(), - chain.addr_make("authorizee"), - ) -} - -/*#[test] -fn upgrade_manager_last() -> AResult { - let sender = Addr::unchecked(OWNER); - let chain = Mock::new(&sender); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let account = create_default_account(&abstr.account_factory)?; - let AbstractAccount { manager, proxy: _ } = &account; - - abstr - .version_control - .claim_namespace(TEST_ACCOUNT_ID, vec![TEST_NAMESPACE.to_string()])?; - deploy_modules(&chain); - - // install adapter 1 - let adapter1 = install_module_version(manager, &abstr, adapter_1::MOCK_ADAPTER_ID, V1)?; - - // install adapter 2 - let adapter2 = install_module_version(manager, &abstr, adapter_2::MOCK_ADAPTER_ID, V1)?; - - // successfully install app 1 - let app1 = install_module_version(manager, &abstr, app_1::MOCK_APP_ID, V1)?; - account.expect_modules(vec![adapter1, adapter2, app1])?; - - // Upgrade all modules, including the manager module, but ensure the manager is upgraded last - let res = manager.upgrade(vec![ - ( - ModuleInfo::from_id_latest(app_1::MOCK_APP_ID)?, - Some(to_json_binary(&app::MigrateMsg { - base: app::BaseMigrateMsg {}, - module: MockMigrateMsg, - })?), - ), - ( - ModuleInfo::from_id_latest("abstract:manager")?, - Some(to_json_binary(&manager::MigrateMsg {})?), - ), - (ModuleInfo::from_id_latest(adapter_1::MOCK_ADAPTER_ID)?, None), - (ModuleInfo::from_id_latest(adapter_2::MOCK_ADAPTER_ID)?, None), - ])?; - - // get the events - let mut events: Vec = res.events; - events.pop(); - let migrate_event = events.pop().unwrap(); - - // the 2nd last event will be the manager execution - assert_that!(migrate_event.attributes).has_length(3); - let mut attributes = migrate_event.attributes; - // check that the action was migrate - assert_that!(attributes.pop()) - .is_some() - .is_equal_to(Attribute::from(("action", "migrate"))); - - // and that it was the manager - assert_that!(attributes.pop()) - .is_some() - .is_equal_to(Attribute::from(("contract", "abstract:manager"))); - - Ok(()) -}*/ - -#[test] -fn no_duplicate_migrations() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let account = create_default_account(&abstr.account_factory)?; - let AbstractAccount { - account: manager, - proxy: _, - } = &account; - - abstr - .version_control - .claim_namespace(TEST_ACCOUNT_ID, TEST_NAMESPACE.to_string())?; - deploy_modules(&chain); - - // Install adapter 1 - let adapter1 = install_module_version(manager, adapter_1::MOCK_ADAPTER_ID, V1)?; - - account.expect_modules(vec![adapter1])?; - - // Upgrade all modules, including the manager module - let res = manager.upgrade(vec![ - ( - ModuleInfo::from_id_latest(adapter_1::MOCK_ADAPTER_ID)?, - None, - ), - ( - ModuleInfo::from_id_latest(adapter_1::MOCK_ADAPTER_ID)?, - None, - ), - ]); - - assert_that!(res).is_err(); - - assert_that!(res.unwrap_err().root().to_string()).is_equal_to( - ManagerError::DuplicateModuleMigration { - module_id: adapter_1::MOCK_ADAPTER_ID.to_string(), - } - .to_string(), - ); - - Ok(()) -} - -#[test] -fn create_account_with_installed_module() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let factory = &deployment.account_factory; - - let _deployer_acc = factory.create_new_account( - AccountDetails { - name: String::from("first_account"), - description: Some(String::from("account_description")), - link: Some(String::from("https://account_link_of_at_least_11_char")), - namespace: Some(String::from(TEST_NAMESPACE)), - install_modules: vec![], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - )?; - deploy_modules(&chain); - - let account = factory - .create_new_account( - AccountDetails { - name: String::from("second_account"), - description: Some(String::from("account_description")), - link: Some(String::from("https://account_link_of_at_least_11_char")), - namespace: None, - install_modules: vec![ - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_1::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_2::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id( - app_1::MOCK_APP_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - Some(to_json_binary(&MockInitMsg {})?), - ), - ], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - ) - .unwrap(); - - // Make sure all installed - let account_module_versions = account.account.module_versions(vec![ - String::from(adapter_1::MOCK_ADAPTER_ID), - String::from(adapter_2::MOCK_ADAPTER_ID), - String::from(app_1::MOCK_APP_ID), - ])?; - assert_eq!( - account_module_versions, - ModuleVersionsResponse { - versions: vec![ - ContractVersion { - contract: String::from(adapter_1::MOCK_ADAPTER_ID), - version: String::from(V1) - }, - ContractVersion { - contract: String::from(adapter_2::MOCK_ADAPTER_ID), - version: String::from(V1) - }, - ContractVersion { - contract: String::from(app_1::MOCK_APP_ID), - version: String::from(V1) - } - ] - } - ); - Ok(()) -} - -#[test] -fn create_sub_account_with_installed_module() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::create_sub_account_with_modules_installed(chain) -} - -#[test] -fn create_account_with_installed_module_and_monetization() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - // Adding coins to fill monetization - chain.add_balance(&sender, vec![coin(10, "coin1"), coin(10, "coin2")])?; - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let factory = &deployment.account_factory; - - let _deployer_acc = factory.create_new_account( - AccountDetails { - name: String::from("first_account"), - description: Some(String::from("account_description")), - link: Some(String::from("https://account_link_of_at_least_11_char")), - namespace: Some(String::from(TEST_NAMESPACE)), - install_modules: vec![], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - )?; - deploy_modules(&chain); - // Add monetization - deployment.version_control.update_module_configuration( - "mock-adapter1".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: Some(Monetization::InstallFee(FixedFee::new(&coin(5, "coin1")))), - instantiation_funds: None, - }, - )?; - deployment.version_control.update_module_configuration( - "mock-adapter2".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: Some(Monetization::InstallFee(FixedFee::new(&coin(5, "coin1")))), - instantiation_funds: None, - }, - )?; - deployment.version_control.update_module_configuration( - "mock-app1".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: Some(Monetization::InstallFee(FixedFee::new(&coin(5, "coin2")))), - instantiation_funds: None, - }, - )?; - // Check how much we need - let simulate_response = deployment.module_factory.simulate_install_modules(vec![ - ModuleInfo::from_id(adapter_1::MOCK_ADAPTER_ID, V1.into()).unwrap(), - ModuleInfo::from_id(adapter_2::MOCK_ADAPTER_ID, V1.into()).unwrap(), - ModuleInfo::from_id(app_1::MOCK_APP_ID, V1.into()).unwrap(), - ])?; - assert_eq!( - simulate_response, - SimulateInstallModulesResponse { - total_required_funds: vec![coin(10, "coin1"), coin(5, "coin2")], - monetization_funds: vec![ - (adapter_1::MOCK_ADAPTER_ID.to_string(), coin(5, "coin1")), - (adapter_2::MOCK_ADAPTER_ID.to_string(), coin(5, "coin1")), - (app_1::MOCK_APP_ID.to_string(), coin(5, "coin2")) - ], - initialization_funds: vec![], - } - ); - - let account = factory - .create_new_account( - AccountDetails { - name: String::from("second_account"), - description: None, - link: None, - namespace: None, - install_modules: vec![ - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_1::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_2::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id( - app_1::MOCK_APP_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - Some(to_json_binary(&MockInitMsg {})?), - ), - ], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - // we attach 5 extra coin2, rest should go to proxy - &[coin(10, "coin1"), coin(10, "coin2")], - ) - .unwrap(); - let balances = chain.query_all_balances(&account.proxy.address()?)?; - assert_eq!(balances, vec![coin(5, "coin2")]); - // Make sure all installed - let account_module_versions = account.account.module_versions(vec![ - String::from(adapter_1::MOCK_ADAPTER_ID), - String::from(adapter_2::MOCK_ADAPTER_ID), - String::from(app_1::MOCK_APP_ID), - ])?; - assert_eq!( - account_module_versions, - ModuleVersionsResponse { - versions: vec![ - ContractVersion { - contract: String::from(adapter_1::MOCK_ADAPTER_ID), - version: String::from(V1) - }, - ContractVersion { - contract: String::from(adapter_2::MOCK_ADAPTER_ID), - version: String::from(V1) - }, - ContractVersion { - contract: String::from(app_1::MOCK_APP_ID), - version: String::from(V1) - } - ] - } - ); - Ok(()) -} - -#[test] -fn create_account_with_installed_module_and_monetization_should_fail() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - // Adding coins to fill monetization - chain.add_balance(&sender, vec![coin(10, "coin1"), coin(10, "coin2")])?; - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let factory = &deployment.account_factory; - - let _deployer_acc = factory.create_new_account( - AccountDetails { - name: String::from("first_account"), - description: Some(String::from("account_description")), - link: Some(String::from("https://account_link_of_at_least_11_char")), - namespace: Some(String::from(TEST_NAMESPACE)), - install_modules: vec![], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - )?; - deploy_modules(&chain); - // Add monetization - deployment.version_control.update_module_configuration( - "mock-adapter1".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: Some(Monetization::InstallFee(FixedFee::new(&coin(5, "coin1")))), - instantiation_funds: None, - }, - )?; - deployment.version_control.update_module_configuration( - "mock-adapter2".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: Some(Monetization::InstallFee(FixedFee::new(&coin(5, "coin1")))), - instantiation_funds: None, - }, - )?; - deployment.version_control.update_module_configuration( - "mock-app1".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: Some(Monetization::InstallFee(FixedFee::new(&coin(5, "coin2")))), - instantiation_funds: None, - }, - )?; - - // Check how much we need - let simulate_response = deployment.module_factory.simulate_install_modules(vec![ - ModuleInfo::from_id(adapter_1::MOCK_ADAPTER_ID, V1.into()).unwrap(), - ModuleInfo::from_id(adapter_2::MOCK_ADAPTER_ID, V1.into()).unwrap(), - ModuleInfo::from_id(app_1::MOCK_APP_ID, V1.into()).unwrap(), - ])?; - assert_eq!( - simulate_response.total_required_funds, - vec![coin(10, "coin1"), coin(5, "coin2")] - ); - - let result = factory.create_new_account( - AccountDetails { - name: String::from("second_account"), - description: None, - link: None, - namespace: None, - install_modules: vec![ - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_1::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_2::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id(app_1::MOCK_APP_ID, ModuleVersion::Version(V1.to_owned()))?, - Some(to_json_binary(&MockInitMsg {})?), - ), - ], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - // we attach 1 less coin1 - &[coin(9, "coin1"), coin(10, "coin2")], - ); - // Mock doesn't implement debug so we can't .unwrap_err, LOL - let Err(AbstractInterfaceError::Orch(e)) = result else { - panic!() - }; - assert!(e.root().to_string().contains(&format!( - "Expected {:?}, sent {:?}", - simulate_response.total_required_funds, - vec![coin(9, "coin1"), coin(10, "coin2")] - ))); - - Ok(()) -} - -#[test] -fn create_account_with_installed_module_and_init_funds() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - // Adding coins to fill monetization - chain.add_balance(&sender, vec![coin(15, "coin1"), coin(10, "coin2")])?; - let deployment = Abstract::deploy_on(chain.clone(), sender.to_string())?; - - let factory = &deployment.account_factory; - - let _deployer_acc = factory.create_new_account( - AccountDetails { - name: String::from("first_account"), - description: Some(String::from("account_description")), - link: Some(String::from("https://account_link_of_at_least_11_char")), - namespace: Some(String::from(TEST_NAMESPACE)), - install_modules: vec![], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - &[], - )?; - deploy_modules(&chain); - - let standalone_contract = Box::new(ContractWrapper::new( - standalone_no_cw2::mock_execute, - standalone_no_cw2::mock_instantiate, - standalone_no_cw2::mock_query, - )); - let standalone_id = chain.app.borrow_mut().store_code(standalone_contract); - - deployment.version_control.propose_modules(vec![( - ModuleInfo { - namespace: Namespace::new("tester")?, - name: "standalone".to_owned(), - version: ModuleVersion::Version(V1.to_owned()), - }, - ModuleReference::Standalone(standalone_id), - )])?; - - // Add init_funds - deployment.version_control.update_module_configuration( - "mock-app1".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: None, - instantiation_funds: Some(vec![coin(3, "coin1"), coin(5, "coin2")]), - }, - )?; - deployment.version_control.update_module_configuration( - "standalone".to_owned(), - Namespace::new("tester").unwrap(), - UpdateModule::Versioned { - version: V1.to_owned(), - metadata: None, - monetization: None, - instantiation_funds: Some(vec![coin(6, "coin1")]), - }, - )?; - - // Check how much we need - let simulate_response = deployment.module_factory.simulate_install_modules(vec![ - ModuleInfo::from_id(adapter_1::MOCK_ADAPTER_ID, V1.into()).unwrap(), - ModuleInfo::from_id(adapter_2::MOCK_ADAPTER_ID, V1.into()).unwrap(), - ModuleInfo::from_id(app_1::MOCK_APP_ID, V1.into()).unwrap(), - ModuleInfo { - namespace: Namespace::new("tester")?, - name: "standalone".to_owned(), - version: V1.into(), - }, - ])?; - assert_eq!( - simulate_response, - SimulateInstallModulesResponse { - total_required_funds: vec![coin(9, "coin1"), coin(5, "coin2")], - monetization_funds: vec![], - initialization_funds: vec![ - ( - app_1::MOCK_APP_ID.to_string(), - vec![coin(3, "coin1"), coin(5, "coin2")] - ), - ("tester:standalone".to_string(), vec![coin(6, "coin1")]) - ], - } - ); - - let account = factory - .create_new_account( - AccountDetails { - name: String::from("second_account"), - description: None, - link: None, - namespace: None, - install_modules: vec![ - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_1::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id( - adapter_2::MOCK_ADAPTER_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - None, - ), - ModuleInstallConfig::new( - ModuleInfo::from_id( - app_1::MOCK_APP_ID, - ModuleVersion::Version(V1.to_owned()), - )?, - Some(to_json_binary(&MockInitMsg {})?), - ), - ModuleInstallConfig::new( - ModuleInfo { - namespace: Namespace::new("tester")?, - name: "standalone".to_owned(), - version: V1.into(), - }, - Some(to_json_binary(&MockInitMsg {})?), - ), - ], - account_id: None, - }, - GovernanceDetails::Monarchy { - monarch: sender.to_string(), - }, - // we attach 1 extra coin1 and 5 extra coin2, rest should go to proxy - &[coin(10, "coin1"), coin(10, "coin2")], - ) - .unwrap(); - let balances = chain.query_all_balances(&account.proxy.address()?)?; - assert_eq!(balances, vec![coin(1, "coin1"), coin(5, "coin2")]); - // Make sure all installed - Ok(()) -} - -#[test] -fn create_account_with_installed_module_monetization_and_init_funds() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::create_account_with_installed_module_monetization_and_init_funds(chain, ("coin1", "coin2")) -} - -// See gen_app_mock for more details -#[test] -fn install_app_with_proxy_action() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - Abstract::deploy_on(chain.clone(), sender.to_string())?; - abstract_integration_tests::manager::install_app_with_proxy_action(chain) -} - -#[test] -fn native_not_migratable() -> AResult { - let chain = MockBech32::new("mock"); - let sender = chain.sender_addr(); - let abstr = Abstract::deploy_on(chain.clone(), sender.to_string())?; - let abstr_account = AbstractAccount::new(&abstr, AccountId::local(0)); - abstr_account.install_module::(IBC_CLIENT, None, &[])?; - - let latest_ibc_client = ModuleInfo::from_id_latest(IBC_CLIENT).unwrap(); - - let err: ManagerError = abstr_account - .account - .upgrade(vec![(latest_ibc_client.clone(), None)]) - .unwrap_err() - .downcast() - .unwrap(); - assert_eq!(err, ManagerError::NotUpgradeable(latest_ibc_client)); - Ok(()) -} - -// TODO: -// - adapter-adapter dependencies -// - app-adapter dependencies -// - app-app dependencies diff --git a/framework/contracts/account/proxy/Cargo.toml b/framework/contracts/account/proxy/Cargo.toml deleted file mode 100644 index fd3e892ad5..0000000000 --- a/framework/contracts/account/proxy/Cargo.toml +++ /dev/null @@ -1,58 +0,0 @@ -[package] -name = "abstract-proxy" -version = { workspace = true } -authors = { workspace = true } -edition = { workspace = true } -description = "Abstract Proxy Contract" -license = { workspace = true } -readme = "README.md" -repository = "https://github.com/AbstractSDK/abstract" - - -exclude = ["contract.wasm", "hash.txt"] - - -[lib] -crate-type = ["cdylib", "rlib"] - -[features] -default = ["export"] -export = [] - -[dependencies] -abstract-std = { workspace = true } -abstract-sdk = { workspace = true } -cosmwasm-schema = { workspace = true } -cosmwasm-std = { workspace = true, features = ["stargate"] } -cw-asset = { workspace = true } -cw-utils = { workspace = true } -cw-controllers = { workspace = true } -cw-storage-plus = { workspace = true } -cw2 = { workspace = true } -cw20 = { workspace = true } -schemars = { workspace = true } -semver = { workspace = true } -serde = { workspace = true } -thiserror = { workspace = true } -abstract-macros = { workspace = true } -abstract-ica = { workspace = true } - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -workspace-hack = { version = "0.1", path = "../../../workspace-hack" } - -[dev-dependencies] -cw20 = { workspace = true } -rstest = { workspace = true } -speculoos = { workspace = true } -abstract-testing = { workspace = true } - -[profile.release] -rpath = false -lto = true -overflow-checks = true -opt-level = 3 -debug = false -debug-assertions = false -codegen-units = 1 -panic = 'abort' -incremental = false diff --git a/framework/contracts/account/proxy/README.md b/framework/contracts/account/proxy/README.md deleted file mode 100644 index 8290289bf8..0000000000 --- a/framework/contracts/account/proxy/README.md +++ /dev/null @@ -1 +0,0 @@ -# Abstract Proxy diff --git a/framework/contracts/account/proxy/examples/schema.rs b/framework/contracts/account/proxy/examples/schema.rs deleted file mode 100644 index a2eabb777d..0000000000 --- a/framework/contracts/account/proxy/examples/schema.rs +++ /dev/null @@ -1,11 +0,0 @@ -use abstract_sdk::std::proxy::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; -use cosmwasm_schema::write_api; - -fn main() { - write_api! { - instantiate: InstantiateMsg, - query: QueryMsg, - execute: ExecuteMsg, - migrate: MigrateMsg, - }; -} diff --git a/framework/contracts/account/proxy/src/contract.rs b/framework/contracts/account/proxy/src/contract.rs deleted file mode 100644 index 3ad6098ece..0000000000 --- a/framework/contracts/account/proxy/src/contract.rs +++ /dev/null @@ -1,200 +0,0 @@ -use abstract_macros::abstract_response; -use abstract_sdk::std::{ - objects::account::ACCOUNT_ID, - proxy::{ - state::{State, ADMIN, STATE}, - ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg, - }, - ACCOUNT, -}; -use abstract_std::objects::module_version::assert_contract_upgrade; -use cosmwasm_std::{ - to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, SubMsgResult, -}; -use semver::Version; - -use crate::{commands::*, error::ProxyError, queries::*, reply}; - -pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); -pub(crate) const RESPONSE_REPLY_ID: u64 = 1; - -#[abstract_response(ACCOUNT)] -pub struct ProxyResponse; - -/// The result type for the proxy contract. -pub type ProxyResult = Result; - -/* - The proxy is the bank account of the account. It owns the liquidity and acts as a proxy contract. - Whitelisted dApps construct messages for this contract. The dApps are controlled by the Manager. -*/ - -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn instantiate( - mut deps: DepsMut, - _env: Env, - _info: MessageInfo, - msg: InstantiateMsg, -) -> ProxyResult { - // Use CW2 to set the contract version, this is needed for migrations - cw2::set_contract_version(deps.storage, ACCOUNT, CONTRACT_VERSION)?; - - let manager_addr = deps.api.addr_validate(&msg.manager_addr)?; - ACCOUNT_ID.save(deps.storage, &msg.account_id)?; - STATE.save( - deps.storage, - &State { - modules: vec![manager_addr.clone()], - }, - )?; - let admin_addr = Some(manager_addr); - ADMIN.set(deps.branch(), admin_addr)?; - - Ok(Response::default()) -} - -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn execute(deps: DepsMut, _env: Env, info: MessageInfo, msg: ExecuteMsg) -> ProxyResult { - match msg { - ExecuteMsg::ModuleAction { msgs } => execute_module_action(deps, info, msgs), - ExecuteMsg::ModuleActionWithData { msg } => execute_module_action_response(deps, info, msg), - ExecuteMsg::IbcAction { msg } => execute_ibc_action(deps, info, msg), - ExecuteMsg::SetAdmin { admin } => set_admin(deps, info, &admin), - ExecuteMsg::AddModules { modules } => add_modules(deps, info, modules), - ExecuteMsg::RemoveModule { module } => remove_module(deps, info, module), - ExecuteMsg::IcaAction { action_query_msg } => ica_action(deps, info, action_query_msg), - } -} - -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ProxyResult { - let version: Version = CONTRACT_VERSION.parse().unwrap(); - - deps.storage.remove("\u{0}{6}ans_host".as_bytes()); - assert_contract_upgrade(deps.storage, ACCOUNT, version)?; - cw2::set_contract_version(deps.storage, ACCOUNT, CONTRACT_VERSION)?; - Ok(Response::default()) -} - -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> ProxyResult { - match msg { - QueryMsg::Config {} => to_json_binary(&query_config(deps)?), - } - .map_err(Into::into) -} - -/// This just stores the result for future query -#[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> ProxyResult { - match &msg { - Reply { - id: RESPONSE_REPLY_ID, - result: SubMsgResult::Ok(_), - payload: _, - gas_used: _, - } => reply::forward_response_data(msg), - _ => Err(ProxyError::UnexpectedReply {}), - } -} - -#[cfg(test)] -mod tests { - use cosmwasm_std::testing::*; - use speculoos::prelude::*; - - use super::*; - use crate::{contract, test_common::*}; - - mod migrate { - use abstract_std::AbstractError; - - use super::*; - - #[test] - fn disallow_same_version() -> ProxyResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let version: Version = CONTRACT_VERSION.parse().unwrap(); - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); - - assert_that!(res).is_err().is_equal_to(ProxyError::Abstract( - AbstractError::CannotDowngradeContract { - contract: ACCOUNT.to_string(), - from: version.clone(), - to: version, - }, - )); - - Ok(()) - } - - #[test] - fn disallow_downgrade() -> ProxyResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let big_version = "999.999.999"; - cw2::set_contract_version(deps.as_mut().storage, ACCOUNT, big_version)?; - - let version: Version = CONTRACT_VERSION.parse().unwrap(); - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); - - assert_that!(res).is_err().is_equal_to(ProxyError::Abstract( - AbstractError::CannotDowngradeContract { - contract: ACCOUNT.to_string(), - from: big_version.parse().unwrap(), - to: version, - }, - )); - - Ok(()) - } - - #[test] - fn disallow_name_change() -> ProxyResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let old_version = "0.0.0"; - let old_name = "old:contract"; - cw2::set_contract_version(deps.as_mut().storage, old_name, old_version)?; - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); - - assert_that!(res).is_err().is_equal_to(ProxyError::Abstract( - AbstractError::ContractNameMismatch { - from: old_name.parse().unwrap(), - to: ACCOUNT.parse().unwrap(), - }, - )); - - Ok(()) - } - - #[test] - fn works() -> ProxyResult<()> { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let version: Version = CONTRACT_VERSION.parse().unwrap(); - - let small_version = Version { - minor: version.minor - 1, - ..version.clone() - } - .to_string(); - cw2::set_contract_version(deps.as_mut().storage, ACCOUNT, small_version)?; - - let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {})?; - assert_that!(res.messages).has_length(0); - - assert_that!(cw2::get_contract_version(&deps.storage)?.version) - .is_equal_to(version.to_string()); - Ok(()) - } - } -} diff --git a/framework/contracts/account/proxy/src/error.rs b/framework/contracts/account/proxy/src/error.rs deleted file mode 100644 index f18ae09ced..0000000000 --- a/framework/contracts/account/proxy/src/error.rs +++ /dev/null @@ -1,64 +0,0 @@ -use abstract_sdk::AbstractSdkError; -use abstract_std::{objects::ans_host::AnsHostError, AbstractError}; -use cosmwasm_std::{StdError, Uint128}; -use cw_asset::AssetError; -use cw_utils::ParseReplyError; -use thiserror::Error; - -#[derive(Error, Debug, PartialEq)] -pub enum ProxyError { - #[error("{0}")] - Std(#[from] StdError), - - #[error("{0}")] - Abstract(#[from] AbstractError), - - #[error("{0}")] - AbstractSdk(#[from] AbstractSdkError), - - #[error("{0}")] - Asset(#[from] AssetError), - - #[error(transparent)] - Admin(#[from] ::cw_controllers::AdminError), - - #[error("{0}")] - Parse(#[from] ParseReplyError), - - #[error("{0}")] - AnsHostError(#[from] AnsHostError), - - #[error("Module with address {0} is already whitelisted")] - AlreadyWhitelisted(String), - - #[error("Module with address {0} not found in whitelist")] - NotWhitelisted(String), - - #[error("Sender is not whitelisted")] - SenderNotWhitelisted {}, - - #[error("Max amount of assets registered")] - AssetsLimitReached, - - #[error("Max amount of modules registered")] - ModuleLimitReached, - - #[error("no base asset registered on proxy")] - MissingBaseAsset, - - #[error("The proposed update resulted in a bad configuration: {0}")] - BadUpdate(String), - - #[error( - "Account balance too low, {} requested but it only has {}", - requested, - balance - )] - Broke { - balance: Uint128, - requested: Uint128, - }, - - #[error("Contract got an unexpected Reply")] - UnexpectedReply(), -} diff --git a/framework/contracts/account/proxy/src/lib.rs b/framework/contracts/account/proxy/src/lib.rs deleted file mode 100644 index 7c5b5ec810..0000000000 --- a/framework/contracts/account/proxy/src/lib.rs +++ /dev/null @@ -1,28 +0,0 @@ -pub mod commands; -pub mod contract; -pub mod error; -mod queries; -pub mod reply; - -#[cfg(test)] -mod test_common { - use abstract_std::proxy::InstantiateMsg; - use abstract_testing::prelude::*; - use cosmwasm_std::{ - testing::{message_info, mock_env, MockApi, MOCK_CONTRACT_ADDR}, - OwnedDeps, - }; - - use crate::contract; - - pub fn mock_init(deps: &mut OwnedDeps) { - let base = test_account_base(deps.api); - let info = message_info(&base.manager, &[]); - let msg = InstantiateMsg { - account_id: TEST_ACCOUNT_ID, - ans_host_address: MOCK_CONTRACT_ADDR.to_string(), - manager_addr: base.manager.to_string(), - }; - let _res = contract::instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); - } -} diff --git a/framework/contracts/account/proxy/src/queries.rs b/framework/contracts/account/proxy/src/queries.rs deleted file mode 100644 index 54d427af83..0000000000 --- a/framework/contracts/account/proxy/src/queries.rs +++ /dev/null @@ -1,83 +0,0 @@ -use abstract_sdk::std::proxy::{state::STATE, ConfigResponse}; -use cosmwasm_std::{Addr, Deps, StdResult}; - -/// Returns the whitelisted modules -pub fn query_config(deps: Deps) -> StdResult { - let state = STATE.load(deps.storage)?; - let modules: Vec = state.modules; - let resp = ConfigResponse { - modules: modules - .iter() - .map(|module| -> String { module.to_string() }) - .collect(), - }; - Ok(resp) -} - -#[cfg(test)] -mod test { - #![allow(clippy::needless_borrows_for_generic_args)] - use super::*; - - use crate::contract::{execute, instantiate, query, ProxyResult}; - use abstract_std::proxy::{ExecuteMsg, InstantiateMsg}; - use abstract_testing::prelude::*; - use cosmwasm_std::{ - testing::{message_info, mock_dependencies, mock_env, MockApi}, - OwnedDeps, - }; - - type MockDeps = OwnedDeps; - - fn mock_init(deps: &mut MockDeps) { - let abstr = AbstractMockAddrs::new(deps.api); - let info = message_info(&abstr.owner, &[]); - let msg = InstantiateMsg { - account_id: TEST_ACCOUNT_ID, - ans_host_address: abstr.ans_host.to_string(), - manager_addr: abstr.account.manager.to_string(), - }; - let _res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); - } - - pub fn execute_as_admin(deps: &mut MockDeps, msg: ExecuteMsg) -> ProxyResult { - let abstr = AbstractMockAddrs::new(deps.api); - let info = message_info(&abstr.account.manager, &[]); - execute(deps.as_mut(), mock_env(), info, msg) - } - - #[test] - fn query_config() { - let mut deps = mock_dependencies(); - deps.querier = MockAnsHost::new(deps.api).with_defaults().to_querier(); - mock_init(&mut deps); - let abstr = AbstractMockAddrs::new(deps.api); - - execute_as_admin( - &mut deps, - ExecuteMsg::AddModules { - modules: vec![abstr.module_address.to_string()], - }, - ) - .unwrap(); - - let config: ConfigResponse = from_json( - query( - deps.as_ref(), - mock_env(), - abstract_std::proxy::QueryMsg::Config {}, - ) - .unwrap(), - ) - .unwrap(); - assert_eq!( - config, - ConfigResponse { - modules: vec![ - abstr.account.manager.to_string(), - abstr.module_address.to_string() - ], - } - ); - } -} diff --git a/framework/contracts/account/proxy/src/reply.rs b/framework/contracts/account/proxy/src/reply.rs deleted file mode 100644 index c5d1cc9163..0000000000 --- a/framework/contracts/account/proxy/src/reply.rs +++ /dev/null @@ -1,26 +0,0 @@ -use cosmwasm_std::{Reply, StdError}; - -use crate::contract::{ProxyResponse, ProxyResult}; - -/// Add the message's data to the response -pub fn forward_response_data(result: Reply) -> ProxyResult { - // get the result from the reply - let res = result.result.into_result().map_err(StdError::generic_err)?; - - // log and add data if needed - #[allow(deprecated)] - let resp = if let Some(data) = res.data { - ProxyResponse::new( - "forward_response_data_reply", - vec![("response_data", "true")], - ) - .set_data(data) - } else { - ProxyResponse::new( - "forward_response_data_reply", - vec![("response_data", "false")], - ) - }; - - Ok(resp) -} diff --git a/framework/contracts/account/proxy/src/commands.rs b/framework/contracts/account/src/actions.rs similarity index 54% rename from framework/contracts/account/proxy/src/commands.rs rename to framework/contracts/account/src/actions.rs index c37ff72bac..d0ac48c341 100644 --- a/framework/contracts/account/proxy/src/commands.rs +++ b/framework/contracts/account/src/actions.rs @@ -1,6 +1,6 @@ use abstract_sdk::std::{ + account::state::{ADMIN, WHITELISTED_MODULES}, ibc_client::ExecuteMsg as IbcClientMsg, - proxy::state::{ADMIN, STATE}, IBC_CLIENT, }; use abstract_std::ICA_CLIENT; @@ -9,53 +9,55 @@ use cosmwasm_std::{ }; use crate::{ - contract::{ProxyResponse, ProxyResult, RESPONSE_REPLY_ID}, - error::ProxyError, + contract::{AccountResponse, AccountResult, RESPONSE_REPLY_ID}, + error::AccountError, }; -const LIST_SIZE_LIMIT: usize = 15; - -/// Executes `Vec` on the proxy. +/// Executes `CosmosMsg` on the proxy and forwards its response. /// Permission: Module -pub fn execute_module_action( +pub fn execute_module_action_response( deps: DepsMut, msg_info: MessageInfo, - msgs: Vec>, -) -> ProxyResult { - let state = STATE.load(deps.storage)?; - if !state.modules.contains(&msg_info.sender) { - return Err(ProxyError::SenderNotWhitelisted {}); + msg: CosmosMsg, +) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); } - Ok(ProxyResponse::action("execute_module_action").add_messages(msgs)) + let submsg = SubMsg::reply_on_success(msg, RESPONSE_REPLY_ID); + + Ok(AccountResponse::action("execute_module_action_response").add_submessage(submsg)) } -/// Executes `CosmosMsg` on the proxy and forwards its response. +/// Executes `Vec` on the proxy. /// Permission: Module -pub fn execute_module_action_response( +pub fn execute_module_action( deps: DepsMut, msg_info: MessageInfo, - msg: CosmosMsg, -) -> ProxyResult { - let state = STATE.load(deps.storage)?; - if !state.modules.contains(&msg_info.sender) { - return Err(ProxyError::SenderNotWhitelisted {}); + msgs: Vec>, +) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); } - let submsg = SubMsg::reply_on_success(msg, RESPONSE_REPLY_ID); - - Ok(ProxyResponse::action("execute_module_action_response").add_submessage(submsg)) + Ok(AccountResponse::action("execute_module_action").add_messages(msgs)) } /// Executes IBC actions on the IBC client. /// Permission: Module -pub fn execute_ibc_action(deps: DepsMut, msg_info: MessageInfo, msg: IbcClientMsg) -> ProxyResult { - let state = STATE.load(deps.storage)?; - if !state.modules.contains(&msg_info.sender) { - return Err(ProxyError::SenderNotWhitelisted {}); +pub fn execute_ibc_action( + deps: DepsMut, + msg_info: MessageInfo, + msg: IbcClientMsg, +) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); } let manager_address = ADMIN.get(deps.as_ref())?.unwrap(); - let ibc_client_address = abstract_sdk::std::manager::state::ACCOUNT_MODULES + let ibc_client_address = abstract_sdk::std::account::state::ACCOUNT_MODULES .query(&deps.querier, manager_address, IBC_CLIENT)? .ok_or_else(|| { StdError::generic_err(format!( @@ -70,7 +72,7 @@ pub fn execute_ibc_action(deps: DepsMut, msg_info: MessageInfo, msg: IbcClientMs }; let client_msg = wasm_execute(ibc_client_address, &msg, funds_to_send)?; - Ok(ProxyResponse::action("execute_ibc_action").add_message(client_msg)) + Ok(AccountResponse::action("execute_ibc_action").add_message(client_msg)) } /// Execute an action on an ICA. @@ -80,14 +82,14 @@ pub fn execute_ibc_action(deps: DepsMut, msg_info: MessageInfo, msg: IbcClientMs /// It then fires a smart-query on that address of type [`QueryMsg::IcaAction`](abstract_ica::msg::QueryMsg). /// /// The resulting `Vec` are then executed on the proxy contract. -pub fn ica_action(deps: DepsMut, msg_info: MessageInfo, action_query: Binary) -> ProxyResult { - let state = STATE.load(deps.storage)?; - if !state.modules.contains(&msg_info.sender) { - return Err(ProxyError::SenderNotWhitelisted {}); +pub fn ica_action(deps: DepsMut, msg_info: MessageInfo, action_query: Binary) -> AccountResult { + let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + if !whitelisted_modules.0.contains(&msg_info.sender) { + return Err(AccountError::SenderNotWhitelisted {}); } let manager_address = ADMIN.get(deps.as_ref())?.unwrap(); - let ica_client_address = abstract_sdk::std::manager::state::ACCOUNT_MODULES + let ica_client_address = abstract_sdk::std::account::state::ACCOUNT_MODULES .query(&deps.querier, manager_address, ICA_CLIENT)? .ok_or_else(|| { StdError::generic_err(format!( @@ -103,256 +105,11 @@ pub fn ica_action(deps: DepsMut, msg_info: MessageInfo, action_query: Binary) -> .into(), )?; - Ok(ProxyResponse::action("ica_action").add_messages(res.msgs)) -} - -/// Add a contract to the whitelist -pub fn add_modules(deps: DepsMut, msg_info: MessageInfo, modules: Vec) -> ProxyResult { - ADMIN.assert_admin(deps.as_ref(), &msg_info.sender)?; - - let mut state = STATE.load(deps.storage)?; - - // This is a limit to prevent potentially running out of gas when doing lookups on the modules list - if state.modules.len() >= LIST_SIZE_LIMIT { - return Err(ProxyError::ModuleLimitReached {}); - } - - for module in modules.iter() { - let module_addr = deps.api.addr_validate(module)?; - - if state.modules.contains(&module_addr) { - return Err(ProxyError::AlreadyWhitelisted(module.clone())); - } - - // Add contract to whitelist. - state.modules.push(module_addr); - } - - STATE.save(deps.storage, &state)?; - - // Respond and note the change - Ok(ProxyResponse::new( - "add_module", - vec![("modules", modules.join(","))], - )) -} - -/// Remove a contract from the whitelist -pub fn remove_module(deps: DepsMut, msg_info: MessageInfo, module: String) -> ProxyResult { - ADMIN.assert_admin(deps.as_ref(), &msg_info.sender)?; - - STATE.update(deps.storage, |mut state| { - let module_address = deps.api.addr_validate(&module)?; - - if !state.modules.contains(&module_address) { - return Err(ProxyError::NotWhitelisted(module.clone())); - } - // Remove contract from whitelist. - state.modules.retain(|addr| *addr != module_address); - Ok(state) - })?; - - // Respond and note the change - Ok(ProxyResponse::new( - "remove_module", - vec![("module", module)], - )) -} - -pub fn set_admin(deps: DepsMut, info: MessageInfo, admin: &String) -> ProxyResult { - let admin_addr = deps.api.addr_validate(admin)?; - let previous_admin = ADMIN.get(deps.as_ref())?.unwrap(); - ADMIN.execute_update_admin::(deps, info, Some(admin_addr))?; - Ok(ProxyResponse::new( - "set_admin", - vec![ - ("previous_admin", previous_admin.to_string()), - ("admin", admin.to_string()), - ], - )) + Ok(AccountResponse::action("ica_action").add_messages(res.msgs)) } #[cfg(test)] mod test { - #![allow(clippy::needless_borrows_for_generic_args)] - use super::*; - - use crate::{contract::execute, test_common::*}; - use abstract_std::proxy::ExecuteMsg; - use abstract_testing::prelude::*; - use cosmwasm_std::{ - testing::{message_info, mock_dependencies, mock_env, MockApi, MOCK_CONTRACT_ADDR}, - Addr, OwnedDeps, Storage, - }; - use speculoos::prelude::*; - - const TEST_MODULE: &str = "module"; - - type MockDeps = OwnedDeps; - - pub fn execute_as_admin(deps: &mut MockDeps, msg: ExecuteMsg) -> ProxyResult { - let base = test_account_base(deps.api); - let info = message_info(&base.manager, &[]); - execute(deps.as_mut(), mock_env(), info, msg) - } - - fn load_modules(storage: &dyn Storage) -> Vec { - STATE.load(storage).unwrap().modules - } - - mod add_module { - use super::*; - - use cw_controllers::AdminError; - - #[test] - fn only_admin_can_add_module() { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let test_module_addr = deps.api.addr_make(TEST_MODULE); - let msg = ExecuteMsg::AddModules { - modules: vec![test_module_addr.to_string()], - }; - let info = message_info(&deps.api.addr_make("not_admin"), &[]); - - let res = execute(deps.as_mut(), mock_env(), info, msg); - assert_that(&res) - .is_err() - .is_equal_to(ProxyError::Admin(AdminError::NotAdmin {})) - } - - #[test] - fn add_module() { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let test_module_addr = deps.api.addr_make(TEST_MODULE); - let msg = ExecuteMsg::AddModules { - modules: vec![test_module_addr.to_string()], - }; - - let res = execute_as_admin(&mut deps, msg); - assert_that(&res).is_ok(); - - let actual_modules = load_modules(&deps.storage); - // Plus manager - assert_that(&actual_modules).has_length(2); - assert_that(&actual_modules).contains(&test_module_addr); - } - - #[test] - fn fails_adding_previously_added_module() { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let test_module_addr = deps.api.addr_make(TEST_MODULE); - let msg = ExecuteMsg::AddModules { - modules: vec![test_module_addr.to_string()], - }; - - let res = execute_as_admin(&mut deps, msg.clone()); - assert_that(&res).is_ok(); - - let res = execute_as_admin(&mut deps, msg); - assert_that(&res) - .is_err() - .is_equal_to(ProxyError::AlreadyWhitelisted(test_module_addr.to_string())); - } - - #[test] - fn fails_adding_module_when_list_is_full() { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let test_module_addr = deps.api.addr_make(TEST_MODULE); - let mut msg = ExecuteMsg::AddModules { - modules: vec![test_module_addr.to_string()], - }; - - // -1 because manager counts as module as well - for i in 0..LIST_SIZE_LIMIT - 1 { - let test_module = format!("module_{i}"); - let test_module_addr = deps.api.addr_make(&test_module); - msg = ExecuteMsg::AddModules { - modules: vec![test_module_addr.to_string()], - }; - let res = execute_as_admin(&mut deps, msg.clone()); - assert_that(&res).is_ok(); - } - - let res = execute_as_admin(&mut deps, msg); - assert_that(&res) - .is_err() - .is_equal_to(ProxyError::ModuleLimitReached {}); - } - } - - type ProxyTestResult = Result<(), ProxyError>; - - mod remove_module { - use abstract_std::proxy::state::State; - use cw_controllers::AdminError; - - use super::*; - - #[test] - fn only_admin() { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let msg = ExecuteMsg::RemoveModule { - module: TEST_MODULE.to_string(), - }; - let info = message_info(&deps.api.addr_make("not_admin"), &[]); - - let res = execute(deps.as_mut(), mock_env(), info, msg); - assert_that(&res) - .is_err() - .is_equal_to(ProxyError::Admin(AdminError::NotAdmin {})) - } - - #[test] - fn remove_module() -> ProxyTestResult { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let test_module_addr = deps.api.addr_make(TEST_MODULE); - STATE.save( - &mut deps.storage, - &State { - modules: vec![test_module_addr.clone()], - }, - )?; - - let msg = ExecuteMsg::RemoveModule { - module: test_module_addr.to_string(), - }; - let res = execute_as_admin(&mut deps, msg); - assert_that(&res).is_ok(); - - let actual_modules = load_modules(&deps.storage); - assert_that(&actual_modules).is_empty(); - - Ok(()) - } - - #[test] - fn fails_removing_non_existing_module() { - let mut deps = mock_dependencies(); - mock_init(&mut deps); - - let test_module_addr = deps.api.addr_make(TEST_MODULE); - let msg = ExecuteMsg::RemoveModule { - module: test_module_addr.to_string(), - }; - - let res = execute_as_admin(&mut deps, msg); - assert_that(&res) - .is_err() - .is_equal_to(ProxyError::NotWhitelisted(test_module_addr.to_string())); - } - } mod execute_action { use abstract_std::proxy::state::State; diff --git a/framework/contracts/account/src/config.rs b/framework/contracts/account/src/config.rs new file mode 100644 index 0000000000..22721abcc6 --- /dev/null +++ b/framework/contracts/account/src/config.rs @@ -0,0 +1,680 @@ +use crate::{ + contract::{AccountResponse, AccountResult}, + error::AccountError, + modules::update_module_addresses, +}; +use abstract_sdk::{cw_helpers::AbstractAttributes, feature_objects::VersionControlContract}; +use abstract_std::{ + account::{ + state::{ + AccountInfo, SuspensionStatus, ACCOUNT_ID, CONFIG, INFO, SUB_ACCOUNTS, + SUSPENSION_STATUS, + }, + types::{InternalConfigAction, UpdateSubAccountAction}, + ExecuteMsg, + }, + objects::{ + gov_type::GovernanceDetails, + ownership, + validation::{validate_description, validate_link, validate_name}, + }, +}; +use cosmwasm_std::{ + ensure, from_json, wasm_execute, Binary, CosmosMsg, DepsMut, MessageInfo, Response, StdError, +}; + +pub fn update_account_status( + deps: DepsMut, + info: MessageInfo, + suspension_status: Option, +) -> Result { + let mut response = AccountResponse::action("update_status"); + + if let Some(suspension_status) = suspension_status { + response = update_suspension_status(deps, info, suspension_status, response)?; + } else { + return Err(AccountError::NoUpdates {}); + } + + Ok(response) +} + +pub fn update_suspension_status( + deps: DepsMut, + info: MessageInfo, + is_suspended: SuspensionStatus, + response: Response, +) -> AccountResult { + // only owner can update suspension status + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + SUSPENSION_STATUS.save(deps.storage, &is_suspended)?; + + Ok(response.add_abstract_attributes(vec![("is_suspended", is_suspended.to_string())])) +} + +/// Allows the owner to manually update the internal configuration of the account. +/// This can be used to unblock the account and its modules in case of a bug/lock on the account. +pub fn update_internal_config(deps: DepsMut, info: MessageInfo, config: Binary) -> AccountResult { + // deserialize the config action + let action: InternalConfigAction = + from_json(config).map_err(|error| AccountError::InvalidConfigAction { error })?; + + let (add, remove) = match action { + InternalConfigAction::UpdateModuleAddresses { to_add, to_remove } => (to_add, to_remove), + _ => { + return Err(AccountError::InvalidConfigAction { + error: StdError::generic_err("Unknown config action"), + }) + } + }; + + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + update_module_addresses(deps, add, remove) +} + +/// Update the Account information +pub fn update_info( + deps: DepsMut, + info: MessageInfo, + name: Option, + description: Option, + link: Option, +) -> AccountResult { + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + let mut info: AccountInfo = INFO.load(deps.storage)?; + if let Some(name) = name { + validate_name(&name)?; + info.name = name; + } + validate_description(description.as_deref())?; + info.description = description; + validate_link(link.as_deref())?; + info.link = link; + INFO.save(deps.storage, &info)?; + + Ok(AccountResponse::action("update_info")) +} + +/// Renounce ownership of this account \ +/// **WARNING**: This will lock the account, making it unusable. +pub fn remove_account_from_contracts(deps: DepsMut) -> AccountResult> { + let mut msgs = vec![]; + + let account_id = ACCOUNT_ID.load(deps.storage)?; + // Check for any sub accounts + let sub_account = SUB_ACCOUNTS + .keys(deps.storage, None, None, cosmwasm_std::Order::Ascending) + .next() + .transpose()?; + ensure!( + sub_account.is_none(), + AccountError::RenounceWithSubAccount {} + ); + + let ownership = ownership::get_ownership(deps.storage)?; + if let GovernanceDetails::SubAccount { account } = ownership.owner { + // Unregister itself (sub-account) from the owning account. + msgs.push( + wasm_execute( + account, + &ExecuteMsg::UpdateSubAccount(UpdateSubAccountAction::UnregisterSubAccount { + id: account_id.seq(), + }), + vec![], + )? + .into(), + ); + } + + let config = CONFIG.load(deps.storage)?; + let vc = VersionControlContract::new(config.version_control_address); + let mut namespaces = vc + .query_namespaces(vec![account_id], &deps.querier)? + .namespaces; + let namespace = namespaces.pop(); + if let Some((namespace, _)) = namespace { + // Remove the namespace that this account holds. + msgs.push( + wasm_execute( + vc.address, + &abstract_std::version_control::ExecuteMsg::RemoveNamespaces { + namespaces: vec![namespace.to_string()], + }, + vec![], + )? + .into(), + ) + }; + Ok(msgs) +} + +#[cfg(test)] +mod tests { + use super::*; + + use crate::{contract, test_common::mock_init}; + use abstract_testing::prelude::*; + use cosmwasm_std::{ + testing::{message_info, mock_dependencies, mock_env, MockApi, MockQuerier, MockStorage}, + Order, OwnedDeps, StdError, + }; + use speculoos::prelude::*; + + type ManagerTestResult = Result<(), ManagerError>; + + fn mock_installed_proxy(deps: &mut MockDeps) -> StdResult<()> { + let base = test_account_base(deps.api); + ACCOUNT_MODULES.save(deps.as_mut().storage, ACCOUNT, &base.proxy) + } + + fn execute_as(deps: DepsMut, sender: &Addr, msg: ExecuteMsg) -> ManagerResult { + contract::execute(deps, mock_env(), message_info(sender, &[]), msg) + } + + fn init_with_proxy(deps: &mut MockDeps) { + mock_init(deps).unwrap(); + mock_installed_proxy(deps).unwrap(); + } + + fn load_account_modules(storage: &dyn Storage) -> Result, StdError> { + ACCOUNT_MODULES + .range(storage, None, None, Order::Ascending) + .collect() + } + + fn test_only_owner(msg: ExecuteMsg) -> ManagerTestResult { + let mut deps = mock_dependencies(); + let not_owner = deps.api.addr_make("not_owner"); + mock_init(&mut deps)?; + + let res = execute_as(deps.as_mut(), ¬_owner, msg); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::Ownership( + ownership::GovOwnershipError::NotOwner, + )); + + Ok(()) + } + + type MockDeps = OwnedDeps; + + mod set_owner_and_gov_type { + use ownership::GovAction; + + use super::*; + + #[test] + fn only_owner() -> ManagerTestResult { + let deps = mock_dependencies(); + let test_owner = deps.api.addr_make("test_owner"); + + let msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { + new_owner: GovernanceDetails::Monarchy { + monarch: test_owner.to_string(), + }, + expiry: None, + }); + + test_only_owner(msg) + } + + #[test] + fn validates_new_owner_address() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + mock_init(&mut deps)?; + + let msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { + new_owner: GovernanceDetails::Monarchy { + monarch: "INVALID".to_string(), + }, + expiry: None, + }); + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(res).is_err().matches(|err| { + matches!( + err, + ManagerError::Ownership(GovOwnershipError::Abstract( + abstract_std::AbstractError::Std(StdError::GenericErr { .. }) + )) + ) + }); + Ok(()) + } + + #[test] + fn updates_owner() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + let new_owner = deps.api.addr_make("new_owner"); + mock_init(&mut deps)?; + + let set_owner_msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { + new_owner: GovernanceDetails::Monarchy { + monarch: new_owner.to_string(), + }, + expiry: None, + }); + + let res = execute_as(deps.as_mut(), &owner, set_owner_msg); + assert_that!(&res).is_ok(); + + let accept_msg = ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership); + execute_as(deps.as_mut(), &new_owner, accept_msg)?; + + let actual_owner = ownership::get_ownership(&deps.storage)?.owner; + + assert_that!(&actual_owner).is_equal_to(GovernanceDetails::Monarchy { + monarch: Addr::unchecked(new_owner), + }); + + Ok(()) + } + + #[test] + fn updates_governance_type() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + let new_gov = deps.api.addr_make("new_gov"); + + mock_init(&mut deps)?; + + let msg = ExecuteMsg::UpdateOwnership(GovAction::TransferOwnership { + new_owner: GovernanceDetails::Monarchy { + monarch: new_gov.to_string(), + }, + expiry: None, + }); + + execute_as(deps.as_mut(), &owner, msg)?; + + let ownership = ownership::get_ownership(deps.as_ref().storage)?; + assert_that!(ownership + .owner + .owner_address(&deps.as_ref().querier) + .unwrap() + .to_string()) + .is_equal_to(owner.to_string()); + + let accept_msg = ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership); + execute_as(deps.as_mut(), &new_gov, accept_msg)?; + + let ownership = ownership::get_ownership(deps.as_ref().storage)?; + assert_that!(ownership + .owner + .owner_address(&deps.as_ref().querier) + .unwrap() + .to_string()) + .is_equal_to(new_gov.to_string()); + + Ok(()) + } + } + + mod update_info { + use abstract_std::objects::validation::ValidationError; + + use super::*; + + #[test] + fn only_owner() -> ManagerTestResult { + let msg = ExecuteMsg::UpdateInfo { + name: None, + description: None, + link: None, + }; + + test_only_owner(msg) + } + // integration tests + + #[test] + fn updates() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + init_with_proxy(&mut deps); + + let name = "new name"; + let description = "new description"; + let link = "http://a.be"; + + let msg = ExecuteMsg::UpdateInfo { + name: Some(name.to_string()), + description: Some(description.to_string()), + link: Some(link.to_string()), + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res).is_ok(); + + let info = INFO.load(deps.as_ref().storage)?; + + assert_that!(&info.name).is_equal_to(name.to_string()); + assert_that!(&info.description.unwrap()).is_equal_to(description.to_string()); + assert_that!(&info.link.unwrap()).is_equal_to(link.to_string()); + + Ok(()) + } + + #[test] + fn removals() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + init_with_proxy(&mut deps); + + let prev_name = "name".to_string(); + INFO.save( + deps.as_mut().storage, + &AccountInfo { + name: prev_name.clone(), + description: Some("description".to_string()), + link: Some("link".to_string()), + }, + )?; + + let msg = ExecuteMsg::UpdateInfo { + name: None, + description: None, + link: None, + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res).is_ok(); + + let info = INFO.load(deps.as_ref().storage)?; + + assert_that!(&info.name).is_equal_to(&prev_name); + assert_that!(&info.description).is_none(); + assert_that!(&info.link).is_none(); + + Ok(()) + } + + #[test] + fn validates_name() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + init_with_proxy(&mut deps); + + let msg = ExecuteMsg::UpdateInfo { + name: Some("".to_string()), + description: None, + link: None, + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res).is_err().matches(|e| { + matches!( + e, + ManagerError::Validation(ValidationError::TitleInvalidShort(_)) + ) + }); + + let msg = ExecuteMsg::UpdateInfo { + name: Some("a".repeat(65)), + description: None, + link: None, + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res).is_err().matches(|e| { + matches!( + e, + ManagerError::Validation(ValidationError::TitleInvalidLong(_)) + ) + }); + + Ok(()) + } + + #[test] + fn validates_link() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + + init_with_proxy(&mut deps); + + let msg = ExecuteMsg::UpdateInfo { + name: None, + description: None, + link: Some("aoeu".to_string()), + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res).is_err().matches(|e| { + matches!( + e, + ManagerError::Validation(ValidationError::LinkInvalidShort(_)) + ) + }); + + let msg = ExecuteMsg::UpdateInfo { + name: None, + description: None, + link: Some("a".repeat(129)), + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res).is_err().matches(|e| { + matches!( + e, + ManagerError::Validation(ValidationError::LinkInvalidLong(_)) + ) + }); + + Ok(()) + } + } + + mod handle_callback { + use super::*; + + #[test] + fn only_by_contract() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let not_contract = deps.api.addr_make("not_contract"); + mock_init(&mut deps)?; + let callback = CallbackMsg {}; + + let msg = ExecuteMsg::Callback(callback); + + let res = contract::execute( + deps.as_mut(), + mock_env(), + message_info(¬_contract, &[]), + msg, + ); + + assert_that!(&res) + .is_err() + .matches(|err| matches!(err, ManagerError::Std(StdError::GenericErr { .. }))); + + Ok(()) + } + } + + mod update_suspension_status { + use super::*; + + #[test] + fn only_owner() -> ManagerTestResult { + let mut deps = mock_dependencies(); + mock_init(&mut deps)?; + + let msg = ExecuteMsg::UpdateStatus { + is_suspended: Some(true), + }; + + test_only_owner(msg) + } + + #[test] + fn exec_fails_when_suspended() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + mock_init(&mut deps)?; + + let msg = ExecuteMsg::UpdateStatus { + is_suspended: Some(true), + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(res).is_ok(); + let actual_is_suspended = SUSPENSION_STATUS.load(&deps.storage).unwrap(); + assert_that!(&actual_is_suspended).is_true(); + + let update_info_msg = ExecuteMsg::UpdateInfo { + name: Some("asonetuh".to_string()), + description: None, + link: None, + }; + + let res = execute_as(deps.as_mut(), &owner, update_info_msg); + + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::AccountSuspended {}); + + Ok(()) + } + + #[test] + fn suspend_account() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + mock_init(&mut deps)?; + + let msg = ExecuteMsg::UpdateStatus { + is_suspended: Some(true), + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + + assert_that!(&res).is_ok(); + let actual_is_suspended = SUSPENSION_STATUS.load(&deps.storage).unwrap(); + assert_that!(&actual_is_suspended).is_true(); + Ok(()) + } + + #[test] + fn unsuspend_account() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + mock_init(&mut deps)?; + + let msg = ExecuteMsg::UpdateStatus { + is_suspended: Some(false), + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + + assert_that!(&res).is_ok(); + let actual_status = SUSPENSION_STATUS.load(&deps.storage).unwrap(); + assert_that!(&actual_status).is_false(); + Ok(()) + } + } + + mod update_internal_config { + use abstract_std::manager::{InternalConfigAction::UpdateModuleAddresses, QueryMsg}; + + use super::*; + + #[test] + fn only_account_owner() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + + mock_init(&mut deps)?; + + let msg = ExecuteMsg::UpdateInternalConfig( + to_json_binary(&UpdateModuleAddresses { + to_add: None, + to_remove: None, + }) + .unwrap(), + ); + + let bad_sender = deps.api.addr_make("not_account_owner"); + let res = execute_as(deps.as_mut(), &bad_sender, msg.clone()); + + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::Ownership(GovOwnershipError::NotOwner)); + + let factory_res = execute_as(deps.as_mut(), &abstr.account_factory, msg.clone()); + assert_that!(&factory_res).is_err(); + + let owner_res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&owner_res).is_ok(); + + Ok(()) + } + + #[test] + fn should_return_err_unrecognized_action() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + mock_init(&mut deps)?; + + let msg = + ExecuteMsg::UpdateInternalConfig(to_json_binary(&QueryMsg::Config {}).unwrap()); + + let res = execute_as(deps.as_mut(), &abstr.account_factory, msg); + + assert_that!(&res) + .is_err() + .matches(|e| matches!(e, ManagerError::InvalidConfigAction { .. })); + + Ok(()) + } + } + + mod update_ownership { + use super::*; + + #[test] + fn allows_ownership_acceptance() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + mock_init(&mut deps)?; + + let pending_owner = deps.api.addr_make("not_owner"); + // mock pending owner + Item::new("ownership").save( + deps.as_mut().storage, + &ownership::Ownership { + owner: GovernanceDetails::Monarchy { monarch: owner }, + pending_expiry: None, + pending_owner: Some(GovernanceDetails::Monarchy { + monarch: pending_owner.clone(), + }), + }, + )?; + + let msg = ExecuteMsg::UpdateOwnership(ownership::GovAction::AcceptOwnership {}); + + execute_as(deps.as_mut(), &pending_owner, msg)?; + + Ok(()) + } + } + + // upgrade_modules tests are in the integration tests `upgrades` +} diff --git a/framework/contracts/account/account/src/contract.rs b/framework/contracts/account/src/contract.rs similarity index 81% rename from framework/contracts/account/account/src/contract.rs rename to framework/contracts/account/src/contract.rs index 30556fd5f4..b0ce4e303b 100644 --- a/framework/contracts/account/account/src/contract.rs +++ b/framework/contracts/account/src/contract.rs @@ -20,6 +20,7 @@ use cosmwasm_std::{ wasm_execute, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsgResult, }; +pub use crate::migrate::migrate; use crate::{ actions::{ execute_ibc_action, execute_module_action, execute_module_action_response, ica_action, @@ -417,3 +418,113 @@ mod tests { } } } + +#[cfg(test)] +mod tests { + use cosmwasm_std::testing::*; + use semver::Version; + use speculoos::prelude::*; + + use super::*; + use crate::{contract, test_common::mock_init}; + + mod migrate { + use abstract_std::{manager::MigrateMsg, AbstractError}; + use cw2::get_contract_version; + + use super::*; + + #[test] + fn disallow_same_version() -> ManagerResult<()> { + let mut deps = mock_dependencies(); + mock_init(&mut deps)?; + + let version: Version = CONTRACT_VERSION.parse().unwrap(); + + let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); + + assert_that!(res) + .is_err() + .is_equal_to(ManagerError::Abstract( + AbstractError::CannotDowngradeContract { + contract: ACCOUNT.to_string(), + from: version.clone(), + to: version, + }, + )); + + Ok(()) + } + + #[test] + fn disallow_downgrade() -> ManagerResult<()> { + let mut deps = mock_dependencies(); + mock_init(&mut deps)?; + + let big_version = "999.999.999"; + set_contract_version(deps.as_mut().storage, ACCOUNT, big_version)?; + + let version: Version = CONTRACT_VERSION.parse().unwrap(); + + let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); + + assert_that!(res) + .is_err() + .is_equal_to(ManagerError::Abstract( + AbstractError::CannotDowngradeContract { + contract: ACCOUNT.to_string(), + from: big_version.parse().unwrap(), + to: version, + }, + )); + + Ok(()) + } + + #[test] + fn disallow_name_change() -> ManagerResult<()> { + let mut deps = mock_dependencies(); + mock_init(&mut deps)?; + + let old_version = "0.0.0"; + let old_name = "old:contract"; + set_contract_version(deps.as_mut().storage, old_name, old_version)?; + + let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {}); + + assert_that!(res) + .is_err() + .is_equal_to(ManagerError::Abstract( + AbstractError::ContractNameMismatch { + from: old_name.parse().unwrap(), + to: ACCOUNT.parse().unwrap(), + }, + )); + + Ok(()) + } + + #[test] + fn works() -> ManagerResult<()> { + let mut deps = mock_dependencies(); + mock_init(&mut deps)?; + + let version: Version = CONTRACT_VERSION.parse().unwrap(); + + let small_version = Version { + minor: version.minor - 1, + ..version.clone() + } + .to_string(); + + set_contract_version(deps.as_mut().storage, ACCOUNT, small_version)?; + + let res = contract::migrate(deps.as_mut(), mock_env(), MigrateMsg {})?; + assert_that!(res.messages).has_length(0); + + assert_that!(get_contract_version(&deps.storage)?.version) + .is_equal_to(version.to_string()); + Ok(()) + } + } +} diff --git a/framework/contracts/account/account/src/error.rs b/framework/contracts/account/src/error.rs similarity index 100% rename from framework/contracts/account/account/src/error.rs rename to framework/contracts/account/src/error.rs diff --git a/framework/contracts/account/manager/src/lib.rs b/framework/contracts/account/src/lib.rs similarity index 90% rename from framework/contracts/account/manager/src/lib.rs rename to framework/contracts/account/src/lib.rs index abd6d089cb..da9cfb7e4e 100644 --- a/framework/contracts/account/manager/src/lib.rs +++ b/framework/contracts/account/src/lib.rs @@ -1,10 +1,13 @@ -pub mod commands; +pub mod actions; +pub mod config; pub mod contract; pub mod error; -pub(crate) mod migrate; -mod queries; -mod validation; -mod versioning; +pub mod migrate; +pub mod modules; +pub mod queries; +pub mod reply; +pub mod sub_account; +pub mod versioning; #[cfg(test)] mod test_common { diff --git a/framework/contracts/account/manager/src/migrate.rs b/framework/contracts/account/src/migrate.rs similarity index 57% rename from framework/contracts/account/manager/src/migrate.rs rename to framework/contracts/account/src/migrate.rs index f0f24f759c..1d6b6e8b0f 100644 --- a/framework/contracts/account/manager/src/migrate.rs +++ b/framework/contracts/account/src/migrate.rs @@ -1,20 +1,17 @@ use abstract_std::{ - manager::MigrateMsg, objects::module_version::assert_contract_upgrade, ACCOUNT, + account::MigrateMsg, objects::module_version::assert_contract_upgrade, ACCOUNT, }; use cosmwasm_std::{DepsMut, Env}; use cw2::set_contract_version; use semver::Version; -use crate::{ - commands::ManagerResponse, - contract::{ManagerResult, CONTRACT_VERSION}, -}; +use crate::contract::{AccountResponse, AccountResult, CONTRACT_VERSION}; #[cfg_attr(feature = "export", cosmwasm_std::entry_point)] -pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ManagerResult { +pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> AccountResult { let version: Version = CONTRACT_VERSION.parse().unwrap(); assert_contract_upgrade(deps.storage, ACCOUNT, version)?; set_contract_version(deps.storage, ACCOUNT, CONTRACT_VERSION)?; - Ok(ManagerResponse::action("migrate")) + Ok(AccountResponse::action("migrate")) } diff --git a/framework/contracts/account/src/modules.rs b/framework/contracts/account/src/modules.rs new file mode 100644 index 0000000000..9f5208ab13 --- /dev/null +++ b/framework/contracts/account/src/modules.rs @@ -0,0 +1,852 @@ +use abstract_std::{ + account::{ + state::{ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, DEPENDENTS, WHITELISTED_MODULES}, + ModuleInstallConfig, + }, + adapter::{AdapterBaseMsg, BaseExecuteMsg, ExecuteMsg as AdapterExecMsg}, + module_factory::{ExecuteMsg as ModuleFactoryMsg, FactoryModuleInstallConfig}, + objects::{ + module::{Module, ModuleInfo, ModuleVersion}, + module_reference::ModuleReference, + ownership::{self}, + salt::generate_instantiate_salt, + version_control::VersionControlContract, + }, + version_control::ModuleResponse, +}; +use cosmwasm_std::{ + ensure, wasm_execute, Addr, Attribute, Binary, Coin, CosmosMsg, Deps, DepsMut, MessageInfo, + StdResult, Storage, SubMsg, WasmMsg, +}; +use cw2::ContractVersion; +use cw_storage_plus::Item; +use semver::Version; + +use crate::{ + contract::{AccountResponse, AccountResult, REGISTER_MODULES_DEPENDENCIES_REPLY_ID}, + error::AccountError, +}; + +pub use migration::MIGRATE_CONTEXT; +pub(crate) const INSTALL_MODULES_CONTEXT: Item)>> = Item::new("icontext"); + +pub mod migration; + +const LIST_SIZE_LIMIT: usize = 15; + +/// Attempts to install a new module through the Module Factory Contract +pub fn install_modules( + mut deps: DepsMut, + info: MessageInfo, + modules: Vec, +) -> AccountResult { + // only owner can call this method + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + let config = CONFIG.load(deps.storage)?; + + let (install_msgs, install_attribute) = _install_modules( + deps.branch(), + modules, + config.module_factory_address, + config.version_control_address, + info.funds, // We forward all the funds to the module_factory address for them to use in the install + )?; + let response = AccountResponse::new("install_modules", std::iter::once(install_attribute)) + .add_submessages(install_msgs); + + Ok(response) +} + +/// Generate message and attribute for installing module +/// Adds the modules to the internal store for reference and adds them to the proxy allowlist if applicable. +pub fn _install_modules( + mut deps: DepsMut, + modules: Vec, + module_factory_address: Addr, + version_control_address: Addr, + funds: Vec, +) -> AccountResult<(Vec, Attribute)> { + let mut installed_modules = Vec::with_capacity(modules.len()); + let mut manager_modules = Vec::with_capacity(modules.len()); + let account_id = ACCOUNT_ID.load(deps.storage)?; + let version_control = VersionControlContract::new(version_control_address); + + let canonical_module_factory = deps + .api + .addr_canonicalize(module_factory_address.as_str())?; + + let (infos, init_msgs): (Vec<_>, Vec<_>) = + modules.into_iter().map(|m| (m.module, m.init_msg)).unzip(); + let modules = version_control + .query_modules_configs(infos, &deps.querier) + .map_err(|error| AccountError::QueryModulesFailed { error })?; + + let mut install_context = Vec::with_capacity(modules.len()); + let mut add_to_whitelist = Vec::with_capacity(modules.len()); + let mut add_to_manager = Vec::with_capacity(modules.len()); + + let salt: Binary = generate_instantiate_salt(&account_id); + for (ModuleResponse { module, .. }, init_msg) in modules.into_iter().zip(init_msgs) { + // Check if module is already enabled. + if ACCOUNT_MODULES + .may_load(deps.storage, &module.info.id())? + .is_some() + { + return Err(AccountError::ModuleAlreadyInstalled(module.info.id())); + } + installed_modules.push(module.info.id_with_version()); + + let init_msg_salt = match &module.reference { + ModuleReference::Adapter(module_address) + | ModuleReference::Native(module_address) + | ModuleReference::Service(module_address) => { + if module.should_be_whitelisted() { + add_to_whitelist.push(module_address.to_string()); + } + add_to_manager.push((module.info.id(), module_address.to_string())); + install_context.push((module.clone(), None)); + None + } + ModuleReference::App(code_id) | ModuleReference::Standalone(code_id) => { + let checksum = deps.querier.query_wasm_code_info(*code_id)?.checksum; + let module_address = cosmwasm_std::instantiate2_address( + checksum.as_slice(), + &canonical_module_factory, + &salt, + )?; + let module_address = deps.api.addr_humanize(&module_address)?; + ensure!( + deps.querier + .query_wasm_contract_info(module_address.to_string()) + .is_err(), + AccountError::ProhibitedReinstall {} + ); + if module.should_be_whitelisted() { + add_to_whitelist.push(module_address.to_string()); + } + add_to_manager.push((module.info.id(), module_address.to_string())); + install_context.push((module.clone(), Some(module_address))); + + Some(init_msg.unwrap()) + } + _ => return Err(AccountError::ModuleNotInstallable(module.info.to_string())), + }; + manager_modules.push(FactoryModuleInstallConfig::new(module.info, init_msg_salt)); + } + _whitelist_modules(deps.branch(), add_to_whitelist)?; + + INSTALL_MODULES_CONTEXT.save(deps.storage, &install_context)?; + + let mut messages = vec![]; + + // Update module addrs + update_module_addresses(deps.branch(), Some(add_to_manager), None)?; + + // Install modules message + messages.push(SubMsg::reply_on_success( + wasm_execute( + module_factory_address, + &ModuleFactoryMsg::InstallModules { + modules: manager_modules, + salt, + }, + funds, + )?, + REGISTER_MODULES_DEPENDENCIES_REPLY_ID, + )); + + Ok(( + messages, + Attribute::new("installed_modules", format!("{installed_modules:?}")), + )) +} + +/// Adds, updates or removes provided addresses. +/// Should only be called by contract that adds/removes modules. +/// Factory is admin on init +pub fn update_module_addresses( + deps: DepsMut, + to_add: Option>, + to_remove: Option>, +) -> AccountResult { + if let Some(modules_to_add) = to_add { + for (id, new_address) in modules_to_add.into_iter() { + if id.is_empty() { + return Err(AccountError::InvalidModuleName {}); + }; + // validate addr + ACCOUNT_MODULES.save( + deps.storage, + id.as_str(), + &deps.api.addr_validate(&new_address)?, + )?; + } + } + + if let Some(modules_to_remove) = to_remove { + for id in modules_to_remove.into_iter() { + ACCOUNT_MODULES.remove(deps.storage, id.as_str()); + } + } + + Ok(AccountResponse::action("update_module_addresses")) +} + +/// Uninstall the module with the ID [`module_id`] +pub fn uninstall_module(mut deps: DepsMut, info: MessageInfo, module_id: String) -> AccountResult { + // only owner can uninstall modules + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + // module can only be uninstalled if there are no dependencies on it + let dependents = DEPENDENTS.may_load(deps.storage, &module_id)?; + if let Some(dependents) = dependents { + if !dependents.is_empty() { + return Err(AccountError::ModuleHasDependents(Vec::from_iter( + dependents, + ))); + } + // Remove the module from the dependents list + DEPENDENTS.remove(deps.storage, &module_id); + } + + // Remove module as dependant from its dependencies. + let module_data = crate::versioning::load_module_data(deps.as_ref(), &module_id)?; + let module_dependencies = module_data.dependencies; + crate::versioning::remove_as_dependent(deps.storage, &module_id, module_dependencies)?; + + // Remove for proxy if needed + let config = CONFIG.load(deps.storage)?; + let vc = VersionControlContract::new(config.version_control_address); + + let module = vc.query_module( + ModuleInfo::from_id(&module_data.module, module_data.version.into())?, + &deps.querier, + )?; + + // Remove module from whitelist if it supposed to be removed + if module.should_be_whitelisted() { + _remove_whitelist_module(deps.branch(), module_id.clone())?; + } + ACCOUNT_MODULES.remove(deps.storage, &module_id); + + let response = AccountResponse::new("uninstall_module", vec![("module", &module_id)]); + Ok(response) +} + +/// Execute the [`exec_msg`] on the provided [`module_id`], +pub fn exec_on_module( + deps: DepsMut, + info: MessageInfo, + module_id: String, + exec_msg: Binary, +) -> AccountResult { + // only owner can forward messages to modules + ownership::assert_nested_owner(deps.storage, &deps.querier, &info.sender)?; + + let module_addr = load_module_addr(deps.storage, &module_id)?; + + let response = AccountResponse::new("exec_on_module", vec![("module", module_id)]).add_message( + CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: module_addr.into(), + msg: exec_msg, + funds: info.funds, + }), + ); + + Ok(response) +} + +/// Checked load of a module address +pub fn load_module_addr(storage: &dyn Storage, module_id: &String) -> AccountResult { + ACCOUNT_MODULES + .may_load(storage, module_id)? + .ok_or_else(|| AccountError::ModuleNotFound(module_id.clone())) +} + +/// Query Version Control for the [`Module`] given the provided [`ContractVersion`] +pub fn query_module( + deps: Deps, + module_info: ModuleInfo, + old_contract_version: Option, +) -> Result { + let config = CONFIG.load(deps.storage)?; + // Construct feature object to access registry functions + let version_control = VersionControlContract::new(config.version_control_address); + + let module = match &module_info.version { + ModuleVersion::Version(new_version) => { + let old_contract = old_contract_version.unwrap(); + + let new_version = new_version.parse::().unwrap(); + let old_version = old_contract.version.parse::().unwrap(); + + if new_version < old_version { + return Err(AccountError::OlderVersion( + new_version.to_string(), + old_version.to_string(), + )); + } + Module { + info: module_info.clone(), + reference: version_control + .query_module_reference_raw(&module_info, &deps.querier)?, + } + } + ModuleVersion::Latest => { + // Query latest version of contract + version_control.query_module(module_info.clone(), &deps.querier)? + } + }; + + Ok(ModuleResponse { + module: Module { + info: module.info, + reference: module.reference, + }, + config: version_control.query_config(module_info, &deps.querier)?, + }) +} + +#[inline(always)] +fn configure_adapter( + adapter_address: impl Into, + message: AdapterBaseMsg, +) -> StdResult { + let adapter_msg: AdapterExecMsg = BaseExecuteMsg { + account_adress: None, + msg: message, + } + .into(); + Ok(wasm_execute(adapter_address, &adapter_msg, vec![])?.into()) +} + +/// Add a contract to the whitelist +fn _whitelist_modules(deps: DepsMut, modules: Vec) -> AccountResult<()> { + let mut whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; + + // This is a limit to prevent potentially running out of gas when doing lookups on the modules list + if whitelisted_modules.0.len() >= LIST_SIZE_LIMIT { + return Err(AccountError::ModuleLimitReached {}); + } + + for module in modules.iter() { + let module_addr = deps.api.addr_validate(module)?; + + if whitelisted_modules.0.contains(&module_addr) { + return Err(AccountError::AlreadyWhitelisted(module.clone())); + } + + // Add contract to whitelist. + whitelisted_modules.0.push(module_addr); + } + + WHITELISTED_MODULES.save(deps.storage, &whitelisted_modules)?; + + Ok(()) +} + +/// Remove a contract from the whitelist +fn _remove_whitelist_module(deps: DepsMut, module: String) -> AccountResult<()> { + WHITELISTED_MODULES.update(deps.storage, |mut whitelisted_modules| { + let module_address = deps.api.addr_validate(&module)?; + + if !whitelisted_modules.0.contains(&module_address) { + return Err(AccountError::NotWhitelisted(module.clone())); + } + // Remove contract from whitelist. + whitelisted_modules.0.retain(|addr| *addr != module_address); + Ok(whitelisted_modules) + })?; + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + mod add_module_upgrade_to_context { + use super::*; + + #[test] + fn should_allow_migrate_msg() -> ManagerTestResult { + let mut deps = mock_dependencies(); + mock_init(&mut deps)?; + let storage = deps.as_mut().storage; + + let result = add_module_upgrade_to_context(storage, TEST_MODULE_ID, vec![]); + assert_that!(result).is_ok(); + + let upgraded_modules: Vec<(String, Vec)> = + MIGRATE_CONTEXT.load(storage).unwrap(); + + assert_that!(upgraded_modules).has_length(1); + assert_eq!(upgraded_modules[0].0, TEST_MODULE_ID); + + Ok(()) + } + } + + mod update_module_addresses { + use super::*; + + #[test] + fn manual_adds_module_to_account_modules() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let module1_addr = deps.api.addr_make("module1"); + let module2_addr = deps.api.addr_make("module2"); + + mock_init(&mut deps).unwrap(); + + let to_add: Vec<(String, String)> = vec![ + ("test:module1".to_string(), module1_addr.to_string()), + ("test:module2".to_string(), module2_addr.to_string()), + ]; + + let res = update_module_addresses(deps.as_mut(), Some(to_add.clone()), Some(vec![])); + assert_that!(&res).is_ok(); + + let actual_modules = load_account_modules(&deps.storage)?; + + speculoos::prelude::VecAssertions::has_length( + &mut assert_that!(&actual_modules), + // Plus proxy + to_add.len() + 1, + ); + for (module_id, addr) in to_add { + speculoos::iter::ContainingIntoIterAssertions::contains( + &mut assert_that!(&actual_modules), + &(module_id, Addr::unchecked(addr)), + ); + } + + Ok(()) + } + + #[test] + fn missing_id() -> ManagerTestResult { + let mut deps = mock_dependencies(); + + mock_init(&mut deps).unwrap(); + + let to_add: Vec<(String, String)> = vec![("".to_string(), "module1_addr".to_string())]; + + let res = update_module_addresses(deps.as_mut(), Some(to_add), Some(vec![])); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::InvalidModuleName {}); + + Ok(()) + } + + #[test] + fn manual_removes_module_from_account_modules() -> ManagerTestResult { + let mut deps = mock_dependencies(); + mock_init(&mut deps)?; + + // manually add module + ACCOUNT_MODULES.save( + &mut deps.storage, + "test:module", + &Addr::unchecked("test_module_addr"), + )?; + + let to_remove: Vec = vec!["test:module".to_string()]; + + let res = update_module_addresses(deps.as_mut(), Some(vec![]), Some(to_remove)); + assert_that!(&res).is_ok(); + + let actual_modules = load_account_modules(&deps.storage)?; + + // Only proxy left + speculoos::prelude::VecAssertions::has_length(&mut assert_that!(&actual_modules), 1); + + Ok(()) + } + + #[test] + fn disallows_removing_proxy() -> ManagerTestResult { + let mut deps = mock_dependencies(); + init_with_proxy(&mut deps); + + let to_remove: Vec = vec![ACCOUNT.to_string()]; + + let res = update_module_addresses(deps.as_mut(), Some(vec![]), Some(to_remove)); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::CannotRemoveProxy {}); + + Ok(()) + } + + #[test] + fn only_account_owner() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + let not_account_factory = deps.api.addr_make("not_account_factory"); + let module_addr = deps.api.addr_make("module_addr"); + mock_init(&mut deps)?; + + // add some thing + let action_add = InternalConfigAction::UpdateModuleAddresses { + to_add: Some(vec![("module:other".to_string(), module_addr.to_string())]), + to_remove: None, + }; + let msg = ExecuteMsg::UpdateInternalConfig(to_json_binary(&action_add).unwrap()); + + // the factory can not call this + let res = execute_as(deps.as_mut(), &abstr.account_factory, msg.clone()); + assert_that!(&res).is_err(); + + // only the owner can + let res = execute_as(deps.as_mut(), &owner, msg.clone()); + assert_that!(&res).is_ok(); + + let res = execute_as(deps.as_mut(), ¬_account_factory, msg); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::Ownership(GovOwnershipError::NotOwner)); + + Ok(()) + } + } + + // TODO: move those tests to integrations tests, since we can't do query in unit tests + mod install_module { + use super::*; + + #[test] + fn only_account_owner() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let not_owner = deps.api.addr_make("not_owner"); + mock_init(&mut deps)?; + + let msg = ExecuteMsg::InstallModules { + modules: vec![ModuleInstallConfig::new( + ModuleInfo::from_id_latest("test:module")?, + None, + )], + }; + + let res = execute_as(deps.as_mut(), ¬_owner, msg); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::Ownership(GovOwnershipError::NotOwner)); + + Ok(()) + } + } + + mod uninstall_module { + use std::collections::HashSet; + + use super::*; + + #[test] + fn only_owner() -> ManagerTestResult { + let msg = ExecuteMsg::UninstallModule { + module_id: "test:module".to_string(), + }; + + test_only_owner(msg) + } + + #[test] + fn errors_with_existing_dependents() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + init_with_proxy(&mut deps); + + let test_module = "test:module"; + let msg = ExecuteMsg::UninstallModule { + module_id: test_module.to_string(), + }; + + // manually add dependents + let dependents = HashSet::from_iter(vec!["test:dependent".to_string()]); + DEPENDENTS.save(&mut deps.storage, test_module, &dependents)?; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::ModuleHasDependents(Vec::from_iter( + dependents, + ))); + + Ok(()) + } + + #[test] + fn disallows_removing_proxy() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + init_with_proxy(&mut deps); + + let msg = ExecuteMsg::UninstallModule { + module_id: ACCOUNT.to_string(), + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::CannotRemoveProxy {}); + + Ok(()) + } + + // rest should be in integration tests + } + + mod exec_on_module { + use super::*; + + #[test] + fn only_owner() -> ManagerTestResult { + let msg = ExecuteMsg::ExecOnModule { + module_id: "test:module".to_string(), + exec_msg: to_json_binary(&"some msg")?, + }; + + test_only_owner(msg) + } + + #[test] + fn fails_with_nonexistent_module() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + + mock_init(&mut deps)?; + + let missing_module = "test:module".to_string(); + let msg = ExecuteMsg::ExecOnModule { + module_id: missing_module.clone(), + exec_msg: to_json_binary(&"some msg")?, + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res) + .is_err() + .is_equal_to(ManagerError::ModuleNotFound(missing_module)); + + Ok(()) + } + + #[test] + fn forwards_exec_to_module() -> ManagerTestResult { + let mut deps = mock_dependencies(); + let abstr = AbstractMockAddrs::new(deps.api); + let owner = abstr.owner; + + init_with_proxy(&mut deps); + + let exec_msg = "some msg"; + + let msg = ExecuteMsg::ExecOnModule { + module_id: ACCOUNT.to_string(), + exec_msg: to_json_binary(&exec_msg)?, + }; + + let res = execute_as(deps.as_mut(), &owner, msg); + assert_that!(&res).is_ok(); + + let msgs = res.unwrap().messages; + assert_that!(&msgs).has_length(1); + + let expected_msg: CosmosMsg = + wasm_execute(abstr.account.proxy, &exec_msg, vec![])?.into(); + + let actual_msg = &msgs[0]; + assert_that!(&actual_msg.msg).is_equal_to(&expected_msg); + + Ok(()) + } + } +} + +#[cfg(test)] +mod test { + #![allow(clippy::needless_borrows_for_generic_args)] + use super::*; + + use crate::{contract::execute, test_common::*}; + use abstract_std::proxy::ExecuteMsg; + use abstract_testing::prelude::*; + use cosmwasm_std::{ + testing::{message_info, mock_dependencies, mock_env, MockApi, MOCK_CONTRACT_ADDR}, + Addr, OwnedDeps, Storage, + }; + use speculoos::prelude::*; + + const TEST_MODULE: &str = "module"; + + type MockDeps = OwnedDeps; + + pub fn execute_as_admin(deps: &mut MockDeps, msg: ExecuteMsg) -> ProxyResult { + let base = test_account_base(deps.api); + let info = message_info(&base.manager, &[]); + execute(deps.as_mut(), mock_env(), info, msg) + } + + fn load_modules(storage: &dyn Storage) -> Vec { + STATE.load(storage).unwrap().modules + } + + mod add_module { + use super::*; + + use cw_controllers::AdminError; + + #[test] + fn only_admin_can_add_module() { + let mut deps = mock_dependencies(); + mock_init(&mut deps); + + let test_module_addr = deps.api.addr_make(TEST_MODULE); + let msg = ExecuteMsg::AddModules { + modules: vec![test_module_addr.to_string()], + }; + let info = message_info(&deps.api.addr_make("not_admin"), &[]); + + let res = execute(deps.as_mut(), mock_env(), info, msg); + assert_that(&res) + .is_err() + .is_equal_to(ProxyError::Admin(AdminError::NotAdmin {})) + } + + #[test] + fn add_module() { + let mut deps = mock_dependencies(); + mock_init(&mut deps); + + let test_module_addr = deps.api.addr_make(TEST_MODULE); + let msg = ExecuteMsg::AddModules { + modules: vec![test_module_addr.to_string()], + }; + + let res = execute_as_admin(&mut deps, msg); + assert_that(&res).is_ok(); + + let actual_modules = load_modules(&deps.storage); + // Plus manager + assert_that(&actual_modules).has_length(2); + assert_that(&actual_modules).contains(&test_module_addr); + } + + #[test] + fn fails_adding_previously_added_module() { + let mut deps = mock_dependencies(); + mock_init(&mut deps); + + let test_module_addr = deps.api.addr_make(TEST_MODULE); + let msg = ExecuteMsg::AddModules { + modules: vec![test_module_addr.to_string()], + }; + + let res = execute_as_admin(&mut deps, msg.clone()); + assert_that(&res).is_ok(); + + let res = execute_as_admin(&mut deps, msg); + assert_that(&res) + .is_err() + .is_equal_to(ProxyError::AlreadyWhitelisted(test_module_addr.to_string())); + } + + #[test] + fn fails_adding_module_when_list_is_full() { + let mut deps = mock_dependencies(); + mock_init(&mut deps); + + let test_module_addr = deps.api.addr_make(TEST_MODULE); + let mut msg = ExecuteMsg::AddModules { + modules: vec![test_module_addr.to_string()], + }; + + // -1 because manager counts as module as well + for i in 0..LIST_SIZE_LIMIT - 1 { + let test_module = format!("module_{i}"); + let test_module_addr = deps.api.addr_make(&test_module); + msg = ExecuteMsg::AddModules { + modules: vec![test_module_addr.to_string()], + }; + let res = execute_as_admin(&mut deps, msg.clone()); + assert_that(&res).is_ok(); + } + + let res = execute_as_admin(&mut deps, msg); + assert_that(&res) + .is_err() + .is_equal_to(ProxyError::ModuleLimitReached {}); + } + } + + type ProxyTestResult = Result<(), ProxyError>; + + mod remove_module { + use abstract_std::proxy::state::State; + use cw_controllers::AdminError; + + use super::*; + + #[test] + fn only_admin() { + let mut deps = mock_dependencies(); + mock_init(&mut deps); + + let msg = ExecuteMsg::RemoveModule { + module: TEST_MODULE.to_string(), + }; + let info = message_info(&deps.api.addr_make("not_admin"), &[]); + + let res = execute(deps.as_mut(), mock_env(), info, msg); + assert_that(&res) + .is_err() + .is_equal_to(ProxyError::Admin(AdminError::NotAdmin {})) + } + + #[test] + fn remove_module() -> ProxyTestResult { + let mut deps = mock_dependencies(); + mock_init(&mut deps); + + let test_module_addr = deps.api.addr_make(TEST_MODULE); + STATE.save( + &mut deps.storage, + &State { + modules: vec![test_module_addr.clone()], + }, + )?; + + let msg = ExecuteMsg::RemoveModule { + module: test_module_addr.to_string(), + }; + let res = execute_as_admin(&mut deps, msg); + assert_that(&res).is_ok(); + + let actual_modules = load_modules(&deps.storage); + assert_that(&actual_modules).is_empty(); + + Ok(()) + } + + #[test] + fn fails_removing_non_existing_module() { + let mut deps = mock_dependencies(); + mock_init(&mut deps); + + let test_module_addr = deps.api.addr_make(TEST_MODULE); + let msg = ExecuteMsg::RemoveModule { + module: test_module_addr.to_string(), + }; + + let res = execute_as_admin(&mut deps, msg); + assert_that(&res) + .is_err() + .is_equal_to(ProxyError::NotWhitelisted(test_module_addr.to_string())); + } + } +} diff --git a/framework/contracts/account/account/src/modules/migration.rs b/framework/contracts/account/src/modules/migration.rs similarity index 99% rename from framework/contracts/account/account/src/modules/migration.rs rename to framework/contracts/account/src/modules/migration.rs index 339cb19282..0db3a57498 100644 --- a/framework/contracts/account/account/src/modules/migration.rs +++ b/framework/contracts/account/src/modules/migration.rs @@ -99,6 +99,7 @@ pub fn upgrade_modules( .add_messages(upgrade_msgs) .add_message(callback_msg)) } + pub fn set_migrate_msgs_and_context( deps: DepsMut, module_info: ModuleInfo, diff --git a/framework/contracts/account/account/src/queries.rs b/framework/contracts/account/src/queries.rs similarity index 74% rename from framework/contracts/account/account/src/queries.rs rename to framework/contracts/account/src/queries.rs index 55d187cd53..89ea52a30c 100644 --- a/framework/contracts/account/account/src/queries.rs +++ b/framework/contracts/account/src/queries.rs @@ -4,7 +4,7 @@ use abstract_sdk::feature_objects::VersionControlContract; use abstract_std::{ account::{ responses::{ - ConfigResponse, InfoResponse, ManagerModuleInfo, ModuleAddressesResponse, + AccountModuleInfo, ConfigResponse, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, ModuleVersionsResponse, SubAccountIdsResponse, }, state::{AccountInfo, ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, INFO}, @@ -77,10 +77,10 @@ pub fn handle_module_info_query( let config = CONFIG.load(deps.storage)?; let version_control = VersionControlContract::new(config.version_control_address); - let mut resp_vec: Vec = vec![]; + let mut resp_vec: Vec = vec![]; for (id, address) in ids_and_addr.into_iter() { let version = query_module_version(deps, address.clone(), &version_control)?; - resp_vec.push(ManagerModuleInfo { + resp_vec.push(AccountModuleInfo { id, version, address, @@ -190,3 +190,71 @@ pub fn query_module_addresses( } Ok(modules) } + +#[cfg(test)] +mod test { + #![allow(clippy::needless_borrows_for_generic_args)] + use super::*; + + use crate::contract::{execute, instantiate, query, ProxyResult}; + use abstract_std::proxy::{ExecuteMsg, InstantiateMsg}; + use abstract_testing::prelude::*; + use cosmwasm_std::{ + testing::{message_info, mock_dependencies, mock_env, MockApi}, + OwnedDeps, + }; + + type MockDeps = OwnedDeps; + + fn mock_init(deps: &mut MockDeps) { + let abstr = AbstractMockAddrs::new(deps.api); + let info = message_info(&abstr.owner, &[]); + let msg = InstantiateMsg { + account_id: TEST_ACCOUNT_ID, + ans_host_address: abstr.ans_host.to_string(), + manager_addr: abstr.account.manager.to_string(), + }; + let _res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + } + + pub fn execute_as_admin(deps: &mut MockDeps, msg: ExecuteMsg) -> ProxyResult { + let abstr = AbstractMockAddrs::new(deps.api); + let info = message_info(&abstr.account.manager, &[]); + execute(deps.as_mut(), mock_env(), info, msg) + } + + #[test] + fn query_config() { + let mut deps = mock_dependencies(); + deps.querier = MockAnsHost::new(deps.api).with_defaults().to_querier(); + mock_init(&mut deps); + let abstr = AbstractMockAddrs::new(deps.api); + + execute_as_admin( + &mut deps, + ExecuteMsg::AddModules { + modules: vec![abstr.module_address.to_string()], + }, + ) + .unwrap(); + + let config: ConfigResponse = from_json( + query( + deps.as_ref(), + mock_env(), + abstract_std::proxy::QueryMsg::Config {}, + ) + .unwrap(), + ) + .unwrap(); + assert_eq!( + config, + ConfigResponse { + modules: vec![ + abstr.account.manager.to_string(), + abstr.module_address.to_string() + ], + } + ); + } +} diff --git a/framework/contracts/account/account/src/reply.rs b/framework/contracts/account/src/reply.rs similarity index 100% rename from framework/contracts/account/account/src/reply.rs rename to framework/contracts/account/src/reply.rs diff --git a/framework/contracts/account/account/src/sub_account.rs b/framework/contracts/account/src/sub_account.rs similarity index 100% rename from framework/contracts/account/account/src/sub_account.rs rename to framework/contracts/account/src/sub_account.rs diff --git a/framework/contracts/account/account/src/versioning.rs b/framework/contracts/account/src/versioning.rs similarity index 100% rename from framework/contracts/account/account/src/versioning.rs rename to framework/contracts/account/src/versioning.rs diff --git a/framework/contracts/account/account/tests/README.md b/framework/contracts/account/tests/README.md similarity index 100% rename from framework/contracts/account/account/tests/README.md rename to framework/contracts/account/tests/README.md diff --git a/framework/contracts/account/account/tests/adapters.rs b/framework/contracts/account/tests/adapters.rs similarity index 100% rename from framework/contracts/account/account/tests/adapters.rs rename to framework/contracts/account/tests/adapters.rs diff --git a/framework/contracts/account/account/tests/apps.rs b/framework/contracts/account/tests/apps.rs similarity index 100% rename from framework/contracts/account/account/tests/apps.rs rename to framework/contracts/account/tests/apps.rs diff --git a/framework/contracts/account/account/tests/ibc-client.rs b/framework/contracts/account/tests/ibc-client.rs similarity index 100% rename from framework/contracts/account/account/tests/ibc-client.rs rename to framework/contracts/account/tests/ibc-client.rs diff --git a/framework/contracts/account/account/tests/install_modules.rs b/framework/contracts/account/tests/install_modules.rs similarity index 100% rename from framework/contracts/account/account/tests/install_modules.rs rename to framework/contracts/account/tests/install_modules.rs diff --git a/framework/contracts/account/account/tests/proxy.rs b/framework/contracts/account/tests/proxy.rs similarity index 100% rename from framework/contracts/account/account/tests/proxy.rs rename to framework/contracts/account/tests/proxy.rs diff --git a/framework/contracts/account/account/tests/snapshots/adapters__account_install_adapter.snap b/framework/contracts/account/tests/snapshots/adapters__account_install_adapter.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/adapters__account_install_adapter.snap rename to framework/contracts/account/tests/snapshots/adapters__account_install_adapter.snap diff --git a/framework/contracts/account/account/tests/snapshots/adapters__install_one_adapter.snap b/framework/contracts/account/tests/snapshots/adapters__install_one_adapter.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/adapters__install_one_adapter.snap rename to framework/contracts/account/tests/snapshots/adapters__install_one_adapter.snap diff --git a/framework/contracts/account/account/tests/snapshots/adapters__install_one_adapter_with_fee.snap b/framework/contracts/account/tests/snapshots/adapters__install_one_adapter_with_fee.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/adapters__install_one_adapter_with_fee.snap rename to framework/contracts/account/tests/snapshots/adapters__install_one_adapter_with_fee.snap diff --git a/framework/contracts/account/account/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap b/framework/contracts/account/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap rename to framework/contracts/account/tests/snapshots/adapters__installing_specific_version_should_install_expected.snap diff --git a/framework/contracts/account/account/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap b/framework/contracts/account/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap rename to framework/contracts/account/tests/snapshots/adapters__reinstalling_adapter_should_be_allowed.snap diff --git a/framework/contracts/account/account/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap b/framework/contracts/account/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap rename to framework/contracts/account/tests/snapshots/adapters__reinstalling_new_version_should_install_latest.snap diff --git a/framework/contracts/account/account/tests/snapshots/apps__account_install_app.snap b/framework/contracts/account/tests/snapshots/apps__account_install_app.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/apps__account_install_app.snap rename to framework/contracts/account/tests/snapshots/apps__account_install_app.snap diff --git a/framework/contracts/account/account/tests/snapshots/apps__execute_on_proxy_through_manager.snap b/framework/contracts/account/tests/snapshots/apps__execute_on_proxy_through_manager.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/apps__execute_on_proxy_through_manager.snap rename to framework/contracts/account/tests/snapshots/apps__execute_on_proxy_through_manager.snap diff --git a/framework/contracts/account/account/tests/snapshots/install_modules__adds_module_to_account_modules.snap b/framework/contracts/account/tests/snapshots/install_modules__adds_module_to_account_modules.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/install_modules__adds_module_to_account_modules.snap rename to framework/contracts/account/tests/snapshots/install_modules__adds_module_to_account_modules.snap diff --git a/framework/contracts/account/account/tests/snapshots/proxy__default_without_response_data.snap b/framework/contracts/account/tests/snapshots/proxy__default_without_response_data.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/proxy__default_without_response_data.snap rename to framework/contracts/account/tests/snapshots/proxy__default_without_response_data.snap diff --git a/framework/contracts/account/account/tests/snapshots/proxy__exec_through_manager.snap b/framework/contracts/account/tests/snapshots/proxy__exec_through_manager.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/proxy__exec_through_manager.snap rename to framework/contracts/account/tests/snapshots/proxy__exec_through_manager.snap diff --git a/framework/contracts/account/account/tests/snapshots/proxy__instantiate_proxy.snap b/framework/contracts/account/tests/snapshots/proxy__instantiate_proxy.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/proxy__instantiate_proxy.snap rename to framework/contracts/account/tests/snapshots/proxy__instantiate_proxy.snap diff --git a/framework/contracts/account/account/tests/snapshots/proxy__proxy_install_multiple_modules.snap b/framework/contracts/account/tests/snapshots/proxy__proxy_install_multiple_modules.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/proxy__proxy_install_multiple_modules.snap rename to framework/contracts/account/tests/snapshots/proxy__proxy_install_multiple_modules.snap diff --git a/framework/contracts/account/account/tests/snapshots/proxy__proxy_install_standalone_modules.snap b/framework/contracts/account/tests/snapshots/proxy__proxy_install_standalone_modules.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/proxy__proxy_install_standalone_modules.snap rename to framework/contracts/account/tests/snapshots/proxy__proxy_install_standalone_modules.snap diff --git a/framework/contracts/account/account/tests/snapshots/proxy__proxy_with_response_data.snap b/framework/contracts/account/tests/snapshots/proxy__proxy_with_response_data.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/proxy__proxy_with_response_data.snap rename to framework/contracts/account/tests/snapshots/proxy__proxy_with_response_data.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap b/framework/contracts/account/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap rename to framework/contracts/account/tests/snapshots/subaccount__account_move_ownership_to_falsy_sub_account.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap b/framework/contracts/account/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap rename to framework/contracts/account/tests/snapshots/subaccount__account_move_ownership_to_sub_account.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap b/framework/contracts/account/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap rename to framework/contracts/account/tests/snapshots/subaccount__creating_on_subaccount_should_succeed.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap b/framework/contracts/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap rename to framework/contracts/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed-contract1.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap b/framework/contracts/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap rename to framework/contracts/account/tests/snapshots/subaccount__installed_app_updating_on_subaccount_should_succeed.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap b/framework/contracts/account/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap rename to framework/contracts/account/tests/snapshots/subaccount__proxy_updating_on_subaccount_should_succeed.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap b/framework/contracts/account/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap rename to framework/contracts/account/tests/snapshots/subaccount__recursive_updating_on_subaccount_should_succeed.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__sub_account_move_ownership.snap b/framework/contracts/account/tests/snapshots/subaccount__sub_account_move_ownership.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__sub_account_move_ownership.snap rename to framework/contracts/account/tests/snapshots/subaccount__sub_account_move_ownership.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap b/framework/contracts/account/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap rename to framework/contracts/account/tests/snapshots/subaccount__sub_account_move_ownership_to_sub_account.snap diff --git a/framework/contracts/account/account/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap b/framework/contracts/account/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap similarity index 100% rename from framework/contracts/account/account/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap rename to framework/contracts/account/tests/snapshots/subaccount__updating_on_subaccount_should_succeed.snap diff --git a/framework/contracts/account/account/tests/standalones.rs b/framework/contracts/account/tests/standalones.rs similarity index 100% rename from framework/contracts/account/account/tests/standalones.rs rename to framework/contracts/account/tests/standalones.rs diff --git a/framework/contracts/account/account/tests/subaccount.rs b/framework/contracts/account/tests/subaccount.rs similarity index 100% rename from framework/contracts/account/account/tests/subaccount.rs rename to framework/contracts/account/tests/subaccount.rs diff --git a/framework/contracts/account/account/tests/upgrades.rs b/framework/contracts/account/tests/upgrades.rs similarity index 100% rename from framework/contracts/account/account/tests/upgrades.rs rename to framework/contracts/account/tests/upgrades.rs diff --git a/framework/contracts/native/account-factory/src/commands.rs b/framework/contracts/native/account-factory/src/commands.rs index 3405cc9f86..489fe6d4ee 100644 --- a/framework/contracts/native/account-factory/src/commands.rs +++ b/framework/contracts/native/account-factory/src/commands.rs @@ -1,19 +1,16 @@ use abstract_sdk::{ feature_objects::VersionControlContract, std::{ - manager::InstantiateMsg as ManagerInstantiateMsg, - manager::ModuleInstallConfig, + account::InstantiateMsg as AccountInstantiateMsg, + account::ModuleInstallConfig, module_factory::SimulateInstallModulesResponse, objects::{ account::AccountTrace, module::assert_module_data_validity, salt::generate_instantiate_salt, AccountId, ABSTRACT_ACCOUNT_ID, }, objects::{ - gov_type::GovernanceDetails, - module::{Module, ModuleInfo}, - module_reference::ModuleReference, + gov_type::GovernanceDetails, module::ModuleInfo, module_reference::ModuleReference, }, - proxy::InstantiateMsg as ProxyInstantiateMsg, version_control::{Account, ExecuteMsg as VCExecuteMsg}, AbstractError, ACCOUNT, IBC_HOST, }, @@ -111,18 +108,10 @@ pub fn execute_create_account( }; // Query version_control for code_id of Proxy and Module contract - let (manager_module, proxy_module) = { - let mut modules = version_control.query_modules_configs( - vec![ - ModuleInfo::from_id_latest(ACCOUNT)?, - ModuleInfo::from_id_latest(ACCOUNT)?, - ], - &deps.querier, - )?; - let manager_module: Module = modules.pop().unwrap().module; - let proxy_module: Module = modules.pop().unwrap().module; - - (manager_module, proxy_module) + let account_module = { + let mut modules = version_control + .query_modules_configs(vec![ModuleInfo::from_id_latest(ACCOUNT)?], &deps.querier)?; + modules.pop().unwrap().module }; let simulate_resp: SimulateInstallModulesResponse = deps.querier.query_wasm_smart( @@ -159,60 +148,41 @@ pub fn execute_create_account( let salt = generate_instantiate_salt(&account_id); // Get code_ids - let (proxy_code_id, manager_code_id) = if let ( - ModuleReference::AccountBase(proxy_code_id), - ModuleReference::AccountBase(manager_code_id), - ) = ( - proxy_module.reference.clone(), - manager_module.reference.clone(), - ) { - (proxy_code_id, manager_code_id) - } else { - return Err(AccountFactoryError::WrongModuleKind( - proxy_module.info.to_string(), - "account_base".to_string(), - )); - }; + let account_code_id = + if let ModuleReference::AccountBase(account_code_id) = account_module.reference.clone() { + account_code_id + } else { + return Err(AccountFactoryError::WrongModuleKind( + account_module.info.to_string(), + "account_base".to_string(), + )); + }; // Get checksums - let proxy_checksum = deps.querier.query_wasm_code_info(proxy_code_id)?.checksum; - let manager_checksum = deps.querier.query_wasm_code_info(manager_code_id)?.checksum; + let account_checksum = deps.querier.query_wasm_code_info(account_code_id)?.checksum; - let proxy_addr = instantiate2_address( - proxy_checksum.as_slice(), - &deps.api.addr_canonicalize(env.contract.address.as_str())?, - salt.as_slice(), - )?; - let proxy_addr_human = deps.api.addr_humanize(&proxy_addr)?; - let manager_addr = instantiate2_address( - manager_checksum.as_slice(), + let account_addr = instantiate2_address( + account_checksum.as_slice(), &deps.api.addr_canonicalize(env.contract.address.as_str())?, salt.as_slice(), )?; - let manager_addr_human = deps.api.addr_humanize(&manager_addr)?; + let account_addr_human = deps.api.addr_humanize(&account_addr)?; - let account_base = Account::new(manager_addr_human); + let account_base = Account::new(account_addr_human); // save context for after-init check let context = Context { account_id, account_base: account_base.clone(), - manager_module, - proxy_module, + account_module, }; CONTEXT.save(deps.storage, &context)?; - let proxy_message = ProxyInstantiateMsg { - account_id: context.account_id, - ans_host_address: config.ans_host_contract.to_string(), - manager_addr: context.account_base.addr().to_string(), - }; - // Add Account base to version_control let add_account_to_version_control_msg: CosmosMsg = CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: config.version_control_contract.to_string(), funds: funds_for_namespace_fee, msg: to_json_binary(&VCExecuteMsg::AddAccount { - account_id: proxy_message.account_id.clone(), + account_id: context.account_id.clone(), account_base: context.account_base, namespace: namespace.clone(), })?, @@ -229,8 +199,8 @@ pub fn execute_create_account( if let Some(link) = &link { metadata_attributes.push(("link", link.clone())) } - if let Some(namespace) = namespace { - metadata_attributes.push(("namespace", namespace)) + if let Some(namespace) = &namespace { + metadata_attributes.push(("namespace", namespace.clone())) } // The execution order here is important. @@ -243,11 +213,8 @@ pub fn execute_create_account( "create_account", [ vec![ - ( - "account_sequence", - proxy_message.account_id.seq().to_string(), - ), - ("trace", proxy_message.account_id.trace().to_string()), + ("account_sequence", context.account_id.seq().to_string()), + ("trace", context.account_id.trace().to_string()), ], metadata_attributes, ] @@ -255,33 +222,25 @@ pub fn execute_create_account( ) // So first register account on version control .add_message(add_account_to_version_control_msg) - // Then instantiate proxy - .add_message(WasmMsg::Instantiate2 { - code_id: proxy_code_id, - funds: funds_to_proxy.into_vec(), - admin: Some(account_base.addr().to_string()), - label: format!("Proxy of Account: {}", proxy_message.account_id), - msg: to_json_binary(&proxy_message)?, - salt: salt.clone(), - }) - // Instantiate manager and install apps + // Instantiate account and install apps // And validate contract versions in a callback .add_submessage(SubMsg::reply_on_success( WasmMsg::Instantiate2 { - code_id: manager_code_id, + code_id: account_code_id, funds: funds_for_install, admin: Some(account_base.addr().to_string()), - label: format!("Manager of Account: {}", proxy_message.account_id), - msg: to_json_binary(&ManagerInstantiateMsg { - account_id: proxy_message.account_id, + label: format!("Manager of Account: {}", context.account_id), + msg: to_json_binary(&AccountInstantiateMsg { + account_id: Some(context.account_id), owner: governance.into(), version_control_address: config.version_control_contract.into_string(), module_factory_address: config.module_factory_address.into_string(), - proxy_addr: account_base.into_addr().into_string(), name, description, link, install_modules, + namespace, + ans_host_address: config.ans_host_contract.into_string(), })?, salt, }, @@ -312,15 +271,10 @@ pub fn validate_instantiated_account(deps: DepsMut, _result: SubMsgResult) -> Ac let account_base = context.account_base; let account_id = context.account_id; - // assert proxy and manager contract information is correct - assert_module_data_validity( - &deps.querier, - &context.manager_module, - Some(account_base.addr().clone()), - )?; + // assert account contract information is correct assert_module_data_validity( &deps.querier, - &context.proxy_module, + &context.account_module, Some(account_base.addr().clone()), )?; diff --git a/framework/contracts/native/ibc-client/src/commands.rs b/framework/contracts/native/ibc-client/src/commands.rs index af6212e70b..61cedf0751 100644 --- a/framework/contracts/native/ibc-client/src/commands.rs +++ b/framework/contracts/native/ibc-client/src/commands.rs @@ -6,6 +6,7 @@ use abstract_sdk::{ }; use abstract_std::{ account, + account::ModuleInstallConfig, app::AppState, ibc::{Callback, ModuleQuery}, ibc_client::{ @@ -13,7 +14,6 @@ use abstract_std::{ IbcClientCallback, InstalledModuleIdentification, }, ibc_host::{self, HostAction, InternalAction}, - manager::{self, ModuleInstallConfig}, objects::{ module::ModuleInfo, module_reference::ModuleReference, AccountId, ChannelEntry, TruncatedChainId, @@ -257,7 +257,7 @@ pub fn execute_send_module_to_module_packet( .version_control .account_id(account.addr(), &deps.querier)?; let account_base = cfg.version_control.account(&account_id, &deps.querier)?; - let ibc_client = manager::state::ACCOUNT_MODULES.query( + let ibc_client = account::state::ACCOUNT_MODULES.query( &deps.querier, account_base.into_addr(), IBC_CLIENT, @@ -385,9 +385,9 @@ pub fn execute_register_account( let account_id = account_base.account_id(deps.as_ref())?; // get auxiliary information - let account_info: account::InfoResponse = deps + let account_info: account::responses::InfoResponse = deps .querier - .query_wasm_smart(account_base.addr(), &manager::QueryMsg::Info {})?; + .query_wasm_smart(account_base.addr(), &account::QueryMsg::Info {})?; let account_info = account_info.info; let note_message = send_remote_host_action( diff --git a/framework/contracts/native/ibc-client/src/contract.rs b/framework/contracts/native/ibc-client/src/contract.rs index ddb8956dad..1080d87d31 100644 --- a/framework/contracts/native/ibc-client/src/contract.rs +++ b/framework/contracts/native/ibc-client/src/contract.rs @@ -468,8 +468,8 @@ mod tests { use std::str::FromStr; use abstract_std::{ + account, ibc_host::{self, HostAction, InternalAction}, - manager, objects::{version_control::VersionControlError, TruncatedChainId}, }; @@ -491,7 +491,7 @@ mod tests { let msg = ExecuteMsg::RemoteAction { host_chain: chain_name, action: HostAction::Dispatch { - manager_msgs: vec![manager::ExecuteMsg::UpdateInfo { + manager_msgs: vec![account::ExecuteMsg::UpdateInfo { name: None, description: None, link: None, diff --git a/framework/contracts/native/ibc-host/src/account_commands.rs b/framework/contracts/native/ibc-host/src/account_commands.rs index 61a1d321e3..16775ab6a3 100644 --- a/framework/contracts/native/ibc-host/src/account_commands.rs +++ b/framework/contracts/native/ibc-host/src/account_commands.rs @@ -3,11 +3,11 @@ use abstract_sdk::{ Resolve, }; use abstract_std::{ - account, account_factory, + account, + account::ModuleInstallConfig, + account_factory, ibc_host::state::CONFIG, - manager::{self, ModuleInstallConfig}, objects::{AccountId, TruncatedChainId}, - proxy, version_control::Account, ACCOUNT, }; @@ -144,9 +144,9 @@ pub fn send_all_back( // call the message to send everything back through the manager let manager_msg = wasm_execute( account.into_addr(), - &manager::ExecuteMsg::ExecOnModule { + &account::ExecuteMsg::ExecOnModule { module_id: ACCOUNT.into(), - exec_msg: to_json_binary(&proxy::ExecuteMsg::ModuleAction { msgs })?, + exec_msg: to_json_binary(&account::ExecuteMsg::ModuleAction { msgs })?, }, vec![], )?; diff --git a/framework/packages/abstract-adapter/src/endpoints/execute.rs b/framework/packages/abstract-adapter/src/endpoints/execute.rs index ed25facc83..100b4cb7eb 100644 --- a/framework/packages/abstract-adapter/src/endpoints/execute.rs +++ b/framework/packages/abstract-adapter/src/endpoints/execute.rs @@ -4,8 +4,8 @@ use abstract_sdk::{ AbstractResponse, AccountVerification, }; use abstract_std::{ + account::state::ACCOUNT_MODULES, adapter::{AdapterBaseMsg, AdapterExecuteMsg, AdapterRequestMsg, BaseExecuteMsg, ExecuteMsg}, - manager::state::ACCOUNT_MODULES, objects::ownership::nested_admin::query_top_level_owner_addr, }; use cosmwasm_std::{Addr, Deps, DepsMut, Env, MessageInfo, QuerierWrapper, Response, StdResult}; @@ -63,13 +63,16 @@ impl AdapterResult { - let BaseExecuteMsg { proxy_address, msg } = message; + let BaseExecuteMsg { + account_adress, + msg, + } = message; let account_registry = self.account_registry(deps.as_ref())?; - let account_base = match proxy_address { - // If proxy address provided, check if the sender is a direct or nested owner for this account. - Some(requested_proxy) => { - let proxy_address = deps.api.addr_validate(&requested_proxy)?; - let requested_core = account_registry.assert_proxy(&proxy_address)?; + let account_base = match account_adress { + // If account address provided, check if the sender is a direct or nested owner for this account. + Some(requested_account) => { + let account_address = deps.api.addr_validate(&requested_account)?; + let requested_core = account_registry.assert_account(&account_address)?; if requested_core.addr() == info.sender || is_top_level_owner( &deps.querier, @@ -87,7 +90,7 @@ impl account_registry.assert_manager(&info.sender).map_err(|_| { + None => account_registry.assert_account(&info.sender).map_err(|_| { AdapterError::UnauthorizedAdapterRequest { adapter: self.module_id().to_string(), sender: info.sender.to_string(), @@ -123,9 +126,9 @@ impl { - let proxy_address = deps.api.addr_validate(&requested_proxy)?; - let requested_core = account_registry.assert_proxy(&proxy_address)?; + Some(requested_account) => { + let account_address = deps.api.addr_validate(&requested_account)?; + let requested_core = account_registry.assert_account(&account_address)?; if requested_core.addr() == sender { // If the caller is the account of the indicated proxy_address, it's authorized to do the operation @@ -135,7 +138,7 @@ impl account_registry - .assert_manager(sender) + .assert_account(sender) .map_err(|_| unauthorized_sender())?, }; self.target_account = Some(account_base); @@ -295,7 +298,7 @@ mod tests { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], }, - proxy_address: None, + account_adress: None, }; base_execute_as(deps.as_mut(), &base.account, msg)?; @@ -322,7 +325,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - proxy_address: None, + account_adress: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], @@ -335,7 +338,7 @@ mod tests { assert_that!(authorized_addrs.len()).is_equal_to(1); let msg = BaseExecuteMsg { - proxy_address: None, + account_adress: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![], to_remove: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], @@ -358,7 +361,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - proxy_address: None, + account_adress: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], @@ -368,7 +371,7 @@ mod tests { base_execute_as(deps.as_mut(), &base.account, msg)?; let msg = BaseExecuteMsg { - proxy_address: None, + account_adress: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], @@ -399,7 +402,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - proxy_address: None, + account_adress: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![TEST_MODULE_ID.into()], to_remove: vec![], @@ -427,7 +430,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - proxy_address: None, + account_adress: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![], to_remove: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).into()], @@ -472,7 +475,7 @@ mod tests { mock_init(deps).unwrap(); let msg = BaseExecuteMsg { - proxy_address: None, + account_adress: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: authorized .into_iter() diff --git a/framework/packages/abstract-adapter/src/features.rs b/framework/packages/abstract-adapter/src/features.rs index b30c5a816e..71e43589ae 100644 --- a/framework/packages/abstract-adapter/src/features.rs +++ b/framework/packages/abstract-adapter/src/features.rs @@ -32,11 +32,6 @@ impl AccountExecutor - for AdapterContract -{ -} - /// Get the version control contract impl AbstractRegistryAccess diff --git a/framework/packages/abstract-app/src/features.rs b/framework/packages/abstract-app/src/features.rs index 7760d70dab..ca09b12013 100644 --- a/framework/packages/abstract-app/src/features.rs +++ b/framework/packages/abstract-app/src/features.rs @@ -43,18 +43,6 @@ impl< } } -impl< - Error: ContractError, - CustomInitMsg, - CustomExecMsg, - CustomQueryMsg, - CustomMigrateMsg, - SudoMsg, - > AccountExecutor - for AppContract -{ -} - impl< Error: ContractError, CustomInitMsg, diff --git a/framework/packages/abstract-client/src/account.rs b/framework/packages/abstract-client/src/account.rs index 8581065b7b..1e69fe61b1 100644 --- a/framework/packages/abstract-client/src/account.rs +++ b/framework/packages/abstract-client/src/account.rs @@ -28,9 +28,12 @@ use abstract_interface::{ }; use abstract_std::{ account, - manager::{ - state::AccountInfo, InfoResponse, ManagerModuleInfo, ModuleAddressesResponse, - ModuleInfosResponse, ModuleInstallConfig, + account::{ + responses::{ + AccountModuleInfo, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, + }, + state::AccountInfo, + ModuleInstallConfig, }, objects::{ gov_type::GovernanceDetails, @@ -608,22 +611,13 @@ impl Account { pub fn upgrade(&self, version: ModuleVersion) -> AbstractClientResult { self.abstr_account .account - .upgrade(vec![ - ( - ModuleInfo::from_id(abstract_std::registry::ACCOUNT, version.clone())?, - Some( - to_json_binary(&abstract_std::manager::MigrateMsg {}) - .map_err(Into::::into)?, - ), + .upgrade(vec![( + ModuleInfo::from_id(abstract_std::registry::ACCOUNT, version.clone())?, + Some( + to_json_binary(&abstract_std::account::MigrateMsg {}) + .map_err(Into::::into)?, ), - ( - ModuleInfo::from_id(abstract_std::registry::ACCOUNT, version)?, - Some( - to_json_binary(&abstract_std::proxy::MigrateMsg {}) - .map_err(Into::::into)?, - ), - ), - ]) + )]) .map_err(Into::into) } @@ -652,14 +646,14 @@ impl Account { self.configure( &account::ExecuteMsg::ExecOnModule { module_id: ACCOUNT.to_owned(), - exec_msg: to_json_binary(&abstract_std::proxy::ExecuteMsg::ModuleAction { msgs }) + exec_msg: to_json_binary(&abstract_std::account::ExecuteMsg::ModuleAction { msgs }) .map_err(AbstractInterfaceError::from)?, }, funds, ) } - /// Executes a [`account::ExecuteMsg`] on the manager of the account. + /// Executes a [`account::ExecuteMsg`] on the account. pub fn configure( &self, execute_msg: &account::ExecuteMsg, @@ -696,7 +690,7 @@ impl Account { /// Module infos of installed modules on account pub fn module_infos(&self) -> AbstractClientResult { - let mut module_infos: Vec = vec![]; + let mut module_infos: Vec = vec![]; loop { let last_module_id: Option = module_infos .last() diff --git a/framework/packages/abstract-client/src/client.rs b/framework/packages/abstract-client/src/client.rs index c4deaf9916..a31fed51ab 100644 --- a/framework/packages/abstract-client/src/client.rs +++ b/framework/packages/abstract-client/src/client.rs @@ -207,9 +207,9 @@ impl AbstractClient { ) .map_err(Into::into)?; - let manager_config: abstract_std::manager::ConfigResponse = chain + let manager_config: abstract_std::account::responses::ConfigResponse = chain .query( - &abstract_std::manager::QueryMsg::Config {}, + &abstract_std::account::QueryMsg::Config {}, &app_config.manager_address, ) .map_err(Into::into)?; diff --git a/framework/packages/abstract-client/src/interchain/remote_account.rs b/framework/packages/abstract-client/src/interchain/remote_account.rs index bc255b4507..cd1beba2e7 100644 --- a/framework/packages/abstract-client/src/interchain/remote_account.rs +++ b/framework/packages/abstract-client/src/interchain/remote_account.rs @@ -8,18 +8,22 @@ use abstract_interface::{ IbcClient, InstallConfig, ManagerQueryFns as _, RegisteredModule, VCQueryFns as _, }; use abstract_std::{ + account::{ + self, + responses::{ + AccountModuleInfo, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, + }, + state::AccountInfo, + ModuleInstallConfig, + }, ibc_client::{self, QueryMsgFns as _}, ibc_host, - manager::{ - self, state::AccountInfo, InfoResponse, ManagerModuleInfo, ModuleAddressesResponse, - ModuleInfosResponse, ModuleInstallConfig, - }, objects::{ module::{ModuleId, ModuleInfo, ModuleVersion}, namespace::Namespace, ownership, AccountId, TruncatedChainId, }, - proxy, ACCOUNT, IBC_CLIENT, + ACCOUNT, IBC_CLIENT, }; use cosmwasm_std::{to_json_binary, CosmosMsg, Uint128}; use cw_orch::{ @@ -245,27 +249,14 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch self.abstr_owner_account.account.environment().clone() } - /// Address of the proxy - pub fn proxy(&self) -> AbstractClientResult { - let base_response = self - .host_abstract()? - .version_control - .account_base(self.remote_account_id.clone())?; - Ok(base_response.account_base.proxy) - } - /// Address of the account (proxy) pub fn address(&self) -> AbstractClientResult { - self.proxy() - } - - /// Get manager address of the account - pub fn manager(&self) -> AbstractClientResult { let base_response = self .host_abstract()? .version_control .account_base(self.remote_account_id.clone())?; - Ok(base_response.account_base.manager) + + Ok(base_response.account_base.addr().clone()) } /// Query account balance of a given denom @@ -273,7 +264,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch let coins = self .host_chain() .bank_querier() - .balance(&self.proxy()?, Some(denom.into())) + .balance(&self.address()?, Some(denom.into())) .map_err(Into::into)?; // There will always be a single element in this case. @@ -284,7 +275,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch pub fn query_balances(&self) -> AbstractClientResult> { self.host_chain() .bank_querier() - .balance(&self.proxy()?, None) + .balance(&self.address()?, None) .map_err(Into::into) .map_err(Into::into) } @@ -293,7 +284,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch pub fn info(&self) -> AbstractClientResult { let info_response: InfoResponse = self .host_chain() - .query(&manager::QueryMsg::Info {}, &self.manager()?) + .query(&account::QueryMsg::Info {}, &self.address()?) .map_err(Into::into)?; Ok(info_response.info) } @@ -367,16 +358,16 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch self.ibc_client_execute(ibc_client::ExecuteMsg::RemoteAction { host_chain: self.host_chain_id(), action: ibc_host::HostAction::Dispatch { - manager_msgs: vec![manager::ExecuteMsg::Upgrade { modules }], + account_msgs: vec![account::ExecuteMsg::Upgrade { modules }], }, }) } /// Returns owner of the account pub fn ownership(&self) -> AbstractClientResult> { - let manager = self.manager()?; + let account = self.address()?; self.host_chain() - .query(&manager::QueryMsg::Ownership {}, &manager) + .query(&account::QueryMsg::Ownership {}, &account) .map_err(Into::into) .map_err(Into::into) } @@ -397,21 +388,19 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch execute_msgs: impl IntoIterator>, ) -> AbstractClientResult> { let msgs = execute_msgs.into_iter().map(Into::into).collect(); - self.execute_on_manager(vec![manager::ExecuteMsg::ExecOnModule { - module_id: ACCOUNT.to_owned(), - exec_msg: to_json_binary(&abstract_std::proxy::ExecuteMsg::ModuleAction { msgs }) - .map_err(AbstractInterfaceError::from)?, + self.execute_on_account(vec![abstract_std::account::ExecuteMsg::ModuleAction { + msgs, }]) } /// Executes a list of [manager::ExecuteMsg] on the manager of the account. - pub fn execute_on_manager( + pub fn execute_on_account( &self, - manager_msgs: Vec, + account_msgs: Vec, ) -> AbstractClientResult> { self.ibc_client_execute(ibc_client::ExecuteMsg::RemoteAction { host_chain: self.host_chain_id(), - action: ibc_host::HostAction::Dispatch { manager_msgs }, + action: ibc_host::HostAction::Dispatch { account_msgs }, }) } @@ -445,9 +434,9 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch /// Module infos of installed modules on account pub fn module_infos(&self) -> AbstractClientResult { - let manager = self.manager()?; + let manager = self.address()?; - let mut module_infos: Vec = vec![]; + let mut module_infos: Vec = vec![]; loop { let last_module_id: Option = module_infos .last() @@ -455,7 +444,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch let res: ModuleInfosResponse = self .host_chain() .query( - &manager::QueryMsg::ModuleInfos { + &account::QueryMsg::ModuleInfos { start_after: last_module_id, limit: None, }, @@ -475,19 +464,19 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch &self, ids: Vec, ) -> AbstractClientResult { - let manager = self.manager()?; + let manager = self.address()?; self.host_chain() - .query(&manager::QueryMsg::ModuleAddresses { ids }, &manager) + .query(&account::QueryMsg::ModuleAddresses { ids }, &manager) .map_err(Into::into) .map_err(Into::into) } /// Check if module installed on account pub fn module_installed(&self, id: ModuleId) -> AbstractClientResult { - let manager = self.manager()?; + let manager = self.address()?; - let key = manager::state::ACCOUNT_MODULES.key(id).to_vec(); + let key = account::state::ACCOUNT_MODULES.key(id).to_vec(); let maybe_module_addr = self .host_chain() .wasm_querier() @@ -530,7 +519,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch let _ = self.ibc_client_execute(ibc_client::ExecuteMsg::RemoteAction { host_chain: self.host_chain_id(), action: ibc_host::HostAction::Dispatch { - manager_msgs: vec![manager::ExecuteMsg::InstallModules { modules }], + account_msgs: vec![account::ExecuteMsg::InstallModules { modules }], }, })?; @@ -546,7 +535,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv> RemoteAccount<'a, Ch &self, exec_msg: ibc_client::ExecuteMsg, ) -> AbstractClientResult> { - let msg = proxy::ExecuteMsg::IbcAction { msg: exec_msg }; + let msg = account::ExecuteMsg::IbcAction { msg: exec_msg }; let tx_response = self .abstr_owner_account @@ -584,7 +573,7 @@ impl<'a, Chain: MutCwEnv + IbcQueryHandler, IBC: InterchainEnv> /// Set balance for the Proxy pub fn set_balance(&self, amount: &[Coin]) -> AbstractClientResult<()> { self.host_chain() - .set_balance(&self.proxy()?, amount.to_vec()) + .set_balance(&self.address()?, amount.to_vec()) .map_err(Into::into) .map_err(Into::into) } @@ -592,7 +581,7 @@ impl<'a, Chain: MutCwEnv + IbcQueryHandler, IBC: InterchainEnv> /// Add balance to the Proxy pub fn add_balance(&self, amount: &[Coin]) -> AbstractClientResult<()> { self.host_chain() - .add_balance(&self.proxy()?, amount.to_vec()) + .add_balance(&self.address()?, amount.to_vec()) .map_err(Into::into) .map_err(Into::into) } diff --git a/framework/packages/abstract-client/src/interchain/remote_application.rs b/framework/packages/abstract-client/src/interchain/remote_application.rs index fa044c57ea..a1fbf95112 100644 --- a/framework/packages/abstract-client/src/interchain/remote_application.rs +++ b/framework/packages/abstract-client/src/interchain/remote_application.rs @@ -5,7 +5,7 @@ use std::fmt::Debug; use abstract_interface::{AbstractInterfaceError, RegisteredModule}; -use abstract_std::{adapter, ibc_client, ibc_host, manager}; +use abstract_std::{account, adapter, ibc_client, ibc_host}; use cosmwasm_std::to_json_binary; use cw_orch::{contract::Contract, prelude::*}; use cw_orch_interchain::{IbcQueryHandler, InterchainEnv}; @@ -50,7 +50,7 @@ impl< .ibc_client_execute(ibc_client::ExecuteMsg::RemoteAction { host_chain: self.remote_account.host_chain_id(), action: ibc_host::HostAction::Dispatch { - manager_msgs: vec![manager::ExecuteMsg::ExecOnModule { + account_msgs: vec![account::ExecuteMsg::ExecOnModule { module_id: M::module_id().to_owned(), exec_msg: to_json_binary(execute).map_err(AbstractInterfaceError::from)?, }], @@ -83,9 +83,9 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv, M: ContractInstance< { /// Authorize this application on installed adapters. Accepts Module Id's of adapters pub fn authorize_on_adapters(&self, adapter_ids: &[&str]) -> AbstractClientResult<()> { - let mut manager_msgs = vec![]; + let mut account_msgs = vec![]; for module_id in adapter_ids { - manager_msgs.push(manager::ExecuteMsg::ExecOnModule { + account_msgs.push(account::ExecuteMsg::ExecOnModule { module_id: module_id.to_string(), exec_msg: to_json_binary(&adapter::ExecuteMsg::::Base( adapter::BaseExecuteMsg { @@ -104,7 +104,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv, M: ContractInstance< .remote_account .ibc_client_execute(ibc_client::ExecuteMsg::RemoteAction { host_chain: self.remote_account.host_chain_id(), - action: ibc_host::HostAction::Dispatch { manager_msgs }, + action: ibc_host::HostAction::Dispatch { account_msgs }, })?; Ok(()) } diff --git a/framework/packages/abstract-interface/Cargo.toml b/framework/packages/abstract-interface/Cargo.toml index e21f662529..203577ad4f 100644 --- a/framework/packages/abstract-interface/Cargo.toml +++ b/framework/packages/abstract-interface/Cargo.toml @@ -45,9 +45,7 @@ ibc-host = { version = "0.23.0", package = "abstract-ibc-host", path = "../../co account-factory = { version = "0.23.0", package = "abstract-account-factory", path = "../../contracts/native/account-factory", default-features = false } ans-host = { version = "0.23.0", package = "abstract-ans-host", path = "../../contracts/native/ans-host", default-features = false } version-control = { version = "0.23.0", package = "abstract-version-control", path = "../../contracts/native/version-control", default-features = false } -proxy = { version = "0.23.0", package = "abstract-proxy", path = "../../contracts/account/proxy", default-features = false } -manager = { version = "0.23.0", package = "abstract-manager", path = "../../contracts/account/manager", default-features = false } -workspace-hack = { version = "0.1", path = "../../workspace-hack" } +account = { version = "0.23.0", package = "abstract-account", path = "../../contracts/account", default-features = false } [build-dependencies] serde_json = "1.0.79" diff --git a/framework/packages/abstract-interface/src/account/manager.rs b/framework/packages/abstract-interface/src/account/manager.rs index 1a02448e0a..451ae0926b 100644 --- a/framework/packages/abstract-interface/src/account/manager.rs +++ b/framework/packages/abstract-interface/src/account/manager.rs @@ -1,9 +1,9 @@ pub use abstract_std::account::{ExecuteMsgFns as ManagerExecFns, QueryMsgFns as ManagerQueryFns}; use abstract_std::{ + account::responses::AccountModuleInfo, account::*, adapter::{self, AdapterBaseMsg}, ibc_host::{HelperAction, HostAction}, - manager::ManagerModuleInfo, module_factory::SimulateInstallModulesResponse, objects::{ module::{ModuleInfo, ModuleVersion}, @@ -29,12 +29,12 @@ impl Uploadable for Account { fn wrapper() -> ::ContractSource { Box::new( ContractWrapper::new_with_empty( - ::manager::contract::execute, - ::manager::contract::instantiate, - ::manager::contract::query, + ::account::contract::execute, + ::account::contract::instantiate, + ::account::contract::query, ) - .with_migrate(::manager::contract::migrate) - .with_reply(::manager::contract::reply), + .with_migrate(::account::contract::migrate) + .with_reply(::account::contract::reply), ) } fn wasm(_chain: &ChainInfoOwned) -> WasmPath { @@ -155,7 +155,7 @@ impl Account { module_id, adapter::ExecuteMsg::::Base(adapter::BaseExecuteMsg { msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add, to_remove }, - proxy_address: None, + account_adress: None, }), )?; @@ -166,7 +166,7 @@ impl Account { pub fn module_info( &self, module_id: &str, - ) -> Result, crate::AbstractInterfaceError> { + ) -> Result, crate::AbstractInterfaceError> { let module_infos = self.module_infos(None, None)?.module_infos; let found = module_infos .into_iter() @@ -200,7 +200,7 @@ impl Account { ) -> Result<::Response, crate::AbstractInterfaceError> { let result = self.exec_on_module( - to_json_binary(&abstract_std::proxy::ExecuteMsg::IbcAction { + to_json_binary(&abstract_std::account::ExecuteMsg::IbcAction { msg: abstract_std::ibc_client::ExecuteMsg::Register { host_chain, namespace: None, @@ -236,7 +236,7 @@ impl Account { msg: ExecuteMsg, ) -> Result<::Response, crate::AbstractInterfaceError> { - let msg = abstract_std::proxy::ExecuteMsg::IbcAction { + let msg = abstract_std::account::ExecuteMsg::IbcAction { msg: abstract_std::ibc_client::ExecuteMsg::RemoteAction { host_chain, action: HostAction::Dispatch { @@ -255,7 +255,7 @@ impl Account { msg: Binary, ) -> Result<::Response, crate::AbstractInterfaceError> { - let msg = abstract_std::proxy::ExecuteMsg::IbcAction { + let msg = abstract_std::account::ExecuteMsg::IbcAction { msg: abstract_std::ibc_client::ExecuteMsg::RemoteAction { host_chain, action: HostAction::Dispatch { @@ -275,7 +275,7 @@ impl Account { host_chain: TruncatedChainId, ) -> Result<::Response, crate::AbstractInterfaceError> { - let msg = abstract_std::proxy::ExecuteMsg::IbcAction { + let msg = abstract_std::account::ExecuteMsg::IbcAction { msg: abstract_std::ibc_client::ExecuteMsg::RemoteAction { host_chain, action: HostAction::Helpers(HelperAction::SendAllBack), diff --git a/framework/packages/abstract-interface/src/account/mod.rs b/framework/packages/abstract-interface/src/account/mod.rs index cbe1f69ca0..e3ba68f31b 100644 --- a/framework/packages/abstract-interface/src/account/mod.rs +++ b/framework/packages/abstract-interface/src/account/mod.rs @@ -12,7 +12,7 @@ //! - upgrade module use abstract_std::{ - manager::ModuleInstallConfig, + account::ModuleInstallConfig, objects::{ module::{ModuleInfo, ModuleStatus, ModuleVersion}, TruncatedChainId, @@ -30,7 +30,7 @@ mod manager; use std::collections::HashSet; -use abstract_std::{manager::ManagerModuleInfo, objects::AccountId}; +use abstract_std::{account::responses::AccountModuleInfo, objects::AccountId}; use cw_orch::{environment::Environment, prelude::*}; use serde::Serialize; use speculoos::prelude::*; @@ -100,12 +100,12 @@ impl AbstractAccount { /// Assert that the Account has the expected modules with the provided **expected_module_addrs** installed. /// Note that the proxy is automatically included in the assertions. - /// Returns the `Vec` from the manager + /// Returns the `Vec` from the manager pub fn expect_modules( &self, module_addrs: Vec, - ) -> Result, crate::AbstractInterfaceError> { - let abstract_std::manager::ModuleInfosResponse { + ) -> Result, crate::AbstractInterfaceError> { + let abstract_std::account::responses::ModuleInfosResponse { module_infos: manager_modules, } = self.account.module_infos(None, None)?; @@ -148,15 +148,14 @@ impl AbstractAccount { .collect::>(); // check proxy config - let abstract_std::account::ConfigResponse { - modules: proxy_whitelist, - .. + let abstract_std::account::responses::ConfigResponse { + modules: whitelist, .. } = self.account.config()?; - let actual_proxy_whitelist = HashSet::from_iter(proxy_whitelist.clone()); - assert_eq!(actual_proxy_whitelist, expected_whitelisted_addrs); + let actual_whitelist = HashSet::from_iter(whitelist.clone()); + assert_eq!(actual_whitelist, expected_whitelisted_addrs); - Ok(proxy_whitelist) + Ok(whitelist) } /// Gets the account ID of the account. @@ -235,7 +234,7 @@ impl AbstractAccount { self.account.execute_on_module( abstract_std::ACCOUNT, - abstract_std::proxy::ExecuteMsg::IbcAction { + abstract_std::account::ExecuteMsg::IbcAction { msg: abstract_std::ibc_client::ExecuteMsg::Register { host_chain, namespace, @@ -306,7 +305,7 @@ impl AbstractAccount { if self.account.upload_if_needed()?.is_some() { modules_to_register.push(( self.account.as_instance(), - ::manager::contract::CONTRACT_VERSION.to_string(), + ::account::contract::CONTRACT_VERSION.to_string(), )); }; diff --git a/framework/packages/abstract-interface/src/deployers.rs b/framework/packages/abstract-interface/src/deployers.rs index 592cef7e1d..453356c197 100644 --- a/framework/packages/abstract-interface/src/deployers.rs +++ b/framework/packages/abstract-interface/src/deployers.rs @@ -1,5 +1,5 @@ use abstract_std::{ - manager::ModuleInstallConfig, + account::ModuleInstallConfig, objects::{ dependency::StaticDependency, module::{ModuleInfo, ModuleVersion}, diff --git a/framework/packages/abstract-interface/src/migrate.rs b/framework/packages/abstract-interface/src/migrate.rs index 5f6a859d45..52e485b30d 100644 --- a/framework/packages/abstract-interface/src/migrate.rs +++ b/framework/packages/abstract-interface/src/migrate.rs @@ -5,7 +5,7 @@ use abstract_std::{ version_control, ACCOUNT, }; use abstract_std::{ - ACCOUNT, ACCOUNT_FACTORY, ANS_HOST, IBC_CLIENT, IBC_HOST, MODULE_FACTORY, VERSION_CONTROL, + ACCOUNT_FACTORY, ANS_HOST, IBC_CLIENT, IBC_HOST, MODULE_FACTORY, VERSION_CONTROL, }; use cosmwasm_std::from_json; use cw2::{ContractVersion, CONTRACT}; @@ -121,21 +121,12 @@ impl Abstract { ])? .modules; - if ::manager::contract::CONTRACT_VERSION != versions[0].module.info.version.to_string() + if ::account::contract::CONTRACT_VERSION != versions[0].module.info.version.to_string() && self.account.account.upload_if_needed()?.is_some() { accounts_to_register.push(( self.account.account.as_instance(), - ::manager::contract::CONTRACT_VERSION.to_string(), - )); - } - - if ::proxy::contract::CONTRACT_VERSION != versions[1].module.info.version.to_string() - && self.account.proxy.upload_if_needed()?.is_some() - { - accounts_to_register.push(( - self.account.proxy.as_instance(), - ::proxy::contract::CONTRACT_VERSION.to_string(), + ::account::contract::CONTRACT_VERSION.to_string(), )); } diff --git a/framework/packages/abstract-interface/src/native/account_factory.rs b/framework/packages/abstract-interface/src/native/account_factory.rs index 9b1c72f952..64036abb49 100644 --- a/framework/packages/abstract-interface/src/native/account_factory.rs +++ b/framework/packages/abstract-interface/src/native/account_factory.rs @@ -2,8 +2,8 @@ pub use abstract_std::account_factory::{ ExecuteMsgFns as AccountFactoryExecFns, QueryMsgFns as AccountFactoryQueryFns, }; use abstract_std::{ + account::ModuleInstallConfig, account_factory::*, - manager::ModuleInstallConfig, objects::{gov_type::GovernanceDetails, AccountId}, }; use cw_orch::{environment::Environment, interface, prelude::*}; diff --git a/framework/packages/abstract-interface/src/native/version_control.rs b/framework/packages/abstract-interface/src/native/version_control.rs index f2f1a894cb..52800143c3 100644 --- a/framework/packages/abstract-interface/src/native/version_control.rs +++ b/framework/packages/abstract-interface/src/native/version_control.rs @@ -197,7 +197,7 @@ impl VersionControl { let account_module = ( ModuleInfo::from_id( &account.id, - ModuleVersion::Version(manager::contract::CONTRACT_VERSION.to_string()), + ModuleVersion::Version(account::contract::CONTRACT_VERSION.to_string()), )?, ModuleReference::AccountBase(account.code_id()?), ); diff --git a/framework/packages/abstract-std/src/account/responses.rs b/framework/packages/abstract-std/src/account/responses.rs index 0af6d6155f..400637f53c 100644 --- a/framework/packages/abstract-std/src/account/responses.rs +++ b/framework/packages/abstract-std/src/account/responses.rs @@ -37,7 +37,7 @@ pub struct InfoResponse { } #[cosmwasm_schema::cw_serde] -pub struct ManagerModuleInfo { +pub struct AccountModuleInfo { pub id: String, pub version: ContractVersion, pub address: Addr, @@ -45,7 +45,7 @@ pub struct ManagerModuleInfo { #[cosmwasm_schema::cw_serde] pub struct ModuleInfosResponse { - pub module_infos: Vec, + pub module_infos: Vec, } #[cosmwasm_schema::cw_serde] diff --git a/framework/packages/abstract-std/src/adapter.rs b/framework/packages/abstract-std/src/adapter.rs index 861392316a..e69d28d6b1 100644 --- a/framework/packages/abstract-std/src/adapter.rs +++ b/framework/packages/abstract-std/src/adapter.rs @@ -101,10 +101,10 @@ impl AdapterRequestMsg { // serde attributes remain it compatible with previous versions in cases where proxy_address is omitted #[cosmwasm_schema::cw_serde] pub struct BaseExecuteMsg { - /// The Proxy address for which to apply the configuration - /// If None, the sender must be an Account manager and the configuration is applied to its associated proxy. - /// If Some, the sender must be a direct or indirect owner (through sub-accounts) of the specified proxy. - pub proxy_address: Option, + /// The account address for which to apply the configuration + /// If None, the sender must be an Account + /// If Some, the sender must be a direct or indirect owner (through sub-accounts) of the specified account. + pub account_adress: Option, // The actual base message pub msg: AdapterBaseMsg, } diff --git a/framework/packages/abstract-std/src/native/account_factory.rs b/framework/packages/abstract-std/src/native/account_factory.rs index 8726ee4cfd..ba23f9711e 100644 --- a/framework/packages/abstract-std/src/native/account_factory.rs +++ b/framework/packages/abstract-std/src/native/account_factory.rs @@ -32,8 +32,7 @@ pub mod state { #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Context { pub account_base: Account, - pub manager_module: Module, - pub proxy_module: Module, + pub account_module: Module, pub account_id: AccountId, } From 8b6c83ef38c7215e3d302250b883ef2bec5c12f4 Mon Sep 17 00:00:00 2001 From: Kayanski Date: Wed, 11 Sep 2024 08:40:13 +0000 Subject: [PATCH 06/17] formatting [skip ci] --- framework/contracts/account/src/modules/migration.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/contracts/account/src/modules/migration.rs b/framework/contracts/account/src/modules/migration.rs index 0db3a57498..e366ef6d53 100644 --- a/framework/contracts/account/src/modules/migration.rs +++ b/framework/contracts/account/src/modules/migration.rs @@ -17,7 +17,8 @@ use abstract_std::{ ACCOUNT, }; use cosmwasm_std::{ - ensure, ensure_eq, to_json_binary, wasm_execute, Addr, Binary, CosmosMsg, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Storage, WasmMsg + ensure, ensure_eq, to_json_binary, wasm_execute, Addr, Binary, CosmosMsg, DepsMut, Empty, Env, + MessageInfo, Response, StdError, StdResult, Storage, WasmMsg, }; use cw2::get_contract_version; use cw_storage_plus::Item; From 43c59da1f1e2fb83d5a0fa69606f6d0780ee8576 Mon Sep 17 00:00:00 2001 From: Kayanski Date: Wed, 11 Sep 2024 08:50:22 +0000 Subject: [PATCH 07/17] Better std structure for account --- framework/contracts/account/src/config.rs | 3 +- framework/contracts/account/src/contract.rs | 3 +- .../account/src/modules/migration.rs | 3 +- framework/contracts/account/src/queries.rs | 6 +- .../contracts/account/src/sub_account.rs | 3 +- .../native/ibc-client/src/commands.rs | 2 +- .../packages/abstract-client/src/account.rs | 7 +- .../packages/abstract-client/src/client.rs | 2 +- .../src/interchain/remote_account.rs | 4 +- .../abstract-interface/src/account/manager.rs | 2 +- .../abstract-interface/src/account/mod.rs | 6 +- .../packages/abstract-std/src/account/mod.rs | 322 +++++++++++++++++- .../packages/abstract-std/src/account/msgs.rs | 160 --------- .../abstract-std/src/account/responses.rs | 63 ---- .../abstract-std/src/account/state.rs | 56 --- .../abstract-std/src/account/types.rs | 43 --- .../abstract-std/src/native/ibc_client.rs | 13 +- 17 files changed, 338 insertions(+), 360 deletions(-) delete mode 100644 framework/packages/abstract-std/src/account/msgs.rs delete mode 100644 framework/packages/abstract-std/src/account/responses.rs delete mode 100644 framework/packages/abstract-std/src/account/state.rs delete mode 100644 framework/packages/abstract-std/src/account/types.rs diff --git a/framework/contracts/account/src/config.rs b/framework/contracts/account/src/config.rs index 22721abcc6..bab2c2f1f6 100644 --- a/framework/contracts/account/src/config.rs +++ b/framework/contracts/account/src/config.rs @@ -10,8 +10,7 @@ use abstract_std::{ AccountInfo, SuspensionStatus, ACCOUNT_ID, CONFIG, INFO, SUB_ACCOUNTS, SUSPENSION_STATUS, }, - types::{InternalConfigAction, UpdateSubAccountAction}, - ExecuteMsg, + ExecuteMsg, InternalConfigAction, UpdateSubAccountAction, }, objects::{ gov_type::GovernanceDetails, diff --git a/framework/contracts/account/src/contract.rs b/framework/contracts/account/src/contract.rs index b0ce4e303b..f8f2cd6c26 100644 --- a/framework/contracts/account/src/contract.rs +++ b/framework/contracts/account/src/contract.rs @@ -10,8 +10,7 @@ use abstract_std::{ AccountInfo, Config, WhitelistedModules, CONFIG, INFO, SUSPENSION_STATUS, WHITELISTED_MODULES, }, - types::UpdateSubAccountAction, - ExecuteMsg, InstantiateMsg, QueryMsg, + ExecuteMsg, InstantiateMsg, QueryMsg, UpdateSubAccountAction, }, objects::{gov_type::GovernanceDetails, ownership, AccountId}, version_control::Account, diff --git a/framework/contracts/account/src/modules/migration.rs b/framework/contracts/account/src/modules/migration.rs index e366ef6d53..dc3b38b67a 100644 --- a/framework/contracts/account/src/modules/migration.rs +++ b/framework/contracts/account/src/modules/migration.rs @@ -1,8 +1,7 @@ use abstract_std::{ account::{ - msgs::CallbackMsg, state::{ACCOUNT_MODULES, CONFIG}, - ExecuteMsg, + CallbackMsg, ExecuteMsg, }, adapter::{ AdapterBaseMsg, AuthorizedAddressesResponse, BaseQueryMsg, QueryMsg as AdapterQuery, diff --git a/framework/contracts/account/src/queries.rs b/framework/contracts/account/src/queries.rs index 89ea52a30c..26a5186eb4 100644 --- a/framework/contracts/account/src/queries.rs +++ b/framework/contracts/account/src/queries.rs @@ -3,12 +3,10 @@ use std::collections::BTreeMap; use abstract_sdk::feature_objects::VersionControlContract; use abstract_std::{ account::{ - responses::{ - AccountModuleInfo, ConfigResponse, InfoResponse, ModuleAddressesResponse, - ModuleInfosResponse, ModuleVersionsResponse, SubAccountIdsResponse, - }, state::{AccountInfo, ACCOUNT_ID, ACCOUNT_MODULES, CONFIG, INFO}, state::{Config, SUB_ACCOUNTS, SUSPENSION_STATUS}, + AccountModuleInfo, ConfigResponse, InfoResponse, ModuleAddressesResponse, + ModuleInfosResponse, ModuleVersionsResponse, SubAccountIdsResponse, }, objects::{ gov_type::TopLevelOwnerResponse, diff --git a/framework/contracts/account/src/sub_account.rs b/framework/contracts/account/src/sub_account.rs index 48a1913001..c23ddc0049 100644 --- a/framework/contracts/account/src/sub_account.rs +++ b/framework/contracts/account/src/sub_account.rs @@ -1,8 +1,7 @@ use abstract_std::{ account::{ state::{ACCOUNT_ID, CONFIG, SUB_ACCOUNTS}, - types::UpdateSubAccountAction, - ExecuteMsg, ModuleInstallConfig, + ExecuteMsg, ModuleInstallConfig, UpdateSubAccountAction, }, objects::{ gov_type::GovernanceDetails, diff --git a/framework/contracts/native/ibc-client/src/commands.rs b/framework/contracts/native/ibc-client/src/commands.rs index 61cedf0751..7a06e1d9cb 100644 --- a/framework/contracts/native/ibc-client/src/commands.rs +++ b/framework/contracts/native/ibc-client/src/commands.rs @@ -385,7 +385,7 @@ pub fn execute_register_account( let account_id = account_base.account_id(deps.as_ref())?; // get auxiliary information - let account_info: account::responses::InfoResponse = deps + let account_info: account::InfoResponse = deps .querier .query_wasm_smart(account_base.addr(), &account::QueryMsg::Info {})?; let account_info = account_info.info; diff --git a/framework/packages/abstract-client/src/account.rs b/framework/packages/abstract-client/src/account.rs index 1e69fe61b1..ac6da8f3a0 100644 --- a/framework/packages/abstract-client/src/account.rs +++ b/framework/packages/abstract-client/src/account.rs @@ -29,11 +29,8 @@ use abstract_interface::{ use abstract_std::{ account, account::{ - responses::{ - AccountModuleInfo, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, - }, - state::AccountInfo, - ModuleInstallConfig, + state::AccountInfo, AccountModuleInfo, InfoResponse, ModuleAddressesResponse, + ModuleInfosResponse, ModuleInstallConfig, }, objects::{ gov_type::GovernanceDetails, diff --git a/framework/packages/abstract-client/src/client.rs b/framework/packages/abstract-client/src/client.rs index a31fed51ab..95d53e7c95 100644 --- a/framework/packages/abstract-client/src/client.rs +++ b/framework/packages/abstract-client/src/client.rs @@ -207,7 +207,7 @@ impl AbstractClient { ) .map_err(Into::into)?; - let manager_config: abstract_std::account::responses::ConfigResponse = chain + let manager_config: abstract_std::account::ConfigResponse = chain .query( &abstract_std::account::QueryMsg::Config {}, &app_config.manager_address, diff --git a/framework/packages/abstract-client/src/interchain/remote_account.rs b/framework/packages/abstract-client/src/interchain/remote_account.rs index cd1beba2e7..c72c3fcd48 100644 --- a/framework/packages/abstract-client/src/interchain/remote_account.rs +++ b/framework/packages/abstract-client/src/interchain/remote_account.rs @@ -10,9 +10,9 @@ use abstract_interface::{ use abstract_std::{ account::{ self, - responses::{ + AccountModuleInfo, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, - }, + state::AccountInfo, ModuleInstallConfig, }, diff --git a/framework/packages/abstract-interface/src/account/manager.rs b/framework/packages/abstract-interface/src/account/manager.rs index 451ae0926b..5137620dd8 100644 --- a/framework/packages/abstract-interface/src/account/manager.rs +++ b/framework/packages/abstract-interface/src/account/manager.rs @@ -1,6 +1,6 @@ pub use abstract_std::account::{ExecuteMsgFns as ManagerExecFns, QueryMsgFns as ManagerQueryFns}; use abstract_std::{ - account::responses::AccountModuleInfo, + account::AccountModuleInfo, account::*, adapter::{self, AdapterBaseMsg}, ibc_host::{HelperAction, HostAction}, diff --git a/framework/packages/abstract-interface/src/account/mod.rs b/framework/packages/abstract-interface/src/account/mod.rs index e3ba68f31b..4c6e4da4a8 100644 --- a/framework/packages/abstract-interface/src/account/mod.rs +++ b/framework/packages/abstract-interface/src/account/mod.rs @@ -30,7 +30,7 @@ mod manager; use std::collections::HashSet; -use abstract_std::{account::responses::AccountModuleInfo, objects::AccountId}; +use abstract_std::{account::AccountModuleInfo, objects::AccountId}; use cw_orch::{environment::Environment, prelude::*}; use serde::Serialize; use speculoos::prelude::*; @@ -105,7 +105,7 @@ impl AbstractAccount { &self, module_addrs: Vec, ) -> Result, crate::AbstractInterfaceError> { - let abstract_std::account::responses::ModuleInfosResponse { + let abstract_std::account::ModuleInfosResponse { module_infos: manager_modules, } = self.account.module_infos(None, None)?; @@ -148,7 +148,7 @@ impl AbstractAccount { .collect::>(); // check proxy config - let abstract_std::account::responses::ConfigResponse { + let abstract_std::account::ConfigResponse { modules: whitelist, .. } = self.account.config()?; diff --git a/framework/packages/abstract-std/src/account/mod.rs b/framework/packages/abstract-std/src/account/mod.rs index a99aa12c8f..b0cab9fbec 100644 --- a/framework/packages/abstract-std/src/account/mod.rs +++ b/framework/packages/abstract-std/src/account/mod.rs @@ -1,7 +1,317 @@ -pub mod msgs; -pub mod responses; -pub mod state; -pub mod types; +//! # Account Account +//! +//! `abstract_std::account` implements the contract interface and state lay-out. +//! +//! ## Description +//! +//! The Account manager is part of the Core Abstract Account contracts along with the `abstract_std::proxy` contract. +//! This contract is responsible for: +//! - Managing modules instantiation and migrations. +//! - Managing permissions. +//! - Upgrading the Account and its modules. +//! - Providing module name to address resolution. +//! +//! **The manager should be set as the contract/CosmWasm admin by default on your modules.** +//! ## Migration +//! Migrating this contract is done by calling `ExecuteMsg::Upgrade` with `abstract::manager` as module. +//! +use cosmwasm_schema::QueryResponses; +use cosmwasm_std::{Binary, CosmosMsg, Empty}; -pub use msgs::{ExecuteMsg, ExecuteMsgFns, InstantiateMsg, MigrateMsg, QueryMsg, QueryMsgFns}; -pub use types::ModuleInstallConfig; +use crate::objects::{ + gov_type::{GovAction, GovernanceDetails, TopLevelOwnerResponse}, + module::ModuleInfo, + ownership::Ownership, + AccountId, +}; + +use cosmwasm_std::Addr; +use cw2::ContractVersion; + +use state::{AccountInfo, SuspensionStatus}; + +pub mod state { + use std::collections::HashSet; + + use cosmwasm_std::Addr; + use cw_controllers::Admin; + use cw_storage_plus::{Item, Map}; + + pub use crate::objects::account::ACCOUNT_ID; + use crate::objects::{common_namespace::ADMIN_NAMESPACE, module::ModuleId}; + + pub type SuspensionStatus = bool; + + /// Manager configuration + #[cosmwasm_schema::cw_serde] + pub struct Config { + pub version_control_address: Addr, + pub module_factory_address: Addr, + } + + /// Abstract Account details. + #[cosmwasm_schema::cw_serde] + pub struct AccountInfo { + pub name: String, + pub description: Option, + pub link: Option, + } + + pub mod namespace { + pub const SUSPENSION_STATUS: &str = "a"; + pub const CONFIG: &str = "b"; + pub const INFO: &str = "c"; + pub const ACCOUNT_MODULES: &str = "d"; + pub const DEPENDENTS: &str = "e"; + pub const SUB_ACCOUNTS: &str = "f"; + pub const WHITELISTED_MODULES: &str = "g"; + } + + pub const WHITELISTED_MODULES: Item = + Item::new(namespace::WHITELISTED_MODULES); + pub const ADMIN: Admin = Admin::new(ADMIN_NAMESPACE); + + /// Suspension status + pub const SUSPENSION_STATUS: Item = Item::new(namespace::SUSPENSION_STATUS); + /// Configuration + pub const CONFIG: Item = Item::new(namespace::CONFIG); + /// Info about the Account + pub const INFO: Item = Item::new(namespace::INFO); + /// Enabled Abstract modules + pub const ACCOUNT_MODULES: Map = Map::new(namespace::ACCOUNT_MODULES); + /// Stores the dependency relationship between modules + /// map module -> modules that depend on module. + pub const DEPENDENTS: Map> = Map::new(namespace::DEPENDENTS); + /// List of sub-accounts + pub const SUB_ACCOUNTS: Map = Map::new(namespace::SUB_ACCOUNTS); + // Additional states, not listed here: cw_gov_ownable::GovOwnership + + #[cosmwasm_schema::cw_serde] + pub struct WhitelistedModules(pub Vec); +} + +#[cosmwasm_schema::cw_serde] +pub struct MigrateMsg {} + +/// Account Instantiate Msg +/// https://github.com/burnt-labs/contracts/blob/main/contracts/account/src/msg.rs +#[cosmwasm_schema::cw_serde] +pub struct InstantiateMsg { + // TODO: fork and make pub + // pub authenticator: Option, + pub account_id: Option, + pub owner: GovernanceDetails, + pub namespace: Option, + // Optionally modules can be provided. They will be installed after account registration. + pub install_modules: Vec, + pub name: String, + pub description: Option, + pub link: Option, + // TODO: Compute these using instantiate2. + pub module_factory_address: String, + pub version_control_address: String, + pub ans_host_address: String, +} + +/// Callback message to set the dependencies after module upgrades. +#[cosmwasm_schema::cw_serde] +pub struct CallbackMsg {} + +#[cosmwasm_schema::cw_serde] +#[derive(cw_orch::ExecuteFns)] +pub enum ExecuteMsg { + // ## Old Proxy ## + /// Executes the provided messages if sender is whitelisted + ModuleAction { msgs: Vec> }, + /// Execute a message and forward the Response data + ModuleActionWithData { msg: CosmosMsg }, + /// Execute IBC action on Client + IbcAction { msg: crate::ibc_client::ExecuteMsg }, + /// Queries the Abstract Ica Client with the provided action query. + /// Provides access to different ICA implementations for different ecosystems. + IcaAction { + /// Query of type `abstract-ica-client::msg::QueryMsg` + action_query_msg: Binary, + }, + + // ## Old Manager ## + /// Forward execution message to module + #[cw_orch(payable)] + ExecOnModule { module_id: String, exec_msg: Binary }, + /// Update Abstract-specific configuration of the module. + /// Only callable by the account factory or owner. + UpdateInternalConfig(Binary), + /// Install module using module factory, callable by Owner + #[cw_orch(payable)] + InstallModules { + // Module information and Instantiate message to instantiate the contract + modules: Vec, + }, + /// Uninstall a module given its ID. + UninstallModule { module_id: String }, + /// Upgrade the module to a new version + /// If module is `abstract::manager` then the contract will do a self-migration. + Upgrade { + modules: Vec<(ModuleInfo, Option)>, + }, + /// Creates a sub-account on the account + #[cw_orch(payable)] + CreateSubAccount { + // Name of the sub-account + name: String, + // Description of the account + description: Option, + // URL linked to the account + link: Option, + // optionally specify a namespace for the sub-account + namespace: Option, + // Provide list of module to install after sub-account creation + install_modules: Vec, + /// If `None`, will create a new local account without asserting account-id. + /// + /// When provided sequence in 0..2147483648 range: The tx will error + /// When provided sequence in 2147483648..u32::MAX range: Signals use of unclaimed Account Id in this range. The tx will error if this account-id already claimed. Useful for instantiate2 address prediction. + account_id: Option, + }, + /// Update info + UpdateInfo { + name: Option, + description: Option, + link: Option, + }, + /// Update account statuses + UpdateStatus { is_suspended: Option }, + /// Actions called by internal or external sub-accounts + UpdateSubAccount(UpdateSubAccountAction), + /// Update the contract's ownership. The `action` + /// can propose transferring ownership to an account, + /// accept a pending ownership transfer, or renounce the ownership + /// of the account permanently. + UpdateOwnership(GovAction), + + /// Callback endpoint + Callback(CallbackMsg), +} + +#[cosmwasm_schema::cw_serde] +#[derive(QueryResponses, cw_orch::QueryFns)] +pub enum QueryMsg { + // ## Old Proxy ## + /// Contains the enabled modules + /// Returns [`ConfigResponse`] + #[returns(ConfigResponse)] + Config {}, + + // ## Old Manager ## + /// Query the versions of modules installed on the account given their `ids`. + /// Returns [`ModuleVersionsResponse`] + #[returns(ModuleVersionsResponse)] + ModuleVersions { ids: Vec }, + /// Query the addresses of modules installed on the account given their `ids`. + /// Returns [`ModuleAddressesResponse`] + #[returns(ModuleAddressesResponse)] + ModuleAddresses { ids: Vec }, + /// Query information of all modules installed on the account. + /// Returns [`ModuleInfosResponse`] + #[returns(ModuleInfosResponse)] + ModuleInfos { + start_after: Option, + limit: Option, + }, + /// Query the Account info. + /// Returns [`InfoResponse`] + #[returns(InfoResponse)] + Info {}, + /// Returns [`SubAccountIdsResponse`] + #[returns(SubAccountIdsResponse)] + SubAccountIds { + start_after: Option, + limit: Option, + }, + /// Returns [`TopLevelOwnerResponse`] + #[returns(TopLevelOwnerResponse)] + TopLevelOwner {}, + /// Query the contract's ownership information + #[returns(Ownership)] + Ownership {}, +} + +/// Module info and init message +#[non_exhaustive] +#[cosmwasm_schema::cw_serde] +pub struct ModuleInstallConfig { + pub module: ModuleInfo, + pub init_msg: Option, +} + +impl ModuleInstallConfig { + pub fn new(module: ModuleInfo, init_msg: Option) -> Self { + Self { module, init_msg } + } +} +/// Internal configuration actions accessible from the [`ExecuteMsg::UpdateInternalConfig`] message. +#[cosmwasm_schema::cw_serde] +#[non_exhaustive] +pub enum InternalConfigAction { + /// Updates the [`state::ACCOUNT_MODULES`] map + /// Only callable by account factory or owner. + UpdateModuleAddresses { + to_add: Option>, + to_remove: Option>, + }, +} + +#[cosmwasm_schema::cw_serde] +#[non_exhaustive] +pub enum UpdateSubAccountAction { + /// Unregister sub-account + /// It will unregister sub-account from the state + /// Could be called only by the sub-account itself + UnregisterSubAccount { id: u32 }, + /// Register sub-account + /// It will register new sub-account into the state + /// Could be called by the sub-account manager + /// Note: since it happens after the claim by this manager state won't have spam accounts + RegisterSubAccount { id: u32 }, +} + +#[cosmwasm_schema::cw_serde] +pub struct ModuleVersionsResponse { + pub versions: Vec, +} + +#[cosmwasm_schema::cw_serde] +pub struct ModuleAddressesResponse { + pub modules: Vec<(String, Addr)>, +} + +#[cosmwasm_schema::cw_serde] +pub struct InfoResponse { + pub info: AccountInfo, +} + +#[cosmwasm_schema::cw_serde] +pub struct AccountModuleInfo { + pub id: String, + pub version: ContractVersion, + pub address: Addr, +} + +#[cosmwasm_schema::cw_serde] +pub struct ModuleInfosResponse { + pub module_infos: Vec, +} + +#[cosmwasm_schema::cw_serde] +pub struct SubAccountIdsResponse { + pub sub_accounts: Vec, +} + +#[cosmwasm_schema::cw_serde] +pub struct ConfigResponse { + pub modules: Vec, + pub account_id: AccountId, + pub is_suspended: SuspensionStatus, + pub version_control_address: Addr, + pub module_factory_address: Addr, +} diff --git a/framework/packages/abstract-std/src/account/msgs.rs b/framework/packages/abstract-std/src/account/msgs.rs deleted file mode 100644 index 25c082c379..0000000000 --- a/framework/packages/abstract-std/src/account/msgs.rs +++ /dev/null @@ -1,160 +0,0 @@ -pub use super::responses::{ - ConfigResponse, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, - ModuleVersionsResponse, SubAccountIdsResponse, -}; -use super::types::{ModuleInstallConfig, UpdateSubAccountAction}; -use cosmwasm_schema::QueryResponses; -use cosmwasm_std::{Binary, CosmosMsg, Empty}; - -use crate::objects::{ - gov_type::{GovAction, GovernanceDetails, TopLevelOwnerResponse}, - module::ModuleInfo, - ownership::Ownership, - AccountId, -}; - -#[cosmwasm_schema::cw_serde] -pub struct MigrateMsg {} - -/// Account Instantiate Msg -/// https://github.com/burnt-labs/contracts/blob/main/contracts/account/src/msg.rs -#[cosmwasm_schema::cw_serde] -pub struct InstantiateMsg { - // TODO: fork and make pub - // pub authenticator: Option, - pub account_id: Option, - pub owner: GovernanceDetails, - pub namespace: Option, - // Optionally modules can be provided. They will be installed after account registration. - pub install_modules: Vec, - pub name: String, - pub description: Option, - pub link: Option, - // TODO: Compute these using instantiate2. - pub module_factory_address: String, - pub version_control_address: String, - pub ans_host_address: String, -} - -/// Callback message to set the dependencies after module upgrades. -#[cosmwasm_schema::cw_serde] -pub struct CallbackMsg {} - -#[cosmwasm_schema::cw_serde] -#[derive(cw_orch::ExecuteFns)] -pub enum ExecuteMsg { - // ## Old Proxy ## - /// Executes the provided messages if sender is whitelisted - ModuleAction { msgs: Vec> }, - /// Execute a message and forward the Response data - ModuleActionWithData { msg: CosmosMsg }, - /// Execute IBC action on Client - IbcAction { msg: crate::ibc_client::ExecuteMsg }, - /// Queries the Abstract Ica Client with the provided action query. - /// Provides access to different ICA implementations for different ecosystems. - IcaAction { - /// Query of type `abstract-ica-client::msg::QueryMsg` - action_query_msg: Binary, - }, - - // ## Old Manager ## - /// Forward execution message to module - #[cw_orch(payable)] - ExecOnModule { module_id: String, exec_msg: Binary }, - /// Update Abstract-specific configuration of the module. - /// Only callable by the account factory or owner. - UpdateInternalConfig(Binary), - /// Install module using module factory, callable by Owner - #[cw_orch(payable)] - InstallModules { - // Module information and Instantiate message to instantiate the contract - modules: Vec, - }, - /// Uninstall a module given its ID. - UninstallModule { module_id: String }, - /// Upgrade the module to a new version - /// If module is `abstract::manager` then the contract will do a self-migration. - Upgrade { - modules: Vec<(ModuleInfo, Option)>, - }, - /// Creates a sub-account on the account - #[cw_orch(payable)] - CreateSubAccount { - // Name of the sub-account - name: String, - // Description of the account - description: Option, - // URL linked to the account - link: Option, - // optionally specify a namespace for the sub-account - namespace: Option, - // Provide list of module to install after sub-account creation - install_modules: Vec, - /// If `None`, will create a new local account without asserting account-id. - /// - /// When provided sequence in 0..2147483648 range: The tx will error - /// When provided sequence in 2147483648..u32::MAX range: Signals use of unclaimed Account Id in this range. The tx will error if this account-id already claimed. Useful for instantiate2 address prediction. - account_id: Option, - }, - /// Update info - UpdateInfo { - name: Option, - description: Option, - link: Option, - }, - /// Update account statuses - UpdateStatus { is_suspended: Option }, - /// Actions called by internal or external sub-accounts - UpdateSubAccount(UpdateSubAccountAction), - /// Update the contract's ownership. The `action` - /// can propose transferring ownership to an account, - /// accept a pending ownership transfer, or renounce the ownership - /// of the account permanently. - UpdateOwnership(GovAction), - - /// Callback endpoint - Callback(CallbackMsg), -} - -#[cosmwasm_schema::cw_serde] -#[derive(QueryResponses, cw_orch::QueryFns)] -pub enum QueryMsg { - // ## Old Proxy ## - /// Contains the enabled modules - /// Returns [`ConfigResponse`] - #[returns(ConfigResponse)] - Config {}, - - // ## Old Manager ## - /// Query the versions of modules installed on the account given their `ids`. - /// Returns [`ModuleVersionsResponse`] - #[returns(ModuleVersionsResponse)] - ModuleVersions { ids: Vec }, - /// Query the addresses of modules installed on the account given their `ids`. - /// Returns [`ModuleAddressesResponse`] - #[returns(ModuleAddressesResponse)] - ModuleAddresses { ids: Vec }, - /// Query information of all modules installed on the account. - /// Returns [`ModuleInfosResponse`] - #[returns(ModuleInfosResponse)] - ModuleInfos { - start_after: Option, - limit: Option, - }, - /// Query the Account info. - /// Returns [`InfoResponse`] - #[returns(InfoResponse)] - Info {}, - /// Returns [`SubAccountIdsResponse`] - #[returns(SubAccountIdsResponse)] - SubAccountIds { - start_after: Option, - limit: Option, - }, - /// Returns [`TopLevelOwnerResponse`] - #[returns(TopLevelOwnerResponse)] - TopLevelOwner {}, - /// Query the contract's ownership information - #[returns(Ownership)] - Ownership {}, -} diff --git a/framework/packages/abstract-std/src/account/responses.rs b/framework/packages/abstract-std/src/account/responses.rs deleted file mode 100644 index 400637f53c..0000000000 --- a/framework/packages/abstract-std/src/account/responses.rs +++ /dev/null @@ -1,63 +0,0 @@ -//! # Account Manager -//! -//! `abstract_std::manager` implements the contract interface and state lay-out. -//! -//! ## Description -//! -//! The Account manager is part of the Core Abstract Account contracts along with the `abstract_std::proxy` contract. -//! This contract is responsible for: -//! - Managing modules instantiation and migrations. -//! - Managing permissions. -//! - Upgrading the Account and its modules. -//! - Providing module name to address resolution. -//! -//! **The manager should be set as the contract/CosmWasm admin by default on your modules.** -//! ## Migration -//! Migrating this contract is done by calling `ExecuteMsg::Upgrade` with `abstract::manager` as module. - -use cosmwasm_std::Addr; -use cw2::ContractVersion; - -use super::state::AccountInfo; -use crate::{account::state::SuspensionStatus, objects::account::AccountId}; - -#[cosmwasm_schema::cw_serde] -pub struct ModuleVersionsResponse { - pub versions: Vec, -} - -#[cosmwasm_schema::cw_serde] -pub struct ModuleAddressesResponse { - pub modules: Vec<(String, Addr)>, -} - -#[cosmwasm_schema::cw_serde] -pub struct InfoResponse { - pub info: AccountInfo, -} - -#[cosmwasm_schema::cw_serde] -pub struct AccountModuleInfo { - pub id: String, - pub version: ContractVersion, - pub address: Addr, -} - -#[cosmwasm_schema::cw_serde] -pub struct ModuleInfosResponse { - pub module_infos: Vec, -} - -#[cosmwasm_schema::cw_serde] -pub struct SubAccountIdsResponse { - pub sub_accounts: Vec, -} - -#[cosmwasm_schema::cw_serde] -pub struct ConfigResponse { - pub modules: Vec, - pub account_id: AccountId, - pub is_suspended: SuspensionStatus, - pub version_control_address: Addr, - pub module_factory_address: Addr, -} diff --git a/framework/packages/abstract-std/src/account/state.rs b/framework/packages/abstract-std/src/account/state.rs deleted file mode 100644 index 1758d053f1..0000000000 --- a/framework/packages/abstract-std/src/account/state.rs +++ /dev/null @@ -1,56 +0,0 @@ -use std::collections::HashSet; - -use cosmwasm_std::Addr; -use cw_controllers::Admin; -use cw_storage_plus::{Item, Map}; - -pub use crate::objects::account::ACCOUNT_ID; -use crate::objects::{common_namespace::ADMIN_NAMESPACE, module::ModuleId}; - -pub type SuspensionStatus = bool; - -/// Manager configuration -#[cosmwasm_schema::cw_serde] -pub struct Config { - pub version_control_address: Addr, - pub module_factory_address: Addr, -} - -/// Abstract Account details. -#[cosmwasm_schema::cw_serde] -pub struct AccountInfo { - pub name: String, - pub description: Option, - pub link: Option, -} - -pub mod namespace { - pub const SUSPENSION_STATUS: &str = "a"; - pub const CONFIG: &str = "b"; - pub const INFO: &str = "c"; - pub const ACCOUNT_MODULES: &str = "d"; - pub const DEPENDENTS: &str = "e"; - pub const SUB_ACCOUNTS: &str = "f"; - pub const WHITELISTED_MODULES: &str = "g"; -} - -pub const WHITELISTED_MODULES: Item = Item::new(namespace::WHITELISTED_MODULES); -pub const ADMIN: Admin = Admin::new(ADMIN_NAMESPACE); - -/// Suspension status -pub const SUSPENSION_STATUS: Item = Item::new(namespace::SUSPENSION_STATUS); -/// Configuration -pub const CONFIG: Item = Item::new(namespace::CONFIG); -/// Info about the Account -pub const INFO: Item = Item::new(namespace::INFO); -/// Enabled Abstract modules -pub const ACCOUNT_MODULES: Map = Map::new(namespace::ACCOUNT_MODULES); -/// Stores the dependency relationship between modules -/// map module -> modules that depend on module. -pub const DEPENDENTS: Map> = Map::new(namespace::DEPENDENTS); -/// List of sub-accounts -pub const SUB_ACCOUNTS: Map = Map::new(namespace::SUB_ACCOUNTS); -// Additional states, not listed here: cw_gov_ownable::GovOwnership - -#[cosmwasm_schema::cw_serde] -pub struct WhitelistedModules(pub Vec); diff --git a/framework/packages/abstract-std/src/account/types.rs b/framework/packages/abstract-std/src/account/types.rs deleted file mode 100644 index 809cf27c73..0000000000 --- a/framework/packages/abstract-std/src/account/types.rs +++ /dev/null @@ -1,43 +0,0 @@ -use cosmwasm_std::Binary; - -use crate::objects::module::ModuleInfo; - -/// Module info and init message -#[non_exhaustive] -#[cosmwasm_schema::cw_serde] -pub struct ModuleInstallConfig { - pub module: ModuleInfo, - pub init_msg: Option, -} - -impl ModuleInstallConfig { - pub fn new(module: ModuleInfo, init_msg: Option) -> Self { - Self { module, init_msg } - } -} - -/// Internal configuration actions accessible from the [`ExecuteMsg::UpdateInternalConfig`] message. -#[cosmwasm_schema::cw_serde] -#[non_exhaustive] -pub enum InternalConfigAction { - /// Updates the [`state::ACCOUNT_MODULES`] map - /// Only callable by account factory or owner. - UpdateModuleAddresses { - to_add: Option>, - to_remove: Option>, - }, -} - -#[cosmwasm_schema::cw_serde] -#[non_exhaustive] -pub enum UpdateSubAccountAction { - /// Unregister sub-account - /// It will unregister sub-account from the state - /// Could be called only by the sub-account itself - UnregisterSubAccount { id: u32 }, - /// Register sub-account - /// It will register new sub-account into the state - /// Could be called by the sub-account manager - /// Note: since it happens after the claim by this manager state won't have spam accounts - RegisterSubAccount { id: u32 }, -} diff --git a/framework/packages/abstract-std/src/native/ibc_client.rs b/framework/packages/abstract-std/src/native/ibc_client.rs index 96abde3fb0..c97eab7cd4 100644 --- a/framework/packages/abstract-std/src/native/ibc_client.rs +++ b/framework/packages/abstract-std/src/native/ibc_client.rs @@ -220,13 +220,12 @@ impl InstalledModuleIdentification { let target_account_id = self.account_id.clone().ok_or(no_account_id_error)?; let account_base = vc.account(&target_account_id, &deps.querier)?; - let module_info: account::responses::ModuleAddressesResponse = - deps.querier.query_wasm_smart( - account_base.into_addr(), - &account::QueryMsg::ModuleAddresses { - ids: vec![self.module_info.id()], - }, - )?; + let module_info: account::ModuleAddressesResponse = deps.querier.query_wasm_smart( + account_base.into_addr(), + &account::QueryMsg::ModuleAddresses { + ids: vec![self.module_info.id()], + }, + )?; module_info .modules .first() From 7440cfc8e25f18ab9bb41589ca89fc2ec284da92 Mon Sep 17 00:00:00 2001 From: Kayanski Date: Wed, 11 Sep 2024 08:50:26 +0000 Subject: [PATCH 08/17] formatting [skip ci] --- .../abstract-client/src/interchain/remote_account.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/framework/packages/abstract-client/src/interchain/remote_account.rs b/framework/packages/abstract-client/src/interchain/remote_account.rs index c72c3fcd48..5e6e0b2e96 100644 --- a/framework/packages/abstract-client/src/interchain/remote_account.rs +++ b/framework/packages/abstract-client/src/interchain/remote_account.rs @@ -9,12 +9,8 @@ use abstract_interface::{ }; use abstract_std::{ account::{ - self, - - AccountModuleInfo, InfoResponse, ModuleAddressesResponse, ModuleInfosResponse, - - state::AccountInfo, - ModuleInstallConfig, + self, state::AccountInfo, AccountModuleInfo, InfoResponse, ModuleAddressesResponse, + ModuleInfosResponse, ModuleInstallConfig, }, ibc_client::{self, QueryMsgFns as _}, ibc_host, From 8c2904213b2174f2ed577b379547f2f975e4d2d1 Mon Sep 17 00:00:00 2001 From: Kayanski Date: Wed, 11 Sep 2024 08:55:01 +0000 Subject: [PATCH 09/17] Framework compiles with all features --- framework/contracts/account/src/modules.rs | 2 +- .../abstract-adapter/src/endpoints/execute.rs | 20 +++++++++---------- .../packages/abstract-adapter/src/features.rs | 8 +++----- .../packages/abstract-app/src/features.rs | 6 ++---- framework/packages/abstract-app/src/lib.rs | 2 +- .../src/interchain/remote_account.rs | 4 ++-- .../src/interchain/remote_application.rs | 2 +- .../abstract-interface/src/account/manager.rs | 2 +- .../packages/abstract-sdk/src/apis/authz.rs | 2 +- .../abstract-sdk/src/apis/feegrant.rs | 2 +- .../abstract-standalone/src/features.rs | 2 +- .../packages/abstract-standalone/src/lib.rs | 2 +- .../packages/abstract-std/src/adapter.rs | 2 +- 13 files changed, 26 insertions(+), 30 deletions(-) diff --git a/framework/contracts/account/src/modules.rs b/framework/contracts/account/src/modules.rs index 9f5208ab13..fe363fb85d 100644 --- a/framework/contracts/account/src/modules.rs +++ b/framework/contracts/account/src/modules.rs @@ -314,7 +314,7 @@ fn configure_adapter( message: AdapterBaseMsg, ) -> StdResult { let adapter_msg: AdapterExecMsg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: message, } .into(); diff --git a/framework/packages/abstract-adapter/src/endpoints/execute.rs b/framework/packages/abstract-adapter/src/endpoints/execute.rs index 100b4cb7eb..2b73452855 100644 --- a/framework/packages/abstract-adapter/src/endpoints/execute.rs +++ b/framework/packages/abstract-adapter/src/endpoints/execute.rs @@ -64,11 +64,11 @@ impl AdapterResult { let BaseExecuteMsg { - account_adress, + account_address, msg, } = message; let account_registry = self.account_registry(deps.as_ref())?; - let account_base = match account_adress { + let account_base = match account_address { // If account address provided, check if the sender is a direct or nested owner for this account. Some(requested_account) => { let account_address = deps.api.addr_validate(&requested_account)?; @@ -298,7 +298,7 @@ mod tests { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], }, - account_adress: None, + account_address: None, }; base_execute_as(deps.as_mut(), &base.account, msg)?; @@ -325,7 +325,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], @@ -338,7 +338,7 @@ mod tests { assert_that!(authorized_addrs.len()).is_equal_to(1); let msg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![], to_remove: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], @@ -361,7 +361,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], @@ -371,7 +371,7 @@ mod tests { base_execute_as(deps.as_mut(), &base.account, msg)?; let msg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).to_string()], to_remove: vec![], @@ -402,7 +402,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![TEST_MODULE_ID.into()], to_remove: vec![], @@ -430,7 +430,7 @@ mod tests { let _api = MOCK_ADAPTER; let msg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![], to_remove: vec![deps.api.addr_make(TEST_AUTHORIZED_ADDR).into()], @@ -475,7 +475,7 @@ mod tests { mock_init(deps).unwrap(); let msg = BaseExecuteMsg { - account_adress: None, + account_address: None, msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: authorized .into_iter() diff --git a/framework/packages/abstract-adapter/src/features.rs b/framework/packages/abstract-adapter/src/features.rs index 71e43589ae..a7ab3ce72d 100644 --- a/framework/packages/abstract-adapter/src/features.rs +++ b/framework/packages/abstract-adapter/src/features.rs @@ -1,11 +1,9 @@ use abstract_sdk::{ feature_objects::{AnsHost, VersionControlContract}, - features::{ - AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, - }, + features::{AbstractNameService, AbstractRegistryAccess, AccountIdentification}, AbstractSdkResult, }; -use cosmwasm_std::{Addr, Deps, StdError}; +use cosmwasm_std::{Deps, StdError}; use crate::{state::ContractError, AdapterContract}; @@ -23,7 +21,7 @@ impl { - fn account(&self, deps: Deps) -> AbstractSdkResult { + fn account(&self, _deps: Deps) -> AbstractSdkResult { if let Some(target) = &self.target_account { Ok(target.clone()) } else { diff --git a/framework/packages/abstract-app/src/features.rs b/framework/packages/abstract-app/src/features.rs index ca09b12013..2df3ec623e 100644 --- a/framework/packages/abstract-app/src/features.rs +++ b/framework/packages/abstract-app/src/features.rs @@ -1,12 +1,10 @@ use abstract_sdk::{ feature_objects::{AnsHost, VersionControlContract}, - features::{ - AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, - }, + features::{AbstractNameService, AbstractRegistryAccess, AccountIdentification}, AbstractSdkResult, }; use abstract_std::version_control::Account; -use cosmwasm_std::{Addr, Deps}; +use cosmwasm_std::Deps; use crate::{state::ContractError, AppContract}; diff --git a/framework/packages/abstract-app/src/lib.rs b/framework/packages/abstract-app/src/lib.rs index eb6015f7e3..29d6e6cc06 100644 --- a/framework/packages/abstract-app/src/lib.rs +++ b/framework/packages/abstract-app/src/lib.rs @@ -32,7 +32,7 @@ pub mod mock { use abstract_interface::{AppDeployer, DependencyCreation, RegisteredModule}; pub use abstract_std::app; use abstract_std::{ - manager::ModuleInstallConfig, + account::ModuleInstallConfig, objects::{dependency::StaticDependency, module::ModuleInfo}, IBC_CLIENT, }; diff --git a/framework/packages/abstract-client/src/interchain/remote_account.rs b/framework/packages/abstract-client/src/interchain/remote_account.rs index 5e6e0b2e96..cfea1d7b77 100644 --- a/framework/packages/abstract-client/src/interchain/remote_account.rs +++ b/framework/packages/abstract-client/src/interchain/remote_account.rs @@ -4,8 +4,8 @@ //! use abstract_interface::{ - Abstract, AbstractAccount, AbstractInterfaceError, AccountDetails, DependencyCreation, - IbcClient, InstallConfig, ManagerQueryFns as _, RegisteredModule, VCQueryFns as _, + Abstract, AbstractAccount, AccountDetails, DependencyCreation, IbcClient, InstallConfig, + ManagerQueryFns as _, RegisteredModule, VCQueryFns as _, }; use abstract_std::{ account::{ diff --git a/framework/packages/abstract-client/src/interchain/remote_application.rs b/framework/packages/abstract-client/src/interchain/remote_application.rs index a1fbf95112..4a481b76e7 100644 --- a/framework/packages/abstract-client/src/interchain/remote_application.rs +++ b/framework/packages/abstract-client/src/interchain/remote_application.rs @@ -89,7 +89,7 @@ impl<'a, Chain: IbcQueryHandler, IBC: InterchainEnv, M: ContractInstance< module_id: module_id.to_string(), exec_msg: to_json_binary(&adapter::ExecuteMsg::::Base( adapter::BaseExecuteMsg { - proxy_address: None, + account_address: None, msg: adapter::AdapterBaseMsg::UpdateAuthorizedAddresses { to_add: vec![], to_remove: vec![], diff --git a/framework/packages/abstract-interface/src/account/manager.rs b/framework/packages/abstract-interface/src/account/manager.rs index 5137620dd8..cecd271cc8 100644 --- a/framework/packages/abstract-interface/src/account/manager.rs +++ b/framework/packages/abstract-interface/src/account/manager.rs @@ -155,7 +155,7 @@ impl Account { module_id, adapter::ExecuteMsg::::Base(adapter::BaseExecuteMsg { msg: AdapterBaseMsg::UpdateAuthorizedAddresses { to_add, to_remove }, - account_adress: None, + account_address: None, }), )?; diff --git a/framework/packages/abstract-sdk/src/apis/authz.rs b/framework/packages/abstract-sdk/src/apis/authz.rs index b9276d0fd0..d543756e5b 100644 --- a/framework/packages/abstract-sdk/src/apis/authz.rs +++ b/framework/packages/abstract-sdk/src/apis/authz.rs @@ -50,7 +50,7 @@ pub trait AuthZInterface: AccountExecutor { deps: cosmwasm_std::Deps<'a>, granter: Option, ) -> AbstractSdkResult { - let granter = granter.unwrap_or(self.account(deps)?.addr()); + let granter = granter.unwrap_or(self.account(deps)?.addr().clone()); Ok(AuthZ { granter }) } } diff --git a/framework/packages/abstract-sdk/src/apis/feegrant.rs b/framework/packages/abstract-sdk/src/apis/feegrant.rs index a739f5cfa9..a86ec358f9 100644 --- a/framework/packages/abstract-sdk/src/apis/feegrant.rs +++ b/framework/packages/abstract-sdk/src/apis/feegrant.rs @@ -37,7 +37,7 @@ pub trait GrantInterface: AccountExecutor { deps: cosmwasm_std::Deps<'a>, granter: Option, ) -> AbstractSdkResult { - let granter = granter.unwrap_or(self.proxy_address(deps)?); + let granter = granter.unwrap_or(self.account(deps)?.addr().clone()); Ok(FeeGranter { granter }) } } diff --git a/framework/packages/abstract-standalone/src/features.rs b/framework/packages/abstract-standalone/src/features.rs index 52bd234c6d..79a430ef64 100644 --- a/framework/packages/abstract-standalone/src/features.rs +++ b/framework/packages/abstract-standalone/src/features.rs @@ -4,7 +4,7 @@ use abstract_sdk::{ AbstractSdkResult, }; use abstract_std::version_control::Account; -use cosmwasm_std::{Addr, Deps}; +use cosmwasm_std::Deps; use crate::StandaloneContract; diff --git a/framework/packages/abstract-standalone/src/lib.rs b/framework/packages/abstract-standalone/src/lib.rs index 61035964b9..7fa0d6dca3 100644 --- a/framework/packages/abstract-standalone/src/lib.rs +++ b/framework/packages/abstract-standalone/src/lib.rs @@ -157,7 +157,7 @@ pub mod mock { .save( &mut deps.storage, &standalone::StandaloneState { - proxy_address: abstr.account.proxy, + account: abstr.account, ans_host: AnsHost::new(abstr.ans_host), version_control: VersionControlContract::new(abstr.version_control), is_migratable: true, diff --git a/framework/packages/abstract-std/src/adapter.rs b/framework/packages/abstract-std/src/adapter.rs index e69d28d6b1..6881de01c2 100644 --- a/framework/packages/abstract-std/src/adapter.rs +++ b/framework/packages/abstract-std/src/adapter.rs @@ -104,7 +104,7 @@ pub struct BaseExecuteMsg { /// The account address for which to apply the configuration /// If None, the sender must be an Account /// If Some, the sender must be a direct or indirect owner (through sub-accounts) of the specified account. - pub account_adress: Option, + pub account_address: Option, // The actual base message pub msg: AdapterBaseMsg, } From f4cda2a48bc890e7afe7149027625dba2543d908 Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Thu, 12 Sep 2024 10:26:13 +0200 Subject: [PATCH 10/17] fix schema import --- framework/contracts/account/examples/schema.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/contracts/account/examples/schema.rs b/framework/contracts/account/examples/schema.rs index b8bdbe24e4..5fb24a7fd0 100644 --- a/framework/contracts/account/examples/schema.rs +++ b/framework/contracts/account/examples/schema.rs @@ -1,4 +1,4 @@ -use abstract_sdk::std::manager::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; +use abstract_sdk::std::account::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use cosmwasm_schema::write_api; fn main() { From 0219c3f6c5a63770096cb0d20534963657636ab9 Mon Sep 17 00:00:00 2001 From: Kayanski Date: Thu, 12 Sep 2024 08:35:14 +0000 Subject: [PATCH 11/17] Nits --- framework/contracts/account/Cargo.toml | 2 ++ framework/contracts/account/src/actions.rs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/framework/contracts/account/Cargo.toml b/framework/contracts/account/Cargo.toml index 1f069880e4..3e6fcc8a30 100644 --- a/framework/contracts/account/Cargo.toml +++ b/framework/contracts/account/Cargo.toml @@ -57,6 +57,8 @@ abstract-testing = { workspace = true } abstract-macros = { workspace = true } # abstract-integration-tests = { workspace = true } +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +workspace-hack = { version = "0.1", path = "../../../workspace-hack" } [profile.release] rpath = false diff --git a/framework/contracts/account/src/actions.rs b/framework/contracts/account/src/actions.rs index d0ac48c341..83074a9902 100644 --- a/framework/contracts/account/src/actions.rs +++ b/framework/contracts/account/src/actions.rs @@ -13,36 +13,36 @@ use crate::{ error::AccountError, }; -/// Executes `CosmosMsg` on the proxy and forwards its response. +/// Executes `Vec` on the proxy. /// Permission: Module -pub fn execute_module_action_response( +pub fn execute_module_action( deps: DepsMut, msg_info: MessageInfo, - msg: CosmosMsg, + msgs: Vec>, ) -> AccountResult { let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; if !whitelisted_modules.0.contains(&msg_info.sender) { return Err(AccountError::SenderNotWhitelisted {}); } - let submsg = SubMsg::reply_on_success(msg, RESPONSE_REPLY_ID); - - Ok(AccountResponse::action("execute_module_action_response").add_submessage(submsg)) + Ok(AccountResponse::action("execute_module_action").add_messages(msgs)) } -/// Executes `Vec` on the proxy. +/// Executes `CosmosMsg` on the proxy and forwards its response. /// Permission: Module -pub fn execute_module_action( +pub fn execute_module_action_response( deps: DepsMut, msg_info: MessageInfo, - msgs: Vec>, + msg: CosmosMsg, ) -> AccountResult { let whitelisted_modules = WHITELISTED_MODULES.load(deps.storage)?; if !whitelisted_modules.0.contains(&msg_info.sender) { return Err(AccountError::SenderNotWhitelisted {}); } - Ok(AccountResponse::action("execute_module_action").add_messages(msgs)) + let submsg = SubMsg::reply_on_success(msg, RESPONSE_REPLY_ID); + + Ok(AccountResponse::action("execute_module_action_response").add_submessage(submsg)) } /// Executes IBC actions on the IBC client. From 28cdb70ea31ea8e93d57f280e876e2c83cc1d7ca Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Thu, 12 Sep 2024 10:51:48 +0200 Subject: [PATCH 12/17] update whitelist logic to return false instead of true on catch any --- framework/packages/abstract-std/src/objects/module.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/framework/packages/abstract-std/src/objects/module.rs b/framework/packages/abstract-std/src/objects/module.rs index 5f6c64c727..33bd40b751 100644 --- a/framework/packages/abstract-std/src/objects/module.rs +++ b/framework/packages/abstract-std/src/objects/module.rs @@ -358,10 +358,9 @@ impl Module { pub fn should_be_whitelisted(&self) -> bool { match &self.reference { // Standalone, Service or Native(for example IBC Client) contracts not supposed to be whitelisted on proxy - ModuleReference::Standalone(_) - | ModuleReference::Native(_) - | ModuleReference::Service(_) => false, - _ => true, + ModuleReference::Adapter(_) + | ModuleReference::App(_) => true, + _ => false, } } } From 56aa8f5c1dffc24fff0461f1039a4778c57a3a05 Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Thu, 12 Sep 2024 10:55:07 +0200 Subject: [PATCH 13/17] rename file --- .../abstract-interface/src/account/{manager.rs => account.rs} | 0 framework/packages/abstract-interface/src/account/mod.rs | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename framework/packages/abstract-interface/src/account/{manager.rs => account.rs} (100%) diff --git a/framework/packages/abstract-interface/src/account/manager.rs b/framework/packages/abstract-interface/src/account/account.rs similarity index 100% rename from framework/packages/abstract-interface/src/account/manager.rs rename to framework/packages/abstract-interface/src/account/account.rs diff --git a/framework/packages/abstract-interface/src/account/mod.rs b/framework/packages/abstract-interface/src/account/mod.rs index 4c6e4da4a8..79c1cbeaad 100644 --- a/framework/packages/abstract-interface/src/account/mod.rs +++ b/framework/packages/abstract-interface/src/account/mod.rs @@ -26,7 +26,7 @@ use semver::{Version, VersionReq}; use crate::{Abstract, AbstractInterfaceError, AccountDetails, AdapterDeployer}; -mod manager; +mod account; use std::collections::HashSet; @@ -35,7 +35,7 @@ use cw_orch::{environment::Environment, prelude::*}; use serde::Serialize; use speculoos::prelude::*; -pub use self::manager::*; +pub use self::account::*; use crate::{get_account_contracts, VersionControl}; #[derive(Clone)] From 0439848a5ea476812ed4de63dc35ccb79d9c3ee3 Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Thu, 12 Sep 2024 11:19:20 +0200 Subject: [PATCH 14/17] nits, remove allow_deprecated as reminder --- framework/contracts/account/src/lib.rs | 1 + framework/contracts/account/src/reply.rs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/contracts/account/src/lib.rs b/framework/contracts/account/src/lib.rs index da9cfb7e4e..e5c76c38ad 100644 --- a/framework/contracts/account/src/lib.rs +++ b/framework/contracts/account/src/lib.rs @@ -1,3 +1,4 @@ +// TODO: make private what we can and write module-level documentation pub mod actions; pub mod config; pub mod contract; diff --git a/framework/contracts/account/src/reply.rs b/framework/contracts/account/src/reply.rs index 1fe927cf57..a654c62250 100644 --- a/framework/contracts/account/src/reply.rs +++ b/framework/contracts/account/src/reply.rs @@ -14,7 +14,6 @@ pub fn forward_response_data(result: Reply) -> AccountResult { let res = result.result.into_result().map_err(StdError::generic_err)?; // log and add data if needed - #[allow(deprecated)] let resp = if let Some(data) = res.data { AccountResponse::new( "forward_response_data_reply", From 9a953b724f3a541f2c5cba985a60e93cad6adeaa Mon Sep 17 00:00:00 2001 From: Kayanski Date: Thu, 12 Sep 2024 10:00:35 +0000 Subject: [PATCH 15/17] Put explicit impl of AccountExecutor back on --- framework/Cargo.lock | 1 + framework/contracts/account/Cargo.toml | 2 +- .../packages/abstract-adapter/src/features.rs | 9 ++++++++- framework/packages/abstract-app/src/features.rs | 16 +++++++++++++++- .../abstract-sdk/src/base/features/executor.rs | 2 -- .../packages/abstract-sdk/src/mock_module.rs | 5 +++-- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/framework/Cargo.lock b/framework/Cargo.lock index c6db35ca06..2347307fe8 100644 --- a/framework/Cargo.lock +++ b/framework/Cargo.lock @@ -36,6 +36,7 @@ dependencies = [ "serde", "speculoos", "thiserror", + "workspace-hack", ] [[package]] diff --git a/framework/contracts/account/Cargo.toml b/framework/contracts/account/Cargo.toml index 3e6fcc8a30..c5ebe14955 100644 --- a/framework/contracts/account/Cargo.toml +++ b/framework/contracts/account/Cargo.toml @@ -58,7 +58,7 @@ abstract-macros = { workspace = true } # abstract-integration-tests = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -workspace-hack = { version = "0.1", path = "../../../workspace-hack" } +workspace-hack = { version = "0.1", path = "../../workspace-hack" } [profile.release] rpath = false diff --git a/framework/packages/abstract-adapter/src/features.rs b/framework/packages/abstract-adapter/src/features.rs index a7ab3ce72d..3ced2e5c83 100644 --- a/framework/packages/abstract-adapter/src/features.rs +++ b/framework/packages/abstract-adapter/src/features.rs @@ -1,6 +1,8 @@ use abstract_sdk::{ feature_objects::{AnsHost, VersionControlContract}, - features::{AbstractNameService, AbstractRegistryAccess, AccountIdentification}, + features::{ + AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, + }, AbstractSdkResult, }; use cosmwasm_std::{Deps, StdError}; @@ -30,6 +32,11 @@ impl AccountExecutor + for AdapterContract +{ +} + /// Get the version control contract impl AbstractRegistryAccess diff --git a/framework/packages/abstract-app/src/features.rs b/framework/packages/abstract-app/src/features.rs index 2df3ec623e..f0f588afd0 100644 --- a/framework/packages/abstract-app/src/features.rs +++ b/framework/packages/abstract-app/src/features.rs @@ -1,6 +1,8 @@ use abstract_sdk::{ feature_objects::{AnsHost, VersionControlContract}, - features::{AbstractNameService, AbstractRegistryAccess, AccountIdentification}, + features::{ + AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, + }, AbstractSdkResult, }; use abstract_std::version_control::Account; @@ -41,6 +43,18 @@ impl< } } +impl< + Error: ContractError, + CustomInitMsg, + CustomExecMsg, + CustomQueryMsg, + CustomMigrateMsg, + SudoMsg, + > AccountExecutor + for AppContract +{ +} + impl< Error: ContractError, CustomInitMsg, diff --git a/framework/packages/abstract-sdk/src/base/features/executor.rs b/framework/packages/abstract-sdk/src/base/features/executor.rs index f3a7cf9f66..f7dd9f1949 100644 --- a/framework/packages/abstract-sdk/src/base/features/executor.rs +++ b/framework/packages/abstract-sdk/src/base/features/executor.rs @@ -20,5 +20,3 @@ pub trait AccountExecutor: AccountIdentification { .map_err(Into::into) } } - -impl AccountExecutor for T where T: AccountIdentification {} diff --git a/framework/packages/abstract-sdk/src/mock_module.rs b/framework/packages/abstract-sdk/src/mock_module.rs index e9e90f1438..0f9de5430e 100644 --- a/framework/packages/abstract-sdk/src/mock_module.rs +++ b/framework/packages/abstract-sdk/src/mock_module.rs @@ -11,8 +11,7 @@ use cosmwasm_std::{testing::MockApi, Deps}; use crate::{ features::{ - AbstractNameService, AbstractRegistryAccess, AccountIdentification, Dependencies, - ModuleIdentification, + AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, Dependencies, ModuleIdentification }, std::objects::module::ModuleId, AbstractSdkResult, @@ -26,6 +25,8 @@ impl AccountIdentification for MockModule { } } +impl AccountExecutor for MockModule {} + impl ModuleIdentification for MockModule { fn module_id(&self) -> &'static str { "mock_module" From 86231a29ebdedd57f3a534d111f03a545f6df877 Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Thu, 12 Sep 2024 15:15:40 +0200 Subject: [PATCH 16/17] return Vec<(String,Addr)> for modules query --- framework/Cargo.lock | 2 ++ framework/contracts/account/Cargo.toml | 2 +- framework/contracts/account/README.md | 2 +- framework/contracts/account/src/queries.rs | 2 +- framework/contracts/native/ibc-client/src/contract.rs | 2 +- framework/packages/abstract-interface/Cargo.toml | 1 + .../packages/abstract-interface/src/account/mod.rs | 4 ++-- framework/packages/abstract-std/src/account/mod.rs | 10 ++-------- 8 files changed, 11 insertions(+), 14 deletions(-) diff --git a/framework/Cargo.lock b/framework/Cargo.lock index c6db35ca06..f6e626f269 100644 --- a/framework/Cargo.lock +++ b/framework/Cargo.lock @@ -36,6 +36,7 @@ dependencies = [ "serde", "speculoos", "thiserror", + "workspace-hack", ] [[package]] @@ -407,6 +408,7 @@ dependencies = [ "serde_json", "speculoos", "thiserror", + "workspace-hack", ] [[package]] diff --git a/framework/contracts/account/Cargo.toml b/framework/contracts/account/Cargo.toml index 3e6fcc8a30..c5ebe14955 100644 --- a/framework/contracts/account/Cargo.toml +++ b/framework/contracts/account/Cargo.toml @@ -58,7 +58,7 @@ abstract-macros = { workspace = true } # abstract-integration-tests = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -workspace-hack = { version = "0.1", path = "../../../workspace-hack" } +workspace-hack = { version = "0.1", path = "../../workspace-hack" } [profile.release] rpath = false diff --git a/framework/contracts/account/README.md b/framework/contracts/account/README.md index acffc87c7c..ee99036055 100644 --- a/framework/contracts/account/README.md +++ b/framework/contracts/account/README.md @@ -1 +1 @@ -# Abstract Manager +# Abstract Account diff --git a/framework/contracts/account/src/queries.rs b/framework/contracts/account/src/queries.rs index 26a5186eb4..7c95e32dc7 100644 --- a/framework/contracts/account/src/queries.rs +++ b/framework/contracts/account/src/queries.rs @@ -52,7 +52,7 @@ pub fn handle_config_query(deps: Deps) -> StdResult { version_control_address, module_factory_address, modules: ACCOUNT_MODULES - .keys(deps.storage, None, None, Order::Ascending) + .range(deps.storage, None, None, Order::Ascending) .collect::>()?, }) } diff --git a/framework/contracts/native/ibc-client/src/contract.rs b/framework/contracts/native/ibc-client/src/contract.rs index b878e8f36a..393d7e58a4 100644 --- a/framework/contracts/native/ibc-client/src/contract.rs +++ b/framework/contracts/native/ibc-client/src/contract.rs @@ -490,7 +490,7 @@ mod tests { let msg = ExecuteMsg::RemoteAction { host_chain: chain_name, action: HostAction::Dispatch { - manager_msgs: vec![account::ExecuteMsg::UpdateInfo { + account_msgs: vec![account::ExecuteMsg::UpdateInfo { name: None, description: None, link: None, diff --git a/framework/packages/abstract-interface/Cargo.toml b/framework/packages/abstract-interface/Cargo.toml index bd4895cdb8..e6ef7253bf 100644 --- a/framework/packages/abstract-interface/Cargo.toml +++ b/framework/packages/abstract-interface/Cargo.toml @@ -45,6 +45,7 @@ account-factory = { version = "0.23.0", package = "abstract-account-factory", pa ans-host = { version = "0.23.0", package = "abstract-ans-host", path = "../../contracts/native/ans-host", default-features = false } version-control = { version = "0.23.0", package = "abstract-version-control", path = "../../contracts/native/version-control", default-features = false } account = { version = "0.23.0", package = "abstract-account", path = "../../contracts/account", default-features = false } +workspace-hack = { version = "0.1", path = "../../workspace-hack" } [build-dependencies] serde_json = "1.0.79" diff --git a/framework/packages/abstract-interface/src/account/mod.rs b/framework/packages/abstract-interface/src/account/mod.rs index 79c1cbeaad..dab45c7efb 100644 --- a/framework/packages/abstract-interface/src/account/mod.rs +++ b/framework/packages/abstract-interface/src/account/mod.rs @@ -140,7 +140,7 @@ impl AbstractAccount { pub fn expect_whitelist( &self, whitelisted_addrs: Vec, - ) -> Result, crate::AbstractInterfaceError> { + ) -> Result, crate::AbstractInterfaceError> { // insert manager in expected whitelisted addresses let expected_whitelisted_addrs = whitelisted_addrs .into_iter() @@ -152,7 +152,7 @@ impl AbstractAccount { modules: whitelist, .. } = self.account.config()?; - let actual_whitelist = HashSet::from_iter(whitelist.clone()); + let actual_whitelist = HashSet::from_iter(whitelist.iter().map(|a|a.0.clone())); assert_eq!(actual_whitelist, expected_whitelisted_addrs); Ok(whitelist) diff --git a/framework/packages/abstract-std/src/account/mod.rs b/framework/packages/abstract-std/src/account/mod.rs index 5f0fd97e75..74896e18bb 100644 --- a/framework/packages/abstract-std/src/account/mod.rs +++ b/framework/packages/abstract-std/src/account/mod.rs @@ -123,7 +123,6 @@ pub struct CallbackMsg {} #[cosmwasm_schema::cw_serde] #[derive(cw_orch::ExecuteFns)] pub enum ExecuteMsg { - // ## Old Proxy ## /// Executes the provided messages if sender is whitelisted ModuleAction { msgs: Vec> }, /// Execute a message and forward the Response data @@ -137,7 +136,6 @@ pub enum ExecuteMsg { action_query_msg: Binary, }, - // ## Old Manager ## /// Forward execution message to module #[cw_orch(payable)] ExecOnModule { module_id: String, exec_msg: Binary }, @@ -199,13 +197,10 @@ pub enum ExecuteMsg { #[cosmwasm_schema::cw_serde] #[derive(QueryResponses, cw_orch::QueryFns)] pub enum QueryMsg { - // ## Old Proxy ## /// Contains the enabled modules /// Returns [`ConfigResponse`] #[returns(ConfigResponse)] Config {}, - - // ## Old Manager ## /// Query the versions of modules installed on the account given their `ids`. /// Returns [`ModuleVersionsResponse`] #[returns(ModuleVersionsResponse)] @@ -273,8 +268,7 @@ pub enum UpdateSubAccountAction { UnregisterSubAccount { id: u32 }, /// Register sub-account /// It will register new sub-account into the state - /// Could be called by the sub-account manager - /// Note: since it happens after the claim by this manager state won't have spam accounts + /// Could be called by the sub-account RegisterSubAccount { id: u32 }, } @@ -312,7 +306,7 @@ pub struct SubAccountIdsResponse { #[cosmwasm_schema::cw_serde] pub struct ConfigResponse { - pub modules: Vec, + pub modules: Vec<(String,Addr)>, pub account_id: AccountId, pub is_suspended: SuspensionStatus, pub version_control_address: Addr, From 7d06823c28bc0e5b88f27fd67c2cda70a64492e4 Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Thu, 12 Sep 2024 15:15:51 +0200 Subject: [PATCH 17/17] formatting [skip ci] --- framework/packages/abstract-interface/src/account/mod.rs | 2 +- framework/packages/abstract-sdk/src/mock_module.rs | 3 ++- framework/packages/abstract-std/src/account/mod.rs | 2 +- framework/packages/abstract-std/src/objects/module.rs | 3 +-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/packages/abstract-interface/src/account/mod.rs b/framework/packages/abstract-interface/src/account/mod.rs index dab45c7efb..642db9197f 100644 --- a/framework/packages/abstract-interface/src/account/mod.rs +++ b/framework/packages/abstract-interface/src/account/mod.rs @@ -152,7 +152,7 @@ impl AbstractAccount { modules: whitelist, .. } = self.account.config()?; - let actual_whitelist = HashSet::from_iter(whitelist.iter().map(|a|a.0.clone())); + let actual_whitelist = HashSet::from_iter(whitelist.iter().map(|a| a.0.clone())); assert_eq!(actual_whitelist, expected_whitelisted_addrs); Ok(whitelist) diff --git a/framework/packages/abstract-sdk/src/mock_module.rs b/framework/packages/abstract-sdk/src/mock_module.rs index 0f9de5430e..a19a0cb5bd 100644 --- a/framework/packages/abstract-sdk/src/mock_module.rs +++ b/framework/packages/abstract-sdk/src/mock_module.rs @@ -11,7 +11,8 @@ use cosmwasm_std::{testing::MockApi, Deps}; use crate::{ features::{ - AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, Dependencies, ModuleIdentification + AbstractNameService, AbstractRegistryAccess, AccountExecutor, AccountIdentification, + Dependencies, ModuleIdentification, }, std::objects::module::ModuleId, AbstractSdkResult, diff --git a/framework/packages/abstract-std/src/account/mod.rs b/framework/packages/abstract-std/src/account/mod.rs index 74896e18bb..71f5521bca 100644 --- a/framework/packages/abstract-std/src/account/mod.rs +++ b/framework/packages/abstract-std/src/account/mod.rs @@ -306,7 +306,7 @@ pub struct SubAccountIdsResponse { #[cosmwasm_schema::cw_serde] pub struct ConfigResponse { - pub modules: Vec<(String,Addr)>, + pub modules: Vec<(String, Addr)>, pub account_id: AccountId, pub is_suspended: SuspensionStatus, pub version_control_address: Addr, diff --git a/framework/packages/abstract-std/src/objects/module.rs b/framework/packages/abstract-std/src/objects/module.rs index 33bd40b751..bd317ce3e7 100644 --- a/framework/packages/abstract-std/src/objects/module.rs +++ b/framework/packages/abstract-std/src/objects/module.rs @@ -358,8 +358,7 @@ impl Module { pub fn should_be_whitelisted(&self) -> bool { match &self.reference { // Standalone, Service or Native(for example IBC Client) contracts not supposed to be whitelisted on proxy - ModuleReference::Adapter(_) - | ModuleReference::App(_) => true, + ModuleReference::Adapter(_) | ModuleReference::App(_) => true, _ => false, } }