@@ -7,6 +7,32 @@ import "./interface/IDrop1155.sol";
77import "../lib/MerkleProof.sol " ;
88
99abstract 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+
1036 /*///////////////////////////////////////////////////////////////
1137 State variables
1238 //////////////////////////////////////////////////////////////*/
@@ -64,7 +90,7 @@ abstract contract Drop1155 is IDrop1155 {
6490 bool _resetClaimEligibility
6591 ) external virtual override {
6692 if (! _canSetClaimConditions ()) {
67- revert ( " Not authorized " );
93+ revert DropUnauthorized ( );
6894 }
6995 ClaimConditionList storage conditionList = claimCondition[_tokenId];
7096 uint256 existingStartIndex = conditionList.currentStartId;
@@ -91,7 +117,7 @@ abstract contract Drop1155 is IDrop1155 {
91117
92118 uint256 supplyClaimedAlready = conditionList.conditions[newStartIndex + i].supplyClaimed;
93119 if (supplyClaimedAlready > _conditions[i].maxClaimableSupply) {
94- revert ( " max supply claimed " );
120+ revert DropExceedMaxSupply ( );
95121 }
96122
97123 conditionList.conditions[newStartIndex + i] = _conditions[i];
@@ -174,19 +200,22 @@ abstract contract Drop1155 is IDrop1155 {
174200 uint256 supplyClaimedByWallet = claimCondition[_tokenId].supplyClaimedByWallet[_conditionId][_claimer];
175201
176202 if (_currency != claimCurrency || _pricePerToken != claimPrice) {
177- revert ( " !PriceOrCurrency " );
203+ revert DropClaimInvalidTokenPrice (_currency, _pricePerToken, claimCurrency, claimPrice );
178204 }
179205
180206 if (_quantity == 0 || (_quantity + supplyClaimedByWallet > claimLimit)) {
181- revert ( " !Qty " );
207+ revert DropClaimExceedLimit (claimLimit, _quantity + supplyClaimedByWallet );
182208 }
183209
184210 if (currentClaimPhase.supplyClaimed + _quantity > currentClaimPhase.maxClaimableSupply) {
185- revert ("!MaxSupply " );
211+ revert DropClaimExceedMaxSupply (
212+ currentClaimPhase.maxClaimableSupply,
213+ currentClaimPhase.supplyClaimed + _quantity
214+ );
186215 }
187216
188217 if (currentClaimPhase.startTimestamp > block .timestamp ) {
189- revert ( " cant claim yet " );
218+ revert DropClaimNotStarted (currentClaimPhase.startTimestamp, block . timestamp );
190219 }
191220 }
192221
@@ -199,7 +228,7 @@ abstract contract Drop1155 is IDrop1155 {
199228 }
200229 }
201230
202- revert ( " !CONDITION. " );
231+ revert DropNoActiveCondition ( );
203232 }
204233
205234 /// @dev Returns the claim condition at the given uid.
0 commit comments