abstract_cw3_fixed_multisig/
msg.rs

1use abstract_cw3::Vote;
2use cosmwasm_schema::{cw_serde, QueryResponses};
3use cosmwasm_std::{CosmosMsg, Empty};
4use cw_utils::{Duration, Expiration, Threshold};
5
6#[cw_serde]
7pub struct InstantiateMsg {
8    pub voters: Vec<Voter>,
9    pub threshold: Threshold,
10    pub max_voting_period: Duration,
11}
12
13#[cw_serde]
14pub struct Voter {
15    pub addr: String,
16    pub weight: u64,
17}
18
19// TODO: add some T variants? Maybe good enough as fixed Empty for now
20#[cw_serde]
21#[derive(cw_orch::ExecuteFns)]
22pub enum ExecuteMsg {
23    Propose {
24        title: String,
25        description: String,
26        msgs: Vec<CosmosMsg<Empty>>,
27        // note: we ignore API-spec'd earliest if passed, always opens immediately
28        latest: Option<Expiration>,
29    },
30    Vote {
31        proposal_id: u64,
32        vote: Vote,
33    },
34    Execute {
35        proposal_id: u64,
36    },
37    Close {
38        proposal_id: u64,
39    },
40}
41
42// We can also add this as a cw3 extension
43#[cw_serde]
44#[derive(QueryResponses, cw_orch::QueryFns)]
45pub enum QueryMsg {
46    #[returns(cw_utils::ThresholdResponse)]
47    Threshold {},
48    #[returns(abstract_cw3::ProposalResponse)]
49    Proposal { proposal_id: u64 },
50    #[returns(abstract_cw3::ProposalListResponse)]
51    ListProposals {
52        start_after: Option<u64>,
53        limit: Option<u32>,
54    },
55    #[returns(abstract_cw3::ProposalListResponse)]
56    ReverseProposals {
57        start_before: Option<u64>,
58        limit: Option<u32>,
59    },
60    #[returns(abstract_cw3::VoteResponse)]
61    Vote { proposal_id: u64, voter: String },
62    #[returns(abstract_cw3::VoteListResponse)]
63    ListVotes {
64        proposal_id: u64,
65        start_after: Option<String>,
66        limit: Option<u32>,
67    },
68    #[returns(abstract_cw3::VoterResponse)]
69    Voter { address: String },
70    #[returns(abstract_cw3::VoterListResponse)]
71    ListVoters {
72        start_after: Option<String>,
73        limit: Option<u32>,
74    },
75}