1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use {crate::state::*, anchor_lang::prelude::*};

#[derive(Accounts)]
#[account(delegate: Pubkey)]
pub struct Cycle<'info> {
    #[account(seeds = [SEED_CONFIG], bump)]
    pub config: Account<'info, Config>,

    #[account(address = config.cycler)]
    pub cycler: Signer<'info>,

    #[account(mut, seeds = [SEED_POOL], bump)]
    pub pool: Account<'info, Pool>,
}

pub fn handler(ctx: Context<Cycle>, delegate: Pubkey) -> Result<()> {
    let config = &mut ctx.accounts.config;
    let pool = &mut ctx.accounts.pool;

    pool.cycle(config, delegate)?;

    Ok(())
}