Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
0xripleys committed Sep 19, 2023
1 parent 2150ff5 commit 5e73830
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions token-lending/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,20 @@ fn process_set_lending_market_owner_and_config(
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let lending_market_info = next_account_info(account_info_iter)?;
let signer_info = next_account_info(account_info_iter)?;
let market_change_authority_info = next_account_info(account_info_iter)?;

let mut lending_market = LendingMarket::unpack(&lending_market_info.data.borrow())?;
if lending_market_info.owner != program_id {
msg!("Lending market provided is not owned by the lending program");
return Err(LendingError::InvalidAccountOwner.into());
}

if signer_info.key == &lending_market.owner {
if !market_change_authority_info.is_signer {
msg!("Lending market owner or risk authority provided must be a signer");
return Err(LendingError::InvalidSigner.into());
}

if market_change_authority_info.key == &lending_market.owner {
lending_market.owner = new_owner;
lending_market.risk_authority = risk_authority;

Expand All @@ -256,7 +261,7 @@ fn process_set_lending_market_owner_and_config(
}

lending_market.whitelisted_liquidator = whitelisted_liquidator;
} else if signer_info.key == &lending_market.risk_authority {
} else if market_change_authority_info.key == &lending_market.risk_authority {
if rate_limiter_config != lending_market.rate_limiter.config {
lending_market.rate_limiter = RateLimiter::new(rate_limiter_config, Clock::get()?.slot);
}
Expand All @@ -265,11 +270,6 @@ fn process_set_lending_market_owner_and_config(
return Err(LendingError::InvalidMarketOwner.into());
}

if !signer_info.is_signer {
msg!("Lending market owner or risk authority provided must be a signer");
return Err(LendingError::InvalidSigner.into());
}

LendingMarket::pack(lending_market, &mut lending_market_info.data.borrow_mut())?;

Ok(())
Expand Down

0 comments on commit 5e73830

Please sign in to comment.