github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/dev/wasm/cw20-base/src/state.rs (about) 1 use schemars::JsonSchema; 2 use serde::{Deserialize, Serialize}; 3 4 use cosmwasm_std::{Addr, Uint128}; 5 use cw_storage_plus::{Item, Map}; 6 7 use cw20::{AllowanceResponse, Logo, MarketingInfoResponse}; 8 9 #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] 10 #[serde(rename_all = "snake_case")] 11 pub struct TokenInfo { 12 pub name: String, 13 pub symbol: String, 14 pub decimals: u8, 15 pub total_supply: Uint128, 16 pub mint: Option<MinterData>, 17 } 18 19 #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] 20 pub struct MinterData { 21 pub minter: Addr, 22 /// cap is how many more tokens can be issued by the minter 23 pub cap: Option<Uint128>, 24 } 25 26 impl TokenInfo { 27 pub fn get_cap(&self) -> Option<Uint128> { 28 self.mint.as_ref().and_then(|v| v.cap) 29 } 30 } 31 32 pub const TOKEN_INFO: Item<TokenInfo> = Item::new("token_info"); 33 pub const MARKETING_INFO: Item<MarketingInfoResponse> = Item::new("marketing_info"); 34 pub const LOGO: Item<Logo> = Item::new("logo"); 35 pub const BALANCES: Map<&Addr, Uint128> = Map::new("balance"); 36 pub const ALLOWANCES: Map<(&Addr, &Addr), AllowanceResponse> = Map::new("allowance");