dao_proposal_multiple/
query.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use crate::{proposal::MultipleChoiceProposal, state::Config};
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Addr, Uint128};

use dao_voting::multiple_choice::MultipleChoiceVote;

#[cw_serde]
pub struct ProposalListResponse {
    pub proposals: Vec<ProposalResponse>,
}

/// Information about a proposal returned by proposal queries.
#[cw_serde]
pub struct ProposalResponse {
    pub id: u64,
    pub proposal: MultipleChoiceProposal,
}

/// Information about a vote that was cast.
#[cw_serde]
pub struct VoteInfo {
    /// The address that voted.
    pub voter: Addr,
    /// Position on the vote.
    pub vote: MultipleChoiceVote,
    /// The voting power behind the vote.
    pub power: Uint128,
    /// The rationale behind the vote.
    pub rationale: Option<String>,
}

#[cw_serde]
pub struct VoteResponse {
    pub vote: Option<VoteInfo>,
}

#[cw_serde]
pub struct VoteListResponse {
    pub votes: Vec<VoteInfo>,
}

#[cw_serde]
pub struct VoterResponse {
    pub weight: Option<Uint128>,
}

#[cw_serde]
pub struct ConfigResponse {
    pub config: Config,
}