From 5974fc9745984349da6d824645c66986ddd897ef Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Tue, 19 Sep 2023 09:44:39 -0700 Subject: [PATCH] Start v2 migration --- Cargo.lock | 4 ++ Cargo.toml | 1 + ci/bootstrap-env/src/main.rs | 1 + ci/integration-tests/src/helpers/helper.rs | 18 ++++--- contracts/external/dao-migrator/Cargo.toml | 9 +++- .../external/dao-migrator/src/contract.rs | 2 +- .../dao-migrator/src/testing/setup.rs | 2 +- .../dao-migrator/src/testing/state_helpers.rs | 12 ++--- .../src/testing/test_migration.rs | 4 +- contracts/external/dao-migrator/src/types.rs | 6 +-- .../dao-migrator/src/utils/query_helpers.rs | 4 +- .../dao-migrator/src/utils/state_queries.rs | 16 +++--- .../src/tests.rs | 3 ++ .../dao-pre-propose-approver/src/tests.rs | 48 +++++++++-------- .../dao-pre-propose-single/src/tests.rs | 53 ++++++++++--------- .../dao-proposal-hook-counter/src/tests.rs | 1 + 16 files changed, 104 insertions(+), 80 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18483f306..a693bfbe4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1767,6 +1767,7 @@ dependencies = [ "cw-proposal-single", "cw-storage-plus 1.1.0", "cw-utils 0.13.4", + "cw-utils 0.16.0", "cw-utils 1.0.1", "cw2 1.1.0", "cw20 0.13.4", @@ -1778,11 +1779,14 @@ dependencies = [ "cw4 0.13.4", "cw4-voting", "dao-dao-core 2.2.0", + "dao-dao-core 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "dao-interface 2.2.0", "dao-proposal-single 2.2.0", + "dao-proposal-single 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "dao-testing", "dao-voting 0.1.0", "dao-voting 2.2.0", + "dao-voting 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "dao-voting-cw20-staked", "dao-voting-cw4", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 135ac8fc5..cb7e61c48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,6 +132,7 @@ stake-cw20-v03 = { package = "stake-cw20", version = "0.2.6" } # v2 dependencies. used for state migrations cw-utils-v2 = { package = "cw-utils", version = "0.16" } dao-dao-core-v2 = { package = "dao-dao-core", version = "2.2.0" } +dao-interface-v2 = { package = "dao-interface", version = "2.2.0" } dao-proposal-single-v2 = { package = "dao-proposal-single", version = "2.2.0" } voting-v2 = { package = "dao-voting", version = "2.2.0" } diff --git a/ci/bootstrap-env/src/main.rs b/ci/bootstrap-env/src/main.rs index b8bdeb0a5..7765d2f7b 100644 --- a/ci/bootstrap-env/src/main.rs +++ b/ci/bootstrap-env/src/main.rs @@ -105,6 +105,7 @@ fn main() -> Result<()> { }, }, close_proposal_on_execution_failure: false, + timelock: None, })?, admin: Some(Admin::CoreModule {}), label: "DAO DAO Proposal Module".to_string(), diff --git a/ci/integration-tests/src/helpers/helper.rs b/ci/integration-tests/src/helpers/helper.rs index 3c685c22d..a19780e30 100644 --- a/ci/integration-tests/src/helpers/helper.rs +++ b/ci/integration-tests/src/helpers/helper.rs @@ -89,6 +89,7 @@ pub fn create_dao( label: "DAO DAO Pre-Propose Module".to_string(), }, }, + timelock: None, })?, admin: Some(Admin::CoreModule {}), label: "DAO DAO Proposal Module".to_string(), @@ -118,15 +119,16 @@ pub fn create_dao( .unwrap(); let ProposalCreationPolicy::Module { addr: pre_propose } = chain - .orc - .query( - "dao_proposal_single", - &dao_proposal_single::msg::QueryMsg::ProposalCreationPolicy {} - ).unwrap() - .data() - .unwrap() + .orc + .query( + "dao_proposal_single", + &dao_proposal_single::msg::QueryMsg::ProposalCreationPolicy {}, + ) + .unwrap() + .data() + .unwrap() else { - panic!("expected pre-propose module") + panic!("expected pre-propose module") }; chain .orc diff --git a/contracts/external/dao-migrator/Cargo.toml b/contracts/external/dao-migrator/Cargo.toml index 346ec7f6f..fa41b9130 100644 --- a/contracts/external/dao-migrator/Cargo.toml +++ b/contracts/external/dao-migrator/Cargo.toml @@ -34,6 +34,7 @@ cw20-stake = { workspace = true, features = ["library"] } dao-voting-cw20-staked = { workspace = true, features = ["library"] } cw20-base = { workspace = true, features = ["library"] } +# v1 migration cw-utils-v1 = { workspace = true } voting-v1 = { workspace = true } cw-core-v1 = { workspace = true, features = ["library"] } @@ -43,7 +44,13 @@ cw20-stake-v1 = { workspace = true, features = ["library"] } cw-core-interface-v1 = { package = "cw-core-interface", version = "0.1.0", git = "https://github.com/DA0-DA0/dao-contracts.git", tag = "v1.0.0" } cw4-voting-v1 = { package = "cw4-voting", version = "0.1.0", git = "https://github.com/DA0-DA0/dao-contracts.git", tag = "v1.0.0" } cw20-v1 = { version = "0.13", package = "cw20" } -cw4-v1 = { version = "0.13", package = "cw4" } +cw4-v1 = { version = "0.13", package = "cw4" } + +# v2 migration +dao-dao-core-v2 = { workspace = true } +cw-utils-v2 = { workspace = true } +dao-proposal-single-v2 = { workspace = true, features = ["library"] } +voting-v2 = { workspace = true} [dev-dependencies] cosmwasm-schema = { workspace = true } diff --git a/contracts/external/dao-migrator/src/contract.rs b/contracts/external/dao-migrator/src/contract.rs index ae91152d5..387a5e278 100644 --- a/contracts/external/dao-migrator/src/contract.rs +++ b/contracts/external/dao-migrator/src/contract.rs @@ -111,7 +111,7 @@ fn execute_migration_v1_v2( v1_code_ids.proposal_single, v2_code_ids.proposal_single, MigrationMsgs::DaoProposalSingle( - dao_proposal_single::msg::MigrateMsg::FromV1 { + dao_proposal_single_v2::msg::MigrateMsg::FromV1 { close_proposal_on_execution_failure: proposal_params .close_proposal_on_execution_failure, pre_propose_info: proposal_params.pre_propose_info, diff --git a/contracts/external/dao-migrator/src/testing/setup.rs b/contracts/external/dao-migrator/src/testing/setup.rs index b9d93950e..22703b6d6 100644 --- a/contracts/external/dao-migrator/src/testing/setup.rs +++ b/contracts/external/dao-migrator/src/testing/setup.rs @@ -274,7 +274,7 @@ pub fn execute_migration( ProposalParams { close_proposal_on_execution_failure: true, pre_propose_info: - dao_voting::pre_propose::PreProposeInfo::AnyoneMayPropose {}, + voting_v2::pre_propose::PreProposeInfo::AnyoneMayPropose {}, }, ) }) diff --git a/contracts/external/dao-migrator/src/testing/state_helpers.rs b/contracts/external/dao-migrator/src/testing/state_helpers.rs index 451a28821..e0005360b 100644 --- a/contracts/external/dao-migrator/src/testing/state_helpers.rs +++ b/contracts/external/dao-migrator/src/testing/state_helpers.rs @@ -8,7 +8,7 @@ use crate::utils::query_helpers::{ #[derive(PartialEq, Debug, Clone)] pub struct TestState { pub proposal_count: u64, - pub proposal: dao_proposal_single::proposal::SingleChoiceProposal, + pub proposal: dao_proposal_single_v2::proposal::SingleChoiceProposal, pub total_power: Uint128, pub single_power: Uint128, } @@ -16,7 +16,7 @@ pub struct TestState { pub fn query_proposal_v1( app: &mut App, proposal_addr: Addr, -) -> (u64, dao_proposal_single::proposal::SingleChoiceProposal) { +) -> (u64, dao_proposal_single_v2::proposal::SingleChoiceProposal) { // proposal count let proposal_count: u64 = app .wrap() @@ -41,7 +41,7 @@ pub fn query_proposal_v1( .clone() .proposal; - let proposal = dao_proposal_single::proposal::SingleChoiceProposal { + let proposal = dao_proposal_single_v2::proposal::SingleChoiceProposal { title: proposal.title, description: proposal.description, proposer: proposal.proposer, @@ -62,20 +62,20 @@ pub fn query_proposal_v1( pub fn query_proposal_v2( app: &mut App, proposal_addr: Addr, -) -> (u64, dao_proposal_single::proposal::SingleChoiceProposal) { +) -> (u64, dao_proposal_single_v2::proposal::SingleChoiceProposal) { // proposal count let proposal_count: u64 = app .wrap() .query_wasm_smart( proposal_addr.clone(), - &dao_proposal_single::msg::QueryMsg::ProposalCount {}, + &dao_proposal_single_v2::msg::QueryMsg::ProposalCount {}, ) .unwrap(); // query proposal let proposal = app .wrap() - .query_wasm_smart::( + .query_wasm_smart::( proposal_addr, &dao_proposal_single::msg::QueryMsg::ListProposals { start_after: None, diff --git a/contracts/external/dao-migrator/src/testing/test_migration.rs b/contracts/external/dao-migrator/src/testing/test_migration.rs index cf936f7e4..904b210e2 100644 --- a/contracts/external/dao-migrator/src/testing/test_migration.rs +++ b/contracts/external/dao-migrator/src/testing/test_migration.rs @@ -188,14 +188,14 @@ fn test_duplicate_proposal_params() { module_addrs.proposals[0].to_string(), ProposalParams { close_proposal_on_execution_failure: true, - pre_propose_info: dao_voting::pre_propose::PreProposeInfo::AnyoneMayPropose {}, + pre_propose_info: voting_v2::pre_propose::PreProposeInfo::AnyoneMayPropose {}, }, ), ( module_addrs.proposals[0].to_string(), ProposalParams { close_proposal_on_execution_failure: true, - pre_propose_info: dao_voting::pre_propose::PreProposeInfo::AnyoneMayPropose {}, + pre_propose_info: voting_v2::pre_propose::PreProposeInfo::AnyoneMayPropose {}, }, ), ]; diff --git a/contracts/external/dao-migrator/src/types.rs b/contracts/external/dao-migrator/src/types.rs index 837ca736e..9a3326c7e 100644 --- a/contracts/external/dao-migrator/src/types.rs +++ b/contracts/external/dao-migrator/src/types.rs @@ -45,7 +45,7 @@ impl V2CodeIds { #[cw_serde] pub struct ProposalParams { pub close_proposal_on_execution_failure: bool, - pub pre_propose_info: dao_voting::pre_propose::PreProposeInfo, + pub pre_propose_info: voting_v2::pre_propose::PreProposeInfo, } #[cw_serde] @@ -65,7 +65,7 @@ pub struct MigrationParams { #[cw_serde] #[serde(untagged)] pub enum MigrationMsgs { - DaoProposalSingle(dao_proposal_single::msg::MigrateMsg), + DaoProposalSingle(dao_proposal_single_v2::msg::MigrateMsg), DaoVotingCw4(dao_voting_cw4::msg::MigrateMsg), Cw20Stake(cw20_stake::msg::MigrateMsg), DaoVotingCw20Staked(dao_voting_cw20_staked::msg::MigrateMsg), @@ -124,7 +124,7 @@ pub struct SingleProposalData { #[cw_serde] pub struct TestState { pub proposal_counts: Vec, - pub proposals: Vec, + pub proposals: Vec, pub total_voting_power: Uint128, /// This is the voting power of the proposer of the sample proposal pub single_voting_power: Uint128, diff --git a/contracts/external/dao-migrator/src/utils/query_helpers.rs b/contracts/external/dao-migrator/src/utils/query_helpers.rs index dc5a433cd..142f89dcd 100644 --- a/contracts/external/dao-migrator/src/utils/query_helpers.rs +++ b/contracts/external/dao-migrator/src/utils/query_helpers.rs @@ -1,5 +1,5 @@ -use cw_utils::Expiration; -use dao_voting::{ +use cw_utils_v2::Expiration; +use voting_v2::{ status::Status, threshold::{PercentageThreshold, Threshold}, voting::Votes, diff --git a/contracts/external/dao-migrator/src/utils/state_queries.rs b/contracts/external/dao-migrator/src/utils/state_queries.rs index 52fcc8bfd..fcfb91835 100644 --- a/contracts/external/dao-migrator/src/utils/state_queries.rs +++ b/contracts/external/dao-migrator/src/utils/state_queries.rs @@ -24,7 +24,7 @@ pub fn query_proposal_count_v2(deps: Deps, proposals_addrs: Vec) -> StdRes .map(|proposal_addr| { deps.querier.query_wasm_smart( proposal_addr, - &dao_proposal_single::msg::QueryMsg::ProposalCount {}, + &dao_proposal_single_v2::msg::QueryMsg::ProposalCount {}, ) }) .collect() @@ -35,7 +35,7 @@ pub fn query_proposal_v1( proposals_addrs: Vec, ) -> Result< ( - Vec, + Vec, SingleProposalData, ), ContractError, @@ -70,7 +70,7 @@ pub fn query_proposal_v1( }); } - Ok(dao_proposal_single::proposal::SingleChoiceProposal { + Ok(dao_proposal_single_v2::proposal::SingleChoiceProposal { title: proposal.title, description: proposal.description, proposer: proposal.proposer, @@ -85,7 +85,7 @@ pub fn query_proposal_v1( allow_revoting: proposal.allow_revoting, }) }) - .collect::, ContractError>>( + .collect::, ContractError>>( )?; Ok((proposals, sample_proposal.unwrap())) @@ -96,7 +96,7 @@ pub fn query_proposal_v2( proposals_addrs: Vec, ) -> Result< ( - Vec, + Vec, SingleProposalData, ), ContractError, @@ -106,10 +106,10 @@ pub fn query_proposal_v2( let proposals = proposals_addrs .into_iter() .map(|proposal_addr| { - let proposals: dao_proposal_single::query::ProposalListResponse = + let proposals: dao_proposal_single_v2::query::ProposalListResponse = deps.querier.query_wasm_smart( proposal_addr.clone(), - &dao_proposal_single::msg::QueryMsg::ReverseProposals { + &dao_proposal_single_v2::msg::QueryMsg::ReverseProposals { start_before: None, limit: None, }, @@ -132,7 +132,7 @@ pub fn query_proposal_v2( Ok(proposal) }) - .collect::, ContractError>>( + .collect::, ContractError>>( )?; Ok((proposals, sample_proposal.unwrap())) diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs index 2127cebf5..13c688b95 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs @@ -75,6 +75,7 @@ fn get_default_proposal_module_instantiate( }, }, close_proposal_on_execution_failure: false, + timelock: None, } } @@ -1204,6 +1205,7 @@ fn test_instantiate_with_zero_native_deposit() { }, }, close_proposal_on_execution_failure: false, + timelock: None, } }; @@ -1267,6 +1269,7 @@ fn test_instantiate_with_zero_cw20_deposit() { }, }, close_proposal_on_execution_failure: false, + timelock: None, } }; diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs index 5aea7b2bc..1d2ecf206 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs @@ -1,9 +1,9 @@ use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; -use cps::query::{ProposalListResponse, ProposalResponse}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; use cw_multi_test::{App, BankSudo, Contract, ContractWrapper, Executor}; +use dps::query::{ProposalListResponse, ProposalResponse}; use dao_interface::state::ProposalModule; use dao_interface::state::{Admin, ModuleInstantiateInfo}; @@ -14,7 +14,7 @@ use dao_pre_propose_approval_single::{ state::PendingProposal, }; use dao_pre_propose_base::{error::PreProposeError, msg::DepositInfoResponse, state::Config}; -use dao_proposal_single as cps; +use dao_proposal_single as dps; use dao_testing::helpers::instantiate_with_cw4_groups_governance; use dao_voting::{ deposit::{CheckedDepositInfo, DepositRefundPolicy, DepositToken, UncheckedDepositInfo}, @@ -32,12 +32,12 @@ const APPROVER: &str = "contract6"; fn cw_dao_proposal_single_contract() -> Box> { let contract = ContractWrapper::new( - cps::contract::execute, - cps::contract::instantiate, - cps::contract::query, + dps::contract::execute, + dps::contract::instantiate, + dps::contract::query, ) - .with_migrate(cps::contract::migrate) - .with_reply(cps::contract::reply); + .with_migrate(dps::contract::migrate) + .with_reply(dps::contract::reply); Box::new(contract) } @@ -72,10 +72,10 @@ fn get_proposal_module_approval_single_instantiate( app: &mut App, deposit_info: Option, open_proposal_submission: bool, -) -> cps::msg::InstantiateMsg { +) -> dps::msg::InstantiateMsg { let pre_propose_id = app.store_code(cw_pre_propose_base_proposal_single()); - cps::msg::InstantiateMsg { + dps::msg::InstantiateMsg { threshold: Threshold::AbsolutePercentage { percentage: PercentageThreshold::Majority {}, }, @@ -99,6 +99,7 @@ fn get_proposal_module_approval_single_instantiate( }, }, close_proposal_on_execution_failure: false, + timelock: None, } } @@ -107,10 +108,10 @@ fn get_proposal_module_approver_instantiate( _deposit_info: Option, _open_proposal_submission: bool, pre_propose_approval_contract: String, -) -> cps::msg::InstantiateMsg { +) -> dps::msg::InstantiateMsg { let pre_propose_id = app.store_code(pre_propose_approver_contract()); - cps::msg::InstantiateMsg { + dps::msg::InstantiateMsg { threshold: Threshold::AbsolutePercentage { percentage: PercentageThreshold::Majority {}, }, @@ -130,6 +131,7 @@ fn get_proposal_module_approver_instantiate( }, }, close_proposal_on_execution_failure: false, + timelock: None, } } @@ -171,7 +173,7 @@ fn setup_default_test( deposit_info: Option, open_proposal_submission: bool, ) -> DefaultTestSetup { - let cps_id = app.store_code(cw_dao_proposal_single_contract()); + let dps_id = app.store_code(cw_dao_proposal_single_contract()); // Instantiate SubDAO with pre-propose-approval-single let proposal_module_instantiate = get_proposal_module_approval_single_instantiate( @@ -181,7 +183,7 @@ fn setup_default_test( ); let core_addr = instantiate_with_cw4_groups_governance( app, - cps_id, + dps_id, to_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { @@ -212,7 +214,7 @@ fn setup_default_test( .wrap() .query_wasm_smart( proposal_single.clone(), - &cps::msg::QueryMsg::ProposalCreationPolicy {}, + &dps::msg::QueryMsg::ProposalCreationPolicy {}, ) .unwrap(); let pre_propose = match proposal_creation_policy { @@ -235,7 +237,7 @@ fn setup_default_test( let _approver_core_addr = instantiate_with_cw4_groups_governance( app, - cps_id, + dps_id, to_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { @@ -266,7 +268,7 @@ fn setup_default_test( .wrap() .query_wasm_smart( proposal_single_approver.clone(), - &cps::msg::QueryMsg::ProposalCreationPolicy {}, + &dps::msg::QueryMsg::ProposalCreationPolicy {}, ) .unwrap(); let pre_propose_approver = match proposal_creation_policy { @@ -369,7 +371,7 @@ fn vote(app: &mut App, module: Addr, sender: &str, id: u64, position: Vote) -> S app.execute_contract( Addr::unchecked(sender), module.clone(), - &cps::msg::ExecuteMsg::Vote { + &dps::msg::ExecuteMsg::Vote { proposal_id: id, vote: position, rationale: None, @@ -380,7 +382,7 @@ fn vote(app: &mut App, module: Addr, sender: &str, id: u64, position: Vote) -> S let proposal: ProposalResponse = app .wrap() - .query_wasm_smart(module, &cps::msg::QueryMsg::Proposal { proposal_id: id }) + .query_wasm_smart(module, &dps::msg::QueryMsg::Proposal { proposal_id: id }) .unwrap(); proposal.proposal.status @@ -414,7 +416,7 @@ fn get_proposals(app: &App, module: Addr) -> ProposalListResponse { app.wrap() .query_wasm_smart( module, - &cps::msg::QueryMsg::ListProposals { + &dps::msg::QueryMsg::ListProposals { start_after: None, limit: None, }, @@ -428,7 +430,7 @@ fn get_latest_proposal_id(app: &App, module: Addr) -> u64 { .wrap() .query_wasm_smart( module, - &cps::msg::QueryMsg::ListProposals { + &dps::msg::QueryMsg::ListProposals { start_after: None, limit: None, }, @@ -510,7 +512,7 @@ fn close_proposal(app: &mut App, module: Addr, sender: &str, proposal_id: u64) { app.execute_contract( Addr::unchecked(sender), module, - &cps::msg::ExecuteMsg::Close { proposal_id }, + &dps::msg::ExecuteMsg::Close { proposal_id }, &[], ) .unwrap(); @@ -520,7 +522,7 @@ fn execute_proposal(app: &mut App, module: Addr, sender: &str, proposal_id: u64) app.execute_contract( Addr::unchecked(sender), module, - &cps::msg::ExecuteMsg::Execute { proposal_id }, + &dps::msg::ExecuteMsg::Execute { proposal_id }, &[], ) .unwrap(); @@ -1517,7 +1519,7 @@ fn test_withdraw() { .wrap() .query_wasm_smart( proposal_single.clone(), - &cps::msg::QueryMsg::ProposalCreationPolicy {}, + &dps::msg::QueryMsg::ProposalCreationPolicy {}, ) .unwrap(); diff --git a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs index 6a8b48e9f..519ed989a 100644 --- a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs @@ -1,5 +1,4 @@ use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; -use cps::query::ProposalResponse; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -8,7 +7,7 @@ use cw_utils::Duration; use dao_interface::state::ProposalModule; use dao_interface::state::{Admin, ModuleInstantiateInfo}; use dao_pre_propose_base::{error::PreProposeError, msg::DepositInfoResponse, state::Config}; -use dao_proposal_single as cps; +use dao_proposal_single as dps; use dao_testing::helpers::instantiate_with_cw4_groups_governance; use dao_voting::{ deposit::{CheckedDepositInfo, DepositRefundPolicy, DepositToken, UncheckedDepositInfo}, @@ -17,17 +16,18 @@ use dao_voting::{ threshold::{PercentageThreshold, Threshold}, voting::Vote, }; +use dps::query::ProposalResponse; use crate::contract::*; fn cw_dao_proposal_single_contract() -> Box> { let contract = ContractWrapper::new( - cps::contract::execute, - cps::contract::instantiate, - cps::contract::query, + dps::contract::execute, + dps::contract::instantiate, + dps::contract::query, ) - .with_migrate(cps::contract::migrate) - .with_reply(cps::contract::reply); + .with_migrate(dps::contract::migrate) + .with_reply(dps::contract::reply); Box::new(contract) } @@ -49,10 +49,10 @@ fn get_default_proposal_module_instantiate( app: &mut App, deposit_info: Option, open_proposal_submission: bool, -) -> cps::msg::InstantiateMsg { +) -> dps::msg::InstantiateMsg { let pre_propose_id = app.store_code(cw_pre_propose_base_proposal_single()); - cps::msg::InstantiateMsg { + dps::msg::InstantiateMsg { threshold: Threshold::AbsolutePercentage { percentage: PercentageThreshold::Majority {}, }, @@ -74,6 +74,7 @@ fn get_default_proposal_module_instantiate( }, }, close_proposal_on_execution_failure: false, + timelock: None, } } @@ -111,14 +112,14 @@ fn setup_default_test( deposit_info: Option, open_proposal_submission: bool, ) -> DefaultTestSetup { - let cps_id = app.store_code(cw_dao_proposal_single_contract()); + let dps_id = app.store_code(cw_dao_proposal_single_contract()); let proposal_module_instantiate = get_default_proposal_module_instantiate(app, deposit_info, open_proposal_submission); let core_addr = instantiate_with_cw4_groups_governance( app, - cps_id, + dps_id, to_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { @@ -148,7 +149,7 @@ fn setup_default_test( .wrap() .query_wasm_smart( proposal_single.clone(), - &cps::msg::QueryMsg::ProposalCreationPolicy {}, + &dps::msg::QueryMsg::ProposalCreationPolicy {}, ) .unwrap(); @@ -194,7 +195,7 @@ fn make_proposal( let id: u64 = app .wrap() - .query_wasm_smart(&proposal_module, &cps::msg::QueryMsg::NextProposalId {}) + .query_wasm_smart(&proposal_module, &dps::msg::QueryMsg::NextProposalId {}) .unwrap(); let id = id - 1; @@ -202,7 +203,7 @@ fn make_proposal( .wrap() .query_wasm_smart( proposal_module, - &cps::msg::QueryMsg::Proposal { proposal_id: id }, + &dps::msg::QueryMsg::Proposal { proposal_id: id }, ) .unwrap(); @@ -282,7 +283,7 @@ fn vote(app: &mut App, module: Addr, sender: &str, id: u64, position: Vote) -> S app.execute_contract( Addr::unchecked(sender), module.clone(), - &cps::msg::ExecuteMsg::Vote { + &dps::msg::ExecuteMsg::Vote { rationale: None, proposal_id: id, vote: position, @@ -293,7 +294,7 @@ fn vote(app: &mut App, module: Addr, sender: &str, id: u64, position: Vote) -> S let proposal: ProposalResponse = app .wrap() - .query_wasm_smart(module, &cps::msg::QueryMsg::Proposal { proposal_id: id }) + .query_wasm_smart(module, &dps::msg::QueryMsg::Proposal { proposal_id: id }) .unwrap(); proposal.proposal.status @@ -402,7 +403,7 @@ fn close_proposal(app: &mut App, module: Addr, sender: &str, proposal_id: u64) { app.execute_contract( Addr::unchecked(sender), module, - &cps::msg::ExecuteMsg::Close { proposal_id }, + &dps::msg::ExecuteMsg::Close { proposal_id }, &[], ) .unwrap(); @@ -412,7 +413,7 @@ fn execute_proposal(app: &mut App, module: Addr, sender: &str, proposal_id: u64) app.execute_contract( Addr::unchecked(sender), module, - &cps::msg::ExecuteMsg::Execute { proposal_id }, + &dps::msg::ExecuteMsg::Execute { proposal_id }, &[], ) .unwrap(); @@ -966,12 +967,12 @@ fn test_execute_extension_does_nothing() { fn test_instantiate_with_zero_native_deposit() { let mut app = App::default(); - let cps_id = app.store_code(cw_dao_proposal_single_contract()); + let dps_id = app.store_code(cw_dao_proposal_single_contract()); let proposal_module_instantiate = { let pre_propose_id = app.store_code(cw_pre_propose_base_proposal_single()); - cps::msg::InstantiateMsg { + dps::msg::InstantiateMsg { threshold: Threshold::AbsolutePercentage { percentage: PercentageThreshold::Majority {}, }, @@ -999,13 +1000,14 @@ fn test_instantiate_with_zero_native_deposit() { }, }, close_proposal_on_execution_failure: false, + timelock: None, } }; // Should panic. instantiate_with_cw4_groups_governance( &mut app, - cps_id, + dps_id, to_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { @@ -1027,12 +1029,12 @@ fn test_instantiate_with_zero_cw20_deposit() { let cw20_addr = instantiate_cw20_base_default(&mut app); - let cps_id = app.store_code(cw_dao_proposal_single_contract()); + let dps_id = app.store_code(cw_dao_proposal_single_contract()); let proposal_module_instantiate = { let pre_propose_id = app.store_code(cw_pre_propose_base_proposal_single()); - cps::msg::InstantiateMsg { + dps::msg::InstantiateMsg { threshold: Threshold::AbsolutePercentage { percentage: PercentageThreshold::Majority {}, }, @@ -1060,13 +1062,14 @@ fn test_instantiate_with_zero_cw20_deposit() { }, }, close_proposal_on_execution_failure: false, + timelock: None, } }; // Should panic. instantiate_with_cw4_groups_governance( &mut app, - cps_id, + dps_id, to_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { @@ -1311,7 +1314,7 @@ fn test_withdraw() { .wrap() .query_wasm_smart( proposal_single.clone(), - &cps::msg::QueryMsg::ProposalCreationPolicy {}, + &dps::msg::QueryMsg::ProposalCreationPolicy {}, ) .unwrap(); diff --git a/test-contracts/dao-proposal-hook-counter/src/tests.rs b/test-contracts/dao-proposal-hook-counter/src/tests.rs index cb3483a81..db5244d5e 100644 --- a/test-contracts/dao-proposal-hook-counter/src/tests.rs +++ b/test-contracts/dao-proposal-hook-counter/src/tests.rs @@ -153,6 +153,7 @@ fn test_counters() { allow_revoting: false, pre_propose_info: PreProposeInfo::AnyoneMayPropose {}, close_proposal_on_execution_failure: true, + timelock: None, }; let governance_addr =