miclockwork_thread_program/
lib.rs1#[macro_use]
5extern crate version;
6
7pub mod errors;
8pub mod state;
9
10mod instructions;
11
12use anchor_lang::prelude::*;
13use miclockwork_utils::{
14 thread::{SerializableInstruction, Trigger},
15 CrateInfo,
16};
17use instructions::*;
18use state::*;
19
20declare_id!("CLoCKyJ6DXBJqqu2VWx9RLbgnwwR6BMHHuyasVmfMzBh");
21
22#[program]
24pub mod thread_program {
25 use super::*;
26
27 pub fn get_crate_info(ctx: Context<GetCrateInfo>) -> Result<CrateInfo> {
29 get_crate_info::handler(ctx)
30 }
31
32 pub fn thread_exec(ctx: Context<ThreadExec>) -> Result<()> {
34 thread_exec::handler(ctx)
35 }
36
37 pub fn thread_create(
39 ctx: Context<ThreadCreate>,
40 amount: u64,
41 id: Vec<u8>,
42 instructions: Vec<SerializableInstruction>,
43 trigger: Trigger,
44 ) -> Result<()> {
45 thread_create::handler(ctx, amount, id, instructions, trigger)
46 }
47
48 pub fn thread_delete(ctx: Context<ThreadDelete>) -> Result<()> {
50 thread_delete::handler(ctx)
51 }
52
53 pub fn thread_instruction_add(
55 ctx: Context<ThreadInstructionAdd>,
56 instruction: SerializableInstruction,
57 ) -> Result<()> {
58 thread_instruction_add::handler(ctx, instruction)
59 }
60
61 pub fn thread_instruction_remove(
63 ctx: Context<ThreadInstructionRemove>,
64 index: u64,
65 ) -> Result<()> {
66 thread_instruction_remove::handler(ctx, index)
67 }
68
69 pub fn thread_kickoff(ctx: Context<ThreadKickoff>) -> Result<()> {
71 thread_kickoff::handler(ctx)
72 }
73
74 pub fn thread_pause(ctx: Context<ThreadPause>) -> Result<()> {
76 thread_pause::handler(ctx)
77 }
78
79 pub fn thread_resume(ctx: Context<ThreadResume>) -> Result<()> {
81 thread_resume::handler(ctx)
82 }
83
84 pub fn thread_reset(ctx: Context<ThreadReset>) -> Result<()> {
86 thread_reset::handler(ctx)
87 }
88
89 pub fn thread_update(ctx: Context<ThreadUpdate>, settings: ThreadSettings) -> Result<()> {
91 thread_update::handler(ctx, settings)
92 }
93
94 pub fn thread_withdraw(ctx: Context<ThreadWithdraw>, amount: u64) -> Result<()> {
96 thread_withdraw::handler(ctx, amount)
97 }
98}