1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
use anchor_lang::prelude::*;
use anchor_lang::AccountDeserialize;

pub const SEED_HEALTH: &[u8] = b"health";

#[account]
#[derive(Debug)]
pub struct Health {
    pub real_time: u64,
    pub target_time: u64,
    pub bump: u8,
}

impl From<Vec<u8>> for Health {
    fn from(data: Vec<u8>) -> Self {
        Health::try_deserialize(&mut data.as_slice()).unwrap()
    }
}