github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/dev/wasm/cw4-stake/src/msg.rs (about)

     1  use cosmwasm_std::Uint128;
     2  use schemars::JsonSchema;
     3  use serde::{Deserialize, Serialize};
     4  
     5  use cw20::{Cw20ReceiveMsg, Denom};
     6  pub use cw_controllers::ClaimsResponse;
     7  use cw_utils::Duration;
     8  
     9  #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
    10  pub struct InstantiateMsg {
    11      /// denom of the token to stake
    12      pub denom: Denom,
    13      pub tokens_per_weight: Uint128,
    14      pub min_bond: Uint128,
    15      pub unbonding_period: Duration,
    16  
    17      // admin can only add/remove hooks, not change other parameters
    18      pub admin: Option<String>,
    19  }
    20  
    21  #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
    22  #[serde(rename_all = "snake_case")]
    23  pub enum ExecuteMsg {
    24      /// Bond will bond all staking tokens sent with the message and update membership weight
    25      Bond {},
    26      /// Unbond will start the unbonding process for the given number of tokens.
    27      /// The sender immediately loses weight from these tokens, and can claim them
    28      /// back to his wallet after `unbonding_period`
    29      Unbond { tokens: Uint128 },
    30      /// Claim is used to claim your native tokens that you previously "unbonded"
    31      /// after the contract-defined waiting period (eg. 1 week)
    32      Claim {},
    33  
    34      /// Change the admin
    35      UpdateAdmin { admin: Option<String> },
    36      /// Add a new hook to be informed of all membership changes. Must be called by Admin
    37      AddHook { addr: String },
    38      /// Remove a hook. Must be called by Admin
    39      RemoveHook { addr: String },
    40  
    41      /// This accepts a properly-encoded ReceiveMsg from a cw20 contract
    42      Receive(Cw20ReceiveMsg),
    43  }
    44  
    45  #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
    46  #[serde(rename_all = "snake_case")]
    47  pub enum ReceiveMsg {
    48      /// Only valid cw20 message is to bond the tokens
    49      Bond {},
    50  }
    51  
    52  #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
    53  #[serde(rename_all = "snake_case")]
    54  pub enum QueryMsg {
    55      /// Claims shows the tokens in process of unbonding for this address
    56      Claims {
    57          address: String,
    58      },
    59      // Show the number of tokens currently staked by this address.
    60      Staked {
    61          address: String,
    62      },
    63  
    64      /// Return AdminResponse
    65      Admin {},
    66      /// Return TotalWeightResponse
    67      TotalWeight {},
    68      /// Returns MembersListResponse
    69      ListMembers {
    70          start_after: Option<String>,
    71          limit: Option<u32>,
    72      },
    73      /// Returns MemberResponse
    74      Member {
    75          addr: String,
    76          at_height: Option<u64>,
    77      },
    78      /// Shows all registered hooks. Returns HooksResponse.
    79      Hooks {},
    80  }
    81  
    82  #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
    83  pub struct StakedResponse {
    84      pub stake: Uint128,
    85      pub denom: Denom,
    86  }