Skip to content

Commit f835e84

Browse files
committed
Rev namespace for abstract (#524)
Signed-off-by: Buckram <[email protected]>
1 parent 0cd09d3 commit f835e84

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

framework/contracts/native/registry/src/contract.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub(crate) use abstract_std::objects::namespace::ABSTRACT_NAMESPACE;
44
use abstract_std::{
55
objects::namespace::Namespace,
66
registry::{
7-
state::{LOCAL_ACCOUNT_SEQUENCE, NAMESPACES},
7+
state::{LOCAL_ACCOUNT_SEQUENCE, NAMESPACES, REV_NAMESPACES},
88
Config,
99
},
1010
};
@@ -46,11 +46,9 @@ pub fn instantiate(deps: DepsMut, _env: Env, _info: MessageInfo, msg: Instantiat
4646
cw_ownable::initialize_owner(deps.storage, deps.api, Some(&admin))?;
4747

4848
// Save the abstract namespace to the Abstract admin account
49-
NAMESPACES.save(
50-
deps.storage,
51-
&Namespace::new(ABSTRACT_NAMESPACE)?,
52-
&ABSTRACT_ACCOUNT_ID,
53-
)?;
49+
let namespace = Namespace::new(ABSTRACT_NAMESPACE)?;
50+
NAMESPACES.save(deps.storage, &namespace, &ABSTRACT_ACCOUNT_ID)?;
51+
REV_NAMESPACES.save(deps.storage, &ABSTRACT_ACCOUNT_ID, &namespace)?;
5452

5553
LOCAL_ACCOUNT_SEQUENCE.save(deps.storage, &0)?;
5654

framework/contracts/native/registry/src/migrate.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
use abstract_std::{
2-
objects::{module_version::assert_cw_contract_upgrade, namespace::Namespace, AccountId},
2+
objects::{
3+
module_version::assert_cw_contract_upgrade,
4+
namespace::{Namespace, ABSTRACT_NAMESPACE},
5+
AccountId, ABSTRACT_ACCOUNT_ID,
6+
},
37
registry::{
48
state::{NAMESPACES, REV_NAMESPACES},
59
MigrateMsg,
@@ -47,7 +51,14 @@ pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> VCResult {
4751
let namespaces_info = NAMESPACES_INFO
4852
.range(deps.storage, None, None, Order::Ascending)
4953
.collect::<StdResult<Vec<_>>>()?;
50-
for (namespace, account_id) in namespaces_info {
54+
for (namespace, account_id) in namespaces_info
55+
.into_iter()
56+
// Make sure abstract included
57+
.chain(std::iter::once((
58+
Namespace::new(ABSTRACT_NAMESPACE)?,
59+
ABSTRACT_ACCOUNT_ID,
60+
)))
61+
{
5162
NAMESPACES.save(deps.storage, &namespace, &account_id)?;
5263
REV_NAMESPACES.save(deps.storage, &account_id, &namespace)?;
5364
}

0 commit comments

Comments
 (0)