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