From db42d45c097174572b55f789aa3908af591e7a29 Mon Sep 17 00:00:00 2001 From: 0xJayak <135615804+0xJayak@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:52:39 +0100 Subject: [PATCH] Fix naming for dao_proposal_single (#757) --- .../dao-pre-propose-approver/src/tests.rs | 46 ++++++++--------- .../dao-pre-propose-single/src/tests.rs | 50 +++++++++---------- 2 files changed, 48 insertions(+), 48 deletions(-) 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 353fd0c41..a52c91042 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 {}, }, @@ -108,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 {}, }, @@ -173,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( @@ -183,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 { @@ -214,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 { @@ -237,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 { @@ -268,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 { @@ -371,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, @@ -382,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 @@ -416,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, }, @@ -430,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, }, @@ -512,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(); @@ -522,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(); @@ -1519,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 e4ab908f9..fefc69fc3 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 {}, }, @@ -112,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 { @@ -149,7 +149,7 @@ fn setup_default_test( .wrap() .query_wasm_smart( proposal_single.clone(), - &cps::msg::QueryMsg::ProposalCreationPolicy {}, + &dps::msg::QueryMsg::ProposalCreationPolicy {}, ) .unwrap(); @@ -195,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; @@ -203,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(); @@ -283,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, @@ -294,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 @@ -403,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(); @@ -413,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(); @@ -967,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 {}, }, @@ -1007,7 +1007,7 @@ fn test_instantiate_with_zero_native_deposit() { // Should panic. instantiate_with_cw4_groups_governance( &mut app, - cps_id, + dps_id, to_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { @@ -1029,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 {}, }, @@ -1069,7 +1069,7 @@ fn test_instantiate_with_zero_cw20_deposit() { // Should panic. instantiate_with_cw4_groups_governance( &mut app, - cps_id, + dps_id, to_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { @@ -1314,7 +1314,7 @@ fn test_withdraw() { .wrap() .query_wasm_smart( proposal_single.clone(), - &cps::msg::QueryMsg::ProposalCreationPolicy {}, + &dps::msg::QueryMsg::ProposalCreationPolicy {}, ) .unwrap();