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
14 #[error("Payment is not in the correct state for this operation")]
16 InvalidPaymentState = 10,
17 #[error("Payment has already expired")]
18 PaymentExpired = 11,
19 #[error("Payment is not funded")]
20 PaymentNotFunded = 12,
21
22 #[error("Escrow is paused")]
24 EscrowPaused = 20,
25 #[error("Escrow has non-zero balance")]
26 EscrowHasBalance = 21,
27 #[error("Escrow has non-zero fee balance")]
28 EscrowHasFeeBalance = 22,
29 #[error("Invalid escrow settings")]
30 InvalidEscrowSettings = 23,
31 #[error("Fee basis points too high")]
32 FeeTooHigh = 24,
33 #[error("Minimum payment amount must be greater than zero")]
34 InvalidMinPaymentAmount = 25,
35 #[error("Maximum payment amount must be greater than minimum")]
36 InvalidMaxPaymentAmount = 26,
37
38 #[error("Amount exceeds maximum payment limit")]
40 AmountExceedsLimit = 30,
41 #[error("Amount below minimum payment limit")]
42 AmountBelowLimit = 31,
43 #[error("Insufficient funds")]
44 InsufficientFunds = 32,
45 #[error("Insufficient storage balance for SOL operations")]
46 InsufficientStorageBalance = 33,
47
48 #[error("Invalid TTL extension")]
50 InvalidTTLExtension = 40,
51 #[error("TTL extension too large")]
52 TTLExtensionTooLarge = 41,
53 #[error("Payment cannot be canceled after expiration")]
54 CannotCancelExpiredPayment = 42,
55 #[error("Cannot refund a fulfilled payment")]
56 CannotRefundFulfilledPayment = 43,
57 #[error("Cannot refund a payment after delivery is submitted")]
58 CannotRefundDeliveredPayment = 44,
59 #[error("Cannot refund a delivered expired payment")]
60 CannotRefundDeliveredExpiredPayment = 45,
61 #[error("Refund cooldown period is still active")]
62 RefundCooldownPeriodActive = 46,
63 #[error("Cannot release an undelivered expired payment")]
64 CannotReleaseUndeliveredExpiredPayment = 47,
65 #[error("Cannot confirm oracle before delivery is submitted")]
66 DeliveryNotSubmitted = 48,
67
68 #[error("Invalid account provided")]
70 InvalidAccount = 50,
71 #[error("Account is not writable")]
72 AccountNotWritable = 51,
73 #[error("Account is not signer")]
74 AccountNotSigner = 52,
75 #[error("Account is not empty")]
76 AccountNotEmpty = 53,
77 #[error("Account is empty")]
78 AccountEmpty = 54,
79
80 #[error("Invalid token account")]
82 InvalidTokenAccount = 60,
83 #[error("Token transfer failed")]
84 TokenTransferFailed = 61,
85 #[error("Token account close failed")]
86 TokenAccountCloseFailed = 62,
87
88 #[error("Invalid program ID")]
90 InvalidProgramId = 70,
91 #[error("Invalid instruction data")]
92 InvalidInstructionData = 71,
93 #[error("Account not found")]
94 AccountNotFound = 72,
95 #[error("Not enough account keys")]
96 NotEnoughAccountKeys = 73,
97 #[error("Missing required field")]
98 MissingRequiredField = 74,
99 #[error("Cannot close active payment")]
100 CannotCloseActivePayment = 75,
101 #[error("Too early to close payment")]
102 TooEarlyToClose = 76,
103
104 #[error("Insufficient token balance in escrow account")]
106 InsufficientTokenBalance = 80,
107 #[error("Insufficient liquidity for this operation")]
108 InsufficientLiquidity = 81,
109 #[error("Fee balance exceeds actual token balance")]
110 FeeBalanceExceedsBalance = 82,
111}
112
113error!(EscrowError);