Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose gov::Gov trait #21

Closed
0xphilipp opened this issue Jan 17, 2023 · 2 comments · Fixed by #43
Closed

Expose gov::Gov trait #21

0xphilipp opened this issue Jan 17, 2023 · 2 comments · Fixed by #43
Assignees

Comments

@0xphilipp
Copy link

Hi I wanted to use cw_multi for some governance tests, but can't implement an AcceptingModule as the Gov trait is not exposed.

pub trait Gov: Module<ExecT = GovMsg, QueryT = Empty, SudoT = Empty> {}

mod gov;

image

use cosmwasm_schema::{schemars, serde};
use cosmwasm_std::{Binary, Empty, GovMsg};
use cw_multi_test::{gov::Gov, AppResponse, CosmosRouter, FailingModule, Module};

pub struct AcceptingModule;

impl Gov for AcceptingModule {}

impl Module for AcceptingModule {
    type ExecT = GovMsg;
    type QueryT = Empty;
    type SudoT = Empty;

    fn execute<ExecC, QueryC>(
        &self,
        _api: &dyn cosmwasm_std::Api,
        _storage: &mut dyn cosmwasm_std::Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &cosmwasm_std::BlockInfo,
        _sender: cosmwasm_std::Addr,
        _msg: Self::ExecT,
    ) -> anyhow::Result<crate::AppResponse>
    where
        ExecC: std::fmt::Debug
            + Clone
            + PartialEq
            + schemars::JsonSchema
            + serde::de::DeserializeOwned
            + 'static,
        QueryC: cosmwasm_std::CustomQuery + serde::de::DeserializeOwned + 'static,
    {
        Ok(AppResponse::default())
    }

    fn sudo<ExecC, QueryC>(
        &self,
        _api: &dyn cosmwasm_std::Api,
        _storage: &mut dyn cosmwasm_std::Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &cosmwasm_std::BlockInfo,
        _msg: Self::SudoT,
    ) -> anyhow::Result<crate::AppResponse>
    where
        ExecC: std::fmt::Debug
            + Clone
            + PartialEq
            + schemars::JsonSchema
            + serde::de::DeserializeOwned
            + 'static,
        QueryC: cosmwasm_std::CustomQuery + serde::de::DeserializeOwned + 'static,
    {
        Ok(AppResponse::default())
    }

    fn query(
        &self,
        _api: &dyn cosmwasm_std::Api,
        _storage: &dyn cosmwasm_std::Storage,
        _querier: &dyn cosmwasm_std::Querier,
        _block: &cosmwasm_std::BlockInfo,
        _request: Self::QueryT,
    ) -> anyhow::Result<cosmwasm_std::Binary> {
        Ok(Binary::default())
    }
}

And without it I can't add it:
image

@jawoznia
Copy link
Contributor

jawoznia commented Jun 7, 2023

Hi @0xphilipp
gov::Gov and staking::Distribution just got released in v0.16.5

@DariuszDepta
Copy link
Member

Closing as implemented.

@DariuszDepta DariuszDepta self-assigned this Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants