Skip to main content

tg4_stake/
state.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use crate::claim::Claims;
5use cosmwasm_std::{Addr, Uint128};
6use cw_storage_plus::{Item, Map};
7use tg_utils::Duration;
8
9/// Builds a claims map as it cannot be done in const time
10pub fn claims() -> Claims<'static> {
11    Claims::new("claims", "claims__release")
12}
13
14#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
15pub struct Config {
16    /// denom of the token to stake
17    pub denom: String,
18    pub tokens_per_point: Uint128,
19    pub min_bond: Uint128,
20    /// time in seconds
21    pub unbonding_period: Duration,
22    /// limits of how much claims can be automatically returned at end of block
23    pub auto_return_limit: u64,
24}
25
26pub const CONFIG: Item<Config> = Item::new("config");
27pub const STAKE: Map<&Addr, Uint128> = Map::new("stake");
28pub const STAKE_VESTING: Map<&Addr, Uint128> = Map::new("vesting_stake");