fn exchange_rate(
        &self,
        total_liquidity: Decimal,
    ) -> Result<CollateralExchangeRate, ProgramError> {
        let rate = if self.mint_total_supply == 0 || total_liquidity == Decimal::zero() {
            Rate::from_scaled_val(INITIAL_COLLATERAL_RATE)
        } else {
            let collateral_supply = Decimal::from(self.mint_total_supply);
            Rate::try_from(collateral_supply.try_div(total_liquidity)?)?
        };

        Ok(CollateralExchangeRate(rate))
    }
/// Return the current collateral exchange rate.
Return the current collateral exchange rate.
Return the current collateral exchange rate .
fn exchange_rate(
        &self,
        total_liquidity: Decimal,
    ) -> Result<CollateralExchangeRate, ProgramError> {
        let rate = if self.mint_total_supply == 0 || total_liquidity == Decimal::zero() {
            Rate::from_scaled_val(INITIAL_COLLATERAL_RATE)
        } else {
            let collateral_supply = Decimal::from(self.mint_total_supply);
            Rate::try_from(collateral_supply.try_div(total_liquidity)?)?
        };
        Ok(CollateralExchangeRate(rate))
    }
fn exchange_rate ( & self , total_liquidity : Decimal , ) -> Result < CollateralExchangeRate , ProgramError > { let rate = if self . mint_total_supply == 0 || total_liquidity == Decimal :: zero ( ) { Rate :: from_scaled_val ( INITIAL_COLLATERAL_RATE ) } else { let collateral_supply = Decimal :: from ( self . mint_total_supply ) ; Rate :: try_from ( collateral_supply . try_div ( total_liquidity ) ? ) ? } ; Ok ( CollateralExchangeRate ( rate ) ) }
Return the current collateral exchange rate.
Return the current collateral exchange rate .
&self
total_liquidity
Decimal