Skip to content

Commit

Permalink
lint: revert obsolete changes
Browse files Browse the repository at this point in the history
  • Loading branch information
losman0s committed Aug 21, 2024
1 parent b2cbfb1 commit afa6d48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 3 additions & 5 deletions programs/marginfi/src/state/marginfi_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ impl<'info> BankAccountWithPriceFeed<'_, 'info> {
requirement_type: RequirementType,
bank: &'a Bank,
) -> MarginfiResult<I80F48> {
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();

Expand Down Expand Up @@ -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::<Bank>::try_from(shorter_bank)
AccountLoader::<Bank>::try_from(shorter_bank)
.unwrap()
.load()
.unwrap()
.config
.risk_tier
.into();
risk_tier == RiskTier::Isolated
== RiskTier::Isolated
});

check!(
Expand Down
7 changes: 3 additions & 4 deletions programs/marginfi/src/state/marginfi_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit afa6d48

Please sign in to comment.