-
Notifications
You must be signed in to change notification settings - Fork 252
/
errors.rs
127 lines (100 loc) · 3.23 KB
/
errors.rs
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
use anchor_lang::prelude::*;
/// Do NOT reorder the errors in this enum. Tests are relying on error ordering.
/// Not great, but for some reason when ErrorCode is factored out into a lib,
/// test messages no longer print actual messages and print error codes instead.
///
/// The other alternative is to have a custom error type inside the common library
/// and to try to convert that -> ErrorCode -> ProgramError
/// Unfortunately I wasn't able to get that working, last leg is failing.
///
/// todo to revisit in v1
#[error_code]
pub enum ErrorCode {
// --------------------------------------- generic (0 - 19)
#[msg("failed to perform some math operation safely")]
ArithmeticError, //0x1770
#[msg("unknown instruction called")]
UnknownInstruction,
#[msg("invalid parameter passed")]
InvalidParameter,
#[msg("anchor serialization issue")]
AnchorSerializationIssue,
#[msg("two amounts that are supposed to be equal are not")]
AmountMismatch,
#[msg("account discriminator doesn't match")]
AccountDiscriminatorMismatch,
#[msg("bad ruleset passed")]
BadRuleset,
#[msg("bad metadata passed")]
BadMetadata,
Reserved8,
Reserved9,
Reserved10,
Reserved11,
Reserved12,
Reserved13,
Reserved14,
Reserved15,
Reserved16,
Reserved17,
Reserved18,
Reserved19,
// --------------------------------------- bank specific (20 - 39)
#[msg("vault is currently locked or frozen and cannot be accessed")]
VaultAccessSuspended, //0x1784
#[msg("vault doesnt't containt any gems")]
VaultIsEmpty,
#[msg("this gem is not present on any of the whitelists")]
NotWhitelisted,
#[msg("whitelist proof exists but for the wrong type")]
WrongWhitelistType,
#[msg("attempted transfer not allowed")]
TransferNotAllowed,
Reserved25,
Reserved26,
Reserved27,
Reserved28,
Reserved29,
Reserved30,
Reserved31,
Reserved32,
Reserved33,
Reserved34,
Reserved35,
Reserved36,
Reserved37,
Reserved38,
Reserved39,
// --------------------------------------- farm specific (40 - 59)
#[msg("passed in reward mint is not available for this farm")]
UnknownRewardMint, //0x1798
#[msg("the reward is locked and cannot be cancelled")]
RewardLocked, //1799
#[msg("can't unstake, minimum staking period has not passed yet")]
MinStakingNotPassed, //179A
#[msg("can't unstake, cooldown period has not passed yet")]
CooldownNotPassed,
Reserved44,
#[msg("reward has insufficient funding, please top up")]
RewardUnderfunded, //0x179D
#[msg("update authority passed doesnt match that stored in metadata")]
WrongUpdateAuthority,
#[msg("wrong metadata account, gem mint doesn't match")]
WrongMetadata,
#[msg("max farmer count exceeded")]
TooManyFarmersStaked, //0x17a0
#[msg("max gems exceeded")]
TooManyGemsStaked, //0x17a1
#[msg("max rarity points exceeded")]
TooManyRarityPointsStaked, //0x17a2
#[msg("unstaking fee lamports must be either 0 or greater than 890880")]
InvalidUnstakingFee, //0x17a3
Reserved52,
Reserved53,
Reserved54,
Reserved55,
Reserved56,
Reserved57,
Reserved58,
Reserved59,
}