tgrade_community_pool/
msg.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::Coin;
5use tg3::Vote;
6
7use tg_voting_contract::state::VotingRules;
8
9#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
10#[serde(rename_all = "snake_case")]
11pub struct InstantiateMsg {
12    pub rules: VotingRules,
13    // this is the group contract that contains the member list
14    pub group_addr: String,
15}
16
17/// The type of proposal to vote on
18#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
19#[serde(rename_all = "snake_case")]
20pub enum Proposal {
21    /// Proposal to send some tokens from community pool contract to given address
22    SendProposal {
23        /// Address to send tokens to
24        to_addr: String,
25        /// Funds to send
26        amount: Coin,
27    },
28    /// An open text proposal with no actual logic executed when it passes
29    Text {},
30}
31
32#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
33#[serde(rename_all = "snake_case")]
34pub enum ExecuteMsg {
35    Propose {
36        title: String,
37        description: String,
38        proposal: Proposal,
39    },
40    Vote {
41        proposal_id: u64,
42        vote: Vote,
43    },
44    Execute {
45        proposal_id: u64,
46    },
47    Close {
48        proposal_id: u64,
49    },
50    /// The Community Pool may be a participant in engagement and end up
51    /// receiving engagement rewards. This endpoint can be used to withdraw
52    /// those. Anyone can call it.
53    WithdrawEngagementRewards {},
54    /// Message comming from valset on funds distribution, just takes funds
55    /// send with message and does nothing
56    DistributeRewards {},
57}
58
59// We can also add this as a tg3 extension
60#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
61#[serde(rename_all = "snake_case")]
62pub enum QueryMsg {
63    /// Return VotingRules
64    Rules {},
65    /// Returns ProposalResponse
66    Proposal { proposal_id: u64 },
67    /// Returns ProposalListResponse
68    ListProposals {
69        start_after: Option<u64>,
70        limit: Option<u32>,
71    },
72    /// Returns ProposalListResponse
73    ReverseProposals {
74        start_before: Option<u64>,
75        limit: Option<u32>,
76    },
77    /// Returns VoteResponse
78    Vote { proposal_id: u64, voter: String },
79    /// Returns VoteListResponse
80    ListVotes {
81        proposal_id: u64,
82        start_after: Option<String>,
83        limit: Option<u32>,
84    },
85    /// Returns VoteListResponse
86    ListVotesByVoter {
87        voter: String,
88        start_after: Option<u64>,
89        limit: Option<u32>,
90    },
91    /// Returns VoterResponse
92    Voter { address: String },
93    /// Returns VoterListResponse
94    ListVoters {
95        start_after: Option<String>,
96        limit: Option<u32>,
97    },
98    /// Returns address of current's group contract
99    GroupContract {},
100    /// List all text proposals
101    ListTextProposals {
102        start_after: Option<u64>,
103        limit: Option<u32>,
104    },
105}