1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use {
crate::state::*,
anchor_lang::{prelude::*, solana_program::sysvar},
};
#[derive(Accounts)]
#[instruction()]
pub struct AdminResetHealth<'info> {
#[account(mut, address = config.admin)]
pub admin: Signer<'info>,
#[account(address = sysvar::clock::ID)]
pub clock: Sysvar<'info, Clock>,
#[account(
seeds = [SEED_CONFIG],
bump = config.bump,
owner = crate::ID,
)]
pub config: Account<'info, Config>,
#[account(
mut,
seeds = [SEED_HEALTH],
bump = health.bump,
owner = crate::ID,
)]
pub health: Account<'info, Health>,
}
pub fn handler(ctx: Context<AdminResetHealth>) -> ProgramResult {
let clock = &ctx.accounts.clock;
let health = &mut ctx.accounts.health;
health.target_time = clock.unix_timestamp;
health.real_time = clock.unix_timestamp;
Ok(())
}