@@ -7,6 +7,32 @@ import "./interface/IDrop1155.sol";
7
7
import "../lib/MerkleProof.sol " ;
8
8
9
9
abstract contract Drop1155 is IDrop1155 {
10
+ /// @dev The sender is not authorized to perform the action
11
+ error DropUnauthorized ();
12
+
13
+ /// @dev Exceeded the max token total supply
14
+ error DropExceedMaxSupply ();
15
+
16
+ /// @dev No active claim condition
17
+ error DropNoActiveCondition ();
18
+
19
+ /// @dev Claim condition invalid currency or price
20
+ error DropClaimInvalidTokenPrice (
21
+ address expectedCurrency ,
22
+ uint256 expectedPricePerToken ,
23
+ address actualCurrency ,
24
+ uint256 actualExpectedPricePerToken
25
+ );
26
+
27
+ /// @dev Claim condition exceeded limit
28
+ error DropClaimExceedLimit (uint256 expected , uint256 actual );
29
+
30
+ /// @dev Claim condition exceeded max supply
31
+ error DropClaimExceedMaxSupply (uint256 expected , uint256 actual );
32
+
33
+ /// @dev Claim condition not started yet
34
+ error DropClaimNotStarted (uint256 expected , uint256 actual );
35
+
10
36
/*///////////////////////////////////////////////////////////////
11
37
State variables
12
38
//////////////////////////////////////////////////////////////*/
@@ -64,7 +90,7 @@ abstract contract Drop1155 is IDrop1155 {
64
90
bool _resetClaimEligibility
65
91
) external virtual override {
66
92
if (! _canSetClaimConditions ()) {
67
- revert ( " Not authorized " );
93
+ revert DropUnauthorized ( );
68
94
}
69
95
ClaimConditionList storage conditionList = claimCondition[_tokenId];
70
96
uint256 existingStartIndex = conditionList.currentStartId;
@@ -91,7 +117,7 @@ abstract contract Drop1155 is IDrop1155 {
91
117
92
118
uint256 supplyClaimedAlready = conditionList.conditions[newStartIndex + i].supplyClaimed;
93
119
if (supplyClaimedAlready > _conditions[i].maxClaimableSupply) {
94
- revert ( " max supply claimed " );
120
+ revert DropExceedMaxSupply ( );
95
121
}
96
122
97
123
conditionList.conditions[newStartIndex + i] = _conditions[i];
@@ -174,19 +200,22 @@ abstract contract Drop1155 is IDrop1155 {
174
200
uint256 supplyClaimedByWallet = claimCondition[_tokenId].supplyClaimedByWallet[_conditionId][_claimer];
175
201
176
202
if (_currency != claimCurrency || _pricePerToken != claimPrice) {
177
- revert ( " !PriceOrCurrency " );
203
+ revert DropClaimInvalidTokenPrice (_currency, _pricePerToken, claimCurrency, claimPrice );
178
204
}
179
205
180
206
if (_quantity == 0 || (_quantity + supplyClaimedByWallet > claimLimit)) {
181
- revert ( " !Qty " );
207
+ revert DropClaimExceedLimit (claimLimit, _quantity + supplyClaimedByWallet );
182
208
}
183
209
184
210
if (currentClaimPhase.supplyClaimed + _quantity > currentClaimPhase.maxClaimableSupply) {
185
- revert ("!MaxSupply " );
211
+ revert DropClaimExceedMaxSupply (
212
+ currentClaimPhase.maxClaimableSupply,
213
+ currentClaimPhase.supplyClaimed + _quantity
214
+ );
186
215
}
187
216
188
217
if (currentClaimPhase.startTimestamp > block .timestamp ) {
189
- revert ( " cant claim yet " );
218
+ revert DropClaimNotStarted (currentClaimPhase.startTimestamp, block . timestamp );
190
219
}
191
220
}
192
221
@@ -199,7 +228,7 @@ abstract contract Drop1155 is IDrop1155 {
199
228
}
200
229
}
201
230
202
- revert ( " !CONDITION. " );
231
+ revert DropNoActiveCondition ( );
203
232
}
204
233
205
234
/// @dev Returns the claim condition at the given uid.
0 commit comments