komple_framework_token_module/
msg.rs

1use crate::state::{CollectionConfig, Config};
2use cosmwasm_schema::{cw_serde, QueryResponses};
3use cosmwasm_std::Binary;
4use cw721::CustomMsg;
5use komple_framework_metadata_module::msg::InstantiateMsg as MetadataInstantiateMsg;
6use komple_framework_types::modules::mint::Collections;
7use komple_framework_types::modules::token::{Locks, SubModules};
8use komple_framework_types::shared::query::ResponseWrapper;
9use komple_framework_whitelist_module::msg::InstantiateMsg as WhitelistInstantiateMsg;
10
11#[cw_serde]
12pub struct TokenInfo {
13    pub symbol: String,
14    pub minter: String,
15}
16
17#[cw_serde]
18pub struct MetadataInfo {
19    pub instantiate_msg: MetadataInstantiateMsg,
20    pub code_id: u64,
21}
22
23#[cw_serde]
24pub struct InstantiateMsg {
25    pub creator: String,
26    pub token_info: TokenInfo,
27    pub collection_name: String,
28    pub collection_type: Collections,
29    pub collection_config: CollectionConfig,
30    pub metadata_info: MetadataInfo,
31}
32
33#[cw_serde]
34pub enum ExecuteMsg {
35    // Reimplementation of cw721 messages
36    // These messages are the same with custom implementation
37    TransferNft {
38        recipient: String,
39        token_id: String,
40    },
41    SendNft {
42        contract: String,
43        token_id: String,
44        msg: Binary,
45    },
46    Mint {
47        owner: String,
48        metadata_id: Option<u32>,
49    },
50    Burn {
51        token_id: String,
52    },
53    /// Admin message.
54    ///
55    /// Update the operators of this contract.
56    UpdateModuleOperators {
57        addrs: Vec<String>,
58    },
59    /// Admin message.
60    ///
61    /// Same message as `TransferNft` but can only be used by admin.
62    AdminTransferNft {
63        recipient: String,
64        token_id: String,
65    },
66    /// Admin message.
67    ///
68    /// Lock the module to prevent some operations.
69    /// Includes minting, burning, transferring and sending.
70    UpdateLocks {
71        locks: Locks,
72    },
73    /// Admin message.
74    ///
75    /// Lock a single token to prevent some operations.
76    /// Includes minting, burning, transferring and sending.
77    UpdateTokenLocks {
78        token_id: String,
79        locks: Locks,
80    },
81    /// Admin message.
82    ///
83    /// Update the collection config.
84    UpdateCollectionConfig {
85        collection_config: CollectionConfig,
86    },
87    /// Admin message.
88    ///
89    /// Create a whitelist contract tied to this contract.
90    InitWhitelistContract {
91        code_id: u64,
92        instantiate_msg: WhitelistInstantiateMsg,
93    },
94}
95impl CustomMsg for ExecuteMsg {}
96
97#[cw_serde]
98#[derive(QueryResponses)]
99pub enum QueryMsg {
100    /// List operation locks for the contract.
101    #[returns(ResponseWrapper<Locks>)]
102    Locks {},
103    /// List operation locks for a token.
104    #[returns(ResponseWrapper<Locks>)]
105    TokenLocks { token_id: String },
106    /// Get the total amount of minted tokens for an address.
107    #[returns(ResponseWrapper<u32>)]
108    MintedTokensPerAddress { address: String },
109    /// List the sub modules for this contract.
110    #[returns(ResponseWrapper<SubModules>)]
111    SubModules {},
112    /// Get this contract's configuration.
113    #[returns(ResponseWrapper<Config>)]
114    Config {},
115    /// Get the operators of this contract.
116    #[returns(ResponseWrapper<Vec<String>>)]
117    ModuleOperators {},
118}
119impl CustomMsg for QueryMsg {}
120
121#[cw_serde]
122pub struct LocksReponse {
123    pub locks: Locks,
124}
125
126#[cw_serde]
127pub struct MintedTokenAmountResponse {
128    pub amount: u32,
129}
130
131#[cw_serde]
132pub struct MigrateMsg {}