From 66bc36d8b3c1c7b1a73440f622fc046f3e8e7a96 Mon Sep 17 00:00:00 2001 From: cyberhoward Date: Thu, 30 May 2024 12:02:13 +0200 Subject: [PATCH] fix last query bug --- contracts/interchain-gov/src/handlers/execute.rs | 4 ++-- contracts/interchain-gov/src/ibc_callbacks/vote_result.rs | 6 +++--- contracts/interchain-gov/tests/integration.rs | 6 +----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/contracts/interchain-gov/src/handlers/execute.rs b/contracts/interchain-gov/src/handlers/execute.rs index 1e3eec5..77a4cb4 100644 --- a/contracts/interchain-gov/src/handlers/execute.rs +++ b/contracts/interchain-gov/src/handlers/execute.rs @@ -245,9 +245,9 @@ fn request_vote_results( host.to_string(), WasmQuery::Smart { contract_addr: module_addr, - msg: to_json_binary(&InterchainGovQueryMsg::Vote { + msg: to_json_binary(&crate::msg::QueryMsg::Module(InterchainGovQueryMsg::Vote { prop_id: prop_id.clone(), - })?, + }))?, }, CallbackInfo::new(REGISTER_VOTE_ID, None), )?; diff --git a/contracts/interchain-gov/src/ibc_callbacks/vote_result.rs b/contracts/interchain-gov/src/ibc_callbacks/vote_result.rs index 8e6bcfe..77399c6 100644 --- a/contracts/interchain-gov/src/ibc_callbacks/vote_result.rs +++ b/contracts/interchain-gov/src/ibc_callbacks/vote_result.rs @@ -3,7 +3,7 @@ use abstract_adapter::std::ibc::{CallbackResult, IbcResponseMsg}; use cosmwasm_std::{from_json, to_json_string, DepsMut, Env, MessageInfo, QueryRequest, WasmQuery}; use crate::contract::{AdapterResult, InterchainGov}; -use crate::msg::{InterchainGovQueryMsg, VoteResponse}; +use crate::msg::{InterchainGovQueryMsg, QueryMsg, VoteResponse}; use crate::state::{GovernanceVote, VOTE_RESULTS}; use crate::InterchainGovError; @@ -30,9 +30,9 @@ pub fn vote_result_callback( let prop_id = match query { QueryRequest::Wasm(wasm) => match wasm { WasmQuery::Smart { contract_addr, msg } => { - let msg: InterchainGovQueryMsg = from_json(msg)?; + let msg: QueryMsg = from_json(msg)?; match msg { - InterchainGovQueryMsg::Vote { prop_id } => prop_id, + QueryMsg::Module(InterchainGovQueryMsg::Vote { prop_id }) => prop_id, _ => unimplemented!("InterchainGovQueryMsg"), } } diff --git a/contracts/interchain-gov/tests/integration.rs b/contracts/interchain-gov/tests/integration.rs index 49c00c2..ac22e75 100644 --- a/contracts/interchain-gov/tests/integration.rs +++ b/contracts/interchain-gov/tests/integration.rs @@ -609,14 +609,10 @@ mod members { let res = interchain.wait_ibc(A_CHAIN_ID, res)?; dbg!(&res.packets[0].outcome); - // a_gov.execute_proposal(prop_id.clone())?; + a_gov.execute_proposal(prop_id.clone())?; let a_members = dbg!(a_gov.members()?); assert_eq!(a_members.members.members.len(), 3); - // let b_members = dbg!(b_gov.members()?); - // assert_eq!(b_members.members.members.len(), 3); - // let c_members = dbg!(c_gov.members()?); - // assert_eq!(c_members.members.members.len(), 3); Ok(()) } }