Skip to content

Commit

Permalink
Fix naming for dao_proposal_single (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJayak authored Nov 7, 2023
1 parent 95e4f73 commit db42d45
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 48 deletions.
46 changes: 23 additions & 23 deletions contracts/pre-propose/dao-pre-propose-approver/src/tests.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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},
Expand All @@ -32,12 +32,12 @@ const APPROVER: &str = "contract6";

fn cw_dao_proposal_single_contract() -> Box<dyn Contract<Empty>> {
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)
}

Expand Down Expand Up @@ -72,10 +72,10 @@ fn get_proposal_module_approval_single_instantiate(
app: &mut App,
deposit_info: Option<UncheckedDepositInfo>,
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 {},
},
Expand Down Expand Up @@ -108,10 +108,10 @@ fn get_proposal_module_approver_instantiate(
_deposit_info: Option<UncheckedDepositInfo>,
_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 {},
},
Expand Down Expand Up @@ -173,7 +173,7 @@ fn setup_default_test(
deposit_info: Option<UncheckedDepositInfo>,
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(
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -1519,7 +1519,7 @@ fn test_withdraw() {
.wrap()
.query_wasm_smart(
proposal_single.clone(),
&cps::msg::QueryMsg::ProposalCreationPolicy {},
&dps::msg::QueryMsg::ProposalCreationPolicy {},
)
.unwrap();

Expand Down
50 changes: 25 additions & 25 deletions contracts/pre-propose/dao-pre-propose-single/src/tests.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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},
Expand All @@ -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<dyn Contract<Empty>> {
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)
}

Expand All @@ -49,10 +49,10 @@ fn get_default_proposal_module_instantiate(
app: &mut App,
deposit_info: Option<UncheckedDepositInfo>,
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 {},
},
Expand Down Expand Up @@ -112,14 +112,14 @@ fn setup_default_test(
deposit_info: Option<UncheckedDepositInfo>,
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 {
Expand Down Expand Up @@ -149,7 +149,7 @@ fn setup_default_test(
.wrap()
.query_wasm_smart(
proposal_single.clone(),
&cps::msg::QueryMsg::ProposalCreationPolicy {},
&dps::msg::QueryMsg::ProposalCreationPolicy {},
)
.unwrap();

Expand Down Expand Up @@ -195,15 +195,15 @@ 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;

let proposal: ProposalResponse = app
.wrap()
.query_wasm_smart(
proposal_module,
&cps::msg::QueryMsg::Proposal { proposal_id: id },
&dps::msg::QueryMsg::Proposal { proposal_id: id },
)
.unwrap();

Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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 {},
},
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {},
},
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -1314,7 +1314,7 @@ fn test_withdraw() {
.wrap()
.query_wasm_smart(
proposal_single.clone(),
&cps::msg::QueryMsg::ProposalCreationPolicy {},
&dps::msg::QueryMsg::ProposalCreationPolicy {},
)
.unwrap();

Expand Down

0 comments on commit db42d45

Please sign in to comment.