cw3_flex_multisig/
msg.rs

1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cosmwasm_std::{CosmosMsg, Empty};
3use cw3::{UncheckedDepositInfo, Vote};
4use cw4::MemberChangedHookMsg;
5use cw_utils::{Duration, Expiration, Threshold};
6
7use crate::state::Executor;
8
9#[cw_serde]
10pub struct InstantiateMsg {
11    // this is the group contract that contains the member list
12    pub group_addr: String,
13    pub threshold: Threshold,
14    pub max_voting_period: Duration,
15    // who is able to execute passed proposals
16    // None means that anyone can execute
17    pub executor: Option<Executor>,
18    /// The cost of creating a proposal (if any).
19    pub proposal_deposit: Option<UncheckedDepositInfo>,
20}
21
22// TODO: add some T variants? Maybe good enough as fixed Empty for now
23#[cw_serde]
24pub enum ExecuteMsg {
25    Propose {
26        title: String,
27        description: String,
28        msgs: Vec<CosmosMsg<Empty>>,
29        // note: we ignore API-spec'd earliest if passed, always opens immediately
30        latest: Option<Expiration>,
31    },
32    Vote {
33        proposal_id: u64,
34        vote: Vote,
35    },
36    Execute {
37        proposal_id: u64,
38    },
39    Close {
40        proposal_id: u64,
41    },
42    /// Handles update hook messages from the group contract
43    MemberChangedHook(MemberChangedHookMsg),
44}
45
46// We can also add this as a cw3 extension
47#[cw_serde]
48#[derive(QueryResponses)]
49pub enum QueryMsg {
50    #[returns(cw_utils::ThresholdResponse)]
51    Threshold {},
52    #[returns(cw3::ProposalResponse)]
53    Proposal { proposal_id: u64 },
54    #[returns(cw3::ProposalListResponse)]
55    ListProposals {
56        start_after: Option<u64>,
57        limit: Option<u32>,
58    },
59    #[returns(cw3::ProposalListResponse)]
60    ReverseProposals {
61        start_before: Option<u64>,
62        limit: Option<u32>,
63    },
64    #[returns(cw3::VoteResponse)]
65    Vote { proposal_id: u64, voter: String },
66    #[returns(cw3::VoteListResponse)]
67    ListVotes {
68        proposal_id: u64,
69        start_after: Option<String>,
70        limit: Option<u32>,
71    },
72    #[returns(cw3::VoterResponse)]
73    Voter { address: String },
74    #[returns(cw3::VoterListResponse)]
75    ListVoters {
76        start_after: Option<String>,
77        limit: Option<u32>,
78    },
79    /// Gets the current configuration.
80    #[returns(crate::state::Config)]
81    Config {},
82}