diff --git a/contracts/logic/NftDistributor.sol b/contracts/logic/NftDistributor.sol index 40839ba..0c11637 100644 --- a/contracts/logic/NftDistributor.sol +++ b/contracts/logic/NftDistributor.sol @@ -71,18 +71,10 @@ contract NftDistributor is AccessControlEnumerable { emit OpenStatusChange(_open); } - /** - * @dev The mintToUser function mints NFTs to a given user. - * - * Only functions called by an address with the MANAGE_ROLE permission can access this function. - * The function takes an array of nftIds and checks that there are enough mintable NFTs for the user. - * It then loops through the user's owned NFTs, checking if each is mintable, and if so, adds it to a list to be minted. - * Then it emits the Minted event with details of the operation. - * - * @param _user - The address of the user receiving the NFTs - */ - function mintToUser(address _user, uint256 count) external onlyManager { + function mintNft(uint256 count) external { require(isOpen, "NFT distributor is not open"); + require(count > 0, "Count is zero"); + address _user = _msgSender(); // Check that there are enough mintable NFTs require(count <= getMintableCount(_user), "Mintable count is not enough"); // Get the array of the user's owned NFTs