pub fn utilization_rate(&self) -> Result<Rate, ProgramError> {
        let total_supply = self.total_supply()?;
        if total_supply == Decimal::zero() {
            return Ok(Rate::zero());
        }
        if self.borrowed_amount_wads.lt(&Decimal::one()) {
            return Ok(Rate::zero());
        }
        if self.borrowed_amount_wads.gt(&total_supply) {
            Ok(Rate::one())
        } else {
            self.borrowed_amount_wads.try_div(total_supply)?.try_into()
        }
    }
/// Calculate the liquidity utilization rate of the reserve

Calculate the liquidity utilization rate of the reserve
Calculate the liquidity utilization rate of the reserve
pub fn utilization_rate(&self) -> Result<Rate, ProgramError> {
        let total_supply = self.total_supply()?;
        if total_supply == Decimal::zero() {
            return Ok(Rate::zero());
        }
        if self.borrowed_amount_wads.lt(&Decimal::one()) {
            return Ok(Rate::zero());
        }
        if self.borrowed_amount_wads.gt(&total_supply) {
            Ok(Rate::one())
        } else {
            self.borrowed_amount_wads.try_div(total_supply)?.try_into()
        }
    }
pub fn utilization_rate ( & self ) -> Result < Rate , ProgramError > { let total_supply = self . total_supply ( ) ? ; if total_supply == Decimal :: zero ( ) { return Ok ( Rate :: zero ( ) ) ; } if self . borrowed_amount_wads . lt ( & Decimal :: one ( ) ) { return Ok ( Rate :: zero ( ) ) ; } if self . borrowed_amount_wads . gt ( & total_supply ) { Ok ( Rate :: one ( ) ) } else { self . borrowed_amount_wads . try_div ( total_supply ) ? . try_into ( ) } }
Calculate the liquidity utilization rate of the reserve
Calculate the liquidity utilization rate of the reserve
&self
&self