1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use borsh::BorshDeserialize;

use solana_client::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;

use common::command::{CliConfig, ProcessResult};
use common::contract::instructions::update_fee_rate::new_update_fee_rate;
use common::contract::state::Clmmpool;
use common::utils::send::send_tx;


pub fn process_update_fee_rate(
    rpc_client: &RpcClient,
    config: &CliConfig,
    fee_tier: &Pubkey,
    clmmpool: &Pubkey,
) -> ProcessResult {
    let data = rpc_client.get_account_data(clmmpool).unwrap();

    let swap_account: Clmmpool = Clmmpool::try_from_slice(&data[8..]).unwrap();

    let ixs = [new_update_fee_rate(&swap_account.clmm_config, fee_tier, clmmpool, config.pubkey().unwrap())];

    let res = send_tx(rpc_client, config, &ixs)?;

    Ok("signers : ".to_owned() + res.to_string().as_str())
}