ore_api/state/
automation.rs1use steel::*;
2
3use crate::state::miner_pda;
4
5use super::OreAccount;
6
7#[repr(C)]
8#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
9pub struct Automation {
10 pub amount: u64,
12
13 pub authority: Pubkey,
15
16 pub balance: u64,
18
19 pub executor: Pubkey,
21
22 pub fee: u64,
24
25 pub strategy: u64,
27
28 pub mask: u64,
31}
32
33#[repr(u8)]
34#[derive(Clone, Copy, Debug, PartialEq, IntoPrimitive, TryFromPrimitive)]
35pub enum AutomationStrategy {
36 Random = 0,
37 Preferred = 1,
38}
39
40impl AutomationStrategy {
41 pub fn from_u64(value: u64) -> Self {
42 Self::try_from(value as u8).unwrap()
43 }
44}
45
46impl Automation {
47 pub fn pda(&self) -> (Pubkey, u8) {
48 miner_pda(self.authority)
49 }
50}
51
52account!(OreAccount, Automation);