Skip to main content

pylon_token/
gov_resp.rs

1use cosmwasm_std::{Decimal, Uint128};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5use crate::gov_msg::{
6    ClaimableAirdrop, PollCategory, PollExecuteMsg, PollStatus, VoteOption, VoterInfo,
7};
8
9#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
10pub struct APIVersionResponse {
11    pub version: String,
12}
13
14#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
15pub struct ConfigResponse {
16    pub owner: String,
17    pub pylon_token: String,
18    pub quorum: Decimal,
19    pub threshold: Decimal,
20    pub voting_period: u64,
21    pub timelock_period: u64,
22    pub proposal_deposit: Uint128,
23    pub snapshot_period: u64,
24}
25
26#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
27pub struct StateResponse {
28    pub poll_count: u64,
29    pub total_share: Uint128,
30    pub total_deposit: Uint128,
31    pub total_airdrop_count: u64,
32    pub airdrop_update_candidates: Vec<u64>,
33}
34
35#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
36pub struct PollResponse {
37    pub id: u64,
38    pub creator: String,
39    pub status: PollStatus,
40    pub end_height: u64,
41    pub title: String,
42    pub category: PollCategory,
43    pub description: String,
44    pub link: Option<String>,
45    pub deposit_amount: Uint128,
46    pub execute_data: Option<Vec<PollExecuteMsg>>,
47    pub yes_votes: Uint128, // balance
48    pub no_votes: Uint128,  // balance
49    pub staked_amount: Option<Uint128>,
50    pub total_balance_at_end_poll: Option<Uint128>,
51}
52
53#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
54pub struct AirdropResponse {
55    pub start: u64,
56    pub period: u64,
57    pub reward_token: String,
58    pub reward_rate: Decimal,
59}
60
61#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
62pub struct AirdropsResponse {
63    pub airdrops: Vec<(u64, AirdropResponse)>,
64}
65
66#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
67pub struct PollsResponse {
68    pub polls: Vec<PollResponse>,
69}
70
71#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
72pub struct PollCountResponse {
73    pub poll_count: u64,
74}
75
76#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
77pub struct StakerResponse {
78    pub balance: Uint128,
79    pub share: Uint128,
80    pub claimable_airdrop: Vec<(u64, ClaimableAirdrop)>,
81    pub locked_balance: Vec<(u64, VoterInfo)>,
82}
83
84#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
85pub struct StakersResponse {
86    pub stakers: Vec<(String, StakerResponse)>,
87}
88
89#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
90pub struct VotersResponseItem {
91    pub voter: String,
92    pub vote: VoteOption,
93    pub balance: Uint128,
94}
95
96#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
97pub struct VotersResponse {
98    pub voters: Vec<VotersResponseItem>,
99}