gmsol_store/events/
shift.rs1use anchor_lang::prelude::*;
2use borsh::BorshSerialize;
3
4use gmsol_utils::InitSpace;
5
6use crate::states::common::action::ActionState;
7
8use super::Event;
9
10#[event]
12#[cfg_attr(feature = "debug", derive(Debug))]
13#[derive(Clone, InitSpace)]
14pub struct ShiftRemoved {
15 pub id: u64,
17 pub ts: i64,
19 pub slot: u64,
21 pub store: Pubkey,
23 pub shift: Pubkey,
25 pub market_token: Pubkey,
27 pub owner: Pubkey,
29 pub state: ActionState,
31 #[max_len(32)]
33 pub reason: String,
34}
35
36impl ShiftRemoved {
37 pub(crate) fn new(
38 id: u64,
39 store: Pubkey,
40 shift: Pubkey,
41 market_token: Pubkey,
42 owner: Pubkey,
43 state: ActionState,
44 reason: impl ToString,
45 ) -> Result<Self> {
46 let clock = Clock::get()?;
47 Ok(Self {
48 id,
49 ts: clock.unix_timestamp,
50 slot: clock.slot,
51 store,
52 shift,
53 market_token,
54 owner,
55 state,
56 reason: reason.to_string(),
57 })
58 }
59}
60
61impl InitSpace for ShiftRemoved {
62 const INIT_SPACE: usize = <Self as Space>::INIT_SPACE;
63}
64
65impl Event for ShiftRemoved {}