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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,361 changes: 734 additions & 627 deletions framework/Cargo.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ polytone-note = { package = "abstract-polytone-note", version = "5.0.0" }

## crates in order of publishing ## see docs/Publishing.md

abstract-adapter = { path = "packages/abstract-adapter" }
abstract-app = { path = "packages/abstract-app" }
abstract-standalone = { path = "packages/abstract-standalone" }
abstract-adapter = { path = "packages/abstract-adapter", version = "0.26.0" }
abstract-app = { path = "packages/abstract-app", version = "0.26.0" }
abstract-standalone = { path = "packages/abstract-standalone", version = "0.26.0" }

# Keep these as path, creates cirular dependency otherwise
# Only need to re-publish all contracts if a re-publish of abstract-interface is required
Expand All @@ -86,8 +86,7 @@ abstract-ica = { version = "0.26.0", path = "packages/abstract-ica" }
abstract-sdk = { version = "0.26.0", path = "packages/abstract-sdk" }
abstract-std = { version = "0.26.0", path = "packages/abstract-std" }
abstract-testing = { version = "0.26.0", path = "packages/abstract-testing" }
abstract-xion = { package = "account", version = "0.1.0", git = "https://github.com/burnt-labs/contracts", features = ["library"] }

abstract-xion = { package = "xion-account", version = "=0.1.1", features = ["library"] }

# These should remain fixed and don't need to be re-published (unless changes are made)
abstract-macros = { version = "0.26.0", path = "packages/abstract-macros" }
Expand Down
Binary file modified framework/artifacts/abstract_account-xion.wasm
Binary file not shown.
Binary file modified framework/artifacts/abstract_account.wasm
Binary file not shown.
Binary file modified framework/artifacts/abstract_ans_host.wasm
Binary file not shown.
Binary file modified framework/artifacts/abstract_ibc_client.wasm
Binary file not shown.
Binary file modified framework/artifacts/abstract_ibc_host.wasm
Binary file not shown.
Binary file modified framework/artifacts/abstract_ica_client.wasm
Binary file not shown.
Binary file modified framework/artifacts/abstract_module_factory.wasm
Binary file not shown.
Binary file modified framework/artifacts/abstract_registry.wasm
Binary file not shown.
16 changes: 8 additions & 8 deletions framework/artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
d8496d6433fb7cb5d2f1a0c6db22d641370e447e42e18beb56c4921987826073 abstract_account-xion.wasm
31f2c1aad47ef1d6c5301a4cdbaa48331b5116090bac25a180c2b23edd2b5cb9 abstract_account.wasm
0cbb852de4606f21fff0396430b41c41980b25f3a7a4198a47922787a6256f42 abstract_ans_host.wasm
79daca6c64abfd5b3557a6a5d77052fb248b3a27e0b196abe4cea721fd832872 abstract_ibc_client.wasm
1669d93a64f0b69664a799c96edac91d9ecb0672f3dd6da833c8a4ccde49a338 abstract_ibc_host.wasm
5e1ebbea19de85d940815bc47bccebddb902bae059a535b05acfbde5f9db5eb3 abstract_ica_client.wasm
efc127ca5c7ff88bd68cbee8b6b33ee64389f88decd2435553e843dacaaf0cb9 abstract_module_factory.wasm
e6a933b2fc0023edcf328db411de5432d03013ae484d01b2b50d21a7487f05e6 abstract_registry.wasm
2b762f3ac65381f39dff37e08f5a0ccd7ab0e6c72e33cf4636f2261136f329bc abstract_account-xion.wasm
0cdd7d7604198a0a52571430013acabfe6d86d6ced2e665caeaf92f63108c163 abstract_account.wasm
f5a034b452dc18e3c26253defa0b3b67beb61848d1a19c216f03e0b1737d5e56 abstract_ans_host.wasm
b344d374793d3213fe3070fa41a1b6646648af440aabcc640818686af4d636c0 abstract_ibc_client.wasm
d53935bf6121cbea4b10a56071cb6749a0bb128386db8ce8daddf3f64ddf10cc abstract_ibc_host.wasm
3d1dd9b70cc9d92b0d86cfe3f95222e363cacfef36b77c00375d1754486dd442 abstract_ica_client.wasm
eefcf1c8acc404625f5eda66b8496efb8f8d15ee41ec72ccd62988cb99c202ee abstract_module_factory.wasm
1cbfb47264d1183e26fe22c45b39c19e755888fb211e5e3835ca187f95ec78f1 abstract_registry.wasm
2 changes: 1 addition & 1 deletion framework/contracts/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = { workspace = true }
name = "abstract-account"
readme = "README.md"
repository = "https://github.com/AbstractSDK/abstract"
version = { workspace = true }
version = "0.26.1"

