pub fn query_collateral(
    querier: &QuerierWrapper,
    collateral_oracle: Addr,
    asset: String,
    check_expire: bool,
) -> StdResult<(Decimal, Decimal, bool)> {
    let timeframe: Option<u64> = if check_expire {
        Some(PRICE_EXPIRE_TIME)
    } else {
        None
    };
    let res: CollateralPriceResponse = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
        contract_addr: collateral_oracle.to_string(),
        msg: to_binary(&CollateralOracleQueryMsg::CollateralPrice { asset, timeframe })?,
    }))?;

    Ok((res.rate, res.multiplier, res.is_revoked))
}
// queries the collateral oracle to get the asset rate and multiplier
queries the collateral oracle to get the asset rate and multiplier
queries the collateral oracle to get the asset rate and multiplier
pub fn query_collateral(
    querier: &QuerierWrapper,
    collateral_oracle: Addr,
    asset: String,
    check_expire: bool,
) -> StdResult<(Decimal, Decimal, bool)> {
    let timeframe: Option<u64> = if check_expire {
        Some(PRICE_EXPIRE_TIME)
    } else {
        None
    };
    let res: CollateralPriceResponse = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
        contract_addr: collateral_oracle.to_string(),
        msg: to_binary(&CollateralOracleQueryMsg::CollateralPrice { asset, timeframe })?,
    }))?;
    Ok((res.rate, res.multiplier, res.is_revoked))
}
pub fn query_collateral ( querier : & QuerierWrapper , collateral_oracle : Addr , asset : String , check_expire : bool , ) -> StdResult < ( Decimal , Decimal , bool ) > { let timeframe : Option < u64 > = if check_expire { Some ( PRICE_EXPIRE_TIME ) } else { None } ; let res : CollateralPriceResponse = querier . query ( & QueryRequest :: Wasm ( WasmQuery :: Smart { contract_addr : collateral_oracle . to_string ( ) , msg : to_binary ( & CollateralOracleQueryMsg :: CollateralPrice { asset , timeframe } ) ? , } ) ) ? ; Ok ( ( res . rate , res . multiplier , res . is_revoked ) ) }
queries the collateral oracle to get the asset rate and multiplier
queries the collateral oracle to get the asset rate and multiplier
querier
&QuerierWrapper
collateral_oracle
Addr
asset
String
check_expire
bool
querier
&QuerierWrapper
collateral_oracle
Addr
asset
String
check_expire
bool