kujira_ghost/market/
execute.rs

1use cosmwasm_schema::cw_serde;
2use cosmwasm_std::{Addr, Decimal, Uint128};
3use kujira_std::CallbackMsg;
4
5#[cw_serde]
6pub enum ExecuteMsg {
7    /// Deposit a collateral asset into the custody contract.
8    Deposit(DepositMsg),
9    /// Withdraw a collateral asset from the custody contract.
10    Withdraw(WithdrawMsg),
11    /// Borrow the specified borrowable asset from the vault.
12    Borrow(BorrowMsg),
13    /// Repay a borrow.
14    Repay(RepayMsg),
15    /// Liquidate a position.
16    Liquidate(LiquidateMsg),
17    /// Self-Liquidate a position.
18    SelfLiquidate { amount: Option<Uint128> },
19    /// Callback entrypoint, only callable by other, permissioned contracts.
20    Callback(CallbackMsg),
21    /// Update contract config. Only callable by contract admin.
22    UpdateConfig(ConfigUpdate),
23}
24
25#[cw_serde]
26pub enum CallbackType {
27    /// Callback for a deposit.
28    BorrowCallback {
29        receiver: Addr,
30        added_debt_shares: Uint128,
31        expected_borrow_return: Uint128,
32    },
33    /// Callback for a liquidation.
34    LiquidateCallback { position_holder: Addr },
35}
36
37#[cw_serde]
38pub struct DepositMsg {
39    /// You can deposit assets on behalf of another address.
40    /// If None, the sender is used.
41    pub position_holder: Option<Addr>,
42}
43
44#[cw_serde]
45pub struct WithdrawMsg {
46    pub amount: Uint128,
47    pub withdraw_to: Option<Addr>,
48}
49
50#[cw_serde]
51pub struct BorrowMsg {
52    pub amount: Uint128,
53}
54
55#[cw_serde]
56pub struct RepayMsg {
57    /// You can repay a borrow on behalf of another address.
58    /// If None, the sender is used.
59    pub position_holder: Option<Addr>,
60}
61
62#[cw_serde]
63pub struct LiquidateMsg {
64    pub position_holder: Addr,
65}
66
67#[cw_serde]
68pub struct ConfigUpdate {
69    pub owner: Option<Addr>,
70    pub orca_addr: Option<Addr>,
71    pub collateral_oracle_denom: Option<String>,
72    pub collateral_decimals: Option<u8>,
73    pub max_ltv: Option<Decimal>,
74    pub full_liquidation_threshold: Option<Uint128>,
75    pub partial_liquidation_target: Option<Decimal>,
76    pub borrow_fee: Option<Decimal>,
77}