use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_std::Uint256;
use cw20::Cw20ReceiveMsg;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct InstantiateMsg {
pub owner: String,
pub collateral_token: String,
pub overseer_contract: String,
pub market_contract: String,
pub liquidation_contract: String,
pub collector_contract: String,
pub max_deposit: Uint256,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Receive(Cw20ReceiveMsg),
UpdateConfig {
owner: Option<String>,
liquidation_contract: Option<String>,
collector_contract: Option<String>,
max_deposit: Option<Uint256>,
},
LockCollateral { borrower: String, amount: Uint256 },
UnlockCollateral { borrower: String, amount: Uint256 },
LiquidateCollateral {
liquidator: String,
borrower: String,
amount: Uint256,
},
WithdrawCollateral { amount: Option<Uint256> },
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Cw20HookMsg {
DepositCollateral {},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct MigrateMsg {}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Config {},
Borrower {
address: String,
},
Borrowers {
start_after: Option<String>,
limit: Option<u32>,
},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct ConfigResponse {
pub owner: String,
pub collateral_token: String,
pub overseer_contract: String,
pub market_contract: String,
pub liquidation_contract: String,
pub collector_contract: String,
pub max_deposit: Uint256,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct BorrowerResponse {
pub borrower: String,
pub balance: Uint256,
pub spendable: Uint256,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct BorrowersResponse {
pub borrowers: Vec<BorrowerResponse>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct BAssetInfo {
pub name: String,
pub symbol: String,
pub decimals: u8,
}