sablier_network_program/jobs/increment_epoch/
job.rs

1use anchor_lang::prelude::*;
2use sablier_utils::thread::ThreadResponse;
3
4use crate::{constants::*, state::*};
5
6#[derive(Accounts)]
7pub struct EpochCutover<'info> {
8    #[account(address = Config::pubkey())]
9    pub config: AccountLoader<'info, Config>,
10
11    #[account(
12        mut,
13        seeds = [SEED_REGISTRY],
14        bump,
15    )]
16    pub registry: Account<'info, Registry>,
17
18    #[account(address = config.load()?.epoch_thread)]
19    pub thread: Signer<'info>,
20}
21
22pub fn handler(ctx: Context<EpochCutover>) -> Result<ThreadResponse> {
23    let registry = &mut ctx.accounts.registry;
24    registry.current_epoch += 1;
25    registry.locked = false;
26
27    Ok(ThreadResponse {
28        close_to: None,
29        dynamic_instruction: None,
30        trigger: None,
31    })
32}