cronos_pool/instructions/
rotate.rs

1use {crate::state::*, anchor_lang::prelude::*};
2
3#[derive(Accounts)]
4#[account(delegate: Pubkey)]
5pub struct Rotate<'info> {
6    #[account(seeds = [SEED_CONFIG], bump)]
7    pub config: Account<'info, Config>,
8
9    #[account(address = config.rotator)]
10    pub rotator: Signer<'info>,
11
12    #[account(mut, seeds = [SEED_POOL], bump)]
13    pub pool: Account<'info, Pool>,
14}
15
16pub fn handler(ctx: Context<Rotate>, delegate: Pubkey) -> Result<()> {
17    let config = &mut ctx.accounts.config;
18    let pool = &mut ctx.accounts.pool;
19
20    pool.rotate(config, delegate)?;
21
22    Ok(())
23}