1use steel::*;
2
3#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
4#[repr(u32)]
5pub enum EscrowError {
6 #[error("The authority is invalid")]
8 InvalidAuthority = 0,
9 #[error("The authority is unchanged")]
10 AuthorityUnchanged = 1,
11 #[error("Only the authority can perform this action")]
12 Unauthorized = 2,
13 #[error("Authority transfer delay period has not elapsed")]
14 AuthorityTransferTooEarly = 3,
15
16 #[error("Payment is not in the correct state for this operation")]
18 InvalidPaymentState = 10,
19 #[error("Payment has already expired")]
20 PaymentExpired = 11,
21 #[error("Payment is not funded")]
22 PaymentNotFunded = 12,
23
24 #[error("Escrow is paused")]
26 EscrowPaused = 20,
27 #[error("Escrow has non-zero balance")]
28 EscrowHasBalance = 21,
29 #[error("Escrow has non-zero fee balance")]
30 EscrowHasFeeBalance = 22,
31 #[error("Invalid escrow settings")]
32 InvalidEscrowSettings = 23,
33 #[error("Fee basis points too high")]
34 FeeTooHigh = 24,
35 #[error("Minimum payment amount must be greater than zero")]
36 InvalidMinPaymentAmount = 25,
37 #[error("Maximum payment amount must be greater than minimum")]
38 InvalidMaxPaymentAmount = 26,
39
40 #[error("Amount exceeds maximum payment limit")]
42 AmountExceedsLimit = 30,
43 #[error("Amount below minimum payment limit")]
44 AmountBelowLimit = 31,
45 #[error("Insufficient funds")]
46 InsufficientFunds = 32,
47 #[error("Insufficient storage balance for SOL operations")]
48 InsufficientStorageBalance = 33,
49 #[error("Payout would be zero after fees and oracle tip")]
50 ZeroPayout = 34,
51
52 #[error("Invalid TTL extension")]
54 InvalidTTLExtension = 40,
55 #[error("TTL extension too large")]
56 TTLExtensionTooLarge = 41,
57 #[error("Payment cannot be canceled after expiration")]
58 CannotCancelExpiredPayment = 42,
59 #[error("Cannot refund a fulfilled payment")]
60 CannotRefundFulfilledPayment = 43,
61 #[error("Cannot refund a payment after delivery is submitted")]
62 CannotRefundDeliveredPayment = 44,
63 #[error("Cannot refund a delivered expired payment")]
64 CannotRefundDeliveredExpiredPayment = 45,
65 #[error("Refund cooldown period is still active")]
66 RefundCooldownPeriodActive = 46,
67 #[error("Cannot release an undelivered expired payment")]
68 CannotReleaseUndeliveredExpiredPayment = 47,
69 #[error("Cannot confirm oracle before delivery is submitted")]
70 DeliveryNotSubmitted = 48,
71 #[error("Delivery submitted too late: oracle needs minimum evaluation window before expiry")]
72 DeliveryTooLateForOracle = 49,
73
74 #[error("Invalid account provided")]
76 InvalidAccount = 50,
77 #[error("Account is not writable")]
78 AccountNotWritable = 51,
79 #[error("Account is not signer")]
80 AccountNotSigner = 52,
81 #[error("Account is not empty")]
82 AccountNotEmpty = 53,
83 #[error("Account is empty")]
84 AccountEmpty = 54,
85
86 #[error("Invalid token account")]
88 InvalidTokenAccount = 60,
89 #[error("Token transfer failed")]
90 TokenTransferFailed = 61,
91 #[error("Token account close failed")]
92 TokenAccountCloseFailed = 62,
93
94 #[error("Invalid program ID")]
96 InvalidProgramId = 70,
97 #[error("Invalid instruction data")]
98 InvalidInstructionData = 71,
99 #[error("Account not found")]
100 AccountNotFound = 72,
101 #[error("Not enough account keys")]
102 NotEnoughAccountKeys = 73,
103 #[error("Missing required field")]
104 MissingRequiredField = 74,
105 #[error("Cannot close active payment")]
106 CannotCloseActivePayment = 75,
107 #[error("Too early to close payment")]
108 TooEarlyToClose = 76,
109
110 #[error("Insufficient token balance in escrow account")]
112 InsufficientTokenBalance = 80,
113 #[error("Insufficient liquidity for this operation")]
114 InsufficientLiquidity = 81,
115 #[error("Fee balance exceeds actual token balance")]
116 FeeBalanceExceedsBalance = 82,
117 #[error("Unsupported Token-2022 mint extension")]
118 UnsupportedTokenExtension = 83,
119}
120
121error!(EscrowError);