use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::tokens::TokensHuman;
use cosmwasm_std::{Decimal256, Uint256};
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct InstantiateMsg {
pub owner_addr: String,
pub oracle_contract: String,
pub market_contract: String,
pub liquidation_contract: String,
pub collector_contract: String,
pub stable_contract: String,
pub price_timeframe: u64,
}
#[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")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
UpdateConfig {
owner_addr: Option<String>,
oracle_contract: Option<String>,
liquidation_contract: Option<String>,
price_timeframe: Option<u64>,
},
Whitelist {
name: String, symbol: String, collateral_token: String, custody_contract: String, max_ltv: Decimal256, },
UpdateWhitelist {
collateral_token: String, custody_contract: Option<String>, max_ltv: Option<Decimal256>, },
LockCollateral {
collaterals: TokensHuman, },
UnlockCollateral {
collaterals: TokensHuman, },
LiquidateCollateral { borrower: String },
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Cw20HookMsg {
FundReserve {},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Config {},
Whitelist {
collateral_token: Option<String>,
start_after: Option<String>,
limit: Option<u32>,
},
Collaterals {
borrower: String,
},
AllCollaterals {
start_after: Option<String>,
limit: Option<u32>,
},
BorrowLimit {
borrower: String,
block_time: Option<u64>,
},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct ConfigResponse {
pub owner_addr: String,
pub oracle_contract: String,
pub market_contract: String,
pub liquidation_contract: String,
pub collector_contract: String,
pub stable_contract: String,
pub price_timeframe: u64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct WhitelistResponseElem {
pub name: String,
pub symbol: String,
pub max_ltv: Decimal256,
pub custody_contract: String,
pub collateral_token: String,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct WhitelistResponse {
pub elems: Vec<WhitelistResponseElem>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct CollateralsResponse {
pub borrower: String,
pub collaterals: TokensHuman, }
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct AllCollateralsResponse {
pub all_collaterals: Vec<CollateralsResponse>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct BorrowLimitResponse {
pub borrower: String,
pub borrow_limit: Uint256,
}