Common Structures
Offered below are some common structures used in the Neptune DeFi Bank.
Cw20HookMsg
pub enum Cw20HookMsg {
Lend {},
Redeem {},
Return { account_index: u8 },
DepositCollateral { account_index: u8 },
}
RUST
PriceInfo
pub struct PriceInfo {
pub price: Decimal256,
pub time_last_updated: Timestamp,
}
RUST
AssetMap
pub type AssetMap<T> = NeptuneMap<AssetInfo, T>;
pub struct NeptuneMap<K, V>(pub Vec<(K, V)>);
RUST
AssetInfo
pub enum AssetInfo {
Token { contract_addr: Addr },
NativeToken { denom: String },
}
RUST
LiquidationOperation
pub struct LiquidationOperation {
pub account_addr: Addr,
pub account_index: u8,
pub ask_assets: AssetMap<LiquidationAmounts>,
pub offer_assets: AssetMap<Uint256>,
}
RUST
LiquidationAmounts
pub struct LiquidationAmounts {
pub amount: Uint256,
pub min_discount: Decimal256,
}
RUST
StateMarketInfo
pub struct StateMarketInfo {
pub time_last_distributed_interest: Timestamp,
pub utilization_accumulator: Decimal256,
pub lending_principal: Uint256,
pub debt_pool: Pool,
pub market_asset_details: MarketAssetDetails,
}
RUST
StateCollateralInfo
pub struct StateCollateralInfo {
pub collateral_details: CollateralDetails,
pub collateral_pool: Pool,
}
RUST
Account
pub struct Account {
pub last_tx_height: u64,
pub debt_pool_accounts: AssetMap<PoolAccount>,
pub collateral_pool_accounts: AssetMap<PoolAccount>,
}
RUST
Pool
pub struct Pool {
pub balance: Uint256,
pub shares: Uint256,
}
RUST
PoolAccount
pub struct PoolAccount {
pub principal: Uint256,
pub shares: Uint256,
}
RUST
MarketAssetDetails
pub struct MarketAssetDetails {
pub receipt_addr: Addr,
pub borrow_halt_utilization: Decimal256,
pub interest_fee: Decimal256,
pub borrow_cap: Option<Uint256>,
pub enabled: bool,
}
RUST
CollateralDetails
pub struct CollateralDetails {
pub collateral_type: AssetType,
pub liquidation_ltv: Decimal256,
pub allowable_ltv: Decimal256,
pub max_discount: Decimal256,
pub min_discount: Decimal256,
pub collateral_cap: Option<Uint256>,
pub enabled: bool,
}
RUST