-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibErrors.sol
More file actions
182 lines (146 loc) · 4.04 KB
/
LibErrors.sol
File metadata and controls
182 lines (146 loc) · 4.04 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
/**
* @title LibErrors
* @dev This library defines custom errors used across the system, grouped by category for better organization.
*/
library LibErrors {
// ========================
// System errors
// ========================
error Revert43();
// ========================
// Address-related errors
// ========================
/**
* @notice Thrown when an invalid admin address is provided.
*/
error InvalidAddressAdmin();
/**
* @notice Thrown when an invalid clone address is provided.
*/
error InvalidAddressClone();
/**
* @notice Thrown when an invalid factory address is provided.
*/
error InvalidAddressFactory();
/**
* @notice Thrown when an invalid field address is provided.
*/
error InvalidAddressField();
/**
* @notice Thrown when an invalid owner address is provided.
*/
error InvalidAddressOwner();
/**
* @notice Thrown when an invalid recipient address is provided.
*/
error InvalidAddressRecipient();
/**
* @notice Thrown when an invalid token address is provided.
*/
error InvalidAddressToken();
/**
* @notice Thrown when an invalid withdrawal address is provided.
*/
error InvalidAddressWithdrawal();
// ========================
// Access control errors
// ========================
/**
* @notice Thrown when the caller is not an admin.
*/
error OnlyAdmin(address caller);
/**
* @notice Thrown when the caller is not the factory.
*/
error OnlyFactory(address caller);
/**
* @notice Thrown when the caller is not the owner.
*/
error OnlyOwner(address caller);
/**
* @notice Thrown when attempting to remove the owner as an admin.
*/
error CannotRemoveOwner();
// ========================
// Array-related errors
// ========================
/**
* @notice Thrown when the length of two arrays does not match.
*/
error ArrayLengthMismatch();
/**
* @notice Thrown when the array of accounts is empty.
*/
error ArrayAccountsCantBeZero();
/**
* @notice Thrown when the array of recipients is empty.
*/
error ArrayRecipientsCantBeZero();
// ========================
// Token and amount errors
// ========================
/**
* @notice Thrown when the amount is zero or less.
*/
error AmountMustBeGreaterThanZero();
/**
* @dev Error to be thrown when transfer parameters are invalid, such as zero amount or invalid address.
*/
error InvalidTransferParameters();
/**
* @notice Thrown when the token amounts provided are zero.
*/
error TokenAmountsCantBeZero();
/**
* @notice Thrown when the transfer type is unsupported.
*/
error UnsupportedTransferType();
/**
* @notice Thrown when the universal transfer fails.
*/
error UniversalTransferFailed(address token, address to, uint256 amount);
/**
* @notice Thrown when withdrawing ERC20 tokens fails.
*/
error WithdrawERC20Failed(address token, uint256 amount);
/**
* @notice Thrown when a withdrawal fails.
*/
error WithdrawFailed(address recipient, uint256 amount);
// ========================
// Clone-related errors
// ========================
/**
* @notice Thrown when no clones are provided.
*/
error NoClonesProvided();
/**
* @notice Thrown when the number of clones and amounts does not match.
*/
error ClonesNotEqualAmounts();
/**
* @notice Thrown when the creation of a proxy contract fails.
*/
error CreatedProxyFailed();
/**
* @notice Thrown when the creation of a clone contract fails.
*/
error CreatedCloneFailed();
// ========================
// General errors
// ========================
/**
* @notice Thrown when an invalid field is provided.
*/
error InvalidField(bytes32 provided);
/**
* @notice Thrown when there is an insufficient balance for an operation.
*/
error InsufficientBalance(uint256 balance, uint256 required);
/**
* @notice Thrown when withdrawal amounts do not match the expected total.
*/
error WithdrawalNotEqual();
}