1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::Uint256;
5use cw20::Cw20ReceiveMsg;
6
7#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
8#[serde(rename_all = "snake_case")]
9pub struct InstantiateMsg {
10 pub owner: String,
12 pub collateral_token: String,
14 pub overseer_contract: String,
16 pub market_contract: String,
18 pub liquidation_contract: String,
20 pub collector_contract: String,
22}
23
24#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
25#[serde(rename_all = "snake_case")]
26pub enum ExecuteMsg {
27 Receive(Cw20ReceiveMsg),
29
30 UpdateConfig {
36 owner: Option<String>,
37 liquidation_contract: Option<String>,
38 collector_contract: Option<String>,
39 },
40 LockCollateral { borrower: String, amount: Uint256 },
42 UnlockCollateral { borrower: String, amount: Uint256 },
44 LiquidateCollateral {
46 liquidator: String,
47 borrower: String,
48 amount: Uint256,
49 },
50
51 WithdrawCollateral { amount: Option<Uint256> },
59}
60
61#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
62#[serde(rename_all = "snake_case")]
63pub enum Cw20HookMsg {
64 DepositCollateral {},
66}
67
68#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
69#[serde(rename_all = "snake_case")]
70pub struct MigrateMsg {}
71
72#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
73#[serde(rename_all = "snake_case")]
74pub enum QueryMsg {
75 Config {},
76 Borrower {
77 address: String,
78 },
79 Borrowers {
80 start_after: Option<String>,
81 limit: Option<u32>,
82 },
83}
84
85#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
87pub struct ConfigResponse {
88 pub owner: String,
89 pub collateral_token: String,
90 pub overseer_contract: String,
91 pub market_contract: String,
92 pub liquidation_contract: String,
93 pub collector_contract: String,
94}
95
96#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
98pub struct BorrowerResponse {
99 pub borrower: String,
100 pub balance: Uint256,
101 pub spendable: Uint256,
102}
103
104#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
106pub struct BorrowersResponse {
107 pub borrowers: Vec<BorrowerResponse>,
108}
109
110#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
111pub struct BAssetInfo {
112 pub name: String,
113 pub symbol: String,
114 pub decimals: u8,
115}