I got an error while deploying my contract
here is my code // SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
/**
-
@dev Extends ERC20 Token Standard basic implementation
*/
contract SlimeCheckinToken is ERC721Enumerable, Ownable, ReentrancyGuardUpgradeable{
mapping(address => uint256) private lastMintDay;
mapping(address => uint256) private mintedTokens;
uint256 public constant dailyLimit = 1 days;
bytes32 public merkleRoot;uint256 public MAX_SUPPLY = 10000; // 10000 SeedNFT
uint256 public constant MINT_END = 1730273185; // Fri Jun 30 2024 01:33:05 GMT+0000
event Minted(address minter, uint tokenId);
event UpdatedMerkleRoot(bytes32 _merkleRoot);
event Referred(address user, address ref, address token, uint amount);constructor(address initialOwner)
ERC721("MyToken", "MTK")
Ownable(initialOwner)
{}function mint() external {
require(lastMintDay[msg.sender] < getCurrentDay(), "You have already minted today");
lastMintDay[msg.sender] = getCurrentDay();
mintedTokens[msg.sender]++;
uint _tokenId = 1 * 1e18;
_mint(msg.sender,_tokenId );
emit Minted(msg.sender, _tokenId);}
function mintRefer(uint tier, bytes32 calldata proof, uint amount, address ref) public nonReentrant {
require(block.timestamp <= MINT_END, "CLAIM_ENDED");
require(msg.sender != ref, "REF_INVALID");uint _left = left(msg.sender, tier, proof); require(amount <= _left, "MINTED"); require(totalSupply() + amount <= MAX_SUPPLY, "INVALID_AMOUNT"); if(ref != address(0)){ uint _tokenId = totalSupply() + 1; _safeMint(msg.sender, _tokenId); emit Minted(msg.sender, _tokenId); _tokenId = totalSupply() + 1; _safeMint(ref, _tokenId); emit Referred(msg.sender, ref, address(this), 1); } mintedTokens[msg.sender] += amount;
}
function hasMintedToday(address user) external view returns (bool) {
return lastMintDay[user] == getCurrentDay();
}function getCurrentDay() internal view returns (uint256) {
return block.timestamp / 1 days;
}function allocated(address account, uint tier, bytes32 calldata proof) internal view returns(uint) {
bytes32 leaf = keccak256(abi.encodePacked(account, tier * 1e18));
bool isValidLeaf = MerkleProof.verify(proof, merkleRoot, leaf);if (!isValidLeaf){ // Not in merkle root can claim 1 NFT return 1; } if (tier == 1){ // Tier 1 can claim 10 NFTs return 10; } if (tier == 2){ // Tier 2 can claim 5 NFTs return 5; } return 1;
}
function left(address account, uint tier, bytes32 calldata proof) public view returns(uint) {
uint _allocated = allocated(account, tier, proof);
return _allocated - mintedTokens[account];
}function getTimeUntilNextMint(address user) external view returns (uint256) {
uint256 lastMintTime = lastMintDay[user] * 1 days;
uint256 currentTime = block.timestamp;if (lastMintTime == 0) { return 0; } uint256 nextMintTime = lastMintTime + 1 days; if (nextMintTime > currentTime) { return nextMintTime - currentTime; } else { return 0; }
}
function getMintedTokens(address user) external view returns (uint256) {
return mintedTokens[user];
}
}