mirror_protocol/
factory.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{Binary, Decimal, Uint128};
5
6#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
7pub struct InstantiateMsg {
8    pub token_code_id: u64,
9    pub base_denom: String,
10    pub distribution_schedule: Vec<(u64, u64, Uint128)>, // [[start_time, end_time, distribution_amount], [], ...]
11}
12
13#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
14#[serde(rename_all = "snake_case")]
15pub enum ExecuteMsg {
16    ///////////////////
17    /// Owner Operations
18    ///////////////////
19    PostInitialize {
20        owner: String,
21        terraswap_factory: String,
22        mirror_token: String,
23        staking_contract: String,
24        oracle_contract: String,
25        mint_contract: String,
26        commission_collector: String,
27    },
28    UpdateConfig {
29        owner: Option<String>,
30        token_code_id: Option<u64>,
31        distribution_schedule: Option<Vec<(u64, u64, Uint128)>>, // [[start_time, end_time, distribution_amount], [], ...]
32    },
33    UpdateWeight {
34        asset_token: String,
35        weight: u32,
36    },
37    Whitelist {
38        /// asset name used to create token contract
39        name: String,
40        /// asset symbol used to create token contract
41        symbol: String,
42        /// authorized asset oracle feeder
43        oracle_feeder: String,
44        /// used to create all necessary contract or register asset
45        params: Params,
46    },
47    PassCommand {
48        contract_addr: String,
49        msg: Binary,
50    },
51
52    //////////////////////
53    /// Feeder Operations
54    /// //////////////////
55
56    /// Revoke asset from MIR rewards pool
57    /// and register end_price to mint contract
58    /// Only feeder can set end_price
59    RevokeAsset {
60        asset_token: String,
61        end_price: Option<Decimal>,
62    },
63    /// Migrate asset to new asset by registering
64    /// end_price to mint contract and add
65    /// the new asset to MIR rewards pool
66    MigrateAsset {
67        name: String,
68        symbol: String,
69        from_token: String,
70        end_price: Decimal,
71    },
72
73    ///////////////////
74    /// User Operations
75    ///////////////////
76    Distribute {},
77}
78
79#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
80#[serde(rename_all = "snake_case")]
81pub enum QueryMsg {
82    Config {},
83    DistributionInfo {},
84}
85
86// We define a custom struct for each query response
87#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
88pub struct ConfigResponse {
89    pub owner: String,
90    pub mirror_token: String,
91    pub mint_contract: String,
92    pub staking_contract: String,
93    pub commission_collector: String,
94    pub oracle_contract: String,
95    pub terraswap_factory: String,
96    pub token_code_id: u64,
97    pub base_denom: String,
98    pub genesis_time: u64,
99    pub distribution_schedule: Vec<(u64, u64, Uint128)>,
100}
101
102// We define a custom struct for each query response
103#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
104pub struct DistributionInfoResponse {
105    pub weights: Vec<(String, u32)>,
106    pub last_distributed: u64,
107}
108
109/// We currently take no arguments for migrations
110#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
111pub struct MigrateMsg {}
112
113#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
114#[serde(rename_all = "snake_case")]
115pub struct Params {
116    /// Auction discount rate applied to asset mint
117    pub auction_discount: Decimal,
118    /// Minium collateral ratio applied to asset mint
119    pub min_collateral_ratio: Decimal,
120    /// Distribution weight (default is 30, which is 1/10 of MIR distribution weight)
121    pub weight: Option<u32>,
122    /// For pre-IPO assets, time period after asset creation in which minting is enabled
123    pub mint_period: Option<u64>,
124    /// For pre-IPO assets, collateral ratio for the asset after ipo
125    pub min_collateral_ratio_after_ipo: Option<Decimal>,
126    /// For pre-IPO assets, fixed price during minting period
127    pub pre_ipo_price: Option<Decimal>,
128}