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