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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
use anchor_lang::prelude::*;
#[account]
#[derive(Default)]
pub struct Reporter {
/// Community account, which this reporter belongs to
pub community: Pubkey,
/// Seed bump for PDA
pub bump: u8,
/// If this is true, reporter can't interact with the contract
pub is_frozen: bool,
/// Reporter account status
pub status: ReporterStatus,
/// Reporter's type
pub role: ReporterRole,
/// Reporter's wallet account
pub pubkey: Pubkey,
/// Short reporter description
pub name: [u8; 32],
/// Current deposited stake
pub stake: u64,
/// Reporter can unstake at this epoch (0 if unstaking hasn't been requested)
pub unlock_epoch: u64,
}
#[account(zero_copy)]
#[derive(Default, Debug)]
pub struct ReporterReward {
/// Reporter account to keep reward counter for
pub reporter: Pubkey,
/// Network that has the reward associated with
pub network: Pubkey,
/// Seed bump for PDA
pub bump: u8,
/// Number of unclaimed address report rewards
pub address_tracer_counter: u64,
/// Number of unclaimed address confirmation rewards
pub address_confirmation_counter: u64,
/// Number of unclaimed asset report rewards
pub asset_tracer_counter: u64,
/// Number of unclaimed asset confirmation rewards
pub asset_confirmation_counter: u64,
}
#[derive(Clone, PartialEq, AnchorDeserialize, AnchorSerialize)]
pub enum ReporterStatus {
/// Reporter is not active, but can activate after staking
Inactive,
/// Reporter is active and can report
Active,
/// Reporter has requested unstaking and can't report
Unstaking,
}
impl Default for ReporterStatus {
fn default() -> Self {
ReporterStatus::Inactive
}
}
#[derive(Clone, PartialEq, AnchorDeserialize, AnchorSerialize)]
pub enum ReporterRole {
/// Validator - can validate addresses
Validator = 0,
/// Tracer - can report and validate addresses
Tracer = 1,
/// Publisher - can report cases and addresses
Publisher = 2,
/// Authority - can report and modify cases and addresses
Authority = 3,
/// Appraiser - can update replication price
Appraiser = 4,
}
impl Default for ReporterRole {
fn default() -> Self {
ReporterRole::Validator
}
}