1use crate::state::{Config, SwapType};
2use cosmwasm_std::{Addr, Uint128};
3use cw20::Expiration;
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6
7#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
8pub struct InstantiateMsg {
9 pub admin: Addr,
10 pub cw721: Addr,
11}
12
13#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
14#[serde(rename_all = "snake_case")]
15pub enum ExecuteMsg {
16 Create(SwapMsg),
17 Finish(SwapMsg),
18 Cancel(CancelMsg),
19 Update(UpdateMsg),
20 UpdateConfig { config: Config },
21}
22#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
23#[serde(rename_all = "snake_case")]
24pub struct CancelMsg {
25 pub id: String,
26}
27#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
28pub struct UpdateMsg {
29 pub id: String,
30 pub expires: Expiration,
31 pub price: Uint128,
32}
33#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
34pub struct SwapMsg {
35 pub id: String,
36 pub payment_token: Option<Addr>, pub token_id: String,
38 pub expires: Expiration,
39 pub price: Uint128,
40 pub swap_type: SwapType,
41}
42
43#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
44#[serde(rename_all = "snake_case")]
45pub enum QueryMsg {
46 List {
49 start_after: Option<String>,
50 limit: Option<u32>,
51 },
52 GetTotal {
54 swap_type: SwapType,
55 },
56 GetOffers {
58 page: Option<u32>,
59 limit: Option<u32>,
60 },
61 GetListings {
63 page: Option<u32>,
64 limit: Option<u32>,
65 },
66 ListingsOfToken {
69 token_id: String,
70 swap_type: Option<SwapType>,
71 page: Option<u32>,
72 limit: Option<u32>,
73 },
74 SwapsOf {
77 address: Addr,
78 swap_type: Option<SwapType>,
79 page: Option<u32>,
80 limit: Option<u32>,
81 },
82 SwapsByPrice {
84 min: Option<Uint128>,
85 max: Option<Uint128>,
86 swap_type: Option<SwapType>,
87 page: Option<u32>,
88 limit: Option<u32>,
89 },
90 SwapsByDenom {
93 payment_token: Option<Addr>,
94 swap_type: Option<SwapType>,
95 page: Option<u32>,
96 limit: Option<u32>,
97 },
98 SwapsByPaymentType {
100 cw20: bool,
101 swap_type: Option<SwapType>,
102 page: Option<u32>,
103 limit: Option<u32>,
104 },
105
106 Details {
109 id: String,
110 },
111}
112
113#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
114#[serde(rename_all = "snake_case")]
115pub struct MigrateMsg {}
116
117#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
119pub struct ListResponse {
120 pub swaps: Vec<String>,
121}
122
123#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
125pub struct DetailsResponse {
126 pub creator: Addr,
127 pub contract: Addr,
128 pub payment_token: Option<Addr>,
129 pub token_id: String,
130 pub expires: Expiration,
131 pub price: Uint128,
132 pub swap_type: SwapType,
133}