use cosmwasm_std::Binary;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_std::{Decimal256, Uint256};
use cw20::Cw20ReceiveMsg;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct InstantiateMsg {
pub owner_addr: String,
pub stable_code_id: u64,
pub base_borrow_fee: Decimal256,
pub fee_increase_factor: Decimal256,
pub flash_mint_fee: Option<Decimal256>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Receive(Cw20ReceiveMsg),
RegisterContracts {
overseer_contract: String,
collector_contract: String,
liquidation_contract: String,
oracle_contract: String,
},
UpdateConfig {
owner_addr: Option<String>,
liquidation_contract: Option<String>,
base_borrow_fee: Option<Decimal256>,
fee_increase_factor: Option<Decimal256>,
flash_mint_fee: Option<Decimal256>,
oracle_addr: Option<String>,
},
BorrowStable {
borrow_amount: Uint256,
to: Option<String>,
},
FlashMint {
amount: Uint256,
msg_callback: Binary,
},
PrivateFlashEnd {
flash_minter: String,
burn_amount: Uint256,
fee_amount: Uint256,
},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Cw20HookMsg {
RepayStable {},
RepayStableFromLiquidation {
borrower: String,
},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Config {},
State {},
BorrowerInfo {
borrower: String,
},
BorrowerInfos {
start_after: Option<String>,
limit: Option<u32>,
},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct ConfigResponse {
pub owner_addr: String,
pub stable_contract: String,
pub overseer_contract: String,
pub collector_contract: String,
pub liquidation_contract: String,
pub oracle_contract: String,
pub flash_mint_fee: Option<Decimal256>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct StateResponse {
pub total_liabilities: Decimal256,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct BorrowerInfoResponse {
pub borrower: String,
pub loan_amount: Uint256,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct BorrowerInfosResponse {
pub borrower_infos: Vec<BorrowerInfoResponse>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct MigrateMsg {}