change nft distributor, change method for user call

This commit is contained in:
CounterFire2023 2023-07-26 19:09:59 +08:00
parent 06ca2f1c9c
commit a7cd708678

View File

@ -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