1use cosmwasm_std::Binary;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5use cosmwasm_std::{Decimal256, Uint256};
6use cw20::Cw20ReceiveMsg;
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 stable_code_id: u64,
14 pub base_borrow_fee: Decimal256,
16 pub fee_increase_factor: Decimal256,
18 pub flash_mint_fee: Option<Decimal256>,
20}
21
22#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
23#[serde(rename_all = "snake_case")]
24pub enum ExecuteMsg {
25 Receive(Cw20ReceiveMsg),
26
27 RegisterContracts {
32 overseer_contract: String,
33 collector_contract: String,
36 liquidation_contract: String,
38
39 oracle_contract: String,
40 },
41
42 UpdateConfig {
44 owner_addr: Option<String>,
45 liquidation_contract: Option<String>,
46 base_borrow_fee: Option<Decimal256>,
47 fee_increase_factor: Option<Decimal256>,
48 flash_mint_fee: Option<Decimal256>,
49 oracle_addr: Option<String>,
50 },
51
52 BorrowStable {
54 borrow_amount: Uint256,
55 to: Option<String>,
56 },
57
58 FlashMint {
60 amount: Uint256,
61 msg_callback: Binary,
62 },
63
64 PrivateFlashEnd {
66 flash_minter: String,
67 burn_amount: Uint256,
68 fee_amount: Uint256,
69 },
70}
71
72#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
73#[serde(rename_all = "snake_case")]
74pub enum Cw20HookMsg {
75 RepayStable {},
78 RepayStableFromLiquidation {
79 borrower: String,
80 },
81}
82
83#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
84#[serde(rename_all = "snake_case")]
85pub enum QueryMsg {
86 Config {},
87 State {},
88 BorrowerInfo {
89 borrower: String,
90 },
91 BorrowerInfos {
92 start_after: Option<String>,
93 limit: Option<u32>,
94 },
95}
96
97#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
99pub struct ConfigResponse {
100 pub owner_addr: String,
101 pub stable_contract: String,
102 pub overseer_contract: String,
103 pub collector_contract: String,
104 pub liquidation_contract: String,
105 pub oracle_contract: String,
106 pub flash_mint_fee: Option<Decimal256>,
107}
108
109#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
111pub struct StateResponse {
112 pub total_liabilities: Decimal256,
113}
114
115#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
117pub struct BorrowerInfoResponse {
118 pub borrower: String,
119 pub loan_amount: Uint256,
120}
121
122#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
124pub struct BorrowerInfosResponse {
125 pub borrower_infos: Vec<BorrowerInfoResponse>,
126}
127
128#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
129#[serde(rename_all = "snake_case")]
130pub struct MigrateMsg {}