Skip to content

Commit

Permalink
Added Queryfns on voting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayanski authored and Jake Hartnell committed Aug 14, 2024
1 parent d06b377 commit 7999ce8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions contracts/dao-dao-core/src/cw_orch_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use dao_interface::{
voting::{InfoResponse, VotingPowerAtHeightResponse},
};
use dao_proposal_sudo::msg::ExecuteMsgFns as _;
use dao_voting_cw20_balance::msg::QueryMsgFns;

pub fn assert_contains(e: impl std::fmt::Debug, el: impl ToString) {
assert!(format!("{:?}", e).contains(&el.to_string()))
Expand Down Expand Up @@ -1448,11 +1449,8 @@ fn test_cw20_receive_auto_add() {
voting.set_address(&gov.voting_module().unwrap());

let gov_token = Cw20Base::new("cw20", mock.clone());
gov_token.set_address(
&voting
.query(&dao_voting_cw20_balance::msg::QueryMsg::TokenContract {})
.unwrap(),
);

gov_token.set_address(&voting.token_contract().unwrap());
// Check that the balances query works with no tokens.
let cw20_balances = gov.cw_20_balances(None, None).unwrap();
assert_eq!(cw20_balances, vec![]);
Expand Down Expand Up @@ -1534,11 +1532,7 @@ fn test_cw20_receive_no_auto_add() {
voting.set_address(&gov.voting_module().unwrap());

let gov_token = Cw20Base::new("cw20", mock.clone());
gov_token.set_address(
&voting
.query(&dao_voting_cw20_balance::msg::QueryMsg::TokenContract {})
.unwrap(),
);
gov_token.set_address(&voting.token_contract().unwrap());

// Send a gov token to the governance contract. Should not be
// added becasue auto add is turned off.
Expand Down
1 change: 1 addition & 0 deletions contracts/test/dao-voting-cw20-balance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ thiserror = { workspace = true }
dao-dao-macros = { workspace = true }
dao-interface = { workspace = true }
cw20-base = { workspace = true, features = ["library"] }
cw-orch = "0.22.2"

[dev-dependencies]
cw-multi-test = { workspace = true }
2 changes: 1 addition & 1 deletion contracts/test/dao-voting-cw20-balance/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ pub enum ExecuteMsg {}
#[cw20_token_query]
#[voting_module_query]
#[cw_serde]
#[derive(QueryResponses)]
#[derive(QueryResponses, cw_orch::QueryFns)]
pub enum QueryMsg {}

0 comments on commit 7999ce8

Please sign in to comment.