@@ -4,7 +4,6 @@ pragma solidity ^0.8.11;
44// ========== External imports ==========
55
66import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol " ;
7- import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol " ;
87import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol " ;
98
109import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol " ;
@@ -314,6 +313,8 @@ contract DropERC20 is
314313
315314 // `_pricePerToken` is interpreted as price per 1 ether unit of the ERC20 tokens.
316315 uint256 totalPrice = (_quantityToClaim * _pricePerToken) / 1 ether ;
316+ require (totalPrice > 0 , "quantity too low " );
317+
317318 uint256 platformFees = (totalPrice * platformFeeBps) / MAX_BPS;
318319
319320 if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {
@@ -366,14 +367,17 @@ contract DropERC20 is
366367 currentClaimPhase.supplyClaimed + _quantity <= currentClaimPhase.maxClaimableSupply,
367368 "exceed max mint supply. "
368369 );
369- require (maxTotalSupply == 0 || totalSupply () + _quantity <= maxTotalSupply, "exceed max total supply. " );
370+
371+ uint256 _maxTotalSupply = maxTotalSupply;
372+ uint256 _maxWalletClaimCount = maxWalletClaimCount;
373+ require (_maxTotalSupply == 0 || totalSupply () + _quantity <= _maxTotalSupply, "exceed max total supply. " );
370374 require (
371- maxWalletClaimCount == 0 || walletClaimCount[_claimer] + _quantity <= maxWalletClaimCount ,
375+ _maxWalletClaimCount == 0 || walletClaimCount[_claimer] + _quantity <= _maxWalletClaimCount ,
372376 "exceed claim limit for wallet "
373377 );
374378
375- (uint256 lastClaimTimestamp , uint256 nextValidClaimTimestamp ) = getClaimTimestamp (_conditionId, _claimer);
376- require (lastClaimTimestamp == 0 || block .timestamp >= nextValidClaimTimestamp, "cannot claim yet. " );
379+ (, uint256 nextValidClaimTimestamp ) = getClaimTimestamp (_conditionId, _claimer);
380+ require (block .timestamp >= nextValidClaimTimestamp, "cannot claim yet. " );
377381 }
378382
379383 /// @dev Checks whether a claimer meets the claim condition's allowlist criteria.
@@ -424,13 +428,15 @@ contract DropERC20 is
424428 {
425429 lastClaimTimestamp = claimCondition.limitLastClaimTimestamp[_conditionId][_claimer];
426430
427- unchecked {
428- nextValidClaimTimestamp =
429- lastClaimTimestamp +
430- claimCondition.phases[_conditionId].waitTimeInSecondsBetweenClaims;
431+ if (lastClaimTimestamp != 0 ) {
432+ unchecked {
433+ nextValidClaimTimestamp =
434+ lastClaimTimestamp +
435+ claimCondition.phases[_conditionId].waitTimeInSecondsBetweenClaims;
431436
432- if (nextValidClaimTimestamp < lastClaimTimestamp) {
433- nextValidClaimTimestamp = type (uint256 ).max;
437+ if (nextValidClaimTimestamp < lastClaimTimestamp) {
438+ nextValidClaimTimestamp = type (uint256 ).max;
439+ }
434440 }
435441 }
436442 }
@@ -488,7 +494,10 @@ contract DropERC20 is
488494
489495 /// @dev Lets a contract admin set the URI for contract-level metadata.
490496 function setContractURI (string calldata _uri ) external onlyRole (DEFAULT_ADMIN_ROLE) {
497+ string memory prevURI = contractURI;
491498 contractURI = _uri;
499+
500+ emit ContractURIUpdated (prevURI, _uri);
492501 }
493502
494503 /*///////////////////////////////////////////////////////////////
0 commit comments