exclude = ["contract.wasm", "hash.txt"]

Expand Down
7 changes: 5 additions & 2 deletions framework/contracts/account/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ pub fn instantiate(
}
MIGRATE_CONTEXT.save(deps.storage, &vec![])?;

let owner = owner.unwrap_or(GovernanceDetails::AbstractAccount {
address: env.contract.address.clone(),
});
let governance = owner.clone().verify(deps.as_ref())?;
match governance {
// Check if the caller is the proposed owner account when creating a sub-account.
Expand Down Expand Up @@ -504,9 +507,9 @@ mod tests {
account::InstantiateMsg {
code_id: 1,
account_id: AccountId::new(1, AccountTrace::Local).ok(),
owner: GovernanceDetails::Monarchy {
owner: Some(GovernanceDetails::Monarchy {
monarch: abstr.owner.to_string(),
},
}),
namespace: None,
name: Some("test".to_string()),
description: None,
Expand Down
3 changes: 3 additions & 0 deletions framework/contracts/account/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ pub enum AccountError {
#[error("Abstract Account don't have Authentication")]
AbstractAccountNoAuth {},

#[error("The new_code_id field needs to be filled when migrating from a xion account")]
MissingCodeIdToMigrate {},

#[cfg(feature = "xion")]
#[error(transparent)]
AbstractXion(#[from] abstract_xion::error::ContractError),
Expand Down
4 changes: 2 additions & 2 deletions framework/contracts/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ mod test_common {
account::InstantiateMsg {
code_id: 1,
account_id: Some(AccountId::new(1, AccountTrace::Local).unwrap()),
owner: GovernanceDetails::Monarchy {
owner: Some(GovernanceDetails::Monarchy {
monarch: abstr.owner.to_string(),
},
}),
namespace: None,
name: Some("test".to_string()),
description: None,
Expand Down
31 changes: 21 additions & 10 deletions framework/contracts/account/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> AccountResult {
} else {
#[cfg(feature = "xion")]
{
if current_contract_version.contract != "account" {
Err(AbstractError::ContractNameMismatch {
from: current_contract_version.contract.clone(),
to: ACCOUNT.to_string(),
})?;
}
// We might want to migrate from a XION account
migrate_from_xion_account(deps, _env, current_contract_version)
migrate_from_xion_account(
deps,
_env,
current_contract_version,
_msg.code_id
.ok_or(crate::error::AccountError::MissingCodeIdToMigrate {})?,
)
}
#[cfg(not(feature = "xion"))]
{
Expand All @@ -44,6 +56,7 @@ pub fn migrate_from_xion_account(
mut deps: DepsMut,
env: Env,
current_contract_version: cw2::ContractVersion,
new_code_id: u64,
) -> AccountResult {
use crate::modules::{_install_modules, MIGRATE_CONTEXT};
use ::{
Expand All @@ -52,6 +65,7 @@ pub fn migrate_from_xion_account(
abstract_std::account::ModuleInstallConfig,
abstract_std::objects::module::ModuleInfo,
abstract_std::objects::AccountId,
abstract_std::IBC_CLIENT,
abstract_std::{
account::state::{WhitelistedModules, SUSPENSION_STATUS, WHITELISTED_MODULES},
objects::{
Expand All @@ -60,7 +74,6 @@ pub fn migrate_from_xion_account(
},
registry::state::LOCAL_ACCOUNT_SEQUENCE,
},
abstract_std::{native_addrs, IBC_CLIENT},
cosmwasm_std::wasm_execute,
};

Expand All @@ -73,9 +86,7 @@ pub fn migrate_from_xion_account(
// Use CW2 to set the contract version, this is needed for migrations
set_contract_version(deps.storage, ACCOUNT, CONTRACT_VERSION)?;

let abstract_code_id =
native_addrs::abstract_code_id(&deps.querier, env.contract.address.clone())?;
let registry = RegistryContract::new(deps.as_ref(), abstract_code_id)?;
let registry = RegistryContract::new(deps.as_ref(), new_code_id)?;

let account_id =
AccountId::local(LOCAL_ACCOUNT_SEQUENCE.query(&deps.querier, registry.address.clone())?);
Expand Down Expand Up @@ -117,7 +128,7 @@ pub fn migrate_from_xion_account(

// Install IBC Client module
let (install_msgs, install_attribute) =
_install_modules(deps, install_modules, vec![], abstract_code_id)?;
_install_modules(deps, install_modules, vec![], new_code_id)?;
response = response
.add_submessages(install_msgs)
.add_attribute(install_attribute.key, install_attribute.value);
Expand Down Expand Up @@ -147,7 +158,7 @@ mod tests {

let version: Version = CONTRACT_VERSION.parse().unwrap();

let res = super::migrate(deps.as_mut(), env, MigrateMsg {});
let res = super::migrate(deps.as_mut(), env, MigrateMsg { code_id: None });

assert_eq!(
res,
Expand Down Expand Up @@ -175,7 +186,7 @@ mod tests {

let version: Version = CONTRACT_VERSION.parse().unwrap();

let res = super::migrate(deps.as_mut(), env, MigrateMsg {});
let res = super::migrate(deps.as_mut(), env, MigrateMsg { code_id: None });

assert_eq!(
res,
Expand All @@ -202,7 +213,7 @@ mod tests {
let old_name = "old:contract";
set_contract_version(deps.as_mut().storage, old_name, old_version)?;

let res = super::migrate(deps.as_mut(), env, MigrateMsg {});
let res = super::migrate(deps.as_mut(), env, MigrateMsg { code_id: None });

assert_eq!(
res,
Expand Down Expand Up @@ -234,7 +245,7 @@ mod tests {

set_contract_version(deps.as_mut().storage, ACCOUNT, small_version)?;

let res = super::migrate(deps.as_mut(), env, MigrateMsg {})?;
let res = super::migrate(deps.as_mut(), env, MigrateMsg { code_id: None })?;
assert!(res.messages.is_empty());

assert_eq!(
Expand Down
4 changes: 2 additions & 2 deletions framework/contracts/account/src/sub_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ pub fn create_sub_account(
let create_account_msg = abstract_std::account::InstantiateMsg {
code_id: self_code_id,
account_id: Some(account_id.clone()),
owner: GovernanceDetails::SubAccount {
owner: Some(GovernanceDetails::SubAccount {
account: env.contract.address.into_string(),
},
}),
namespace,
install_modules,
name,
Expand Down
24 changes: 12 additions & 12 deletions framework/contracts/account/tests/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ fn create_one_account() -> AResult {
namespace: None,
install_modules: vec![],
account_id: None,
owner: GovernanceDetails::Monarchy {
owner: Some(GovernanceDetails::Monarchy {
monarch: sender.to_string(),
},
}),
authenticator: None,
},
None,
Expand Down Expand Up @@ -94,9 +94,9 @@ fn create_two_accounts() -> AResult {
namespace: None,
install_modules: vec![],
account_id: None,
owner: GovernanceDetails::Monarchy {
owner: Some(GovernanceDetails::Monarchy {
monarch: sender.to_string(),
},
}),
authenticator: None,
},
None,
Expand All @@ -113,9 +113,9 @@ fn create_two_accounts() -> AResult {
namespace: None,
install_modules: vec![],
account_id: None,
owner: GovernanceDetails::Monarchy {
owner: Some(GovernanceDetails::Monarchy {
monarch: sender.to_string(),
},
}),
authenticator: None,
},
None,
Expand Down Expand Up @@ -164,9 +164,9 @@ fn sender_is_not_admin_monarchy() -> AResult {
namespace: None,
install_modules: vec![],
account_id: None,
owner: GovernanceDetails::Monarchy {
owner: Some(GovernanceDetails::Monarchy {
monarch: sender.to_string(),
},
}),
authenticator: None,
},
None,
Expand Down Expand Up @@ -213,10 +213,10 @@ fn sender_is_not_admin_external() -> AResult {
namespace: None,
install_modules: vec![],
account_id: None,
owner: GovernanceDetails::External {
owner: Some(GovernanceDetails::External {
governance_address: sender.to_string(),
governance_type: "some-gov-type".to_string(),
},
}),
authenticator: None,
},
None,
Expand Down Expand Up @@ -259,10 +259,10 @@ fn create_one_account_with_namespace() -> AResult {
namespace: Some(namespace_to_claim.to_string()),
install_modules: vec![],
account_id: None,
owner: GovernanceDetails::External {
owner: Some(GovernanceDetails::External {
governance_address: sender.to_string(),
governance_type: "some-gov-type".to_string(),
},
}),
authenticator: None,
},
None,
Expand Down
4 changes: 3 additions & 1 deletion framework/contracts/account/tests/upgrades.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,9 @@ mod upgrade_account {
),
(
ModuleInfo::from_id_latest("abstract:account")?,
Some(to_json_binary(&abstract_std::account::MigrateMsg {})?),
Some(to_json_binary(&abstract_std::account::MigrateMsg {
code_id: None,
})?),
),
(
ModuleInfo::from_id_latest(adapter_1::MOCK_ADAPTER_ID)?,
Expand Down
16 changes: 9 additions & 7 deletions framework/contracts/account/tests/xion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ fn test_init_sign_arb() {
pubkey: Binary::from(pubkey_bytes),
signature: Binary::from(signature_bytes),
}),
owner: abstract_std::objects::gov_type::GovernanceDetails::AbstractAccount {
address: env.contract.address.clone(),
},
owner: Some(
abstract_std::objects::gov_type::GovernanceDetails::AbstractAccount {
address: env.contract.address.clone(),
},
),
name: Some("account".to_owned()),
install_modules: vec![],
account_id: None,
Expand Down Expand Up @@ -159,9 +161,9 @@ pub(crate) fn mock_init(
account::InstantiateMsg {
code_id: 1,
account_id: Some(AccountId::new(1, AccountTrace::Local).unwrap()),
owner: GovernanceDetails::Monarchy {
owner: Some(GovernanceDetails::Monarchy {
monarch: abstr.owner.to_string(),
},
}),
namespace: None,
name: Some("test".to_string()),
description: None,
Expand Down Expand Up @@ -331,9 +333,9 @@ mod actual_signature {
&InstantiateMsg {
code_id,
account_id: None,
owner: GovernanceDetails::AbstractAccount {
owner: Some(GovernanceDetails::AbstractAccount {
address: account_addr.clone(),
},
}),
namespace: None,
install_modules: vec![],
name: None,
Expand Down
10 changes: 6 additions & 4 deletions framework/contracts/native/ibc-host/src/account_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ pub fn receive_register(

let create_account_msg = account::InstantiateMsg::<cosmwasm_std::Empty> {
code_id,
owner: abstract_std::objects::gov_type::GovernanceDetails::External {
governance_address: env.contract.address.into_string(),
governance_type: "abstract-ibc".into(), // at least 4 characters
},
owner: Some(
abstract_std::objects::gov_type::GovernanceDetails::External {
governance_address: env.contract.address.into_string(),
governance_type: "abstract-ibc".into(), // at least 4 characters
},
),
name,
description,
link,
Expand Down
11 changes: 10 additions & 1 deletion framework/docs/src/releases/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@

### Added

- Added migration function to migrate from xion accounts
- Fixed migration from xion accounts, must specify `code_id` field for such migration (because new code_id is not available inside migration function)

### Changed

- Account's `InstantiationMsg` field `owner` is optional now and defaults to AbstractAccount(account_address)

### Removed

## [0.24.1] - 2024-10-25

- Added `PfmMemoBuilder` API for building middleware forwarding memo
- Added `HookMemoBuilder` API for building wasm ibc hook memo
- `execute_with_funds` to Executor to attach funds to execution.
Expand Down
5 changes: 4 additions & 1 deletion framework/packages/abstract-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interchain = ["dep:cw-orch-interchain", "abstract-interface/interchain"]
test-utils = ["cw20", "cw20-base", "cw-plus-interface", "abstract-interface/testing"]

[dependencies]
abstract-interface = { workspace = true }
abstract-std.workspace = true
cosmwasm-std.workspace = true
cw-asset = { workspace = true }
Expand All @@ -42,6 +41,10 @@ cw20-base = { version = "2.0.0", optional = true }
# For random account seq
rand = { version = "0.8.5" }

# Keep this as a version and update when publishing new versions
# Default features only works on the workspace Cargo.toml, so using workspace = true is not possible here
abstract-interface = { path = "../../packages/abstract-interface", version = "0.26.0" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
workspace-hack = { version = "0.1", path = "../../workspace-hack" }

Expand Down
2 changes: 1 addition & 1 deletion framework/packages/abstract-client/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ impl<Chain: CwEnv> Account<Chain> {
.upgrade(vec![(
ModuleInfo::from_id(abstract_std::constants::ACCOUNT, version.clone())?,
Some(
to_json_binary(&abstract_std::account::MigrateMsg {})
to_json_binary(&abstract_std::account::MigrateMsg { code_id: None })
.map_err(Into::<CwOrchError>::into)?,
),
)])
Expand Down
Loading
Loading