dao_interface/
voting.rs

1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cosmwasm_std::Uint128;
3use cw2::ContractVersion;
4
5#[cw_serde]
6#[derive(QueryResponses)]
7pub enum Query {
8    /// Returns the token contract address, if set.
9    #[returns(::cosmwasm_std::Addr)]
10    TokenContract {},
11    /// Returns the native token denom, if used.
12    #[returns(DenomResponse)]
13    Denom {},
14    /// Returns the voting power for an address at a given height.
15    #[returns(VotingPowerAtHeightResponse)]
16    VotingPowerAtHeight {
17        address: ::std::string::String,
18        height: ::std::option::Option<::std::primitive::u64>,
19    },
20    /// Returns the total voting power at a given block heigh.
21    #[returns(TotalPowerAtHeightResponse)]
22    TotalPowerAtHeight {
23        height: ::std::option::Option<::std::primitive::u64>,
24    },
25    /// Returns the address of the DAO this module belongs to.
26    #[returns(cosmwasm_std::Addr)]
27    Dao {},
28    /// Returns contract version info.
29    #[returns(InfoResponse)]
30    Info {},
31    /// Whether the DAO is active or not.
32    #[returns(::std::primitive::bool)]
33    IsActive {},
34}
35
36#[cw_serde]
37pub enum ActiveThresholdQuery {
38    ActiveThreshold {},
39}
40
41#[cw_serde]
42pub struct VotingPowerAtHeightResponse {
43    pub power: Uint128,
44    pub height: u64,
45}
46
47#[cw_serde]
48pub struct TotalPowerAtHeightResponse {
49    pub power: Uint128,
50    pub height: u64,
51}
52
53#[cw_serde]
54pub struct InfoResponse {
55    pub info: ContractVersion,
56}
57
58#[cw_serde]
59pub struct IsActiveResponse {
60    pub active: bool,
61}
62
63#[cw_serde]
64pub struct DenomResponse {
65    pub denom: String,
66}