github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/dev/wasm/cw4-stake/src/state.rs (about) 1 use schemars::JsonSchema; 2 use serde::{Deserialize, Serialize}; 3 4 use cosmwasm_std::{Addr, Uint128}; 5 use cw20::Denom; 6 use cw4::TOTAL_KEY; 7 use cw_controllers::{Admin, Claims, Hooks}; 8 use cw_storage_plus::{Item, Map, SnapshotMap, Strategy}; 9 use cw_utils::Duration; 10 11 pub const CLAIMS: Claims = Claims::new("claims"); 12 13 #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] 14 pub struct Config { 15 /// denom of the token to stake 16 pub denom: Denom, 17 pub tokens_per_weight: Uint128, 18 pub min_bond: Uint128, 19 pub unbonding_period: Duration, 20 } 21 22 pub const ADMIN: Admin = Admin::new("admin"); 23 pub const HOOKS: Hooks = Hooks::new("cw4-hooks"); 24 pub const CONFIG: Item<Config> = Item::new("config"); 25 pub const TOTAL: Item<u64> = Item::new(TOTAL_KEY); 26 27 pub const MEMBERS: SnapshotMap<&Addr, u64> = SnapshotMap::new( 28 cw4::MEMBERS_KEY, 29 cw4::MEMBERS_CHECKPOINTS, 30 cw4::MEMBERS_CHANGELOG, 31 Strategy::EveryBlock, 32 ); 33 34 pub const STAKE: Map<&Addr, Uint128> = Map::new("stake");