1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use crate::tokens::TokensHuman;
5use cosmwasm_std::{Decimal256, Uint256};
6
7#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
8#[serde(rename_all = "snake_case")]
9pub struct InstantiateMsg {
10 pub owner_addr: String,
12 pub oracle_contract: String,
14 pub market_contract: String,
16 pub liquidation_contract: String,
18 pub collector_contract: String,
20 pub stable_contract: String,
23
24 pub price_timeframe: u64,
25}
26
27#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
28#[serde(rename_all = "snake_case")]
29pub struct MigrateMsg {}
30
31#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
32#[serde(rename_all = "snake_case")]
33#[allow(clippy::large_enum_variant)]
34pub enum ExecuteMsg {
35 UpdateConfig {
40 owner_addr: Option<String>,
41 oracle_contract: Option<String>,
42 liquidation_contract: Option<String>,
43 price_timeframe: Option<u64>,
44 },
45 Whitelist {
47 name: String, symbol: String, collateral_token: String, custody_contract: String, max_ltv: Decimal256, },
53 UpdateWhitelist {
55 collateral_token: String, custody_contract: Option<String>, max_ltv: Option<Decimal256>, },
59
60 LockCollateral {
64 collaterals: TokensHuman, },
66 UnlockCollateral {
67 collaterals: TokensHuman, },
69
70 LiquidateCollateral { borrower: String },
74}
75
76#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
77#[serde(rename_all = "snake_case")]
78pub enum Cw20HookMsg {
79 FundReserve {},
80}
81
82#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
83#[serde(rename_all = "snake_case")]
84pub enum QueryMsg {
85 Config {},
86 Whitelist {
87 collateral_token: Option<String>,
88 start_after: Option<String>,
89 limit: Option<u32>,
90 },
91 Collaterals {
92 borrower: String,
93 },
94 AllCollaterals {
95 start_after: Option<String>,
96 limit: Option<u32>,
97 },
98 BorrowLimit {
99 borrower: String,
100 block_time: Option<u64>,
101 },
102}
103
104#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
106pub struct ConfigResponse {
107 pub owner_addr: String,
108 pub oracle_contract: String,
109 pub market_contract: String,
110 pub liquidation_contract: String,
111 pub collector_contract: String,
112 pub stable_contract: String,
113 pub price_timeframe: u64,
114}
115
116#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
118pub struct WhitelistResponseElem {
119 pub name: String,
120 pub symbol: String,
121 pub max_ltv: Decimal256,
122 pub custody_contract: String,
123 pub collateral_token: String,
124}
125
126#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
128pub struct WhitelistResponse {
129 pub elems: Vec<WhitelistResponseElem>,
130}
131
132#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
134pub struct CollateralsResponse {
135 pub borrower: String,
136 pub collaterals: TokensHuman, }
138
139#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
141pub struct AllCollateralsResponse {
142 pub all_collaterals: Vec<CollateralsResponse>,
143}
144
145#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
146pub struct BorrowLimitResponse {
147 pub borrower: String,
148 pub borrow_limit: Uint256,
149}