dao_interface/
proposal.rs

1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cw2::ContractVersion;
3
4#[cw_serde]
5pub struct InfoResponse {
6    pub info: ContractVersion,
7}
8
9#[cw_serde]
10#[derive(QueryResponses)]
11pub enum Query {
12    /// Returns the address of the DAO this module belongs to
13    #[returns(::cosmwasm_std::Addr)]
14    Dao {},
15    /// Returns contract version info
16    #[returns(InfoResponse)]
17    Info {},
18    /// Returns the proposal ID that will be assigned to the
19    /// next proposal created.
20    #[returns(::std::primitive::u64)]
21    NextProposalId {},
22}
23
24mod tests {
25    /// Make sure the enum has all of the fields we expect. This will
26    /// fail to compile if not.
27    #[test]
28    fn test_macro_expansion() {
29        use super::Query;
30
31        let query = Query::Info {};
32
33        match query {
34            Query::Dao {} => (),
35            Query::Info {} => (),
36            Query::NextProposalId {} => (),
37        }
38    }
39}