gpl_core/state/
reaction.rs

1use anchor_lang::prelude::*;
2
3use strum_macros::{AsRefStr, EnumString};
4
5#[account]
6pub struct Reaction {
7    // The profile that owns this reaction
8    pub from_profile: Pubkey,
9    // The post that this reaction is to
10    pub to_post: Pubkey,
11    pub reaction_type: ReactionType,
12}
13
14impl Reaction {
15    pub const LEN: usize = 8 + std::mem::size_of::<Self>();
16}
17
18// Probably better to use emoji codes instead of strings
19#[derive(
20    AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, PartialEq, AsRefStr, EnumString,
21)]
22pub enum ReactionType {
23    #[strum(ascii_case_insensitive)]
24    Like,
25    #[strum(ascii_case_insensitive)]
26    Dislike,
27    #[strum(ascii_case_insensitive)]
28    Love,
29    #[strum(ascii_case_insensitive)]
30    Haha,
31    #[strum(ascii_case_insensitive)]
32    Wow,
33    #[strum(ascii_case_insensitive)]
34    Sad,
35    #[strum(ascii_case_insensitive)]
36    Angry,
37}