Borrow interest rates can be queried with GetBorrowRate
, GetBorrowRates
or GetAllBorrowRates
.
Lend interest rates can be queried with GetAllLendingRates
.
GetAllAssets
can be used to get each asset market state and the param internals for in-depth analysis.
Note: The borrow rate returns a "simple" borrow rate, quantified yearly. From this rate, the borrow annual percentage rate (APR) can be calculated as borrow_apr = e^(borrow_rate + 1) - 1
.
Query Messages
GetBorrowRate { .. }
RUST
pub enum QueryMsg {
/// Returns the borrow interest rate
#[returns(cosmwasm_std::Decimal256)]
GetBorrowRate { asset: AssetInfo },
}
GetBorrowRates { .. }
RUST
pub enum QueryMsg {
/// Returns multiple borrow interest rates
#[returns(neptune_common::asset::AssetMap<cosmwasm_std::Decimal256> )]
GetBorrowRates { assets: Vec<AssetInfo> },
}
GetAllBorrowRates { .. }
RUST
pub enum QueryMsg {
/// Returns multiple borrow interest rates
#[returns(neptune_common::asset::AssetMap<cosmwasm_std::Decimal256> )]
GetAllBorrowRates { start_after: Option<AssetInfo>, limit: Option<u32> },
}
GetAllLendingRates { .. }
RUST
pub enum QueryMsg {
/// Returns multiple lending interest rates
#[returns(neptune_common::asset::AssetMap<cosmwasm_std::Decimal256> )]
GetAllLendingRates { start_after: Option<AssetInfo>, limit: Option<u32> },
}
GetAllAssets { .. }
RUST
pub enum QueryMsg {
/// Returns the state for all whitelisted assets
#[returns(neptune_common::asset::AssetMap<Info> )]
GetAllAssets { start_after: Option<AssetInfo>, limit: Option<u32> },
}
Query Response
The return from the query may include an AssetMap
using Vec Key-Value pairs where the Keys are AssetInfo
as shown below in these Common Structures.
AssetMap
RUST
pub type AssetMap<T> = NeptuneMap<AssetInfo, T>;
pub struct NeptuneMap<K, V>(pub Vec<(K, V)>);
AssetInfo
RUST
pub enum AssetInfo {
Token { contract_addr: Addr },
NativeToken { denom: String },
}