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
28
29
30
31
32
33
34
35
use common::contract::state::Clmmpool;
use solana_client::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;

use common::command::{CliConfig, ProcessResult};
use common::contract::instructions::initialize_rewarder::new_initialize_rewarder;
use common::utils::send::send_tx;

pub fn process(
    rpc_client: &RpcClient,
    config: &mut CliConfig,
    clmmpool: Pubkey,
    rewarder_token_mint: Pubkey,
    rewarder_index: u8,
    mint_wrapper: Pubkey,
    minter: Pubkey,
) -> ProcessResult {
    let rewarder_authority_pubkey = config.pubkey().unwrap();
    let clmmpool_info = Clmmpool::get_info(rpc_client, &clmmpool);

    let ixs = [new_initialize_rewarder(
        clmmpool_info.clmm_config,
        clmmpool,
        rewarder_authority_pubkey,
        rewarder_token_mint,
        rewarder_index,
        mint_wrapper,
        minter,
        config.pubkey().unwrap(),
    )];

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

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