Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nope-finance committed Oct 16, 2024
1 parent 6f5a427 commit 869d856
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions token-lending/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use solana_program::{
program::{invoke, invoke_signed},
program_error::ProgramError,
program_pack::{IsInitialized, Pack},
pubkey,
pubkey::Pubkey,
system_instruction::create_account,
sysvar::instructions::{load_current_index_checked, load_instruction_at_checked},
Expand Down Expand Up @@ -3232,6 +3233,17 @@ pub fn process_donate_to_reserve(
return Err(LendingError::InvalidAccountInput.into());
}

if &reserve.liquidity.supply_pubkey == source_liquidity_info.key {
msg!("Reserve liquidity supply cannot be used as the source liquidity provided");
return Err(LendingError::InvalidAccountInput.into());
}

#[cfg(not(feature = "test-bpf"))]
if *reserve_info.key != pubkey!("6LRNkS4Aq6VZ9Np36o7RDZ9aztWCePekMgiFgUNDhXXN") {
msg!("Donate function is currently limited to JUP pool usdc");
return Err(LendingError::InvalidAccountInput.into());
}

_refresh_reserve_interest(program_id, reserve_info, clock)?;

reserve.liquidity.donate(liquidity_amount)?;
Expand Down

0 comments on commit 869d856

Please sign in to comment.