use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Addr, CosmosMsg, Empty};
use cw_utils::{Expiration, ThresholdResponse};
use crate::{msg::Vote, DepositInfo};
#[cw_serde]
pub enum Cw3QueryMsg {
Threshold {},
Proposal { proposal_id: u64 },
ListProposals {
start_after: Option<u64>,
limit: Option<u32>,
},
ReverseProposals {
start_before: Option<u64>,
limit: Option<u32>,
},
Vote { proposal_id: u64, voter: String },
ListVotes {
proposal_id: u64,
start_after: Option<String>,
limit: Option<u32>,
},
Voter { address: String },
ListVoters {
start_after: Option<String>,
limit: Option<u32>,
},
}
#[cw_serde]
pub struct ProposalResponse<T = Empty> {
pub id: u64,
pub title: String,
pub description: String,
pub msgs: Vec<CosmosMsg<T>>,
pub status: Status,
pub expires: Expiration,
pub threshold: ThresholdResponse,
pub proposer: Addr,
pub deposit: Option<DepositInfo>,
}
#[cw_serde]
#[derive(Copy)]
#[repr(u8)]
pub enum Status {
Pending = 1,
Open = 2,
Rejected = 3,
Passed = 4,
Executed = 5,
}
#[cw_serde]
pub struct ProposalListResponse<T = Empty> {
pub proposals: Vec<ProposalResponse<T>>,
}
#[cw_serde]
pub struct VoteListResponse {
pub votes: Vec<VoteInfo>,
}
#[cw_serde]
pub struct VoteInfo {
pub proposal_id: u64,
pub voter: String,
pub vote: Vote,
pub weight: u64,
}
#[cw_serde]
pub struct VoteResponse {
pub vote: Option<VoteInfo>,
}
#[cw_serde]
pub struct VoterResponse {
pub weight: Option<u64>,
}
#[cw_serde]
pub struct VoterListResponse {
pub voters: Vec<VoterDetail>,
}
#[cw_serde]
pub struct VoterDetail {
pub addr: String,
pub weight: u64,
}