From 2a3cbc8d4215f3142c2cb02a4ac276c20887d713 Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Fri, 14 Apr 2023 15:29:20 +0300 Subject: [PATCH 1/8] add timelock migration --- .../cwd-subdao-timelock-single/src/contract.rs | 15 +++++++++++++-- .../cwd-subdao-timelock-single/src/state.rs | 3 ++- .../neutron-subdao-timelock-single/src/msg.rs | 4 +++- .../neutron-subdao-timelock-single/src/types.rs | 8 ++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 030d7c04..ad2387ce 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -24,7 +24,7 @@ use neutron_subdao_timelock_single::{ }; use crate::error::ContractError; -use crate::state::{CONFIG, DEFAULT_LIMIT, PROPOSALS}; +use crate::state::{CONFIG, CONFIG_OLD, DEFAULT_LIMIT, PROPOSALS}; pub(crate) const CONTRACT_NAME: &str = "crates.io:cwd-subdao-timelock-single"; pub(crate) const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -275,9 +275,20 @@ pub fn query_list_proposals( } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { +pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result { // Set contract to version to latest set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + let mut old_config: Config = CONFIG_OLD.load(deps.storage)?; + + let new_overrule_pre_propose = deps.api.addr_validate(&msg.overrule_pre_propose)?; + let new_config = Config { + owner: old_config.owner, + overrule_pre_propose: new_overrule_pre_propose, + subdao: old_config.subdao, + }; + + CONFIG.save(deps.storage, &new_config)?; + Ok(Response::default()) } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index c1fde550..b949d402 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -4,5 +4,6 @@ use neutron_subdao_timelock_single::types::{Config, SingleChoiceProposal}; /// Default limit for proposal pagination. pub const DEFAULT_LIMIT: u64 = 30; -pub const CONFIG: Item = Item::new("config"); +pub const CONFIG_OLD: Item = Item::new("config"); +pub const CONFIG: Item = Item::new("configv2"); pub const PROPOSALS: Map = Map::new("proposals"); diff --git a/packages/neutron-subdao-timelock-single/src/msg.rs b/packages/neutron-subdao-timelock-single/src/msg.rs index c493610c..3860dd22 100644 --- a/packages/neutron-subdao-timelock-single/src/msg.rs +++ b/packages/neutron-subdao-timelock-single/src/msg.rs @@ -53,4 +53,6 @@ pub enum QueryMsg { } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct MigrateMsg {} +pub struct MigrateMsg { + pub overrule_pre_propose: String, +} diff --git a/packages/neutron-subdao-timelock-single/src/types.rs b/packages/neutron-subdao-timelock-single/src/types.rs index 1360f787..ac740587 100644 --- a/packages/neutron-subdao-timelock-single/src/types.rs +++ b/packages/neutron-subdao-timelock-single/src/types.rs @@ -12,6 +12,14 @@ pub struct Config { pub subdao: Addr, } +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] +pub struct ConfigOld { + pub owner: Addr, + pub timelock_duration: u64, + // subDAO core module can timelock proposals. + pub subdao: Addr, +} + #[derive(Serialize, Deserialize, Clone, JsonSchema, Debug, Eq, PartialEq)] pub struct SingleChoiceProposal { /// The ID of the proposal being returned. From e1c60e49ff7a6a53898386aabb1b0e11dc1a073c Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Fri, 14 Apr 2023 15:35:18 +0300 Subject: [PATCH 2/8] clippy --- contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index ad2387ce..a29ccaa4 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -278,7 +278,7 @@ pub fn query_list_proposals( pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result { // Set contract to version to latest set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - let mut old_config: Config = CONFIG_OLD.load(deps.storage)?; + let old_config: Config = CONFIG_OLD.load(deps.storage)?; let new_overrule_pre_propose = deps.api.addr_validate(&msg.overrule_pre_propose)?; let new_config = Config { From 298474d51ce4fe03f733d5b8095bf4653461e599 Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Fri, 14 Apr 2023 18:37:25 +0300 Subject: [PATCH 3/8] remove core dao migratemsg --- contracts/dao/cwd-core/src/msg.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/contracts/dao/cwd-core/src/msg.rs b/contracts/dao/cwd-core/src/msg.rs index c8a34193..09c4a1d6 100644 --- a/contracts/dao/cwd-core/src/msg.rs +++ b/contracts/dao/cwd-core/src/msg.rs @@ -134,7 +134,4 @@ pub enum QueryMsg { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -pub enum MigrateMsg { - FromV1 { dao_uri: Option }, - FromCompatible {}, -} +pub enum MigrateMsg {} From fccc6ef4e635098eab5da494441c622d2694dd0f Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Mon, 17 Apr 2023 13:17:23 +0300 Subject: [PATCH 4/8] migrate msg type update --- .../dao/cwd-core/schema/migrate_msg.json | 35 +------------------ contracts/dao/cwd-core/schema/query_msg.json | 21 +++++++++++ contracts/dao/cwd-core/src/msg.rs | 2 +- .../schema/migrate_msg.json | 3 +- .../proposal/cwd-proposal-single/src/msg.rs | 2 +- .../lockdrop-vault/schema/execute_msg.json | 8 ++++- .../schema/get_config_response.json | 8 +++-- .../schema/instantiate_msg.json | 11 ++++-- .../schema/migrate_msg.json | 10 +++++- .../schema/proposal_list_response.json | 11 +----- 10 files changed, 56 insertions(+), 55 deletions(-) diff --git a/contracts/dao/cwd-core/schema/migrate_msg.json b/contracts/dao/cwd-core/schema/migrate_msg.json index 6b9264c8..87b18ea7 100644 --- a/contracts/dao/cwd-core/schema/migrate_msg.json +++ b/contracts/dao/cwd-core/schema/migrate_msg.json @@ -1,38 +1,5 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "MigrateMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "from_v1" - ], - "properties": { - "from_v1": { - "type": "object", - "properties": { - "dao_uri": { - "type": [ - "string", - "null" - ] - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "from_compatible" - ], - "properties": { - "from_compatible": { - "type": "object" - } - }, - "additionalProperties": false - } - ] + "type": "object" } diff --git a/contracts/dao/cwd-core/schema/query_msg.json b/contracts/dao/cwd-core/schema/query_msg.json index 2692c274..7e410b64 100644 --- a/contracts/dao/cwd-core/schema/query_msg.json +++ b/contracts/dao/cwd-core/schema/query_msg.json @@ -191,6 +191,27 @@ }, "additionalProperties": false }, + { + "description": "Returns the SubDAO for a specific address if it in the list", + "type": "object", + "required": [ + "get_sub_dao" + ], + "properties": { + "get_sub_dao": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "Implements the DAO Star standard: https://daostar.one/EIP", "type": "object", diff --git a/contracts/dao/cwd-core/src/msg.rs b/contracts/dao/cwd-core/src/msg.rs index 09c4a1d6..b7bea062 100644 --- a/contracts/dao/cwd-core/src/msg.rs +++ b/contracts/dao/cwd-core/src/msg.rs @@ -134,4 +134,4 @@ pub enum QueryMsg { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -pub enum MigrateMsg {} +pub struct MigrateMsg {} diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/migrate_msg.json b/contracts/dao/proposal/cwd-proposal-single/schema/migrate_msg.json index 7e58c323..87b18ea7 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/migrate_msg.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/migrate_msg.json @@ -1,6 +1,5 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "MigrateMsg", - "type": "string", - "enum": [] + "type": "object" } diff --git a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs index d324185f..d4bf3780 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs @@ -194,4 +194,4 @@ pub enum QueryMsg { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -pub enum MigrateMsg {} +pub struct MigrateMsg {} diff --git a/contracts/dao/voting/lockdrop-vault/schema/execute_msg.json b/contracts/dao/voting/lockdrop-vault/schema/execute_msg.json index 3c5ea8bb..5be9b706 100644 --- a/contracts/dao/voting/lockdrop-vault/schema/execute_msg.json +++ b/contracts/dao/voting/lockdrop-vault/schema/execute_msg.json @@ -35,7 +35,13 @@ "null" ] }, - "oracle_contract": { + "oracle_atom_contract": { + "type": [ + "string", + "null" + ] + }, + "oracle_usdc_contract": { "type": [ "string", "null" diff --git a/contracts/dao/voting/lockdrop-vault/schema/get_config_response.json b/contracts/dao/voting/lockdrop-vault/schema/get_config_response.json index 86fc6a48..066f660f 100644 --- a/contracts/dao/voting/lockdrop-vault/schema/get_config_response.json +++ b/contracts/dao/voting/lockdrop-vault/schema/get_config_response.json @@ -6,7 +6,8 @@ "description", "lockdrop_contract", "name", - "oracle_contract", + "oracle_atom_contract", + "oracle_usdc_contract", "owner" ], "properties": { @@ -29,7 +30,10 @@ "name": { "type": "string" }, - "oracle_contract": { + "oracle_atom_contract": { + "$ref": "#/definitions/Addr" + }, + "oracle_usdc_contract": { "$ref": "#/definitions/Addr" }, "owner": { diff --git a/contracts/dao/voting/lockdrop-vault/schema/instantiate_msg.json b/contracts/dao/voting/lockdrop-vault/schema/instantiate_msg.json index 7593de2e..1eb4db48 100644 --- a/contracts/dao/voting/lockdrop-vault/schema/instantiate_msg.json +++ b/contracts/dao/voting/lockdrop-vault/schema/instantiate_msg.json @@ -6,7 +6,8 @@ "description", "lockdrop_contract", "name", - "oracle_contract", + "oracle_atom_contract", + "oracle_usdc_contract", "owner" ], "properties": { @@ -29,8 +30,12 @@ "description": "Name contains the vault name which is used to ease the vault's recognition.", "type": "string" }, - "oracle_contract": { - "description": "The oracle contract behind the vault.", + "oracle_atom_contract": { + "description": "The oracle ATOM/NTRN contract behind the vault.", + "type": "string" + }, + "oracle_usdc_contract": { + "description": "The oracle USDC/NTRN contract behind the vault.", "type": "string" }, "owner": { diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json index 87b18ea7..52d81948 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json @@ -1,5 +1,13 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "MigrateMsg", - "type": "object" + "type": "object", + "required": [ + "overrule_pre_propose" + ], + "properties": { + "overrule_pre_propose": { + "type": "string" + } + } } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/proposal_list_response.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/proposal_list_response.json index 6e17fd24..b2284c86 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/proposal_list_response.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/proposal_list_response.json @@ -1227,8 +1227,7 @@ "required": [ "id", "msgs", - "status", - "timelock_ts" + "status" ], "properties": { "id": { @@ -1246,14 +1245,6 @@ }, "status": { "$ref": "#/definitions/ProposalStatus" - }, - "timelock_ts": { - "description": "The timestamp at which the proposal was submitted to the timelock contract.", - "allOf": [ - { - "$ref": "#/definitions/Timestamp" - } - ] } } }, From d6f6dfc7724f90ba324cf3d011168fafcd06e1af Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Mon, 17 Apr 2023 14:53:31 +0300 Subject: [PATCH 5/8] more migrate msgs --- .../cwd-pre-propose-single-overrule/src/contract.rs | 11 ++++++++++- .../cwd-subdao-pre-propose-single/src/contract.rs | 6 ++++++ packages/neutron-dao-pre-propose-overrule/src/msg.rs | 4 ++++ packages/neutron-subdao-pre-propose-single/src/msg.rs | 4 ++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs index 842710ed..a64b11dd 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs +++ b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs @@ -14,7 +14,7 @@ use cwd_pre_propose_base::{ state::PreProposeContract, }; use neutron_dao_pre_propose_overrule::msg::{ - ExecuteMsg, InstantiateMsg, ProposeMessage, QueryExt, QueryMsg, + ExecuteMsg, InstantiateMsg, MigrateMsg, ProposeMessage, QueryExt, QueryMsg, }; use crate::state::PROPOSALS; @@ -286,3 +286,12 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { _ => PrePropose::default().query(deps, env, msg), } } + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate( + _deps: DepsMut, + _env: Env, + _msg: MigrateMsg, +) -> Result { + Ok(Response::default()) +} diff --git a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/src/contract.rs b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/src/contract.rs index c1f7ad4a..b1fee8fd 100644 --- a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/src/contract.rs +++ b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/src/contract.rs @@ -16,6 +16,7 @@ use cwd_pre_propose_base::{ msg::{ExecuteMsg as ExecuteBase, InstantiateMsg as InstantiateBase}, state::PreProposeContract, }; +use neutron_subdao_pre_propose_single::msg::MigrateMsg; use neutron_subdao_pre_propose_single::{ msg::{ExecuteMsg, InstantiateMsg, QueryExt, QueryMsg}, types::ProposeMessage, @@ -186,3 +187,8 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Result { + Ok(Response::default()) +} diff --git a/packages/neutron-dao-pre-propose-overrule/src/msg.rs b/packages/neutron-dao-pre-propose-overrule/src/msg.rs index f495963e..b7965e6e 100644 --- a/packages/neutron-dao-pre-propose-overrule/src/msg.rs +++ b/packages/neutron-dao-pre-propose-overrule/src/msg.rs @@ -27,3 +27,7 @@ pub enum QueryExt { } pub type QueryMsg = QueryBase; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MigrateMsg {} diff --git a/packages/neutron-subdao-pre-propose-single/src/msg.rs b/packages/neutron-subdao-pre-propose-single/src/msg.rs index 9b7b9b2d..e94b3732 100644 --- a/packages/neutron-subdao-pre-propose-single/src/msg.rs +++ b/packages/neutron-subdao-pre-propose-single/src/msg.rs @@ -29,3 +29,7 @@ pub enum QueryExt { } pub type QueryMsg = QueryBase; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MigrateMsg {} From 2f428ff81727be6b8ca24e90ee6700cf991f4e66 Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:15:28 +0300 Subject: [PATCH 6/8] types fix --- contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs | 3 ++- contracts/subdaos/cwd-subdao-timelock-single/src/state.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index a29ccaa4..6dad5651 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -22,6 +22,7 @@ use neutron_subdao_timelock_single::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, types::{Config, ProposalListResponse, ProposalStatus, SingleChoiceProposal}, }; +use neutron_subdao_timelock_single::types::ConfigOld; use crate::error::ContractError; use crate::state::{CONFIG, CONFIG_OLD, DEFAULT_LIMIT, PROPOSALS}; @@ -278,7 +279,7 @@ pub fn query_list_proposals( pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result { // Set contract to version to latest set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - let old_config: Config = CONFIG_OLD.load(deps.storage)?; + let old_config: ConfigOld = CONFIG_OLD.load(deps.storage)?; let new_overrule_pre_propose = deps.api.addr_validate(&msg.overrule_pre_propose)?; let new_config = Config { diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index b949d402..06dd7de6 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -1,9 +1,9 @@ use cw_storage_plus::{Item, Map}; -use neutron_subdao_timelock_single::types::{Config, SingleChoiceProposal}; +use neutron_subdao_timelock_single::types::{Config, ConfigOld, SingleChoiceProposal}; /// Default limit for proposal pagination. pub const DEFAULT_LIMIT: u64 = 30; -pub const CONFIG_OLD: Item = Item::new("config"); +pub const CONFIG_OLD: Item = Item::new("config"); pub const CONFIG: Item = Item::new("configv2"); pub const PROPOSALS: Map = Map::new("proposals"); From 7120c81f2dce3deafd7a7cdfd0d1b107c9e46def Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Mon, 17 Apr 2023 16:39:40 +0300 Subject: [PATCH 7/8] fmt --- contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 6dad5651..fb1ed7e5 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -18,11 +18,11 @@ use neutron_dao_pre_propose_overrule::msg::{ }; use neutron_subdao_core::msg::QueryMsg as SubdaoQuery; use neutron_subdao_pre_propose_single::msg::QueryMsg as PreProposeQuery; +use neutron_subdao_timelock_single::types::ConfigOld; use neutron_subdao_timelock_single::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, types::{Config, ProposalListResponse, ProposalStatus, SingleChoiceProposal}, }; -use neutron_subdao_timelock_single::types::ConfigOld; use crate::error::ContractError; use crate::state::{CONFIG, CONFIG_OLD, DEFAULT_LIMIT, PROPOSALS}; From cdb1ad7a719d72f9ef4c1f3fbbc7a3354cd4f004 Mon Sep 17 00:00:00 2001 From: oldremez <83083413+oldremez@users.noreply.github.com> Date: Mon, 17 Apr 2023 19:56:52 +0300 Subject: [PATCH 8/8] make migrate handlers empty, regenerate schema --- contracts/dao/cwd-core/src/contract.rs | 3 ++- .../src/contract.rs | 3 ++- .../schema/migrate_msg.json | 10 +--------- .../cwd-subdao-timelock-single/src/contract.rs | 16 ++-------------- .../cwd-subdao-timelock-single/src/state.rs | 5 ++--- .../neutron-subdao-timelock-single/src/msg.rs | 4 +--- .../neutron-subdao-timelock-single/src/types.rs | 8 -------- 7 files changed, 10 insertions(+), 39 deletions(-) diff --git a/contracts/dao/cwd-core/src/contract.rs b/contracts/dao/cwd-core/src/contract.rs index 72954cd6..aba3ec80 100644 --- a/contracts/dao/cwd-core/src/contract.rs +++ b/contracts/dao/cwd-core/src/contract.rs @@ -533,7 +533,8 @@ pub fn query_dao_uri(deps: Deps) -> StdResult { } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { +pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; Ok(Response::default()) } diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs index a64b11dd..c90bc035 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs +++ b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs @@ -289,9 +289,10 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { #[cfg_attr(not(feature = "library"), entry_point)] pub fn migrate( - _deps: DepsMut, + deps: DepsMut, _env: Env, _msg: MigrateMsg, ) -> Result { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; Ok(Response::default()) } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json index 52d81948..87b18ea7 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/migrate_msg.json @@ -1,13 +1,5 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "MigrateMsg", - "type": "object", - "required": [ - "overrule_pre_propose" - ], - "properties": { - "overrule_pre_propose": { - "type": "string" - } - } + "type": "object" } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index fb1ed7e5..030d7c04 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -18,14 +18,13 @@ use neutron_dao_pre_propose_overrule::msg::{ }; use neutron_subdao_core::msg::QueryMsg as SubdaoQuery; use neutron_subdao_pre_propose_single::msg::QueryMsg as PreProposeQuery; -use neutron_subdao_timelock_single::types::ConfigOld; use neutron_subdao_timelock_single::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, types::{Config, ProposalListResponse, ProposalStatus, SingleChoiceProposal}, }; use crate::error::ContractError; -use crate::state::{CONFIG, CONFIG_OLD, DEFAULT_LIMIT, PROPOSALS}; +use crate::state::{CONFIG, DEFAULT_LIMIT, PROPOSALS}; pub(crate) const CONTRACT_NAME: &str = "crates.io:cwd-subdao-timelock-single"; pub(crate) const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -276,20 +275,9 @@ pub fn query_list_proposals( } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result { +pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { // Set contract to version to latest set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - let old_config: ConfigOld = CONFIG_OLD.load(deps.storage)?; - - let new_overrule_pre_propose = deps.api.addr_validate(&msg.overrule_pre_propose)?; - let new_config = Config { - owner: old_config.owner, - overrule_pre_propose: new_overrule_pre_propose, - subdao: old_config.subdao, - }; - - CONFIG.save(deps.storage, &new_config)?; - Ok(Response::default()) } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index 06dd7de6..c1fde550 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -1,9 +1,8 @@ use cw_storage_plus::{Item, Map}; -use neutron_subdao_timelock_single::types::{Config, ConfigOld, SingleChoiceProposal}; +use neutron_subdao_timelock_single::types::{Config, SingleChoiceProposal}; /// Default limit for proposal pagination. pub const DEFAULT_LIMIT: u64 = 30; -pub const CONFIG_OLD: Item = Item::new("config"); -pub const CONFIG: Item = Item::new("configv2"); +pub const CONFIG: Item = Item::new("config"); pub const PROPOSALS: Map = Map::new("proposals"); diff --git a/packages/neutron-subdao-timelock-single/src/msg.rs b/packages/neutron-subdao-timelock-single/src/msg.rs index 3860dd22..c493610c 100644 --- a/packages/neutron-subdao-timelock-single/src/msg.rs +++ b/packages/neutron-subdao-timelock-single/src/msg.rs @@ -53,6 +53,4 @@ pub enum QueryMsg { } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct MigrateMsg { - pub overrule_pre_propose: String, -} +pub struct MigrateMsg {} diff --git a/packages/neutron-subdao-timelock-single/src/types.rs b/packages/neutron-subdao-timelock-single/src/types.rs index ac740587..1360f787 100644 --- a/packages/neutron-subdao-timelock-single/src/types.rs +++ b/packages/neutron-subdao-timelock-single/src/types.rs @@ -12,14 +12,6 @@ pub struct Config { pub subdao: Addr, } -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] -pub struct ConfigOld { - pub owner: Addr, - pub timelock_duration: u64, - // subDAO core module can timelock proposals. - pub subdao: Addr, -} - #[derive(Serialize, Deserialize, Clone, JsonSchema, Debug, Eq, PartialEq)] pub struct SingleChoiceProposal { /// The ID of the proposal being returned.