clockwork_pool/instructions/
pool_rotate.rs1use {crate::state::*, anchor_lang::prelude::*};
2
3#[derive(Accounts)]
4pub struct PoolRotate<'info> {
5 #[account(seeds = [SEED_CONFIG], bump, has_one = pool_authority)]
6 pub config: Account<'info, Config>,
7
8 #[account(mut, seeds = [SEED_POOL, pool.name.as_bytes()], bump)]
9 pub pool: Account<'info, Pool>,
10
11 #[account()]
12 pub pool_authority: Signer<'info>,
13
14 #[account()]
15 pub worker: SystemAccount<'info>,
16}
17
18pub fn handler(ctx: Context<PoolRotate>) -> Result<()> {
19 let pool = &mut ctx.accounts.pool;
21 let worker = &ctx.accounts.worker;
22
23 pool.rotate(worker.key())?;
25
26 Ok(())
27}