cw3_fixed_multisig_secdao/
msg.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{CosmosMsg, Empty};
5use cw3::Vote;
6use cw_utils::{Duration, Expiration, Threshold};
7
8#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
9pub struct InstantiateMsg {
10    pub voters: Vec<Voter>,
11    pub threshold: Threshold,
12    pub max_voting_period: Duration,
13}
14
15#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
16pub struct Voter {
17    pub addr: String,
18    pub weight: u64,
19}
20
21// TODO: add some T variants? Maybe good enough as fixed Empty for now
22#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
23#[serde(rename_all = "snake_case")]
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}
43
44// We can also add this as a cw3 extension
45#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
46#[serde(rename_all = "snake_case")]
47pub enum QueryMsg {
48    /// Return ThresholdResponse
49    Threshold {},
50    /// Returns ProposalResponse
51    Proposal { proposal_id: u64 },
52    /// Returns ProposalListResponse
53    ListProposals {
54        start_after: Option<u64>,
55        limit: Option<u32>,
56    },
57    /// Returns ProposalListResponse
58    ReverseProposals {
59        start_before: Option<u64>,
60        limit: Option<u32>,
61    },
62    /// Returns VoteResponse
63    Vote { proposal_id: u64, voter: String },
64    /// Returns VoteListResponse
65    ListVotes {
66        proposal_id: u64,
67        start_after: Option<String>,
68        limit: Option<u32>,
69    },
70    /// Returns VoterInfo
71    Voter { address: String },
72    /// Returns VoterListResponse
73    ListVoters {
74        start_after: Option<String>,
75        limit: Option<u32>,
76    },
77}