diff --git a/token-lending/program/src/processor.rs b/token-lending/program/src/processor.rs index f27dd4b7f01..a9b05c904de 100644 --- a/token-lending/program/src/processor.rs +++ b/token-lending/program/src/processor.rs @@ -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}, @@ -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)?;