Skip to main content

komple_framework_mint_module/
state.rs

1use cosmwasm_schema::cw_serde;
2use komple_framework_types::shared::{
3    CONFIG_NAMESPACE, EXECUTE_LOCK_NAMESPACE, OPERATORS_NAMESPACE, PARENT_ADDR_NAMESPACE,
4};
5
6use cosmwasm_std::Addr;
7use cw_storage_plus::{Item, Map};
8use komple_framework_types::modules::fee::{FundInfo, FUND_INFO_NAMESPACE};
9use komple_framework_types::modules::mint::{
10    Collections, BLACKLIST_COLLECTION_ADDRS_NAMESPACE, COLLECTION_ADDRS_NAMESPACE,
11    COLLECTION_ID_NAMESPACE, COLLECTION_INFO_NAMESPACE, CREATORS_NAMESPACE,
12    LINKED_COLLECTIONS_NAMESPACE, MINT_LOCKS_NAMESPACE,
13};
14
15#[cw_serde]
16pub struct Config {
17    pub admin: Addr,
18    pub public_collection_creation: bool,
19    pub mint_lock: bool,
20}
21pub const CONFIG: Item<Config> = Item::new(CONFIG_NAMESPACE);
22
23/// General information about the collection.
24#[cw_serde]
25pub struct CollectionInfo {
26    pub collection_type: Collections,
27    pub name: String,
28    pub description: String,
29    pub image: String,
30    pub external_link: Option<String>,
31}
32/// Map of collection ids to collection infos.
33pub const COLLECTION_INFO: Map<u32, CollectionInfo> = Map::new(COLLECTION_INFO_NAMESPACE);
34
35/// Map of collection ids to collection addresses.
36pub const COLLECTION_ADDRS: Map<u32, Addr> = Map::new(COLLECTION_ADDRS_NAMESPACE);
37
38/// ID used for the collection numbers.
39pub const COLLECTION_ID: Item<u32> = Item::new(COLLECTION_ID_NAMESPACE);
40
41/// Hub module address.
42pub const HUB_ADDR: Item<Addr> = Item::new(PARENT_ADDR_NAMESPACE);
43
44/// Operators of this contract.
45pub const OPERATORS: Item<Vec<Addr>> = Item::new(OPERATORS_NAMESPACE);
46
47/// Map of collection ids to a list of collection ids.
48///
49/// This is used to link collections to other
50/// collections for custom usage in operations.
51pub const LINKED_COLLECTIONS: Map<u32, Vec<u32>> = Map::new(LINKED_COLLECTIONS_NAMESPACE);
52
53/// Map of collection ids to a list of collection ids.
54///
55/// This is used to blacklist collections and
56/// prevent them from being used in operations.
57pub const BLACKLIST_COLLECTION_ADDRS: Map<u32, Addr> =
58    Map::new(BLACKLIST_COLLECTION_ADDRS_NAMESPACE);
59
60/// Lock for the execute entry point.
61pub const EXECUTE_LOCK: Item<bool> = Item::new(EXECUTE_LOCK_NAMESPACE);
62
63/// List of creators that can create collections.
64pub const CREATORS: Item<Vec<Addr>> = Item::new(CREATORS_NAMESPACE);
65
66/// Map of collection ids to minting locks.
67pub const MINT_LOCKS: Map<u32, bool> = Map::new(MINT_LOCKS_NAMESPACE);
68
69/// Map of collection ids to fund infos.
70pub const COLLECTION_FUND_INFO: Map<u32, FundInfo> = Map::new(FUND_INFO_NAMESPACE);