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("Allowlist reason exceeds maximum length of 64 characters")]
59    AllowlistReasonTooLong,
60    #[msg("Details exceeds maximum length of 256 characters")]
61    DetailsTooLong,
62    #[msg("Invalid decimals value")]
63    InvalidDecimals,
64
65    // Authority
66    #[msg("Cannot transfer authority to the same address")]
67    SameAuthority,
68    #[msg("New authority cannot be the zero address")]
69    ZeroAuthority,
70    #[msg("No pending authority nomination exists")]
71    NoPendingAuthority,
72    #[msg("Signer is not the pending authority")]
73    NotPendingAuthority,
74
75    // Seize
76    #[msg("Seize amount must be greater than zero")]
77    SeizeAmountZero,
78    #[msg("Source and destination accounts must be different")]
79    SeizeSameAccount,
80
81    // Reserve attestation
82    #[msg("Reserve attestation requires reserves >= outstanding")]
83    InsufficientReserves,
84
85    // Transfer hook
86    #[msg("Invalid transfer hook program ID")]
87    InvalidHookProgram,
88
89    // Allowlist
90    #[msg("Allowlist entry already exists")]
91    AllowlistEntryExists,
92    #[msg("Allowlist entry not found")]
93    AllowlistEntryNotFound,
94
95    // Supply cap
96    #[msg("Mint would exceed the configured supply cap")]
97    SupplyCapExceeded,
98
99    // Arithmetic
100    #[msg("Arithmetic overflow")]
101    Overflow,
102}