pylon_gateway/
swap_msg.rs

1use cosmwasm_bignumber::{Decimal256, Uint256};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
6#[serde(rename_all = "snake_case")]
7pub enum Strategy {
8    Lockup {
9        release_time: u64,
10        release_amount: Decimal256,
11    },
12    Vesting {
13        release_start_time: u64,
14        release_finish_time: u64,
15        release_amount: Decimal256,
16    },
17}
18
19#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
20pub struct InstantiateMsg {
21    pub beneficiary: String,
22    pub pool_x_denom: String,
23    pub pool_y_addr: String,
24    pub pool_liq_x: Uint256,
25    pub pool_liq_y: Uint256, // is also a maximum cap of this pool
26    pub price: Decimal256,
27    pub cap_strategy: Option<String>,
28    pub distribution_strategy: Vec<Strategy>,
29    pub whitelist_enabled: bool,
30    pub swap_pool_size: Uint256,
31    pub start: u64,
32    pub period: u64,
33}
34
35#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
36#[serde(rename_all = "snake_case")]
37pub enum ConfigureMsg {
38    Swap {
39        owner: Option<String>,
40        beneficiary: Option<String>,
41        cap_strategy: Option<String>,
42        whitelist_enabled: Option<bool>,
43    },
44    Pool {
45        x_denom: Option<String>,
46        y_addr: Option<String>,
47        liq_x: Option<Uint256>,
48        liq_y: Option<Uint256>,
49    },
50    Whitelist {
51        whitelist: bool,
52        candidates: Vec<String>,
53    },
54}
55
56#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
57#[serde(rename_all = "snake_case")]
58pub enum ExecuteMsg {
59    Configure(ConfigureMsg),
60    Deposit {},
61    Withdraw { amount: Uint256 },
62    Claim {},
63    Earn {},
64}
65
66#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
67#[serde(rename_all = "snake_case")]
68pub enum QueryMsg {
69    Config {},
70    BalanceOf {
71        owner: String,
72    },
73    IsWhitelisted {
74        address: String,
75    },
76    AvailableCapOf {
77        address: String,
78    },
79    ClaimableTokenOf {
80        address: String,
81    },
82    TotalSupply {},
83    CurrentPrice {},
84    SimulateWithdraw {
85        amount: Uint256,
86        address: Option<String>,
87    },
88}
89
90/// We currently take no arguments for migrations
91#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
92#[serde(rename_all = "snake_case")]
93pub enum MigrateMsg {
94    Refund {},
95    General {},
96}