Skip to main content

sss_token/
errors.rs

1use anchor_lang::prelude::*;
2
3#[error_code]
4pub enum SssError {
5    // Access control
6    #[msg("Unauthorized: caller does not have the required role")]
7    Unauthorized,
8    #[msg("Invalid authority for this operation")]
9    InvalidAuthority,
10
11    // Operational
12    #[msg("Program is currently paused")]
13    ProgramPaused,
14    #[msg("Program is not paused")]
15    ProgramNotPaused,
16
17    // Minting
18    #[msg("Minter is not active")]
19    MinterNotActive,
20    #[msg("Mint amount exceeds minter quota")]
21    MintQuotaExceeded,
22    #[msg("Mint amount must be greater than zero")]
23    MintAmountZero,
24
25    // Burn
26    #[msg("Burn amount must be greater than zero")]
27    BurnAmountZero,
28    #[msg("Insufficient balance for burn")]
29    InsufficientBalance,
30
31    // Feature gating
32    #[msg("Feature not enabled for this stablecoin preset")]
33    FeatureNotEnabled,
34    #[msg("Blacklist feature requires SSS-2 or higher preset")]
35    BlacklistNotEnabled,
36    #[msg("Transfer hook feature requires SSS-2 or higher preset")]
37    TransferHookNotEnabled,
38    #[msg("Confidential transfers require SSS-3 preset")]
39    ConfidentialTransfersNotEnabled,
40    #[msg("Custom preset requires all four feature flags to be specified")]
41    CustomFlagsMissing,
42
43    // Blacklist (SSS-2)
44    #[msg("Cannot blacklist the master authority")]
45    CannotBlacklistAuthority,
46    #[msg("Cannot mint to a blacklisted recipient")]
47    RecipientBlacklisted,
48
49    // Validation
50    #[msg("Name exceeds maximum length of 32 characters")]
51    NameTooLong,
52    #[msg("Symbol exceeds maximum length of 10 characters")]
53    SymbolTooLong,
54    #[msg("URI exceeds maximum length of 200 characters")]
55    UriTooLong,
56    #[msg("Reason exceeds maximum length of 128 characters")]
57    ReasonTooLong,
58    #[msg("Details exceeds maximum length of 256 characters")]
59    DetailsTooLong,
60    #[msg("Invalid decimals value")]
61    InvalidDecimals,
62
63    // Authority
64    #[msg("Cannot transfer authority to the same address")]
65    SameAuthority,
66    #[msg("New authority cannot be the zero address")]
67    ZeroAuthority,
68
69    // Seize
70    #[msg("Seize amount must be greater than zero")]
71    SeizeAmountZero,
72    #[msg("Source and destination accounts must be different")]
73    SeizeSameAccount,
74
75    // Reserve attestation
76    #[msg("Reserve attestation requires reserves >= outstanding")]
77    InsufficientReserves,
78
79    // Transfer hook
80    #[msg("Invalid transfer hook program ID")]
81    InvalidHookProgram,
82
83    // Arithmetic
84    #[msg("Arithmetic overflow")]
85    Overflow,
86}