Skip to content

Commit

Permalink
fixes2
Browse files Browse the repository at this point in the history
  • Loading branch information
nope-finance committed Sep 26, 2024
1 parent 8620038 commit c9f2bdf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions token-lending/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3204,6 +3204,7 @@ pub fn process_donate_to_reserve(
let lending_market_info = next_account_info(account_info_iter)?;
let user_transfer_authority_info = next_account_info(account_info_iter)?;
let token_program_id = next_account_info(account_info_iter)?;
let clock = &Clock::get()?;

let lending_market = LendingMarket::unpack(&lending_market_info.data.borrow())?;
if lending_market_info.owner != program_id {
Expand Down Expand Up @@ -3231,6 +3232,8 @@ pub fn process_donate_to_reserve(
return Err(LendingError::InvalidAccountInput.into());
}

_refresh_reserve_interest(program_id, reserve_info, clock)?;

reserve.liquidity.donate(liquidity_amount)?;
spl_token_transfer(TokenTransferParams {
source: source_liquidity_info.clone(),
Expand All @@ -3241,6 +3244,9 @@ pub fn process_donate_to_reserve(
token_program: token_program_id.clone(),
})?;

reserve.last_update.mark_stale();
Reserve::pack(*reserve, &mut reserve_info.data.borrow_mut())?;

Ok(())
}

Expand Down

0 comments on commit c9f2bdf

Please sign in to comment.