Skip to main content

klend_interface/instructions/
admin.rs

1use solana_instruction::Instruction;
2use solana_pubkey::Pubkey;
3
4use crate::{discriminators, types::ReserveConfigCustomizationArgs, util::*, KLEND_PROGRAM_ID};
5
6// ---------------------------------------------------------------------------
7// clone_reserve_config
8// ---------------------------------------------------------------------------
9
10pub struct CloneReserveConfigAccounts {
11    pub signer: Pubkey,
12    pub target_lending_market: Pubkey,
13    pub source_reserve: Pubkey,
14    pub target_reserve: Pubkey,
15}
16
17pub fn clone_reserve_config(
18    accounts: CloneReserveConfigAccounts,
19    customizations: ReserveConfigCustomizationArgs,
20) -> Instruction {
21    use borsh::BorshSerialize;
22
23    let mut data = discriminators::CLONE_RESERVE_CONFIG.to_vec();
24    customizations.serialize(&mut data).unwrap();
25
26    Instruction {
27        program_id: KLEND_PROGRAM_ID,
28        accounts: vec![
29            signer(accounts.signer),
30            readonly(accounts.target_lending_market),
31            readonly(accounts.source_reserve),
32            writable(accounts.target_reserve),
33        ],
34        data,
35    }
36}