Skip to main content

pfc_steak/
hub_tf.rs

1use std::str::FromStr;
2
3use cosmwasm_schema::cw_serde;
4//
5use cosmwasm_std::{Decimal, Uint128};
6
7use crate::hub::CallbackMsg;
8
9#[cw_serde]
10pub enum TokenFactoryType {
11    CosmWasm = 1,
12    Kujira = 2,
13    Injective = 3,
14    Osmosis = 4,
15}
16impl ToString for TokenFactoryType {
17    fn to_string(&self) -> String {
18        match &self {
19            TokenFactoryType::CosmWasm => String::from("CosmWasm"),
20            TokenFactoryType::Kujira => String::from("Kujira"),
21            TokenFactoryType::Injective => String::from("Injective"),
22            TokenFactoryType::Osmosis => String::from("Osmosis"),
23        }
24    }
25}
26impl FromStr for TokenFactoryType {
27    type Err = ();
28
29    fn from_str(s: &str) -> Result<Self, Self::Err> {
30        match s {
31            "CosmWasm" => Ok(TokenFactoryType::CosmWasm),
32            "Kujira" => Ok(TokenFactoryType::Kujira),
33            "Injective" => Ok(TokenFactoryType::Injective),
34            "Osmosis" => Ok(TokenFactoryType::Osmosis),
35            _ => Err(()),
36        }
37    }
38}
39
40#[cw_serde]
41pub struct InstantiateMsg {
42    /// Account who can call certain privileged functions
43    pub owner: String,
44    /// How often the un-bonding queue is to be executed, in seconds
45    pub epoch_period: u64,
46    /// The staking module's un-bonding time, in seconds
47    pub unbond_period: u64,
48    /// Initial set of validators who will receive the delegations
49    pub validators: Vec<String>,
50    /// denomination of coins to steak (uXXXX)
51    pub denom: String,
52    /// denomination of the steak token (eg steakLuna)
53    pub steak_denom: String,
54    /// type of fee account
55    pub fee_account_type: String,
56    /// Fee Account to send fees too
57    pub fee_account: String,
58    /// Fee "1.00 = 100%"
59    pub fee_amount: Decimal,
60    /// Max Fee "1.00 = 100%"
61    pub max_fee_amount: Decimal,
62    // different chains have different token factory implementations
63    pub token_factory: String,
64    /// The Dust collector contract
65    pub dust_collector: Option<String>,
66}
67
68#[cw_serde]
69pub enum ExecuteMsg {
70    /// Bond specified amount of Luna
71    Bond {
72        receiver: Option<String>,
73        exec_msg: Option<String>,
74    },
75    /// Bond specified amount of Luna
76    Unbond {
77        receiver: Option<String>,
78    },
79
80    /// Withdraw Luna that have finished un-bonding in previous batches
81    WithdrawUnbonded {
82        receiver: Option<String>,
83    },
84    /// Withdraw Luna that has finished unbonding in previous batches, for given address
85    WithdrawUnbondedAdmin {
86        address: String,
87    },
88    /// Add a validator to the whitelist; callable by the owner
89    AddValidator {
90        validator: String,
91    },
92    /// Remove a validator from the whitelist; callable by the owner
93    RemoveValidator {
94        validator: String,
95    },
96    /// Remove a validator from the whitelist; callable by the owner. Does not undelegate. use for
97    /// typos
98    RemoveValidatorEx {
99        validator: String,
100    },
101
102    /// Pause a validator from accepting new delegations
103    PauseValidator {
104        validator: String,
105    },
106    /// Unpause a validator from accepting new delegations
107    UnPauseValidator {
108        validator: String,
109    },
110
111    /// Transfer ownership to another account; will not take effect unless the new owner accepts
112    TransferOwnership {
113        new_owner: String,
114    },
115    /// Accept an ownership transfer
116    AcceptOwnership {},
117    /// Claim staking rewards, swap all for Luna, and restake
118    Harvest {},
119    /// Use redelegations to balance the amounts of Luna delegated to validators
120    Rebalance {
121        minimum: Uint128,
122    },
123    /// redelegate stake from one validator to another
124    Redelegate {
125        validator_from: String,
126        validator_to: String,
127    },
128    /// Update Luna amounts in unbonding batches to reflect any slashing or rounding errors
129    Reconcile {},
130    /// Submit the current pending batch of unbonding requests to be unbonded
131    SubmitBatch {},
132    /// Set unbond period
133    SetUnbondPeriod {
134        unbond_period: u64,
135    },
136
137    /// Transfer Fee collection account to another account
138    TransferFeeAccount {
139        fee_account_type: String,
140        new_fee_account: String,
141    },
142    /// Update fee collection amount
143    UpdateFee {
144        new_fee: Decimal,
145    },
146    /// Callbacks; can only be invoked by the contract itself
147    Callback(CallbackMsg),
148    /// Set Dust Collector Contract
149    SetDustCollector {
150        dust_collector: Option<String>,
151    },
152    /// Collect the Dust
153    CollectDust {
154        max_tokens: u32,
155    },
156    /// Return the Dust in shiny 'base denom'
157    ReturnDenom {},
158    /// change tokenfactory type (ADMIN only)
159    ChangeTokenFactory {
160        token_factory_type: String,
161    },
162}