diff --git a/programs/marginfi/src/state/marginfi_account.rs b/programs/marginfi/src/state/marginfi_account.rs index 4f67d168..978612c7 100644 --- a/programs/marginfi/src/state/marginfi_account.rs +++ b/programs/marginfi/src/state/marginfi_account.rs @@ -260,8 +260,7 @@ impl<'info> BankAccountWithPriceFeed<'_, 'info> { requirement_type: RequirementType, bank: &'a Bank, ) -> MarginfiResult { - let risk_tier: RiskTier = bank.config.risk_tier.into(); - match risk_tier { + match bank.config.risk_tier { RiskTier::Collateral => { let price_feed = self.try_get_price_feed(); @@ -688,14 +687,13 @@ impl<'info> RiskEngine<'_, 'info> { let is_in_isolated_risk_tier = balances_with_liablities.clone().any(|a| { // SAFETY: We are shortening 'info -> 'a let shorter_bank: &'a AccountInfo<'a> = unsafe { core::mem::transmute(&a.bank) }; - let risk_tier: RiskTier = AccountLoader::::try_from(shorter_bank) + AccountLoader::::try_from(shorter_bank) .unwrap() .load() .unwrap() .config .risk_tier - .into(); - risk_tier == RiskTier::Isolated + == RiskTier::Isolated }); check!( diff --git a/programs/marginfi/src/state/marginfi_group.rs b/programs/marginfi/src/state/marginfi_group.rs index 56f055e7..39e3ec8f 100644 --- a/programs/marginfi/src/state/marginfi_group.rs +++ b/programs/marginfi/src/state/marginfi_group.rs @@ -941,14 +941,14 @@ impl Display for BankOperationalState { #[repr(u8)] #[derive(Copy, Clone, Debug, AnchorSerialize, AnchorDeserialize, PartialEq, Eq)] pub enum RiskTier { - Collateral = 0, + Collateral, /// ## Isolated Risk /// Assets in this trance can be borrowed only in isolation. /// They can't be borrowed together with other assets. /// /// For example, if users has USDC, and wants to borrow XYZ which is isolated, /// they can't borrow XYZ together with SOL, only XYZ alone. - Isolated = 1, + Isolated, } #[repr(C)] @@ -1178,8 +1178,7 @@ impl BankConfig { self.interest_rate_config.validate()?; - let risk_tier: RiskTier = self.risk_tier.into(); - if risk_tier == RiskTier::Isolated { + if self.risk_tier == RiskTier::Isolated { check!(asset_init_w == I80F48::ZERO, MarginfiError::InvalidConfig); check!(asset_maint_w == I80F48::ZERO, MarginfiError::InvalidConfig); }