@@ -115,7 +115,14 @@ contract SignatureDrop is
115115
116116 event TokenLazyMinted (uint256 indexed startId , uint256 amount , string indexed baseURI , bytes encryptedBaseURI );
117117 event TokenURIRevealed (uint256 index , string revealedURI );
118- event TokensMinted (address indexed minter , address receiver , uint256 indexed startTokenId , uint256 amountMinted , uint256 pricePerToken , address indexed currency );
118+ event TokensMinted (
119+ address indexed minter ,
120+ address receiver ,
121+ uint256 indexed startTokenId ,
122+ uint256 amountMinted ,
123+ uint256 pricePerToken ,
124+ address indexed currency
125+ );
119126 event ClaimConditionUpdated (ClaimCondition condition , bool resetEligibility );
120127
121128 /*///////////////////////////////////////////////////////////////
@@ -189,7 +196,7 @@ contract SignatureDrop is
189196 function tokenURI (uint256 _tokenId ) public view override returns (string memory uriForToken ) {
190197 uriForToken = uri[_tokenId];
191198
192- if (bytes (uriForToken).length == 0 ) {
199+ if (bytes (uriForToken).length == 0 ) {
193200 uriForToken = string (abi.encodePacked (getBaseURI (_tokenId), _tokenId.toString ()));
194201 }
195202 }
@@ -229,15 +236,12 @@ contract SignatureDrop is
229236 uint256 _amount ,
230237 string calldata _baseURIForTokens ,
231238 bytes calldata _data
232- )
233- external
234- onlyRole (MINTER_ROLE)
235- {
239+ ) external onlyRole (MINTER_ROLE) {
236240 (bytes memory encryptedBaseURI , uint256 expectedStartId ) = abi.decode (_data, (bytes , uint256 ));
237241
238242 uint256 startId = nextTokenIdToMint;
239243 require (startId == expectedStartId, "Unexpected start Id " );
240-
244+
241245 uint256 batchId;
242246 (nextTokenIdToMint, batchId) = _batchMint (startId, _amount, _baseURIForTokens);
243247
@@ -249,10 +253,7 @@ contract SignatureDrop is
249253 }
250254
251255 /// @dev Lets an account with `MINTER_ROLE` reveal the URI for a batch of 'delayed-reveal' NFTs.
252- function reveal (
253- uint256 _index ,
254- bytes calldata _key
255- )
256+ function reveal (uint256 _index , bytes calldata _key )
256257 external
257258 onlyRole (MINTER_ROLE)
258259 returns (string memory revealedURI )
@@ -270,14 +271,7 @@ contract SignatureDrop is
270271 //////////////////////////////////////////////////////////////*/
271272
272273 /// @dev Claim lazy minted tokens via signature.
273- function mintWithSignature (
274- MintRequest calldata _req ,
275- bytes calldata _signature
276- )
277- external
278- payable
279- nonReentrant
280- {
274+ function mintWithSignature (MintRequest calldata _req , bytes calldata _signature ) external payable nonReentrant {
281275 require (_req.quantity > 0 , "minting zero tokens " );
282276 require (nextTokenIdToClaim + _req.quantity <= nextTokenIdToMint, "not enough minted tokens. " );
283277
@@ -294,7 +288,7 @@ contract SignatureDrop is
294288 uint256 tokenIdToMint = nextTokenIdToClaim;
295289 nextTokenIdToClaim += _req.quantity;
296290
297- for (uint256 i = tokenIdToMint; i < tokenIdToMint + _req.quantity; i += 1 ) {
291+ for (uint256 i = tokenIdToMint; i < tokenIdToMint + _req.quantity; i += 1 ) {
298292 _mint (receiver, i);
299293 }
300294
@@ -307,35 +301,25 @@ contract SignatureDrop is
307301 uint256 _quantity ,
308302 address _currency ,
309303 uint256 _pricePerToken
310- )
311- external
312- payable
313-
314- {
304+ ) external payable {
315305 ClaimCondition memory condition = claimCondition;
316306
317307 // Verify claim
318308 require (
319309 _currency == condition.currency && _pricePerToken == condition.pricePerToken,
320310 "invalid currency or price. "
321311 );
322- require (
323- _quantity > 0 && _quantity <= condition.quantityLimitPerTransaction,
324- "invalid quantity. "
325- );
326- require (
327- condition.supplyClaimed + _quantity <= condition.maxClaimableSupply,
328- "exceed max claimable supply. "
329- );
312+ require (_quantity > 0 && _quantity <= condition.quantityLimitPerTransaction, "invalid quantity. " );
313+ require (condition.supplyClaimed + _quantity <= condition.maxClaimableSupply, "exceed max claimable supply. " );
330314 require (nextTokenIdToClaim + _quantity <= nextTokenIdToMint, "not enough minted tokens. " );
331315
332316 uint256 lastClaimTimestampForClaimer = lastClaimTimestamp[msg .sender ][conditionId];
333317 require (
334- lastClaimTimestampForClaimer == 0
335- || block .timestamp >= lastClaimTimestampForClaimer + condition.waitTimeInSecondsBetweenClaims,
318+ lastClaimTimestampForClaimer == 0 ||
319+ block .timestamp >= lastClaimTimestampForClaimer + condition.waitTimeInSecondsBetweenClaims,
336320 "cannot claim. "
337321 );
338-
322+
339323 // Collect price for claim.
340324 collectPrice (_quantity, _currency, _pricePerToken);
341325
@@ -355,19 +339,16 @@ contract SignatureDrop is
355339 emit TokensMinted (_msgSender (), _receiver, tokenIdToClaim, _quantity, _pricePerToken, _currency);
356340 }
357341
358- function setClaimCondition (
359- ClaimCondition calldata _condition ,
360- bool _resetClaimEligibility
361- )
342+ function setClaimCondition (ClaimCondition calldata _condition , bool _resetClaimEligibility )
362343 external
363344 onlyRole (DEFAULT_ADMIN_ROLE)
364345 {
365- if (_resetClaimEligibility) {
346+ if (_resetClaimEligibility) {
366347 conditionId = keccak256 (abi.encodePacked (msg .sender , block .number ));
367348 }
368349
369350 ClaimCondition memory currentConditoin = claimCondition;
370-
351+
371352 claimCondition = ClaimCondition ({
372353 startTimestamp: block .timestamp ,
373354 maxClaimableSupply: _condition.maxClaimableSupply,
@@ -546,4 +527,4 @@ contract SignatureDrop is
546527 {
547528 return ERC2771ContextUpgradeable ._msgData ();
548529 }
549- }
530+ }
0 commit comments