Skip to main content

komple_framework_merge_module/
msg.rs

1use crate::state::Config;
2use cosmwasm_schema::{cw_serde, QueryResponses};
3use cosmwasm_std::Binary;
4use komple_framework_types::shared::execute::SharedExecuteMsg;
5use komple_framework_types::shared::query::ResponseWrapper;
6
7#[cw_serde]
8pub enum ExecuteMsg {
9    /// Admin message.
10    ///
11    /// Update the lock for merging.
12    /// This applies for the normal merge operation.
13    UpdateMergeLock { lock: bool },
14    /// Public message.
15    ///
16    /// Burn multiple tokens and mint a new one.
17    /// Takes merge msg to determine which tokens to burn and which to mint.
18    Merge { msg: MergeMsg },
19    /// Admin message.
20    ///
21    /// Same as `Merge` message but can be used with permissions.
22    PermissionMerge {
23        permission_msg: Binary,
24        merge_msg: MergeMsg,
25    },
26    /// Admin message.
27    ///
28    /// Update the operators of this contract.
29    UpdateOperators { addrs: Vec<String> },
30    /// Hub message.
31    ///
32    /// Lock the execute entry point.
33    /// Can only be called by the hub module.
34    LockExecute {},
35}
36
37impl From<ExecuteMsg> for SharedExecuteMsg {
38    fn from(msg: ExecuteMsg) -> Self {
39        match msg {
40            ExecuteMsg::LockExecute {} => SharedExecuteMsg::LockExecute {},
41            _ => unreachable!("Cannot convert {:?} to SharedExecuteMessage", msg),
42        }
43    }
44}
45
46#[cw_serde]
47#[derive(QueryResponses)]
48pub enum QueryMsg {
49    /// Get the contract's config.
50    #[returns(ResponseWrapper<Config>)]
51    Config {},
52    /// Get the operators of this contract.
53    #[returns(ResponseWrapper<Vec<String>>)]
54    Operators {},
55}
56
57/// Message that is used for the tokens that will be burned.
58#[cw_serde]
59pub struct MergeBurnMsg {
60    pub collection_id: u32,
61    pub token_id: u32,
62}
63
64/// Message that is used for the merge operation.
65#[cw_serde]
66pub struct MergeMsg {
67    pub recipient: String,
68    pub mint_id: u32,
69    pub metadata_id: Option<u32>,
70    pub burn_ids: Vec<MergeBurnMsg>,
71}
72
73#[cw_serde]
74pub struct MigrateMsg {}