Skip to main content

pylon_token/
staking.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{Decimal, Uint128};
5use cw20::Cw20ReceiveMsg;
6
7#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
8pub struct InstantiateMsg {
9    pub pylon_token: String,
10    pub staking_token: String, // lp token of ANC-UST pair contract
11    pub distribution_schedule: Vec<(u64, u64, Uint128)>,
12}
13
14#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
15#[serde(rename_all = "snake_case")]
16pub enum ExecuteMsg {
17    Receive(Cw20ReceiveMsg),
18    Unbond {
19        amount: Uint128,
20    },
21    /// Withdraw pending rewards
22    Withdraw {},
23    MigrateStaking {
24        new_staking_contract: String,
25    },
26}
27
28#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
29#[serde(rename_all = "snake_case")]
30pub enum Cw20HookMsg {
31    Bond {},
32}
33
34/// We currently take no arguments for migrations
35#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
36pub struct MigrateMsg {}
37
38#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
39#[serde(rename_all = "snake_case")]
40pub enum QueryMsg {
41    Config {},
42    State {
43        block_height: Option<u64>,
44    },
45    StakerInfo {
46        staker: String,
47        block_height: Option<u64>,
48    },
49}
50
51// We define a custom struct for each query response
52#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
53pub struct ConfigResponse {
54    pub pylon_token: String,
55    pub staking_token: String,
56    pub distribution_schedule: Vec<(u64, u64, Uint128)>,
57}
58
59// We define a custom struct for each query response
60#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
61pub struct StateResponse {
62    pub last_distributed: u64,
63    pub total_bond_amount: Uint128,
64    pub global_reward_index: Decimal,
65}
66
67// We define a custom struct for each query response
68#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
69pub struct StakerInfoResponse {
70    pub staker: String,
71    pub reward_index: Decimal,
72    pub bond_amount: Uint128,
73    pub pending_reward: Uint128,
74}