bvs_guardrail/
msg.rs

1use crate::state::ProposalId;
2use bvs_library::slashing::SlashingRequestId;
3use cosmwasm_schema::{cw_serde, QueryResponses};
4use cw3::Vote;
5use cw4::Member;
6use cw_utils::Threshold;
7
8#[cw_serde]
9pub struct InstantiateMsg {
10    pub owner: String,
11    pub members: Vec<Member>,
12    pub threshold: Threshold,
13    pub default_expiration: u64,
14}
15
16#[cw_serde]
17pub enum ExecuteMsg {
18    Propose {
19        slashing_request_id: SlashingRequestId,
20        reason: String,
21    },
22    Vote {
23        slashing_request_id: SlashingRequestId,
24        vote: Vote,
25    },
26    Close {
27        slashing_request_id: SlashingRequestId,
28    },
29    /// apply a diff to the existing members.
30    /// remove is applied after add, so if an address is in both, it is removed
31    UpdateMembers {
32        remove: Vec<String>,
33        add: Vec<Member>,
34    },
35}
36
37#[cw_serde]
38#[derive(QueryResponses)]
39pub enum QueryMsg {
40    #[returns(cw_utils::ThresholdResponse)]
41    Threshold { height: Option<u64> },
42    #[returns(cw3::ProposalResponse)]
43    Proposal { proposal_id: ProposalId },
44    #[returns(cw3::ProposalResponse)]
45    ProposalBySlashingRequestId {
46        slashing_request_id: SlashingRequestId,
47    },
48    #[returns(cw3::ProposalListResponse)]
49    ListProposals {
50        start_after: Option<u64>,
51        limit: Option<u32>,
52    },
53    #[returns(cw3::VoteResponse)]
54    Vote {
55        proposal_id: ProposalId,
56        voter: String,
57    },
58    #[returns(cw3::VoteResponse)]
59    VoteBySlashingRequestId {
60        slashing_request_id: SlashingRequestId,
61        voter: String,
62    },
63    #[returns(cw3::VoteListResponse)]
64    ListVotes {
65        proposal_id: ProposalId,
66        start_after: Option<String>,
67        limit: Option<u32>,
68    },
69    #[returns(cw3::VoterResponse)]
70    Voter {
71        address: String,
72        height: Option<u64>,
73    },
74    #[returns(cw3::VoterListResponse)]
75    ListVoters {
76        start_after: Option<String>,
77        limit: Option<u32>,
78    },
79}
80
81#[cw_serde]
82pub struct Voter {
83    pub addr: String,
84    pub weight: u64,
85}